From 5fb84bca4fa125e978106e2943959b45aa8be408 Mon Sep 17 00:00:00 2001 From: moyamo Date: Fri, 25 Dec 2015 16:46:58 +0200 Subject: [PATCH] Allow the user to request their own profile image --- session.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/session.py b/session.py index c31b75f..7e7f8b0 100644 --- a/session.py +++ b/session.py @@ -730,11 +730,16 @@ class Session(YowsupApp): self.logger.debug('Image hash is %s', image_hash) if ID != None: self.backend.handleVCard(self.user, ID, buddy, "", "", response.pictureData) - obuddy = self.buddies[buddy] - self.updateBuddy(buddy, obuddy.nick, obuddy.groups, image_hash) + if not (buddy == self.user or buddy == self.user.split('@')[0]): + obuddy = self.buddies[buddy] + self.updateBuddy(buddy, obuddy.nick, obuddy.groups, image_hash) - self.logger.debug('Requesting profile picture of %s', buddy) - self.requestProfilePicture(buddy, onSuccess = onSuccess) + if buddy == self.user or buddy == self.user.split('@')[0]: + newbuddy = self.legacyName + else: + newbuddy = buddy + self.logger.debug('Requesting profile picture of %s', newbuddy) + self.requestProfilePicture(newbuddy, onSuccess = onSuccess) def onDlsuccess(self, path): self.logger.info("Success: Image downloaded to %s", path)