Philipp Hörist pushed to branch master at gajim / gajim
Commits:
e2343ec9 by Philipp Hörist at 2025-04-17T22:03:26+02:00
cq: VCardAvatars: Add type annotations
- - - - -
8fc76fd9 by Philipp Hörist at 2025-04-17T22:03:26+02:00
fix: MUC: Fix failed join after reconnect
- - - - -
5 changed files:
- gajim/common/const.py
- gajim/common/modules/contacts.py
- gajim/common/modules/muc.py
- gajim/common/modules/vcard_avatars.py
- pyproject.toml
Changes:
=====================================
gajim/common/const.py
=====================================
@@ -200,6 +200,7 @@ def from_str_or_none(s: str) -> XmppUriQuery:
class MUCJoinedState(Enum):
JOINED = 'joined'
NOT_JOINED = 'not joined'
+ BEFORE_JOINING = 'before joining'
JOINING = 'joining'
CREATING = 'creating'
CAPTCHA_REQUEST = 'captcha in progress'
@@ -221,6 +222,10 @@ def is_not_joined(self):
def is_joining(self):
return self == MUCJoinedState.JOINING
+ @property
+ def is_before_joining(self):
+ return self == MUCJoinedState.BEFORE_JOINING
+
@property
def is_creating(self):
return self == MUCJoinedState.CREATING
=====================================
gajim/common/modules/contacts.py
=====================================
@@ -911,7 +911,7 @@ def is_joining(self) -> bool:
muc_data = self.get_module('MUC').get_muc_data(self._jid)
if muc_data is None:
return False
- return muc_data.state.is_joining
+ return muc_data.state.is_joining or muc_data.state.is_before_joining
@property
def is_not_joined(self) -> bool:
=====================================
gajim/common/modules/muc.py
=====================================
@@ -274,7 +274,7 @@ def join(self,
disco_info = app.storage.cache.get_last_disco_info(muc_data.jid,
max_age=60)
if disco_info is None:
- self._set_muc_state(muc_data.jid, MUCJoinedState.JOINING)
+ self._set_muc_state(muc_data.jid, MUCJoinedState.BEFORE_JOINING)
self._con.get_module('Discovery').disco_muc(
muc_data.jid,
callback=self._on_disco_result) # type: ignore
=====================================
gajim/common/modules/vcard_avatars.py
=====================================
@@ -76,7 +76,7 @@ def _request_vcard(self,
assert isinstance(vcard, VCard)
avatar, avatar_sha = vcard.get_avatar()
- if avatar is None:
+ if avatar is None or avatar_sha is None:
self._log.info('Avatar missing: %s %s', contact.jid, expected_sha)
return
@@ -149,7 +149,7 @@ def muc_disco_info_update(self, disco_info: DiscoInfo) ->
None:
def _process_update(self,
jid: JID,
state: AvatarState,
- avatar_sha: str,
+ avatar_sha: str | None,
groupchat: bool
) -> None:
contact = self._con.get_module('Contacts').get_contact(
@@ -158,11 +158,13 @@ def _process_update(self,
if state == AvatarState.EMPTY:
# Empty <photo/> tag, means no avatar is advertised
+ assert avatar_sha is None
self._log.info('%s has no avatar published', jid)
contact.set_avatar_sha(None)
contact.update_avatar(avatar_sha)
else:
+ assert avatar_sha
self._log.info('Update: %s %s', jid, avatar_sha)
if avatar_sha == contact.avatar_sha:
@@ -210,6 +212,7 @@ def _muc_update_received(self, properties:
PresenceProperties) -> None:
contact.update_avatar()
else:
+ assert properties.avatar_sha
self._log.info('Update: %s %s', nick, properties.avatar_sha)
if not app.app.avatar_storage.avatar_exists(properties.avatar_sha):
if properties.avatar_sha not in self._requested_shas:
=====================================
pyproject.toml
=====================================
@@ -130,7 +130,6 @@ exclude = [
"gajim/common/modules/search.py",
"gajim/common/modules/user_avatar.py",
"gajim/common/modules/util.py",
- "gajim/common/modules/vcard_avatars.py",
"gajim/common/settings.py",
"gajim/common/socks5.py",
"gajim/common/structs.py",
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/compare/5504b85c2cbdb9e45424b0e487761fe76118e9c3...8fc76fd93ff258d7a44638f036ae150e40f1df5a
--
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/compare/5504b85c2cbdb9e45424b0e487761fe76118e9c3...8fc76fd93ff258d7a44638f036ae150e40f1df5a
You're receiving this email because of your account on dev.gajim.org.
_______________________________________________
Commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]