bare jid is used as unicode string

darcs-hash:20070731142734-86b55-ee4e0ec6b1395dc699c599de87133cebfef08df6.gz
This commit is contained in:
David Rousselie
2007-07-31 16:27:34 +02:00
parent ddc71a414b
commit 903d2a98e7
4 changed files with 10 additions and 10 deletions

View File

@@ -52,7 +52,7 @@ def get_account_filter(self, stanza, lang_class, node=None):
"""Filter stanzas sent to account jid, only if account exists""" """Filter stanzas sent to account jid, only if account exists"""
name = stanza.get_to().node name = stanza.get_to().node
if name is not None: if name is not None:
return account.get_account(stanza.get_from().bare(), return account.get_account(unicode(stanza.get_from().bare()),
name) name)
else: else:
return None return None
@@ -61,7 +61,7 @@ def get_accounts_root_filter(self, stanza, lang_class, node=None):
"""Filter stanza sent to root node""" """Filter stanza sent to root node"""
to_jid = stanza.get_to() to_jid = stanza.get_to()
if to_jid.resource is None and to_jid.node is None and node is None: if to_jid.resource is None and to_jid.node is None and node is None:
return account.get_accounts(stanza.get_from().bare()) return account.get_accounts(unicode(stanza.get_from().bare()))
else: else:
return None return None

View File

@@ -432,7 +432,7 @@ class JCLComponent(Component, object):
remove = info_query.xpath_eval("r:query/r:remove", remove = info_query.xpath_eval("r:query/r:remove",
{"r" : "jabber:iq:register"}) {"r" : "jabber:iq:register"})
if remove: if remove:
result = self.account_manager.remove_all_accounts(from_jid.bare()) result = self.account_manager.remove_all_accounts(unicode(from_jid.bare()))
self.send_stanzas(result) self.send_stanzas(result)
return 1 return 1
@@ -607,7 +607,7 @@ class AccountManager(object):
info_query = info_query.make_result_response() info_query = info_query.make_result_response()
account_class = self.get_account_class(account_type) account_class = self.get_account_class(account_type)
model.db_connect() model.db_connect()
_account = account.get_account(from_jid.bare(), name, account_class) _account = account.get_account(unicode(from_jid.bare()), name, account_class)
if _account is not None: if _account is not None:
query = info_query.new_query("jabber:iq:register") query = info_query.new_query("jabber:iq:register")
model.db_disconnect() model.db_disconnect()
@@ -706,7 +706,7 @@ class AccountManager(object):
value = None value = None
setattr(_account, field, setattr(_account, field,
field_post_func(value, field_default_func, field_post_func(value, field_default_func,
from_jid.bare())) unicode(from_jid.bare())))
if first_account: if first_account:
# component subscribe user presence when registering the first # component subscribe user presence when registering the first
@@ -740,7 +740,7 @@ class AccountManager(object):
x_data): x_data):
"""Update account""" """Update account"""
self.__logger.debug("Updating account " + account_name) self.__logger.debug("Updating account " + account_name)
bare_from_jid = from_jid.bare() bare_from_jid = unicode(from_jid.bare())
_account = account.get_account(bare_from_jid, _account = account.get_account(bare_from_jid,
account_name) account_name)
if _account is not None: if _account is not None:
@@ -761,7 +761,7 @@ class AccountManager(object):
lang_class, lang_class,
x_data): x_data):
"""Create new account from account_class""" """Create new account from account_class"""
bare_from_jid = from_jid.bare() bare_from_jid = unicode(from_jid.bare())
first_account = (account.get_accounts_count(bare_from_jid) == 0) first_account = (account.get_accounts_count(bare_from_jid) == 0)
model.db_connect() model.db_connect()
_account = account_class(user_jid=unicode(bare_from_jid), _account = account_class(user_jid=unicode(bare_from_jid),

View File

@@ -113,7 +113,7 @@ class RootDiscoGetItemsHandler(DiscoHandler):
else: else:
disco_items = DiscoItems() disco_items = DiscoItems()
for (_account, resource, account_type) in \ for (_account, resource, account_type) in \
self.component.account_manager.list_accounts(from_jid.bare()): self.component.account_manager.list_accounts(unicode(from_jid.bare())):
DiscoItem(disco_items, DiscoItem(disco_items,
JID(unicode(_account.jid) + resource), JID(unicode(_account.jid) + resource),
account_type + _account.name, account_type + _account.name,
@@ -137,7 +137,7 @@ class AccountTypeDiscoGetItemsHandler(DiscoHandler):
if account_class is not None: if account_class is not None:
disco_items = DiscoItems() disco_items = DiscoItems()
for (_account, resource, account_type) in \ for (_account, resource, account_type) in \
self.component.account_manager.list_accounts(from_jid.bare(), self.component.account_manager.list_accounts(unicode(from_jid.bare()),
account_class, account_class,
account_type=account_type): account_type=account_type):
DiscoItem(disco_items, DiscoItem(disco_items,

View File

@@ -39,7 +39,7 @@ class PasswordMessageHandler(Handler):
Return the uniq account associated with a name and user JID. Return the uniq account associated with a name and user JID.
DB connection might already be opened. DB connection might already be opened.
""" """
_account = account.get_account(stanza.get_from().bare(), _account = account.get_account(unicode(stanza.get_from().bare()),
stanza.get_to().node) stanza.get_to().node)
if hasattr(_account, 'password') \ if hasattr(_account, 'password') \
and hasattr(_account, 'waiting_password_reply') \ and hasattr(_account, 'waiting_password_reply') \