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
This commit is contained in:
parent
de678c626c
commit
ca30c9359b
1 changed files with 81 additions and 40 deletions
|
|
@ -291,7 +291,7 @@ class Param():
|
|||
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 @@ class Param():
|
|||
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 @@ class Param():
|
|||
|
||||
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 @@ class Param():
|
|||
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 @@ class Memory:
|
|||
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 @@ class Memory:
|
|||
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 @@ class Memory:
|
|||
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 @@ class Memory:
|
|||
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 @@ class Memory:
|
|||
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 @@ class Memory:
|
|||
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 @@ class Memory:
|
|||
|
||||
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 @@ class Memory:
|
|||
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):
|
||||
|
|
|
|||
Loading…
Reference in a new issue