// message, so that the library does not acknowledge it, and Run stops the
// daemon. An image that cannot be downloaded or stored gets a text marker. A
// message that the batches do not take is handled with nothing to do.
-func (i *WhatsAppInbox) receive(link WhatsAppLink, event *events.Message) bool {
- ctx, cancel := context.WithTimeout(context.Background(), i.lookupTime)
+func (i *WhatsAppInbox) receive(ctx context.Context, link WhatsAppLink, event *events.Message) bool {
+ lookupCtx, cancel := context.WithTimeout(ctx, i.lookupTime)
defer cancel()
- chat, message, found := whatsappMessage(ctx, link.device, link.own, event)
+ chat, message, found := whatsappMessage(lookupCtx, link.device, link.own, event)
if !found {
return true
}
if event.Message.GetImageMessage() != nil {
- ctx, cancel := context.WithTimeout(context.Background(), i.imageTime)
+ ctx, cancel := context.WithTimeout(ctx, i.imageTime)
defer cancel()
message.Text = i.imageText(ctx, link, event, message.Text)