summaryrefslogtreecommitdiff
path: root/sleekxmpp/plugins/xep_0084/avatar.py
diff options
context:
space:
mode:
authorLance Stout <lancestout@gmail.com>2012-07-24 20:01:18 -0700
committerLance Stout <lancestout@gmail.com>2012-07-24 20:01:18 -0700
commitc42f1ad4c79863261977a9c5ea3b33be0b51b946 (patch)
tree8eee86ddb082f51dea0866f16146bcd1f4f13c1f /sleekxmpp/plugins/xep_0084/avatar.py
parenta3ec1af2053bc0be4864ae290e6e5fc39f3fd5fe (diff)
parent9d8de7fc15afc39a666d2ac16b62a068dfc55112 (diff)
downloadslixmpp-c42f1ad4c79863261977a9c5ea3b33be0b51b946.tar.gz
slixmpp-c42f1ad4c79863261977a9c5ea3b33be0b51b946.tar.bz2
slixmpp-c42f1ad4c79863261977a9c5ea3b33be0b51b946.tar.xz
slixmpp-c42f1ad4c79863261977a9c5ea3b33be0b51b946.zip
Merge branch 'master' into develop
Diffstat (limited to 'sleekxmpp/plugins/xep_0084/avatar.py')
-rw-r--r--sleekxmpp/plugins/xep_0084/avatar.py16
1 files changed, 9 insertions, 7 deletions
diff --git a/sleekxmpp/plugins/xep_0084/avatar.py b/sleekxmpp/plugins/xep_0084/avatar.py
index bbac330a..03711871 100644
--- a/sleekxmpp/plugins/xep_0084/avatar.py
+++ b/sleekxmpp/plugins/xep_0084/avatar.py
@@ -41,6 +41,9 @@ class XEP_0084(BasePlugin):
def session_bind(self, jid):
self.xmpp['xep_0163'].register_pep('avatar_metadata', MetaData)
+ def generate_id(self, data):
+ return hashlib.sha1(data).hexdigest()
+
def retrieve_avatar(self, jid, id, url=None, ifrom=None, block=True,
callback=None, timeout=None):
return self.xmpp['xep_0060'].get_item(jid, Data.namespace, id,
@@ -54,8 +57,7 @@ class XEP_0084(BasePlugin):
payload = Data()
payload['value'] = data
return self.xmpp['xep_0163'].publish(payload,
- node=Data.namespace,
- id=hashlib.sha1(data).hexdigest(),
+ id=self.generate_id(data),
ifrom=ifrom,
block=block,
callback=callback,
@@ -72,12 +74,12 @@ class XEP_0084(BasePlugin):
height=info.get('height', ''),
width=info.get('width', ''),
url=info.get('url', ''))
- for pointer in pointers:
- metadata.add_pointer(pointer)
- return self.xmpp['xep_0163'].publish(payload,
- node=Data.namespace,
- id=hashlib.sha1(data).hexdigest(),
+ if pointers is not None:
+ for pointer in pointers:
+ metadata.add_pointer(pointer)
+
+ return self.xmpp['xep_0163'].publish(metadata,
ifrom=ifrom,
block=block,
callback=callback,