Fix sending empty pep data
This commit is contained in:
parent
bdc93e17ae
commit
f00d8087ad
|
@ -106,7 +106,7 @@ class PEP:
|
||||||
retract = items.getTag('retract')
|
retract = items.getTag('retract')
|
||||||
if retract is not None:
|
if retract is not None:
|
||||||
for handler in handlers:
|
for handler in handlers:
|
||||||
handler[PEPHandlerType.RETRACT](jid, retract.getID())
|
handler[PEPHandlerType.RETRACT](jid, retract.getAttr('id'))
|
||||||
raise nbxmpp.NodeProcessed
|
raise nbxmpp.NodeProcessed
|
||||||
|
|
||||||
# Check if we have items
|
# Check if we have items
|
||||||
|
|
|
@ -89,7 +89,7 @@ class UserActivity(AbstractPEPModule):
|
||||||
def _build_node(self, data):
|
def _build_node(self, data):
|
||||||
item = nbxmpp.Node('activity', {'xmlns': self.namespace})
|
item = nbxmpp.Node('activity', {'xmlns': self.namespace})
|
||||||
if data is None:
|
if data is None:
|
||||||
return
|
return item
|
||||||
activity, subactivity, message = data
|
activity, subactivity, message = data
|
||||||
if activity:
|
if activity:
|
||||||
i = item.addChild(activity)
|
i = item.addChild(activity)
|
||||||
|
|
|
@ -88,7 +88,7 @@ class UserMood(AbstractPEPModule):
|
||||||
def _build_node(self, data: Optional[Tuple[str, str]]) -> nbxmpp.Node:
|
def _build_node(self, data: Optional[Tuple[str, str]]) -> nbxmpp.Node:
|
||||||
item = nbxmpp.Node('mood', {'xmlns': nbxmpp.NS_MOOD})
|
item = nbxmpp.Node('mood', {'xmlns': nbxmpp.NS_MOOD})
|
||||||
if data is None:
|
if data is None:
|
||||||
return
|
return item
|
||||||
mood, text = data
|
mood, text = data
|
||||||
if mood:
|
if mood:
|
||||||
item.addChild(mood)
|
item.addChild(mood)
|
||||||
|
|
|
@ -67,9 +67,8 @@ class UserNickname(AbstractPEPModule):
|
||||||
|
|
||||||
def _build_node(self, data: Optional[str]) -> Optional[nbxmpp.Node]:
|
def _build_node(self, data: Optional[str]) -> Optional[nbxmpp.Node]:
|
||||||
item = nbxmpp.Node('nick', {'xmlns': nbxmpp.NS_NICK})
|
item = nbxmpp.Node('nick', {'xmlns': nbxmpp.NS_NICK})
|
||||||
if data is None:
|
if data is not None:
|
||||||
return None
|
item.addData(data)
|
||||||
item.addData(data)
|
|
||||||
return item
|
return item
|
||||||
|
|
||||||
def _notification_received(self,
|
def _notification_received(self,
|
||||||
|
|
|
@ -331,11 +331,10 @@ class ProfileWindow(Gtk.ApplicationWindow):
|
||||||
transient_for=self)
|
transient_for=self)
|
||||||
return
|
return
|
||||||
vcard_, sha = self.make_vcard()
|
vcard_, sha = self.make_vcard()
|
||||||
nick = ''
|
nick = vcard_.get('NICKNAME')
|
||||||
if 'NICKNAME' in vcard_:
|
if nick:
|
||||||
nick = vcard_['NICKNAME']
|
|
||||||
app.connections[self.account].get_module('UserNickname').send(nick)
|
app.connections[self.account].get_module('UserNickname').send(nick)
|
||||||
if nick == '':
|
else:
|
||||||
app.connections[self.account].get_module('UserNickname').retract()
|
app.connections[self.account].get_module('UserNickname').retract()
|
||||||
nick = app.config.get_per('accounts', self.account, 'name')
|
nick = app.config.get_per('accounts', self.account, 'name')
|
||||||
app.nicks[self.account] = nick
|
app.nicks[self.account] = nick
|
||||||
|
|
Loading…
Reference in New Issue