Mercurial > libervia-backend
diff src/memory/memory.py @ 466:448ce3c9e2ac
core: Roster cache refactoring: cache is now managed by client's SatRosterProtocol instance.
author | Goffi <goffi@goffi.org> |
---|---|
date | Mon, 26 Mar 2012 00:22:49 +0200 |
parents | fb1abc0f8c6a |
children | 2a072735e459 |
line wrap: on
line diff
--- a/src/memory/memory.py Sat Mar 24 17:48:12 2012 +0100 +++ b/src/memory/memory.py Mon Mar 26 00:22:49 2012 +0200 @@ -491,7 +491,6 @@ info (_("Memory manager init")) self.initialized = defer.Deferred() self.host = host - self.contacts={} self.presenceStatus={} self.lastResource={} #tmp, will be refactored with bdd integration self.subscriptions={} @@ -655,51 +654,6 @@ assert(self.server_features.has_key(profile)) return feature in self.server_features[profile] - - def addContact(self, contact_jid, attributes, groups, profile_key): - debug("Memory addContact: %s",contact_jid.userhost()) - profile = self.getProfileName(profile_key) - if not profile: - error (_('Trying to add a contact to a non-existant profile')) - return - assert(isinstance(attributes,dict)) - assert(isinstance(groups,set)) - if not self.contacts.has_key(profile): - self.contacts[profile] = {} - self.contacts[profile][contact_jid.userhost()]=[attributes, groups] - - def delContact(self, contact_jid, profile_key): - debug("Memory delContact: %s",contact_jid.userhost()) - profile = self.getProfileName(profile_key) - if not profile: - error (_('Trying to delete a contact for a non-existant profile')) - return - if self.contacts.has_key(profile) and self.contacts[profile].has_key(contact_jid.userhost()): - del self.contacts[profile][contact_jid.userhost()] - - def getContact(self, contact_jid, profile_key): - profile = self.getProfileName(profile_key) - if not profile: - error(_('Asking a contact for a non-existant profile')) - return None - if self.contacts.has_key(profile) and self.contacts[profile].has_key(contact_jid.userhost()): - return self.contacts[profile][contact_jid.userhost()] - - def getContacts(self, profile_key): - """Return list of contacts for given profile - @param profile_key: profile key - @return list of [contact, attr, groups]""" - profile = self.getProfileName(profile_key) - if not profile: - error(_('Asking contacts for a non-existant profile')) - return [] - ret=[] - if self.contacts.has_key(profile): - for contact in self.contacts[profile]: - attr, groups = self.contacts[profile][contact] - ret.append([contact, attr, groups ]) - return ret - def getLastResource(self, contact, profile_key): """Return the last resource used by a contact @param contact: contact jid (unicode)