diff options
author | Lance Stout <lancestout@gmail.com> | 2012-01-05 11:33:47 -0500 |
---|---|---|
committer | Lance Stout <lancestout@gmail.com> | 2012-01-05 11:33:47 -0500 |
commit | 8fd2efa2fa50751af7b5182ad7793295c540d294 (patch) | |
tree | 7639768de4d93b00e998f3575b02830b2ac97b44 /sleekxmpp/plugins/xep_0128 | |
parent | 79f1aa0e1ba7dd29bf597beeae924b96950f9416 (diff) | |
parent | 6b6995bb0b80c91eda72bc92974f68133cef93a3 (diff) | |
download | slixmpp-8fd2efa2fa50751af7b5182ad7793295c540d294.tar.gz slixmpp-8fd2efa2fa50751af7b5182ad7793295c540d294.tar.bz2 slixmpp-8fd2efa2fa50751af7b5182ad7793295c540d294.tar.xz slixmpp-8fd2efa2fa50751af7b5182ad7793295c540d294.zip |
Merge branch 'develop-1.1' into develop
Diffstat (limited to 'sleekxmpp/plugins/xep_0128')
-rw-r--r-- | sleekxmpp/plugins/xep_0128/extended_disco.py | 6 | ||||
-rw-r--r-- | sleekxmpp/plugins/xep_0128/static.py | 37 |
2 files changed, 22 insertions, 21 deletions
diff --git a/sleekxmpp/plugins/xep_0128/extended_disco.py b/sleekxmpp/plugins/xep_0128/extended_disco.py index 63b3cfee..5bb78320 100644 --- a/sleekxmpp/plugins/xep_0128/extended_disco.py +++ b/sleekxmpp/plugins/xep_0128/extended_disco.py @@ -76,7 +76,7 @@ class xep_0128(base_plugin): as extended information, replacing any existing extensions. """ - self.disco._run_node_handler('set_extended_info', jid, node, kwargs) + self.disco._run_node_handler('set_extended_info', jid, node, None, kwargs) def add_extended_info(self, jid=None, node=None, **kwargs): """ @@ -88,7 +88,7 @@ class xep_0128(base_plugin): data -- Either a form, or a list of forms to add as extended information. """ - self.disco._run_node_handler('add_extended_info', jid, node, kwargs) + self.disco._run_node_handler('add_extended_info', jid, node, None, kwargs) def del_extended_info(self, jid=None, node=None, **kwargs): """ @@ -98,4 +98,4 @@ class xep_0128(base_plugin): jid -- The JID to modify. node -- The node to modify. """ - self.disco._run_node_handler('del_extended_info', jid, node, kwargs) + self.disco._run_node_handler('del_extended_info', jid, node, None, kwargs) diff --git a/sleekxmpp/plugins/xep_0128/static.py b/sleekxmpp/plugins/xep_0128/static.py index 493d9370..427011c0 100644 --- a/sleekxmpp/plugins/xep_0128/static.py +++ b/sleekxmpp/plugins/xep_0128/static.py @@ -31,42 +31,43 @@ class StaticExtendedDisco(object): """ self.static = static - def set_extended_info(self, jid, node, data): + def set_extended_info(self, jid, node, ifrom, data): """ Replace the extended identity data for a JID/node combination. The data parameter may provide: data -- Either a single data form, or a list of data forms. """ - self.del_extended_info(jid, node, data) - self.add_extended_info(jid, node, data) + with self.static.lock: + self.del_extended_info(jid, node, ifrom, data) + self.add_extended_info(jid, node, ifrom, data) - def add_extended_info(self, jid, node, data): + def add_extended_info(self, jid, node, ifrom, data): """ Add additional extended identity data for a JID/node combination. The data parameter may provide: data -- Either a single data form, or a list of data forms. """ - self.static.add_node(jid, node) + with self.static.lock: + self.static.add_node(jid, node) - forms = data.get('data', []) - if not isinstance(forms, list): - forms = [forms] + forms = data.get('data', []) + if not isinstance(forms, list): + forms = [forms] - for form in forms: - self.static.nodes[(jid, node)]['info'].append(form) + info = self.static.get_node(jid, node)['info'] + for form in forms: + info.append(form) - def del_extended_info(self, jid, node, data): + def del_extended_info(self, jid, node, ifrom, data): """ Replace the extended identity data for a JID/node combination. The data parameter is not used. """ - if (jid, node) not in self.static.nodes: - return - - info = self.static.nodes[(jid, node)]['info'] - - for form in info['substanza']: - info.xml.remove(form.xml) + with self.static.lock: + if self.static.node_exists(jid, node): + info = self.static.get_node(jid, node)['info'] + for form in info['substanza']: + info.xml.remove(form.xml) |