Allow the user to request their own profile image

This commit is contained in:
moyamo 2015-12-25 16:46:58 +02:00
parent 1446e82dc0
commit 5fb84bca4f

View file

@ -730,11 +730,16 @@ class Session(YowsupApp):
self.logger.debug('Image hash is %s', image_hash) self.logger.debug('Image hash is %s', image_hash)
if ID != None: if ID != None:
self.backend.handleVCard(self.user, ID, buddy, "", "", response.pictureData) self.backend.handleVCard(self.user, ID, buddy, "", "", response.pictureData)
if not (buddy == self.user or buddy == self.user.split('@')[0]):
obuddy = self.buddies[buddy] obuddy = self.buddies[buddy]
self.updateBuddy(buddy, obuddy.nick, obuddy.groups, image_hash) self.updateBuddy(buddy, obuddy.nick, obuddy.groups, image_hash)
self.logger.debug('Requesting profile picture of %s', buddy) if buddy == self.user or buddy == self.user.split('@')[0]:
self.requestProfilePicture(buddy, onSuccess = onSuccess) newbuddy = self.legacyName
else:
newbuddy = buddy
self.logger.debug('Requesting profile picture of %s', newbuddy)
self.requestProfilePicture(newbuddy, onSuccess = onSuccess)
def onDlsuccess(self, path): def onDlsuccess(self, path):
self.logger.info("Success: Image downloaded to %s", path) self.logger.info("Success: Image downloaded to %s", path)