From 2a78570d6551cb5f85fb79083d9bdddf7f86b3d6 Mon Sep 17 00:00:00 2001 From: Lance Stout Date: Wed, 20 Jun 2012 22:21:34 -0700 Subject: Fix setting IPv6 default configuration option. --- sleekxmpp/xmlstream/xmlstream.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sleekxmpp/xmlstream/xmlstream.py b/sleekxmpp/xmlstream/xmlstream.py index a1b6ccd6..321e2694 100644 --- a/sleekxmpp/xmlstream/xmlstream.py +++ b/sleekxmpp/xmlstream/xmlstream.py @@ -212,6 +212,9 @@ class XMLStream(object): #: proxy based on the settings in :attr:`proxy_config`. self.use_proxy = False + #: If set to ``True``, attempt to use IPv6. + self.use_ipv6 = True + #: An optional dictionary of proxy settings. It may provide: #: :host: The host offering proxy services. #: :port: The port for the proxy service. -- cgit v1.2.3 From 1ad171dfe54238f4235de67d7fc3c7eb1d8ec3c0 Mon Sep 17 00:00:00 2001 From: Lance Stout Date: Wed, 20 Jun 2012 23:19:52 -0700 Subject: Fix issue with setting subelements values with default langs. --- sleekxmpp/xmlstream/stanzabase.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sleekxmpp/xmlstream/stanzabase.py b/sleekxmpp/xmlstream/stanzabase.py index 64e00626..88276ddf 100644 --- a/sleekxmpp/xmlstream/stanzabase.py +++ b/sleekxmpp/xmlstream/stanzabase.py @@ -1003,11 +1003,11 @@ class ElementBase(object): last_xml = element element = last_xml - if element.attrib.get('{%s}lang' % XML_NS, default_lang) != lang: - element = ET.Element(ename) - if lang: + if lang: + if element.attrib.get('{%s}lang' % XML_NS, default_lang) != lang: + element = ET.Element(ename) element.attrib['{%s}lang' % XML_NS] = lang - parent.append(element) + parent.append(element) element.text = text return element -- cgit v1.2.3 From f49818be06315e5b7a1fd66d288a5a0572aa17e6 Mon Sep 17 00:00:00 2001 From: Lance Stout Date: Wed, 20 Jun 2012 23:37:39 -0700 Subject: Add support for XEP-0186: Invisible Command --- setup.py | 1 + sleekxmpp/plugins/__init__.py | 1 + sleekxmpp/plugins/xep_0186/__init__.py | 16 +++++++++ sleekxmpp/plugins/xep_0186/invisible_command.py | 44 +++++++++++++++++++++++++ sleekxmpp/plugins/xep_0186/stanza.py | 23 +++++++++++++ 5 files changed, 85 insertions(+) create mode 100644 sleekxmpp/plugins/xep_0186/__init__.py create mode 100644 sleekxmpp/plugins/xep_0186/invisible_command.py create mode 100644 sleekxmpp/plugins/xep_0186/stanza.py diff --git a/setup.py b/setup.py index 9554e5be..19103f90 100755 --- a/setup.py +++ b/setup.py @@ -84,6 +84,7 @@ packages = [ 'sleekxmpp', 'sleekxmpp/plugins/xep_0153', 'sleekxmpp/plugins/xep_0172', 'sleekxmpp/plugins/xep_0184', + 'sleekxmpp/plugins/xep_0186', 'sleekxmpp/plugins/xep_0198', 'sleekxmpp/plugins/xep_0199', 'sleekxmpp/plugins/xep_0202', diff --git a/sleekxmpp/plugins/__init__.py b/sleekxmpp/plugins/__init__.py index 29964bb7..65a3b7dc 100644 --- a/sleekxmpp/plugins/__init__.py +++ b/sleekxmpp/plugins/__init__.py @@ -45,6 +45,7 @@ __all__ = [ 'xep_0163', # Personal Eventing Protocol 'xep_0172', # User Nickname 'xep_0184', # Message Receipts + 'xep_0186', # Invisible Command 'xep_0198', # Stream Management 'xep_0199', # Ping 'xep_0202', # Entity Time diff --git a/sleekxmpp/plugins/xep_0186/__init__.py b/sleekxmpp/plugins/xep_0186/__init__.py new file mode 100644 index 00000000..c9b8c6b9 --- /dev/null +++ b/sleekxmpp/plugins/xep_0186/__init__.py @@ -0,0 +1,16 @@ +""" + SleekXMPP: The Sleek XMPP Library + Copyright (C) 2012 Nathanael C. Fritz, Lance J.T. Stout + This file is part of SleekXMPP. + + See the file LICENSE for copying permission. +""" + +from sleekxmpp.plugins.base import register_plugin + +from sleekxmpp.plugins.xep_0186 import stanza +from sleekxmpp.plugins.xep_0186.stanza import Invisible, Visible +from sleekxmpp.plugins.xep_0186.invisible_command import XEP_0186 + + +register_plugin(XEP_0186) diff --git a/sleekxmpp/plugins/xep_0186/invisible_command.py b/sleekxmpp/plugins/xep_0186/invisible_command.py new file mode 100644 index 00000000..15f63b2d --- /dev/null +++ b/sleekxmpp/plugins/xep_0186/invisible_command.py @@ -0,0 +1,44 @@ +""" + SleekXMPP: The Sleek XMPP Library + Copyright (C) 2012 Nathanael C. Fritz, Lance J.T. Stout + This file is part of SleekXMPP. + + See the file LICENSE for copying permission. +""" + +import logging + +from sleekxmpp import Iq +from sleekxmpp.plugins import BasePlugin +from sleekxmpp.xmlstream import register_stanza_plugin +from sleekxmpp.plugins.xep_0186 import stanza, Visible, Invisible + + +log = logging.getLogger(__name__) + + +class XEP_0186(BasePlugin): + + name = 'xep_0186' + description = 'XEP-0186: Invisible Command' + dependencies = set(['xep_0030']) + + def plugin_init(self): + register_stanza_plugin(Iq, Visible) + register_stanza_plugin(Iq, Invisible) + + def set_invisible(self, ifrom=None, block=True, callback=None, + timeout=None): + iq = self.xmpp.Iq() + iq['type'] = 'set' + iq['from'] = ifrom + iq.enable('invisible') + iq.send(block=block, callback=callback, timeout=timeout) + + def set_visible(self, ifrom=None, block=True, callback=None, + timeout=None): + iq = self.xmpp.Iq() + iq['type'] = 'set' + iq['from'] = ifrom + iq.enable('visible') + iq.send(block=block, callback=callback, timeout=timeout) diff --git a/sleekxmpp/plugins/xep_0186/stanza.py b/sleekxmpp/plugins/xep_0186/stanza.py new file mode 100644 index 00000000..aadbaa16 --- /dev/null +++ b/sleekxmpp/plugins/xep_0186/stanza.py @@ -0,0 +1,23 @@ +""" + SleekXMPP: The Sleek XMPP Library + Copyright (C) 2012 Nathanael C. Fritz, Lance J.T. Stout + This file is part of SleekXMPP. + + See the file LICENSE for copying permission. +""" + +from sleekxmpp.xmlstream import ElementBase, ET + + +class Invisible(ElementBase): + name = 'invisible' + namespace = 'urn:xmpp:invisible:0' + plugin_attrib = 'invisible' + interfaces = set() + + +class Visible(ElementBase): + name = 'visible' + namespace = 'urn:xmpp:visible:0' + plugin_attrib = 'visible' + interfaces = set() -- cgit v1.2.3 From bf0a157c5dfdcc95f630f9919dd1ab1dfdcc4725 Mon Sep 17 00:00:00 2001 From: Lance Stout Date: Wed, 20 Jun 2012 23:38:30 -0700 Subject: Add support for XEP-0221: Data Forms Media Element --- setup.py | 1 + sleekxmpp/plugins/__init__.py | 1 + sleekxmpp/plugins/xep_0221/__init__.py | 16 +++++++++++++ sleekxmpp/plugins/xep_0221/media.py | 27 ++++++++++++++++++++++ sleekxmpp/plugins/xep_0221/stanza.py | 42 ++++++++++++++++++++++++++++++++++ 5 files changed, 87 insertions(+) create mode 100644 sleekxmpp/plugins/xep_0221/__init__.py create mode 100644 sleekxmpp/plugins/xep_0221/media.py create mode 100644 sleekxmpp/plugins/xep_0221/stanza.py diff --git a/setup.py b/setup.py index 19103f90..71973ceb 100755 --- a/setup.py +++ b/setup.py @@ -89,6 +89,7 @@ packages = [ 'sleekxmpp', 'sleekxmpp/plugins/xep_0199', 'sleekxmpp/plugins/xep_0202', 'sleekxmpp/plugins/xep_0203', + 'sleekxmpp/plugins/xep_0221', 'sleekxmpp/plugins/xep_0224', 'sleekxmpp/plugins/xep_0231', 'sleekxmpp/plugins/xep_0249', diff --git a/sleekxmpp/plugins/__init__.py b/sleekxmpp/plugins/__init__.py index 65a3b7dc..cc41280c 100644 --- a/sleekxmpp/plugins/__init__.py +++ b/sleekxmpp/plugins/__init__.py @@ -50,6 +50,7 @@ __all__ = [ 'xep_0199', # Ping 'xep_0202', # Entity Time 'xep_0203', # Delayed Delivery + 'xep_0221', # Data Forms Media Element 'xep_0222', # Persistent Storage of Public Data via Pubsub 'xep_0223', # Persistent Storage of Private Data via Pubsub 'xep_0224', # Attention diff --git a/sleekxmpp/plugins/xep_0221/__init__.py b/sleekxmpp/plugins/xep_0221/__init__.py new file mode 100644 index 00000000..91341f5b --- /dev/null +++ b/sleekxmpp/plugins/xep_0221/__init__.py @@ -0,0 +1,16 @@ +""" + SleekXMPP: The Sleek XMPP Library + Copyright (C) 2012 Nathanael C. Fritz, Lance J.T. Stout + This file is part of SleekXMPP. + + See the file LICENSE for copying permission. +""" + +from sleekxmpp.plugins.base import register_plugin + +from sleekxmpp.plugins.xep_0221 import stanza +from sleekxmpp.plugins.xep_0221.stanza import Media, URI +from sleekxmpp.plugins.xep_0221.media import XEP_0221 + + +register_plugin(XEP_0221) diff --git a/sleekxmpp/plugins/xep_0221/media.py b/sleekxmpp/plugins/xep_0221/media.py new file mode 100644 index 00000000..c4b4a90f --- /dev/null +++ b/sleekxmpp/plugins/xep_0221/media.py @@ -0,0 +1,27 @@ +""" + SleekXMPP: The Sleek XMPP Library + Copyright (C) 2012 Nathanael C. Fritz, Lance J.T. Stout + This file is part of SleekXMPP. + + See the file LICENSE for copying permission. +""" + +import logging + +from sleekxmpp.plugins import BasePlugin +from sleekxmpp.xmlstream import register_stanza_plugin +from sleekxmpp.plugins.xep_0221 import stanza, Media, URI +from sleekxmpp.plugins.xep_0004 import FormField + + +log = logging.getLogger(__name__) + + +class XEP_0221(BasePlugin): + + name = 'xep_0221' + description = 'XEP-0221: Data Forms Media Element' + dependencies = set(['xep_0004']) + + def plugin_init(self): + register_stanza_plugin(FormField, Media) diff --git a/sleekxmpp/plugins/xep_0221/stanza.py b/sleekxmpp/plugins/xep_0221/stanza.py new file mode 100644 index 00000000..915ab380 --- /dev/null +++ b/sleekxmpp/plugins/xep_0221/stanza.py @@ -0,0 +1,42 @@ +""" + SleekXMPP: The Sleek XMPP Library + Copyright (C) 2012 Nathanael C. Fritz, Lance J.T. Stout + This file is part of SleekXMPP. + + See the file LICENSE for copying permission. +""" + +from sleekxmpp.xmlstream import ElementBase, register_stanza_plugin + + +class Media(ElementBase): + name = 'media' + namespace = 'urn:xmpp:media-element' + plugin_attrib = 'media' + interfaces = set(['height', 'width', 'alt']) + + def add_uri(self, value, itype): + uri = URI() + uri['value'] = value + uri['type'] = itype + self.append(uri) + + +class URI(ElementBase): + name = 'uri' + namespace = 'urn:xmpp:media-element' + plugin_attrib = 'uri' + plugin_multi_attrib = 'uris' + interfaces = set(['type', 'value']) + + def get_value(self): + return self.xml.text + + def set_value(self, value): + self.xml.text = value + + def del_value(self): + sel.xml.text = '' + + +register_stanza_plugin(Media, URI, iterable=True) -- cgit v1.2.3 From 8a745c5e8101ee80fff88cf93e969fec5507ba2d Mon Sep 17 00:00:00 2001 From: Lance Stout Date: Wed, 20 Jun 2012 23:45:14 -0700 Subject: Bump version to 1.1.7 --- README.rst | 2 +- sleekxmpp/version.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.rst b/README.rst index 03b1f59a..9e99a9bc 100644 --- a/README.rst +++ b/README.rst @@ -45,7 +45,7 @@ The latest source code for SleekXMPP may be found on `Github ``develop`` branch. **Latest Release** - - `1.1.6 `_ + - `1.1.7 `_ **Develop Releases** - `Latest Develop Version `_ diff --git a/sleekxmpp/version.py b/sleekxmpp/version.py index 1c8737ee..782a8560 100644 --- a/sleekxmpp/version.py +++ b/sleekxmpp/version.py @@ -9,5 +9,5 @@ # We don't want to have to import the entire library # just to get the version info for setup.py -__version__ = '1.1.6' -__version_info__ = (1, 1, 6, '', 0) +__version__ = '1.1.7' +__version_info__ = (1, 1, 7, '', 0) -- cgit v1.2.3