Fixed Bug when receiving Audio or Video-Messages

This commit is contained in:
Nico 2017-06-06 15:17:50 -05:00
parent d85a554e15
commit ce70a912dd

View file

@ -325,6 +325,7 @@ class Session(YowsupApp):
self.logger.debug('Received %s message: %s' % (type, media)) self.logger.debug('Received %s message: %s' % (type, media))
buddy = media._from.split('@')[0] buddy = media._from.split('@')[0]
participant = media.participant participant = media.participant
caption = ''
if media.isEncrypted(): if media.isEncrypted():
self.logger.debug('Received encrypted media message') self.logger.debug('Received encrypted media message')
@ -341,6 +342,9 @@ class Session(YowsupApp):
else: else:
url = media.url url = media.url
if type == 'image':
caption = media.caption
if participant is not None: # Group message if participant is not None: # Group message
partname = participant.split('@')[0] partname = participant.split('@')[0]
if media._from.split('@')[1] == 'broadcast': # Broadcast message if media._from.split('@')[1] == 'broadcast': # Broadcast message
@ -353,6 +357,7 @@ class Session(YowsupApp):
else: else:
self.sendMessageToXMPP(buddy, url, media.timestamp) self.sendMessageToXMPP(buddy, url, media.timestamp)
self.sendMessageToXMPP(buddy, media.caption, media.timestamp) self.sendMessageToXMPP(buddy, media.caption, media.timestamp)
self.sendReceipt(media._id, media._from, None, media.participant) self.sendReceipt(media._id, media._from, None, media.participant)
self.recvMsgIDs.append((media._id, media._from, media.participant, media.timestamp)) self.recvMsgIDs.append((media._id, media._from, media.participant, media.timestamp))