Allow creating private chat portal by inviting WhatsApp puppet. Fixes #110

This commit is contained in:
Tulir Asokan
2020-07-05 18:57:03 +03:00
parent b7cd2c7f2a
commit ffb8529b73
3 changed files with 155 additions and 29 deletions

View File

@@ -125,6 +125,21 @@ func (portal *Portal) GetUsers() []*User {
return nil
}
func (bridge *Bridge) NewManualPortal(key database.PortalKey) *Portal {
portal := &Portal{
Portal: bridge.DB.Portal.New(),
bridge: bridge,
log: bridge.Log.Sub(fmt.Sprintf("Portal/%s", key)),
recentlyHandled: [recentlyHandledLength]types.WhatsAppMessageID{},
messages: make(chan PortalMessage, 128),
}
portal.Key = key
go portal.handleMessageLoop()
return portal
}
func (bridge *Bridge) NewPortal(dbPortal *database.Portal) *Portal {
portal := &Portal{
Portal: dbPortal,