]> git.giacomolli.uk - onechat/blobdiff - whatsapp.go
Derive contexts from the caller and name timeouts
[onechat] / whatsapp.go
index 851cfd1c348053a8dba203afc24a20e7e4a55ec3..f225756e1efb64643a5cfbecf95d6a9ead54f3e5 100644 (file)
@@ -95,6 +95,7 @@ type WhatsAppClient interface {
        PairPhone(ctx context.Context, phone string, showPushNotification bool, clientType whatsmeow.PairClientType, clientDisplayName string) (string, error)
        Logout(ctx context.Context) error
        GetJoinedGroups(ctx context.Context) ([]*types.GroupInfo, error)
+       Download(ctx context.Context, message whatsmeow.DownloadableMessage) ([]byte, error)
        GenerateMessageID() types.MessageID
        SendMessage(ctx context.Context, to types.JID, message *waE2E.Message, extra ...whatsmeow.SendRequestExtra) (whatsmeow.SendResponse, error)
 }
@@ -123,7 +124,7 @@ func openWhatsApp(ctx context.Context, dir string, clock func() time.Time, logge
                return nil, err
        }
 
-       w.inbox = newWhatsAppInbox(w.state, clock, w.groups)
+       w.inbox = newWhatsAppInbox(w.state, clock, w.groups, &ImageStore{dir: filepath.Join(dir, imageDirName)}, logger)
 
        info, err := os.Stat(w.sessionPath())
        if errors.Is(err, os.ErrNotExist) {
@@ -168,9 +169,9 @@ func openWhatsApp(ctx context.Context, dir string, clock func() time.Time, logge
 // creation, close, removal, and snapshots. It is held before mutex, and stays
 // held when removal releases mutex for client callbacks.
 //
-// The inbox puts the text messages into batches and logs them, and groups
-// holds the names of the groups. Both get a WhatsAppLink from link for each
-// call, so they use the current device and client.
+// The inbox puts messages into batches and logs them, and groups holds the
+// names of the groups. Both get a WhatsAppLink from link for each call, so they
+// use the current device and client.
 //
 // The library logs nothing, because its log lines hold the ID of the own
 // account, which is the phone number of the user. The own number and the own