summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sleekxmpp/plugins/xep_0030/disco.py2
-rw-r--r--sleekxmpp/plugins/xep_0030/static.py42
2 files changed, 26 insertions, 18 deletions
diff --git a/sleekxmpp/plugins/xep_0030/disco.py b/sleekxmpp/plugins/xep_0030/disco.py
index 783eddb3..ad3d0ae2 100644
--- a/sleekxmpp/plugins/xep_0030/disco.py
+++ b/sleekxmpp/plugins/xep_0030/disco.py
@@ -452,7 +452,7 @@ class xep_0030(base_plugin):
"""
self._run_node_handler('del_features', jid, node, kwargs)
- def _run_node_handler(self, htype, jid, node, data=None):
+ def _run_node_handler(self, htype, jid, node, data={}):
"""
Execute the most specific node handler for the given
JID/node combination.
diff --git a/sleekxmpp/plugins/xep_0030/static.py b/sleekxmpp/plugins/xep_0030/static.py
index e2d03315..b0e931b4 100644
--- a/sleekxmpp/plugins/xep_0030/static.py
+++ b/sleekxmpp/plugins/xep_0030/static.py
@@ -57,7 +57,7 @@ class StaticDisco(object):
self.nodes[(jid, node)]['info']['node'] = node
self.nodes[(jid, node)]['items']['node'] = node
- def get_info(self, jid, node, data=None):
+ def get_info(self, jid, node, data):
if (jid, node) not in self.nodes:
if not node:
return DiscoInfo()
@@ -66,11 +66,11 @@ class StaticDisco(object):
else:
return self.nodes[(jid, node)]['info']
- def del_info(self, jid, node, data=None):
+ def del_info(self, jid, node, data):
if (jid, node) in self.nodes:
self.nodes[(jid, node)]['info'] = DiscoInfo()
- def get_items(self, jid, node, data=None):
+ def get_items(self, jid, node, data):
if (jid, node) not in self.nodes:
if not node:
return DiscoInfo()
@@ -79,14 +79,16 @@ class StaticDisco(object):
else:
return self.nodes[(jid, node)]['items']
- def set_items(self, jid, node, data=None):
- pass
+ def set_items(self, jid, node, data):
+ items = data.get('items', set())
+ self.add_node(jid, node)
+ self.nodes[(jid, node)]['items']['items'] = items
- def del_items(self, jid, node, data=None):
+ def del_items(self, jid, node, data):
if (jid, node) in self.nodes:
self.nodes[(jid, node)]['items'] = DiscoItems()
- def add_identity(self, jid, node, data={}):
+ def add_identity(self, jid, node, data):
self.add_node(jid, node)
self.nodes[(jid, node)]['info'].add_identity(
data.get('category', ''),
@@ -94,10 +96,12 @@ class StaticDisco(object):
data.get('name', None),
data.get('lang', None))
- def set_identities(self, jid, node, data=None):
- pass
+ def set_identities(self, jid, node, data):
+ identities = data.get('identities', set())
+ self.add_node(jid, node)
+ self.nodes[(jid, node)]['info']['identities'] = identities
- def del_identity(self, jid, node, data=None):
+ def del_identity(self, jid, node, data):
if (jid, node) not in self.nodes:
return
self.nodes[(jid, node)]['info'].del_identity(
@@ -106,25 +110,29 @@ class StaticDisco(object):
data.get('name', None),
data.get('lang', None))
- def add_feature(self, jid, node, data=None):
+ def add_feature(self, jid, node, data):
self.add_node(jid, node)
self.nodes[(jid, node)]['info'].add_feature(data.get('feature', ''))
- def set_features(self, jid, node, data=None):
- pass
+ def set_features(self, jid, node, data):
+ features = data.get('features', set())
+ self.add_node(jid, node)
+ self.nodes[(jid, node)]['info']['features'] = features
- def del_feature(self, jid, node, data=None):
+ def del_feature(self, jid, node, data):
if (jid, node) not in self.nodes:
return
self.nodes[(jid, node)]['info'].del_feature(data.get('feature', ''))
- def add_item(self, jid, node, data=None):
+ def add_item(self, jid, node, data):
self.add_node(jid, node)
self.nodes[(jid, node)]['items'].add_item(
data.get('ijid', ''),
node=data.get('inode', None),
name=data.get('name', None))
- def del_item(self, jid, node, data=None):
+ def del_item(self, jid, node, data):
if (jid, node) in self.nodes:
- self.nodes[(jid, node)]['items'].del_item(**data)
+ self.nodes[(jid, node)]['items'].del_item(
+ data.get('ijid', ''),
+ node=data.get('inode', None))