Mercurial > libervia-backend
diff src/tools/memory.py @ 346:ca3a041fed30
core: fixed several subscription scheme issues + removed most of profile_key default value in core.sat_main and core.xmmp (source of bugs) + contact update
author | Goffi <goffi@goffi.org> |
---|---|
date | Sat, 28 May 2011 20:28:21 +0200 |
parents | 7c9784658163 |
children | 312ca6f9d84a |
line wrap: on
line diff
--- a/src/tools/memory.py Sat May 28 20:24:02 2011 +0200 +++ b/src/tools/memory.py Sat May 28 20:28:21 2011 +0200 @@ -291,7 +291,7 @@ return prof_xml - def getParamsUI(self, profile_key='@DEFAULT@'): + def getParamsUI(self, profile_key): """Return a SàT XMLUI for parameters, with given profile""" profile = self.getProfileName(profile_key) if not profile: @@ -300,7 +300,7 @@ param_xml = self.getParams(profile) return paramsXml2xmlUI(param_xml) - def getParams(self, profile_key='@DEFAULT@'): + def getParams(self, profile_key): """Construct xml for asked profile Take params xml as skeleton""" profile = self.getProfileName(profile_key) @@ -313,7 +313,7 @@ return return_xml - def getParamsForCategory(self, category, profile_key='@DEFAULT@'): + def getParamsForCategory(self, category, profile_key): """Return node's xml for selected category""" #TODO: manage category of general type (without existant profile) profile = self.getProfileName(profile_key) @@ -359,7 +359,7 @@ categories.append(cat.getAttribute("name")) return categories - def setParam(self, name, value, category, profile_key='@DEFAULT@'): + def setParam(self, name, value, category, profile_key): """Set a parameter, return None if the parameter is not in param xml""" profile = self.getProfileName(profile_key) if not profile: @@ -573,7 +573,7 @@ else: return list(entities)[0] if entities else None - def hasServerFeature(self, feature, profile_key='@DEFAULT@'): + def hasServerFeature(self, feature, profile_key): """Tell if the server of the profile has the required feature""" profile = self.getProfileName(profile_key) if not profile: @@ -583,7 +583,7 @@ return feature in self.server_features[profile] - def addContact(self, contact_jid, attributes, groups, profile_key='@DEFAULT@'): + def addContact(self, contact_jid, attributes, groups, profile_key): debug("Memory addContact: %s",contact_jid.userhost()) profile = self.getProfileName(profile_key) if not profile: @@ -595,7 +595,7 @@ self.contacts[profile] = {} self.contacts[profile][contact_jid.userhost()]=[attributes, groups] - def delContact(self, contact_jid, profile_key='@DEFAULT@'): + def delContact(self, contact_jid, profile_key): debug("Memory delContact: %s",contact_jid.userhost()) profile = self.getProfileName(profile_key) if not profile: @@ -604,17 +604,15 @@ 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='@DEFAULT@'): + 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()): - self.contacts[profile][contact_jid.userhost()] - else: - return None + return self.contacts[profile][contact_jid.userhost()] - def getContacts(self, profile_key='@DEFAULT@'): + def getContacts(self, profile_key): """Return list of contacts for given profile @param profile_key: profile key @return list of [contact, attr, groups]""" @@ -630,7 +628,7 @@ ret.append([contact, attr, groups ]) return ret - def addPresenceStatus(self, contact_jid, show, priority, statuses, profile_key='@DEFAULT@'): + def addPresenceStatus(self, contact_jid, show, priority, statuses, profile_key): profile = self.getProfileName(profile_key) if not profile: error(_('Trying to add presence status to a non-existant profile')) @@ -657,7 +655,7 @@ if self.subscriptions.has_key(profile) and self.subscriptions[profile].has_key(contact_jid): del self.subscriptions[profile][contact_jid] - def getWaitingSub(self, profile_key='@DEFAULT@'): + def getWaitingSub(self, profile_key): """Called to get a list of currently waiting subscription requests""" profile = self.getProfileName(profile_key) if not profile: @@ -668,7 +666,7 @@ return self.subscriptions[profile] - def getPresenceStatus(self, profile_key='@DEFAULT@'): + def getPresenceStatus(self, profile_key): profile = self.getProfileName(profile_key) if not profile: error(_('Asking contacts for a non-existant profile')) @@ -678,22 +676,22 @@ debug ("Memory getPresenceStatus (%s)", self.presenceStatus[profile]) return self.presenceStatus[profile] - def getParamA(self, name, category, attr="value", profile_key="@DEFAULT@"): + def getParamA(self, name, category, attr="value", profile_key='@DEFAULT@'): return self.params.getParamA(name, category, attr, profile_key) - def getParamsUI(self, profile_key='@DEFAULT@'): + def getParamsUI(self, profile_key): return self.params.getParamsUI(profile_key) - def getParams(self, profile_key='@DEFAULT@'): + def getParams(self, profile_key): return self.params.getParams(profile_key) - def getParamsForCategory(self, category, profile_key='@DEFAULT@'): + def getParamsForCategory(self, category, profile_key): return self.params.getParamsForCategory(category, profile_key) def getParamsCategories(self): return self.params.getParamsCategories() - def setParam(self, name, value, category, profile_key='@DEFAULT@'): + def setParam(self, name, value, category, profile_key): return self.params.setParam(name, value, category, profile_key) def importParams(self, xml):