diff src/memory/memory.py @ 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 1a759096ccbd
children e77948faaef3
line wrap: on
line diff
--- 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 ""