diff --git a/gajim/common/modules/pep.py b/gajim/common/modules/pep.py index f0cb83baf..8ee110ebb 100644 --- a/gajim/common/modules/pep.py +++ b/gajim/common/modules/pep.py @@ -106,7 +106,7 @@ class PEP: retract = items.getTag('retract') if retract is not None: for handler in handlers: - handler[PEPHandlerType.RETRACT](jid, retract.getID()) + handler[PEPHandlerType.RETRACT](jid, retract.getAttr('id')) raise nbxmpp.NodeProcessed # Check if we have items diff --git a/gajim/common/modules/user_activity.py b/gajim/common/modules/user_activity.py index 8597a4ef6..f7c53ab83 100644 --- a/gajim/common/modules/user_activity.py +++ b/gajim/common/modules/user_activity.py @@ -89,7 +89,7 @@ class UserActivity(AbstractPEPModule): def _build_node(self, data): item = nbxmpp.Node('activity', {'xmlns': self.namespace}) if data is None: - return + return item activity, subactivity, message = data if activity: i = item.addChild(activity) diff --git a/gajim/common/modules/user_mood.py b/gajim/common/modules/user_mood.py index 07b1d64a2..e36ea5a41 100644 --- a/gajim/common/modules/user_mood.py +++ b/gajim/common/modules/user_mood.py @@ -88,7 +88,7 @@ class UserMood(AbstractPEPModule): def _build_node(self, data: Optional[Tuple[str, str]]) -> nbxmpp.Node: item = nbxmpp.Node('mood', {'xmlns': nbxmpp.NS_MOOD}) if data is None: - return + return item mood, text = data if mood: item.addChild(mood) diff --git a/gajim/common/modules/user_nickname.py b/gajim/common/modules/user_nickname.py index 48ca8da3e..f130b2222 100644 --- a/gajim/common/modules/user_nickname.py +++ b/gajim/common/modules/user_nickname.py @@ -67,9 +67,8 @@ class UserNickname(AbstractPEPModule): def _build_node(self, data: Optional[str]) -> Optional[nbxmpp.Node]: item = nbxmpp.Node('nick', {'xmlns': nbxmpp.NS_NICK}) - if data is None: - return None - item.addData(data) + if data is not None: + item.addData(data) return item def _notification_received(self, diff --git a/gajim/gtk/profile.py b/gajim/gtk/profile.py index cda709482..1ce792a77 100644 --- a/gajim/gtk/profile.py +++ b/gajim/gtk/profile.py @@ -331,11 +331,10 @@ class ProfileWindow(Gtk.ApplicationWindow): transient_for=self) return vcard_, sha = self.make_vcard() - nick = '' - if 'NICKNAME' in vcard_: - nick = vcard_['NICKNAME'] + nick = vcard_.get('NICKNAME') + if nick: app.connections[self.account].get_module('UserNickname').send(nick) - if nick == '': + else: app.connections[self.account].get_module('UserNickname').retract() nick = app.config.get_per('accounts', self.account, 'name') app.nicks[self.account] = nick