mirror of
https://github.com/mautrix/whatsapp.git
synced 2026-11-09 15:49:18 -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
|
||||
pushNamesSynced *exsync.Event
|
||||
lastPresence types.Presence
|
||||
lastUnifiedSession atomic.Int64
|
||||
blocklistLock sync.Mutex
|
||||
|
||||
disableNewsletter bool
|
||||
|
|
@ -511,6 +512,15 @@ func (wa *WhatsAppClient) updatePresence(ctx context.Context, presence types.Pre
|
|||
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) {
|
||||
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)
|
||||
}
|
||||
wa.sendDailyUnifiedSession()
|
||||
var pickedMessageID networkid.MessageID
|
||||
if resp.Sender == wa.GetLID() {
|
||||
pickedMessageID = wrappedMsgID2
|
||||
|
|
|
|||
Loading…
Reference in a new issue