Add option to update m.direct with double puppeting

This commit is contained in:
Tulir Asokan
2020-08-22 13:07:55 +03:00
parent b1c947da99
commit 2638204eaa
11 changed files with 87 additions and 12 deletions

View File

@ -84,6 +84,10 @@ func (pq *PortalQuery) GetAllByJID(jid types.WhatsAppID) []*Portal {
return pq.getAll("SELECT * FROM portal WHERE jid=$1", jid)
}
func (pq *PortalQuery) FindPrivateChats(receiver types.WhatsAppID) []*Portal {
return pq.getAll("SELECT * FROM portal WHERE receiver=$1 AND jid LIKE '%@s.whatsapp.net'", receiver)
}
func (pq *PortalQuery) getAll(query string, args ...interface{}) (portals []*Portal) {
rows, err := pq.db.Query(query, args...)
if err != nil || rows == nil {