Philipp Hörist pushed to branch master at gajim / gajim
Commits:
eeb7595a by Philipp Hörist at 2022-09-22T21:27:31+02:00
fix: React correctly to UserAvatar updates
Fixes: #11065
- - - - -
1 changed file:
- gajim/common/modules/user_avatar.py
Changes:
=====================================
gajim/common/modules/user_avatar.py
=====================================
@@ -61,28 +61,39 @@ def _avatar_metadata_received(self,
if metadata is None or not metadata.infos:
self._log.info('No avatar published: %s', jid)
- app.storage.cache.set_contact(jid, 'avatar', None)
contact.update_avatar(None)
+ return
- else:
- sha = contact.avatar_sha
- if contact.avatar_sha:
- if sha in metadata.avatar_shas:
- self._log.info('Avatar already known: %s %s', jid, sha)
- return
+ sha = contact.avatar_sha
+ if sha is not None:
+ if sha in metadata.avatar_shas and app.interface.avatar_exists(sha):
+ self._log.info('Avatar already known: %s %s', jid, sha)
+ return
- if app.interface.avatar_exists(sha):
- contact.update_avatar(sha)
- return
+ if app.interface.avatar_exists(metadata.default):
+ self._log.info('Avatar found in cache, update: %s %s',
+ jid, metadata.default)
+ contact.update_avatar(metadata.default)
+ return
- self._log.info('Request: %s %s', jid, metadata.default)
- self._request_avatar_data(contact, metadata.default)
+ # There are following cases this code is reached:
+ # - We lost the avatar cache
+ # - We use an outdated avatar
+ # - We currently have no avatar set
+ #
+ # Reset the sha, because we don’t know if the avatar data query will
+ # succeed. This forces an update of the avatar if the query succeeds.
+ contact.update_avatar(None)
+ self._request_avatar_data(contact, metadata.default)
@as_task
def _request_avatar_data(self,
contact: types.ChatContactT,
sha: str
) -> Generator[Optional[AvatarData], None, None]:
+
+ self._log.info('Request: %s %s', contact.jid, sha)
+
_task = yield # noqa: F841
avatar = yield self._nbxmpp('UserAvatar').request_avatar_data(
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/commit/eeb7595aafbc43221d890b6c214629fb…
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/commit/eeb7595aafbc43221d890b6c214629fb…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch master at gajim / python-nbxmpp
Commits:
7efb7ef5 by Philipp Hörist at 2022-09-22T00:53:00+02:00
cq: UserAvatar: Fix annotation
- - - - -
1 changed file:
- nbxmpp/modules/user_avatar.py
Changes:
=====================================
nbxmpp/modules/user_avatar.py
=====================================
@@ -16,6 +16,7 @@
# along with this program; If not, see <http://www.gnu.org/licenses/>.
from typing import List
+from typing import Optional
from typing import Dict
import hashlib
@@ -307,7 +308,7 @@ class AvatarData:
@dataclass
class AvatarMetaData:
infos: List[AvatarInfo] = field(default_factory=list)
- default: AvatarInfo = None
+ default: Optional[str] = None
@classmethod
def from_node(cls, node, default=None):
View it on GitLab: https://dev.gajim.org/gajim/python-nbxmpp/-/commit/7efb7ef56490ec567fcb522c…
--
View it on GitLab: https://dev.gajim.org/gajim/python-nbxmpp/-/commit/7efb7ef56490ec567fcb522c…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch master at gajim / python-nbxmpp
Commits:
1e32ee81 by Philipp Hörist at 2022-09-21T20:39:49+02:00
cq: Client: Fix return type
- - - - -
1 changed file:
- nbxmpp/tcp.py
Changes:
=====================================
nbxmpp/tcp.py
=====================================
@@ -76,7 +76,7 @@ class TCPConnection(Connection):
return tls_con.get_protocol_version()
@property
- def ciphersuite(self) -> Optional[int]:
+ def ciphersuite(self) -> Optional[str]:
if self._con is None:
return None
View it on GitLab: https://dev.gajim.org/gajim/python-nbxmpp/-/commit/1e32ee8156ff83c248d038ef…
--
View it on GitLab: https://dev.gajim.org/gajim/python-nbxmpp/-/commit/1e32ee8156ff83c248d038ef…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch master at gajim / gajim
Commits:
3c127373 by Philipp Hörist at 2022-09-20T20:27:05+02:00
fix: GajimRemote: Remove not needed shebang
- - - - -
1 changed file:
- gajim/gajim_remote.py
Changes:
=====================================
gajim/gajim_remote.py
=====================================
@@ -1,5 +1,3 @@
-#!/usr/bin/env python3
-
# This file is part of Gajim.
#
# Gajim is free software; you can redistribute it and/or modify
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/commit/3c1273738b91cdfdea1b3379118aeb83…
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/commit/3c1273738b91cdfdea1b3379118aeb83…
You're receiving this email because of your account on dev.gajim.org.