Commit fc3b9c4c authored by Philipp Hörist's avatar Philipp Hörist

UserAvatar: Adapt to nbxmpp changes

parent 0e9aed6a
Pipeline #6724 passed with stages
in 4 minutes and 35 seconds
......@@ -26,7 +26,8 @@ class UserAvatar(BaseModule):
_nbxmpp_extends = 'UserAvatar'
_nbxmpp_methods = [
'request_avatar',
'request_avatar_metadata',
'request_avatar_data',
'set_avatar',
]
......@@ -60,14 +61,14 @@ def _avatar_metadata_received(self, _con, _stanza, properties):
avatar_info = metadata.infos[0]
self._log.info('Request: %s %s', jid, avatar_info.id)
self._request_avatar(jid, avatar_info)
self._request_avatar_data(jid, avatar_info)
@as_task
def _request_avatar(self, jid, avatar_info):
def _request_avatar_data(self, jid, avatar_info):
_task = yield
avatar = yield self._nbxmpp('UserAvatar').request_avatar(
avatar_info, jid=jid)
avatar = yield self._nbxmpp('UserAvatar').request_avatar_data(
avatar_info.id, jid=jid)
if is_error(avatar):
self._log.warning(avatar)
......@@ -77,10 +78,9 @@ def _request_avatar(self, jid, avatar_info):
app.interface.save_avatar(avatar.data)
if self._con.get_own_jid().bare_match(jid):
app.config.set_per('accounts',
self._account,
'avatar_sha',
avatar.sha)
app.settings.set_account_setting(self._account,
'avatar_sha',
avatar.sha)
else:
self._con.get_module('Roster').set_avatar_sha(
str(jid), avatar.sha)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment