removed timestamp parameter to sendReceipt (fixes #70)

This commit is contained in:
Steffen Vogel 2017-02-11 15:52:17 -03:00
parent ccd866c72f
commit 23bc90adf6
2 changed files with 10 additions and 11 deletions

View File

@ -213,7 +213,7 @@ class Session(YowsupApp):
def sendReadReceipts(self, buddy): def sendReadReceipts(self, buddy):
for _id, _from, participant, t in self.recvMsgIDs: for _id, _from, participant, t in self.recvMsgIDs:
if _from.split('@')[0] == buddy: if _from.split('@')[0] == buddy:
self.sendReceipt(_id, _from, 'read', participant, t) self.sendReceipt(_id, _from, 'read', participant)
self.recvMsgIDs.remove((_id, _from, participant, t)) self.recvMsgIDs.remove((_id, _from, participant, t))
self.logger.debug("Send read receipt to %s (ID: %s)", _from, _id) self.logger.debug("Send read receipt to %s (ID: %s)", _from, _id)
@ -282,7 +282,7 @@ class Session(YowsupApp):
offline, retry, body): offline, retry, body):
buddy = _from.split('@')[0] buddy = _from.split('@')[0]
messageContent = utils.softToUni(body) messageContent = utils.softToUni(body)
self.sendReceipt(_id, _from, None, participant, timestamp) self.sendReceipt(_id, _from, None, participant)
self.recvMsgIDs.append((_id, _from, participant, timestamp)) self.recvMsgIDs.append((_id, _from, participant, timestamp))
self.logger.info("Message received from %s to %s: %s (at ts=%s)" % self.logger.info("Message received from %s to %s: %s (at ts=%s)" %
(buddy, self.legacyName, messageContent, timestamp)) (buddy, self.legacyName, messageContent, timestamp))
@ -335,7 +335,7 @@ class Session(YowsupApp):
else: else:
self.sendMessageToXMPP(buddy, url, image.timestamp) self.sendMessageToXMPP(buddy, url, image.timestamp)
self.sendMessageToXMPP(buddy, image.caption, image.timestamp) self.sendMessageToXMPP(buddy, image.caption, image.timestamp)
self.sendReceipt(image._id, image._from, None, image.participant, image.timestamp) self.sendReceipt(image._id, image._from, None, image.participant)
self.recvMsgIDs.append((image._id, image._from, image.participant, image.timestamp)) self.recvMsgIDs.append((image._id, image._from, image.participant, image.timestamp))
@ -354,7 +354,7 @@ class Session(YowsupApp):
self.sendGroupMessageToXMPP(buddy, partname, message, audio.timestamp) self.sendGroupMessageToXMPP(buddy, partname, message, audio.timestamp)
else: else:
self.sendMessageToXMPP(buddy, message, audio.timestamp) self.sendMessageToXMPP(buddy, message, audio.timestamp)
self.sendReceipt(audio._id, audio._from, None, audio.participant, audio.timestamp) self.sendReceipt(audio._id, audio._from, None, audio.participant)
self.recvMsgIDs.append((audio._id, audio._from, audio.participant, audio.timestamp)) self.recvMsgIDs.append((audio._id, audio._from, audio.participant, audio.timestamp))
@ -374,7 +374,7 @@ class Session(YowsupApp):
self.sendGroupMessageToXMPP(buddy, partname, message, video.timestamp) self.sendGroupMessageToXMPP(buddy, partname, message, video.timestamp)
else: else:
self.sendMessageToXMPP(buddy, message, video.timestamp) self.sendMessageToXMPP(buddy, message, video.timestamp)
self.sendReceipt(video._id, video._from, None, video.participant, video.timestamp) self.sendReceipt(video._id, video._from, None, video.participant)
self.recvMsgIDs.append((video._id, video._from, video.participant, video.timestamp)) self.recvMsgIDs.append((video._id, video._from, video.participant, video.timestamp))
@ -403,7 +403,7 @@ class Session(YowsupApp):
if url is not None: if url is not None:
self.sendMessageToXMPP(buddy, url, location.timestamp) self.sendMessageToXMPP(buddy, url, location.timestamp)
self.sendMessageToXMPP(buddy, latlong, location.timestamp) self.sendMessageToXMPP(buddy, latlong, location.timestamp)
self.sendReceipt(location._id, location._from, None, location.participant, location.timestamp) self.sendReceipt(location._id, location._from, None, location.participant)
self.recvMsgIDs.append((location._id, location._from, location.participant, location.timestamp)) self.recvMsgIDs.append((location._id, location._from, location.participant, location.timestamp))
@ -426,7 +426,7 @@ class Session(YowsupApp):
self.sendMessageToXMPP(buddy, message, timestamp) self.sendMessageToXMPP(buddy, message, timestamp)
# self.sendMessageToXMPP(buddy, card_data) # self.sendMessageToXMPP(buddy, card_data)
#self.transferFile(buddy, str(name), card_data) #self.transferFile(buddy, str(name), card_data)
self.sendReceipt(_id, _from, None, participant, timestamp) self.sendReceipt(_id, _from, None, participant)
self.recvMsgIDs.append((_id, _from, participant, timestamp)) self.recvMsgIDs.append((_id, _from, participant, timestamp))

View File

@ -130,7 +130,7 @@ class YowsupApp(object):
""" """
self.stack.broadcastEvent(YowLayerEvent(YowNetworkLayer.EVENT_STATE_DISCONNECT)) self.stack.broadcastEvent(YowLayerEvent(YowNetworkLayer.EVENT_STATE_DISCONNECT))
def sendReceipt(self, _id, _from, read, participant, t): def sendReceipt(self, _id, _from, read, participant):
""" """
Send a receipt (delivered: double-tick, read: blue-ticks) Send a receipt (delivered: double-tick, read: blue-ticks)
@ -139,10 +139,9 @@ class YowsupApp(object):
- _from: jid of person who sent the message - _from: jid of person who sent the message
- read: ('read' or None) None is just delivered, 'read' is read - read: ('read' or None) None is just delivered, 'read' is read
- participant - participant
- t: The time the original message was sent.
""" """
self.logger.debug(u'Sending receipt to whatsapp: %s', [_id, _from, read, participant, t]) self.logger.debug(u'Sending receipt to whatsapp: %s', [_id, _from, read, participant])
receipt = OutgoingReceiptProtocolEntity(_id, _from, read, participant, t=t) receipt = OutgoingReceiptProtocolEntity(_id, _from, read, participant)
self.sendEntity(receipt) self.sendEntity(receipt)
def downloadMedia(self, url, onSuccess = None, onFailure = None): def downloadMedia(self, url, onSuccess = None, onFailure = None):