Multiple account types: disco get_items implemented and tested

darcs-hash:20070131175146-86b55-de5924fb265a0f611c053303de114e8667d6f881.gz
This commit is contained in:
David Rousselie
2007-01-31 18:51:46 +01:00
parent 95f645fd16
commit cfa8da9655
5 changed files with 96 additions and 32 deletions

View File

@@ -278,7 +278,7 @@ class JCLComponent(Component, object):
if match is not None:
account_type = match.group(1)
DiscoItem(disco_items, \
JID(account_type + "@" + unicode(self.jid)), \
self.jid, \
account_type, \
account_type)
else:
@@ -290,7 +290,8 @@ class JCLComponent(Component, object):
if account_class is not None:
self._list_accounts(disco_items, \
account_class, \
base_from_jid)
base_from_jid,
account_type = nodes[0])
else:
print >> sys.stderr, "Error: " + account_class.__name__ \
+ " class not in account_classes"
@@ -649,15 +650,18 @@ class JCLComponent(Component, object):
return _account_class
return None
def _list_accounts(self, disco_items, _account_class, base_from_jid):
def _list_accounts(self, disco_items, _account_class, base_from_jid, account_type = ""):
"""List accounts in disco_items for given _account_class and user jid"""
if account_type != "":
account_type = account_type + "/"
self.db_connect()
for _account in _account_class.select(_account_class.q.user_jid == \
base_from_jid):
self.__logger.debug(str(_account))
DiscoItem(disco_items, \
JID(_account.jid), \
_account.name, _account.long_name)
account_type + _account.name, \
_account.long_name)
self.db_disconnect()
def _send_presence_available(self, _account, show, lang_class):