Mercurial > libervia-pubsub
changeset 148:b03e5ad81173
Change all calls to jid.JID to jid.internJID to avoid redoing stringprep.
author | Ralph Meijer <ralphm@ik.nu> |
---|---|
date | Wed, 31 Aug 2005 12:58:50 +0000 |
parents | fee92e499d6d |
children | 043f2e5ce8cd |
files | idavoll/memory_storage.py idavoll/pgsql_storage.py |
diffstat | 2 files changed, 9 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/idavoll/memory_storage.py Fri Jul 29 15:38:29 2005 +0000 +++ b/idavoll/memory_storage.py Wed Aug 31 12:58:50 2005 +0000 @@ -58,7 +58,7 @@ subscriptions = [] for node in self._nodes.itervalues(): for subscriber, subscription in node._subscriptions.iteritems(): - subscriber = jid.JID(subscriber) + subscriber = jid.internJID(subscriber) if subscriber.userhostJID() == entity.userhostJID(): subscriptions.append((node.id, subscriber, subscription.state)) @@ -122,7 +122,7 @@ return defer.succeed(None) def get_subscribers(self): - subscribers = [jid.JID(subscriber) for subscriber, subscription + subscribers = [jid.internJID(subscriber) for subscriber, subscription in self._subscriptions.iteritems() if subscription.state == 'subscribed'] @@ -130,14 +130,14 @@ def is_subscribed(self, entity): for subscriber, subscription in self._subscriptions.iteritems(): - if jid.JID(subscriber).userhost() == entity.userhost() and \ + if jid.internJID(subscriber).userhost() == entity.userhost() and \ subscription.state == 'subscribed': return defer.succeed(True) return defer.succeed(False) def get_affiliations(self): - affiliations = [(jid.JID(entity), affiliation) for entity, affiliation + affiliations = [(jid.internJID(entity), affiliation) for entity, affiliation in self._affiliations.iteritems()] return defer.succeed(affiliations)
--- a/idavoll/pgsql_storage.py Fri Jul 29 15:38:29 2005 +0000 +++ b/idavoll/pgsql_storage.py Wed Aug 31 12:58:50 2005 +0000 @@ -99,7 +99,9 @@ return d def _convert_subscription_jids(self, subscriptions): - return [(node, jid.JID('%s/%s' % (subscriber, resource)), subscription) + return [(node, + jid.internJID('%s/%s' % (subscriber, resource)), + subscription) for node, subscriber, resource, subscription in subscriptions] class Node: @@ -256,7 +258,7 @@ return cursor.fetchall() def _convert_to_jids(self, list): - return [jid.JID("%s/%s" % (l[0], l[1])) for l in list] + return [jid.internJID("%s/%s" % (l[0], l[1])) for l in list] def is_subscribed(self, entity): return self._dbpool.runInteraction(self._is_subscribed, entity) @@ -291,7 +293,7 @@ self.id) result = cursor.fetchall() - return [(jid.JID(r[0]), r[1]) for r in result] + return [(jid.internJID(r[0]), r[1]) for r in result] class LeafNodeMixin: