Send image and caption in two different messages

This allows conversations to autodownload the images.
This commit is contained in:
moyamo 2016-01-07 21:12:16 +02:00
parent aeb43dff55
commit 026f21f43e

View file

@ -296,17 +296,19 @@ class Session(YowsupApp):
buddy = image._from.split('@')[0] buddy = image._from.split('@')[0]
participant = image.participant participant = image.participant
if image.caption is None: if image.caption is None:
image.caption = '' image.caption = ''
message = image.url + ' ' + image.caption
if participant is not None: # Group message if participant is not None: # Group message
partname = participant.split('@')[0] partname = participant.split('@')[0]
if image._from.split('@')[1] == 'broadcast': # Broadcast message if image._from.split('@')[1] == 'broadcast': # Broadcast message
self.sendMessageToXMPP(partname, self.broadcast_prefix, image.timestamp) self.sendMessageToXMPP(partname, self.broadcast_prefix, image.timestamp)
self.sendMessageToXMPP(partname, message, image.timestamp) self.sendMessageToXMPP(partname, image.url, image.timestamp)
self.sendMessageToXMPP(partname, image.caption, image.timestamp)
else: # Group message else: # Group message
self.sendGroupMessageToXMPP(buddy, partname, message, image.timestamp) self.sendGroupMessageToXMPP(buddy, partname, image.url, image.timestamp)
self.sendGroupMessageToXMPP(buddy, partname, image.caption, image.timestamp)
else: else:
self.sendMessageToXMPP(buddy, message, image.timestamp) self.sendMessageToXMPP(buddy, image.url, image.timestamp)
self.sendMessageToXMPP(buddy, image.caption, image.timestamp)
self.sendReceipt(image._id, image._from, None, image.participant) self.sendReceipt(image._id, image._from, None, image.participant)
# Called by superclass # Called by superclass