Mercurial > libervia-backend
comparison sat/plugins/plugin_xep_0054.py @ 2765:378188abe941
misc: replaced all "dummy" by the more conventional and readable "__" ("_" being used for gettext)
author | Goffi <goffi@goffi.org> |
---|---|
date | Fri, 11 Jan 2019 11:13:15 +0100 |
parents | 56f94936df1e |
children | 003b8b4b56a7 |
comparison
equal
deleted
inserted
replaced
2764:92af49cde255 | 2765:378188abe941 |
---|---|
384 callbackArgs=[entity_jid, client], | 384 callbackArgs=[entity_jid, client], |
385 errbackArgs=[entity_jid, client], | 385 errbackArgs=[entity_jid, client], |
386 ) | 386 ) |
387 return d | 387 return d |
388 | 388 |
389 def _getCardCb(self, dummy, client, entity): | 389 def _getCardCb(self, __, client, entity): |
390 try: | 390 try: |
391 return client._cache_0054[entity.full()]["avatar"] | 391 return client._cache_0054[entity.full()]["avatar"] |
392 except KeyError: | 392 except KeyError: |
393 raise Failure(exceptions.NotFound()) | 393 raise Failure(exceptions.NotFound()) |
394 | 394 |
395 def _getAvatar(self, entity, cache_only, hash_only, profile): | 395 def _getAvatar(self, entity, cache_only, hash_only, profile): |
396 client = self.host.getClient(profile) | 396 client = self.host.getClient(profile) |
397 d = self.getAvatar(client, jid.JID(entity), cache_only, hash_only) | 397 d = self.getAvatar(client, jid.JID(entity), cache_only, hash_only) |
398 d.addErrback(lambda dummy: "") | 398 d.addErrback(lambda __: "") |
399 | 399 |
400 return d | 400 return d |
401 | 401 |
402 def getAvatar(self, client, entity, cache_only=True, hash_only=False): | 402 def getAvatar(self, client, entity, cache_only=True, hash_only=False): |
403 """get avatar full path or hash | 403 """get avatar full path or hash |
440 if not hash_only: | 440 if not hash_only: |
441 # full path is requested | 441 # full path is requested |
442 if full_path is None: | 442 if full_path is None: |
443 d.addCallback(client.cache.getFilePath) | 443 d.addCallback(client.cache.getFilePath) |
444 else: | 444 else: |
445 d.addCallback(lambda dummy: full_path) | 445 d.addCallback(lambda __: full_path) |
446 return d | 446 return d |
447 | 447 |
448 @defer.inlineCallbacks | 448 @defer.inlineCallbacks |
449 def getNick(self, client, entity): | 449 def getNick(self, client, entity): |
450 """get nick from cache, or check vCard | 450 """get nick from cache, or check vCard |
571 return [disco.DiscoFeature(NS_VCARD)] | 571 return [disco.DiscoFeature(NS_VCARD)] |
572 | 572 |
573 def getDiscoItems(self, requestor, target, nodeIdentifier=""): | 573 def getDiscoItems(self, requestor, target, nodeIdentifier=""): |
574 return [] | 574 return [] |
575 | 575 |
576 def _checkAvatarHash(self, dummy, client, entity, given_hash): | 576 def _checkAvatarHash(self, __, client, entity, given_hash): |
577 """check that hash in cash (i.e. computed hash) is the same as given one""" | 577 """check that hash in cash (i.e. computed hash) is the same as given one""" |
578 # XXX: if they differ, the avater will be requested on each connection | 578 # XXX: if they differ, the avater will be requested on each connection |
579 # TODO: try to avoid re-requesting avatar in this case | 579 # TODO: try to avoid re-requesting avatar in this case |
580 computed_hash = self.plugin_parent.getCache(client, entity, "avatar") | 580 computed_hash = self.plugin_parent.getCache(client, entity, "avatar") |
581 if computed_hash != given_hash: | 581 if computed_hash != given_hash: |