# HG changeset patch # User Goffi # Date 1395492179 -3600 # Node ID ed9841e6d84a4c1fea8f8ad233921ec613192291 # Parent 1597fb8b91081db05313cf91378e64ed0afa6551 core: added IQ_SET to core.constants + getLastResource now manage correctly jid.JID diff -r 1597fb8b9108 -r ed9841e6d84a src/core/constants.py --- 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"]' diff -r 1597fb8b9108 -r ed9841e6d84a src/core/sat_main.py --- 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) diff -r 1597fb8b9108 -r ed9841e6d84a src/memory/memory.py --- 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 ""