summaryrefslogtreecommitdiff
path: root/sleekxmpp
diff options
context:
space:
mode:
authorLance Stout <lancestout@gmail.com>2011-11-06 08:25:29 -0800
committerLance Stout <lancestout@gmail.com>2011-11-06 08:25:29 -0800
commita8d5da509128c48aee8c5e0060ef53fa397e2122 (patch)
treecc6f4539d6761dcd5fdbb497126f1d7d0d344d8e /sleekxmpp
parente2720fac9eb3727f46c4ad953d4886e51bfb71b6 (diff)
downloadslixmpp-a8d5da509128c48aee8c5e0060ef53fa397e2122.tar.gz
slixmpp-a8d5da509128c48aee8c5e0060ef53fa397e2122.tar.bz2
slixmpp-a8d5da509128c48aee8c5e0060ef53fa397e2122.tar.xz
slixmpp-a8d5da509128c48aee8c5e0060ef53fa397e2122.zip
Restore original behaviour for auto_authorize and auto_subscribe.
The change to using the new roster broke the original auto_* values and used per-roster versions. The original auto_* values will now set the behaviour globally. Use the per-roster values to override for a specific JID.
Diffstat (limited to 'sleekxmpp')
-rw-r--r--sleekxmpp/basexmpp.py43
-rw-r--r--sleekxmpp/roster/multi.py48
2 files changed, 86 insertions, 5 deletions
diff --git a/sleekxmpp/basexmpp.py b/sleekxmpp/basexmpp.py
index 02f775ac..59a79b78 100644
--- a/sleekxmpp/basexmpp.py
+++ b/sleekxmpp/basexmpp.py
@@ -106,9 +106,6 @@ class BaseXMPP(XMLStream):
self.client_roster = self.roster[self.boundjid.bare]
self.is_component = False
- self.auto_authorize = True
- self.auto_subscribe = True
-
self.sentpresence = False
self.stanza = sleekxmpp.stanza
@@ -640,6 +637,46 @@ class BaseXMPP(XMLStream):
log.warning("server property deprecated. Use boundjid.host")
self.boundjid.server = value
+ @property
+ def auto_authorize(self):
+ """
+ Auto accept or deny subscription requests.
+
+ If True, auto accept subscription requests.
+ If False, auto deny subscription requests.
+ If None, don't automatically respond.
+ """
+ return self.roster.auto_authorize
+
+ @auto_authorize.setter
+ def auto_authorize(self, value):
+ """
+ Auto accept or deny subscription requests.
+
+ If True, auto accept subscription requests.
+ If False, auto deny subscription requests.
+ If None, don't automatically respond.
+ """
+ self.roster.auto_authorize = value
+
+ @property
+ def auto_subscribe(self):
+ """
+ Auto send requests for mutual subscriptions.
+
+ If True, auto send mutual subscription requests.
+ """
+ return self.roster.auto_subscribe
+
+ @auto_subscribe.setter
+ def auto_subscribe(self, value):
+ """
+ Auto send requests for mutual subscriptions.
+
+ If True, auto send mutual subscription requests.
+ """
+ self.roster.auto_subscribe = value
+
def set_jid(self, jid):
"""Rip a JID apart and claim it as our own."""
log.debug("setting jid to %s" % jid)
diff --git a/sleekxmpp/roster/multi.py b/sleekxmpp/roster/multi.py
index e9f3389e..ee56f2a8 100644
--- a/sleekxmpp/roster/multi.py
+++ b/sleekxmpp/roster/multi.py
@@ -48,8 +48,8 @@ class Roster(object):
"""
self.xmpp = xmpp
self.db = db
- self.auto_authorize = True
- self.auto_subscribe = True
+ self._auto_authorize = True
+ self._auto_subscribe = True
self._rosters = {}
if self.db:
@@ -138,3 +138,47 @@ class Roster(object):
ppriority=ppriority,
pnick=pnick,
pto=pto)
+
+ @property
+ def auto_authorize(self):
+ """
+ Auto accept or deny subscription requests.
+
+ If True, auto accept subscription requests.
+ If False, auto deny subscription requests.
+ If None, don't automatically respond.
+ """
+ return self._auto_authorize
+
+ @auto_authorize.setter
+ def auto_authorize(self, value):
+ """
+ Auto accept or deny subscription requests.
+
+ If True, auto accept subscription requests.
+ If False, auto deny subscription requests.
+ If None, don't automatically respond.
+ """
+ self._auto_authorize = value
+ for node in self._rosters:
+ self._rosters[node].auto_authorize = value
+
+ @property
+ def auto_subscribe(self):
+ """
+ Auto send requests for mutual subscriptions.
+
+ If True, auto send mutual subscription requests.
+ """
+ return self._auto_subscribe
+
+ @auto_subscribe.setter
+ def auto_subscribe(self, value):
+ """
+ Auto send requests for mutual subscriptions.
+
+ If True, auto send mutual subscription requests.
+ """
+ self._auto_subscribe = value
+ for node in self._rosters:
+ self._rosters[node].auto_subscribe = value