summaryrefslogtreecommitdiff
path: root/sleekxmpp/roster.py
diff options
context:
space:
mode:
authorLance Stout <lancestout@gmail.com>2010-10-27 08:09:50 -0400
committerLance Stout <lancestout@gmail.com>2010-11-17 01:49:51 -0500
commit69d430dd75f526984fd6ea6f9db294731698712c (patch)
treeb3e6a1eec56cde1633486cc91cf92bc2362b587c /sleekxmpp/roster.py
parent673545c7e48d86b02f811ad239ed317e4bca0bbc (diff)
downloadslixmpp-69d430dd75f526984fd6ea6f9db294731698712c.tar.gz
slixmpp-69d430dd75f526984fd6ea6f9db294731698712c.tar.bz2
slixmpp-69d430dd75f526984fd6ea6f9db294731698712c.tar.xz
slixmpp-69d430dd75f526984fd6ea6f9db294731698712c.zip
Cleaned up names.
Diffstat (limited to 'sleekxmpp/roster.py')
-rw-r--r--sleekxmpp/roster.py35
1 files changed, 17 insertions, 18 deletions
diff --git a/sleekxmpp/roster.py b/sleekxmpp/roster.py
index 32fd5c0f..de96296b 100644
--- a/sleekxmpp/roster.py
+++ b/sleekxmpp/roster.py
@@ -1,11 +1,11 @@
import logging
-class MultiRoster(object):
+class Roster(object):
- def __init__(self, xmpp, datastore=None):
+ def __init__(self, xmpp, db=None):
self.xmpp = xmpp
- self.datastore = datastore
+ self.db = db
self._rosters = {}
def __getitem__(self, key):
@@ -21,14 +21,14 @@ class MultiRoster(object):
def add(self, node):
if node not in self._rosters:
- self._rosters[node] = Roster(self.xmpp, node, self.datastore)
+ self._rosters[node] = RosterNode(self.xmpp, node, self.db)
-class Roster(object):
+class RosterNode(object):
- def __init__(self, xmpp, jid, datastore=None):
+ def __init__(self, xmpp, jid, db=None):
self.xmpp = xmpp
self.jid = jid
- self.datastore = datastore
+ self.db = db
self.auto_authorize = True
self.auto_subscribe = True
self._jids = {}
@@ -56,7 +56,7 @@ class Roster(object):
'whitelisted': whitelisted,
'subscription': 'none'}
self._jids[jid] = RosterItem(self.xmpp, jid, self.jid,
- state=state, datastore=self.datastore)
+ state=state, db=self.db)
if save:
self._jids[jid].save()
@@ -99,14 +99,13 @@ class Roster(object):
class RosterItem(object):
def __init__(self, xmpp, jid, owner=None,
- state=None, datastore=None):
+ state=None, db=None):
self.xmpp = xmpp
self.jid = jid
self.owner = owner or self.xmpp.jid
self.last_status = None
self.resources = {}
- self.datastore = datastore
-
+ self.db = db
self._state = state or {
'from': False,
'to': False,
@@ -116,13 +115,13 @@ class RosterItem(object):
'subscription': 'none',
'name': '',
'groups': []}
- self._datastore_state = {}
+ self._db_state = {}
self.load()
def load(self):
- if self.datastore:
- item = self.datastore.load(self.owner, self.jid,
- self._datastore_state)
+ if self.db:
+ item = self.db.load(self.owner, self.jid,
+ self._db_state)
if item:
self['name'] = item['name']
self['groups'] = item['groups']
@@ -136,9 +135,9 @@ class RosterItem(object):
return None
def save(self):
- if self.datastore:
- self.datastore.save(self.owner, self.jid,
- self._state, self._datastore_state)
+ if self.db:
+ self.db.save(self.owner, self.jid,
+ self._state, self._db_state)
def __getitem__(self, key):
if key in self._state: