Mercurial > libervia-backend
comparison 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 |
comparison
equal
deleted
inserted
replaced
918:1597fb8b9108 | 919:ed9841e6d84a |
---|---|
336 return feature in self.server_features[profile][jid_] | 336 return feature in self.server_features[profile][jid_] |
337 else: | 337 else: |
338 warning(_("Features of %s not available, maybe they haven't been asked yet?") % jid_) | 338 warning(_("Features of %s not available, maybe they haven't been asked yet?") % jid_) |
339 return None | 339 return None |
340 | 340 |
341 def getLastResource(self, contact, profile_key): | 341 def _getLastResource(self, jid_s, profile_key): |
342 """Return the last resource used by a contact | 342 jid_ = jid.JID(jid_s) |
343 @param contact: contact jid (unicode) | 343 return self.getLastResource(jid_, profile_key) |
344 | |
345 | |
346 def getLastResource(self, jid_, profile_key): | |
347 """Return the last resource used by a jid_ | |
348 @param jid_: bare jid | |
344 @param profile_key: %(doc_profile_key)s""" | 349 @param profile_key: %(doc_profile_key)s""" |
345 profile = self.getProfileName(profile_key) | 350 profile = self.getProfileName(profile_key) |
346 if not profile or not self.host.isConnected(profile): | 351 if not profile or not self.host.isConnected(profile): |
347 error(_('Asking contacts for a non-existant or not connected profile')) | 352 error(_('Asking jid_s for a non-existant or not connected profile')) |
348 return "" | 353 return "" |
349 entity = jid.JID(contact).userhost() | 354 entity = jid_.userhost() |
350 if not entity in self.entitiesCache[profile]: | 355 if not entity in self.entitiesCache[profile]: |
351 info(_("Entity not in cache")) | 356 info(_("Entity not in cache")) |
352 return "" | 357 return "" |
353 try: | 358 try: |
354 return self.entitiesCache[profile][entity]["last_resource"] | 359 return self.entitiesCache[profile][entity]["last_resource"] |