core: added IQ_SET to core.constants + getLastResource now manage correctly jid.JID

This commit is contained in:
Goffi 2014-03-22 13:42:59 +01:00
commit c67faecba1

View file

@ -338,15 +338,20 @@ class Memory(object):
warning(_("Features of %s not available, maybe they haven't been asked yet?") % jid_)
return None
def getLastResource(self, contact, profile_key):
"""Return the last resource used by a contact
@param contact: contact jid (unicode)
def _getLastResource(self, jid_s, profile_key):
jid_ = jid.JID(jid_s)
return self.getLastResource(jid_, profile_key)
def getLastResource(self, jid_, profile_key):
"""Return the last resource used by a jid_
@param jid_: bare jid
@param profile_key: %(doc_profile_key)s"""
profile = self.getProfileName(profile_key)
if not profile or not self.host.isConnected(profile):
error(_('Asking contacts for a non-existant or not connected profile'))
error(_('Asking jid_s for a non-existant or not connected profile'))
return ""
entity = jid.JID(contact).userhost()
entity = jid_.userhost()
if not entity in self.entitiesCache[profile]:
info(_("Entity not in cache"))
return ""