Request new profile picture on profile picture changed notification
This commit is contained in:
parent
16bdc85471
commit
59f0af9f8d
|
@ -457,6 +457,11 @@ class Session(YowsupApp):
|
||||||
except KeyError:
|
except KeyError:
|
||||||
self.logger.debug("%s not in buddy list", number)
|
self.logger.debug("%s not in buddy list", number)
|
||||||
|
|
||||||
|
# Called by superclass
|
||||||
|
def onContactPictureChanged(self, number):
|
||||||
|
self.logger.debug("%s changed their profile picture", number)
|
||||||
|
self.buddies.requestVCard(number)
|
||||||
|
|
||||||
def onPresenceReceived(self, _type, name, jid, lastseen):
|
def onPresenceReceived(self, _type, name, jid, lastseen):
|
||||||
self.logger.info("Presence received: %s %s %s %s", _type, name, jid, lastseen)
|
self.logger.info("Presence received: %s %s %s %s", _type, name, jid, lastseen)
|
||||||
buddy = jid.split("@")[0]
|
buddy = jid.split("@")[0]
|
||||||
|
|
|
@ -549,12 +549,19 @@ class YowsupApp(object):
|
||||||
def onContactStatusChanged(self, number, status):
|
def onContactStatusChanged(self, number, status):
|
||||||
"""Called when a contacts changes their status
|
"""Called when a contacts changes their status
|
||||||
|
|
||||||
Args
|
Args:
|
||||||
number: (str) the number of the contact who changed their status
|
number: (str) the number of the contact who changed their status
|
||||||
status: (str) the new status
|
status: (str) the new status
|
||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def onContactPictureChanged(self, number):
|
||||||
|
"""Called when a contact changes their profile picture
|
||||||
|
Args
|
||||||
|
number: (str) the number of the contact who changed their picture
|
||||||
|
"""
|
||||||
|
pass
|
||||||
|
|
||||||
def sendEntity(self, entity):
|
def sendEntity(self, entity):
|
||||||
"""Sends an entity down the stack (as if YowsupAppLayer called toLower)"""
|
"""Sends an entity down the stack (as if YowsupAppLayer called toLower)"""
|
||||||
self.stack.broadcastEvent(YowLayerEvent(YowsupAppLayer.TO_LOWER_EVENT,
|
self.stack.broadcastEvent(YowLayerEvent(YowsupAppLayer.TO_LOWER_EVENT,
|
||||||
|
@ -666,6 +673,9 @@ class YowsupAppLayer(YowInterfaceLayer):
|
||||||
entity._from.split('@')[0],
|
entity._from.split('@')[0],
|
||||||
entity.status
|
entity.status
|
||||||
)
|
)
|
||||||
|
elif (isinstance(entity, SetPictureNotificationProtocolEntity) or
|
||||||
|
isinstance(entity, DeletePictureNotificationProtocolEntity)):
|
||||||
|
self.caller.onContactPictureChanged(entity.setJid.split('@')[0])
|
||||||
|
|
||||||
@ProtocolEntityCallback('message')
|
@ProtocolEntityCallback('message')
|
||||||
def onMessageReceived(self, entity):
|
def onMessageReceived(self, entity):
|
||||||
|
|
Loading…
Reference in a new issue