avatarSet = False
name = ""
for e in vCard.elements():
- if e.name == "NICKNAME":
+ if e.name == "NICKNAME" and e.__str__():
name = e.__str__()
- if not name and e.name == "FN":
+ if not name and e.name == "FN" and e.__str__():
# Give priority to nickname
name = e.__str__()
if e.name == "PHOTO":
self.legacycon.updateAvatar(self.avatar)
avatarSet = True
if name:
- self.updateNickname(e.__str__())
+ self.updateNickname(name)
if not avatarSet:
self.legacycon.updateAvatar() # Default avatar
del self.resourceList[resource]
self.legacycon.resourceOffline(resource)
- def subscriptionReceived(self, to, subtype):
+ def subscriptionReceived(self, fro, to, subtype):
""" Sends the subscription request to the legacy services handler """
if to.find('@') > 0:
- LogEvent(INFO, self.jabberID, "Passing subscription to legacy service.")
- self.contactList.jabberSubscriptionReceived(to, subtype)
+ if self.ready:
+ LogEvent(INFO, self.jabberID, "Passing subscription to legacy service.")
+ self.contactList.jabberSubscriptionReceived(to, subtype)
+ else:
+ self.sendPresence(fro, to, ptype="error")
else:
if subtype == "subscribe":
self.sendPresence(to=self.jabberID, fro=config.jid, ptype="subscribed")