Mercurial > libervia-backend
changeset 919:ed9841e6d84a
core: added IQ_SET to core.constants + getLastResource now manage correctly jid.JID
author | Goffi <goffi@goffi.org> |
---|---|
date | Sat, 22 Mar 2014 13:42:59 +0100 |
parents | 1597fb8b9108 |
children | 45dffd67a18a |
files | src/core/constants.py src/core/sat_main.py src/memory/memory.py |
diffstat | 3 files changed, 12 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/src/core/constants.py Fri Mar 21 09:09:51 2014 +0100 +++ b/src/core/constants.py Sat Mar 22 13:42:59 2014 +0100 @@ -25,3 +25,4 @@ SAVEFILE_DATABASE = "/sat.db" PROF_KEY_NONE = '@NONE@' PROF_KEY_DEFAULT = '@DEFAULT@' + IQ_SET = '/iq[@type="set"]'
--- a/src/core/sat_main.py Fri Mar 21 09:09:51 2014 +0100 +++ b/src/core/sat_main.py Sat Mar 22 13:42:59 2014 +0100 @@ -143,7 +143,7 @@ self.bridge.register("disconnect", self.disconnect) self.bridge.register("getContacts", self.getContacts) self.bridge.register("getContactsFromGroup", self.getContactsFromGroup) - self.bridge.register("getLastResource", self.memory.getLastResource) + self.bridge.register("getLastResource", self.memory._getLastResource) self.bridge.register("getPresenceStatus", self.memory.getPresenceStatus) self.bridge.register("getWaitingSub", self.memory.getWaitingSub) self.bridge.register("getWaitingConf", self.getWaitingConf)
--- a/src/memory/memory.py Fri Mar 21 09:09:51 2014 +0100 +++ b/src/memory/memory.py Sat Mar 22 13:42:59 2014 +0100 @@ -338,15 +338,20 @@ 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 ""