From 181aea737d5bce9479795b58c29b5a92da3bd48b Mon Sep 17 00:00:00 2001 From: Lance Stout Date: Tue, 5 Jun 2012 16:54:26 -0700 Subject: Add initial support for xml:lang for streams and stanza plugins. Remaining items are suitable default actions for language supporting interfaces. --- sleekxmpp/clientxmpp.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'sleekxmpp/clientxmpp.py') diff --git a/sleekxmpp/clientxmpp.py b/sleekxmpp/clientxmpp.py index 94ced031..8a941867 100644 --- a/sleekxmpp/clientxmpp.py +++ b/sleekxmpp/clientxmpp.py @@ -60,8 +60,8 @@ class ClientXMPP(BaseXMPP): :param escape_quotes: **Deprecated.** """ - def __init__(self, jid, password, ssl=False, plugin_config={}, - plugin_whitelist=[], escape_quotes=True, sasl_mech=None): + def __init__(self, jid, password, plugin_config={}, plugin_whitelist=[], + escape_quotes=True, sasl_mech=None, lang='en'): BaseXMPP.__init__(self, jid, 'jabber:client') self.set_jid(jid) @@ -69,15 +69,18 @@ class ClientXMPP(BaseXMPP): self.plugin_config = plugin_config self.plugin_whitelist = plugin_whitelist self.default_port = 5222 + self.default_lang = lang self.credentials = {} self.password = password - self.stream_header = "" % ( + self.stream_header = "" % ( self.boundjid.host, "xmlns:stream='%s'" % self.stream_ns, - "xmlns='%s'" % self.default_ns) + "xmlns='%s'" % self.default_ns, + "xml:lang='%s'" % self.default_lang, + "version='1.0'") self.stream_footer = "" self.features = set() -- cgit v1.2.3 From d92aa05b5c18806ab5addc947eeedaaf4d51500e Mon Sep 17 00:00:00 2001 From: Lance Stout Date: Tue, 19 Jun 2012 01:29:48 -0700 Subject: PEP8 formatting updates. --- sleekxmpp/clientxmpp.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'sleekxmpp/clientxmpp.py') diff --git a/sleekxmpp/clientxmpp.py b/sleekxmpp/clientxmpp.py index 8a941867..7f606de7 100644 --- a/sleekxmpp/clientxmpp.py +++ b/sleekxmpp/clientxmpp.py @@ -54,13 +54,13 @@ class ClientXMPP(BaseXMPP): :param password: The password for the XMPP user account. :param ssl: **Deprecated.** :param plugin_config: A dictionary of plugin configurations. - :param plugin_whitelist: A list of approved plugins that - will be loaded when calling + :param plugin_whitelist: A list of approved plugins that + will be loaded when calling :meth:`~sleekxmpp.basexmpp.BaseXMPP.register_plugins()`. :param escape_quotes: **Deprecated.** """ - def __init__(self, jid, password, plugin_config={}, plugin_whitelist=[], + def __init__(self, jid, password, plugin_config={}, plugin_whitelist=[], escape_quotes=True, sasl_mech=None, lang='en'): BaseXMPP.__init__(self, jid, 'jabber:client') @@ -189,7 +189,7 @@ class ClientXMPP(BaseXMPP): occurs. Defaults to ``True``. :param timeout: The length of time (in seconds) to wait for a response before continuing if blocking - is used. Defaults to + is used. Defaults to :attr:`~sleekxmpp.xmlstream.xmlstream.XMLStream.response_timeout`. :param callback: Optional reference to a stream handler function. Will be executed when the roster is received. @@ -200,7 +200,7 @@ class ClientXMPP(BaseXMPP): def del_roster_item(self, jid): """Remove an item from the roster. - + This is done by setting its subscription status to ``'remove'``. :param jid: The JID of the item to remove. @@ -215,7 +215,7 @@ class ClientXMPP(BaseXMPP): Defaults to ``True``. :param timeout: The length of time (in seconds) to wait for a response before continuing if blocking is used. - Defaults to + Defaults to :attr:`~sleekxmpp.xmlstream.xmlstream.XMLStream.response_timeout`. :param callback: Optional reference to a stream handler function. Will be executed when the roster is received. @@ -233,7 +233,7 @@ class ClientXMPP(BaseXMPP): response = iq.send(block, timeout, callback) self.event('roster_received', response) - if block: + if block: self._handle_roster(response) return response @@ -279,7 +279,7 @@ class ClientXMPP(BaseXMPP): roster[jid]['pending_out'] = (item['ask'] == 'subscribe') roster[jid].save(remove=(item['subscription'] == 'remove')) - + self.event("roster_update", iq) if iq['type'] == 'set': resp = self.Iq(stype='result', -- cgit v1.2.3