mirror of
https://github.com/mautrix/whatsapp.git
synced 2026-11-09 23:59:17 -05:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
52f7da12b2 | ||
|
|
7f843e8f12 |
2 changed files with 11 additions and 0 deletions
|
|
@ -124,6 +124,7 @@ type WhatsAppClient struct {
|
||||||
isNewLogin bool
|
isNewLogin bool
|
||||||
pushNamesSynced *exsync.Event
|
pushNamesSynced *exsync.Event
|
||||||
lastPresence types.Presence
|
lastPresence types.Presence
|
||||||
|
lastUnifiedSession atomic.Int64
|
||||||
blocklistLock sync.Mutex
|
blocklistLock sync.Mutex
|
||||||
|
|
||||||
disableNewsletter bool
|
disableNewsletter bool
|
||||||
|
|
@ -511,6 +512,15 @@ func (wa *WhatsAppClient) updatePresence(ctx context.Context, presence types.Pre
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (wa *WhatsAppClient) sendDailyUnifiedSession() {
|
||||||
|
last := wa.lastUnifiedSession.Load()
|
||||||
|
if time.Since(time.Unix(last, 0)) < 24*time.Hour || !wa.lastUnifiedSession.CompareAndSwap(last, time.Now().Unix()) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
//lint:ignore SA1019 this is supposed to be dangerous
|
||||||
|
go wa.Client.DangerousInternals().SendUnifiedSession()
|
||||||
|
}
|
||||||
|
|
||||||
func (wa *WhatsAppClient) DownloadImagePack(ctx context.Context, url string) (*bridgev2.ImportedImagePack, error) {
|
func (wa *WhatsAppClient) DownloadImagePack(ctx context.Context, url string) (*bridgev2.ImportedImagePack, error) {
|
||||||
return wa.Main.MsgConv.DownloadImagePack(ctx, wa.UserLogin.ID, wa.Client, url)
|
return wa.Main.MsgConv.DownloadImagePack(ctx, wa.UserLogin.ID, wa.Client, url)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -141,6 +141,7 @@ func (wa *WhatsAppClient) handleConvertedMatrixMessage(ctx context.Context, msg
|
||||||
}
|
}
|
||||||
return nil, wrapWhatsAppError(err)
|
return nil, wrapWhatsAppError(err)
|
||||||
}
|
}
|
||||||
|
wa.sendDailyUnifiedSession()
|
||||||
var pickedMessageID networkid.MessageID
|
var pickedMessageID networkid.MessageID
|
||||||
if resp.Sender == wa.GetLID() {
|
if resp.Sender == wa.GetLID() {
|
||||||
pickedMessageID = wrappedMsgID2
|
pickedMessageID = wrappedMsgID2
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue