From 9c3fece96bee3c381cf0d7bd7022b46c858c6e1b Mon Sep 17 00:00:00 2001 From: Florent Le Coz Date: Thu, 24 Jul 2014 02:07:08 +0200 Subject: Use slixmpp --- src/bookmark.py | 2 +- src/common.py | 6 +++--- src/config.py | 2 +- src/connection.py | 12 ++++++------ src/contact.py | 2 +- src/core/commands.py | 6 +++--- src/core/core.py | 2 +- src/core/handlers.py | 8 ++++---- src/fixes.py | 6 +++--- src/multiuserchat.py | 2 +- src/plugin.py | 10 +++++----- src/plugin_manager.py | 2 +- src/roster.py | 8 ++++---- src/tabs/adhoc_commands_list.py | 2 +- src/tabs/muclisttab.py | 2 +- src/tabs/xmltab.py | 4 ++-- src/xhtml.py | 2 +- 17 files changed, 39 insertions(+), 39 deletions(-) (limited to 'src') diff --git a/src/bookmark.py b/src/bookmark.py index aa710d24..8d230d26 100644 --- a/src/bookmark.py +++ b/src/bookmark.py @@ -11,7 +11,7 @@ bookmarks, both local and remote. import logging from sys import version_info -from sleekxmpp.plugins.xep_0048 import Bookmarks, Conference +from slixmpp.plugins.xep_0048 import Bookmarks, Conference from common import safeJID from config import config diff --git a/src/common.py b/src/common.py index 20700258..d50e7027 100644 --- a/src/common.py +++ b/src/common.py @@ -11,7 +11,7 @@ Various useful functions. from sys import version_info from datetime import datetime, timedelta -from sleekxmpp import JID, InvalidJID +from slixmpp import JID, InvalidJID import base64 import os @@ -283,7 +283,7 @@ def find_delayed_tag(message): """ Check if a message is delayed or not. - :param sleekxmpp.Message message: The message to check. + :param slixmpp.Message message: The message to check. :return: A tuple containing (True, the datetime) or (False, None) :rtype: :py:class:`tuple` """ @@ -521,7 +521,7 @@ def format_gaming_string(infos): def safeJID(*args, **kwargs): """ - Construct a :py:class:`sleekxmpp.JID` object from a string. + Construct a :py:class:`slixmpp.JID` object from a string. Used to avoid tracebacks during is stringprep fails (fall back to a JID with an empty string). diff --git a/src/config.py b/src/config.py index 354c3447..9b45da54 100644 --- a/src/config.py +++ b/src/config.py @@ -454,7 +454,7 @@ def setup_logging(): log = logging.getLogger(__name__) def post_logging_setup(): - # common imports sleekxmpp, which creates then its loggers, so + # common imports slixmpp, which creates then its loggers, so # it needs to be after logger configuration from common import safeJID as JID global safeJID diff --git a/src/connection.py b/src/connection.py index b5b7e12e..be55a90f 100644 --- a/src/connection.py +++ b/src/connection.py @@ -14,15 +14,15 @@ log = logging.getLogger(__name__) import getpass -import sleekxmpp -from sleekxmpp.plugins.xep_0184 import XEP_0184 +import slixmpp +from slixmpp.plugins.xep_0184 import XEP_0184 import common import fixes from common import safeJID from config import config, options -class Connection(sleekxmpp.ClientXMPP): +class Connection(slixmpp.ClientXMPP): """ Receives everything from Jabber and emits the appropriate signals @@ -47,7 +47,7 @@ class Connection(sleekxmpp.ClientXMPP): password = None jid = safeJID(jid) # TODO: use the system language - sleekxmpp.ClientXMPP.__init__(self, jid, password, + slixmpp.ClientXMPP.__init__(self, jid, password, lang=config.get('lang', 'en')) force_encryption = config.get('force_encryption', True) @@ -183,9 +183,9 @@ class Connection(sleekxmpp.ClientXMPP): """ if self.core: self.core.outgoing_stanza(data) - sleekxmpp.ClientXMPP.send_raw(self, data, now, reconnect) + slixmpp.ClientXMPP.send_raw(self, data, now, reconnect) -class MatchAll(sleekxmpp.xmlstream.matcher.base.MatcherBase): +class MatchAll(slixmpp.xmlstream.matcher.base.MatcherBase): """ Callback to retrieve all the stanzas for the XML tab """ diff --git a/src/contact.py b/src/contact.py index 908b609e..c670e5bc 100644 --- a/src/contact.py +++ b/src/contact.py @@ -62,7 +62,7 @@ class Contact(object): """ def __init__(self, item): """ - item: a SleekXMPP RosterItem pointing to that contact + item: a slixmpp RosterItem pointing to that contact """ self.__item = item self.folded_states = defaultdict(lambda: True) diff --git a/src/core/commands.py b/src/core/commands.py index c2e453e9..82d2d6da 100644 --- a/src/core/commands.py +++ b/src/core/commands.py @@ -11,9 +11,9 @@ from datetime import datetime from gettext import gettext as _ from xml.etree import cElementTree as ET -from sleekxmpp.xmlstream.stanzabase import StanzaBase -from sleekxmpp.xmlstream.handler import Callback -from sleekxmpp.xmlstream.matcher import StanzaPath +from slixmpp.xmlstream.stanzabase import StanzaBase +from slixmpp.xmlstream.handler import Callback +from slixmpp.xmlstream.matcher import StanzaPath import bookmark import common diff --git a/src/core/core.py b/src/core/core.py index 985fb752..00d7c364 100644 --- a/src/core/core.py +++ b/src/core/core.py @@ -19,7 +19,7 @@ from threading import Event from datetime import datetime from gettext import gettext as _ -from sleekxmpp.xmlstream.handler import Callback +from slixmpp.xmlstream.handler import Callback import bookmark import connection diff --git a/src/core/handlers.py b/src/core/handlers.py index 119d9e74..e9e1c892 100644 --- a/src/core/handlers.py +++ b/src/core/handlers.py @@ -11,9 +11,9 @@ import time from hashlib import sha1 from gettext import gettext as _ -from sleekxmpp import InvalidJID -from sleekxmpp.stanza import Message -from sleekxmpp.xmlstream.stanzabase import StanzaBase +from slixmpp import InvalidJID +from slixmpp.stanza import Message +from slixmpp.xmlstream.stanzabase import StanzaBase import bookmark import common @@ -1058,7 +1058,7 @@ def incoming_stanza(self, stanza): def validate_ssl(self, pem): """ - Check the server certificate using the sleekxmpp ssl_cert event + Check the server certificate using the slixmpp ssl_cert event """ if config.get('ignore_certificate', False): return diff --git a/src/fixes.py b/src/fixes.py index 18c117d8..39610aa7 100644 --- a/src/fixes.py +++ b/src/fixes.py @@ -1,12 +1,12 @@ """ -Module used to provide fixes for sleekxmpp functions not yet fixed +Module used to provide fixes for slixmpp functions not yet fixed upstream. TODO: Check that they are fixed and remove those hacks """ -from sleekxmpp.stanza import Message -from sleekxmpp.xmlstream import ET +from slixmpp.stanza import Message +from slixmpp.xmlstream import ET import logging diff --git a/src/multiuserchat.py b/src/multiuserchat.py index ae8acb77..dcbafdb2 100644 --- a/src/multiuserchat.py +++ b/src/multiuserchat.py @@ -8,7 +8,7 @@ """ Implementation of the XEP-0045: Multi-User Chat. Add some facilities that are not available on the XEP_0045 -sleek plugin +slix plugin """ from gettext import gettext as _ diff --git a/src/plugin.py b/src/plugin.py index a2412e10..48ff3bd3 100644 --- a/src/plugin.py +++ b/src/plugin.py @@ -339,21 +339,21 @@ class PluginAPI(object): """ return self.plugin_manager.del_event_handler(module, *args, **kwargs) - def add_sleek_event_handler(self, module, event_name, handler): + def add_slix_event_handler(self, module, event_name, handler): """ - Add an event handler for a sleekxmpp event. + Add an event handler for a slixmpp event. :param str event_name: The event name. :param function handler: The handler function. - A list of the SleekXMPP events can be found here + A list of the slixmpp events can be found here http://sleekxmpp.com/event_index.html """ self.core.xmpp.add_event_handler(event_name, handler) - def del_sleek_event_handler(self, module, event_name, handler): + def del_slix_event_handler(self, module, event_name, handler): """ - Remove a handler for a SleekXMPP event + Remove a handler for a slixmpp event :param str event_name: The name of the targeted event. :param function handler: The function to remove from the handlers. diff --git a/src/plugin_manager.py b/src/plugin_manager.py index af87a23b..e449442d 100644 --- a/src/plugin_manager.py +++ b/src/plugin_manager.py @@ -261,7 +261,7 @@ class PluginManager(object): def add_event_handler(self, module_name, event_name, handler, position=0): """ Add an event handler. If event_name isn’t in the event list, assume - it is a sleekxmpp event. + it is a slixmpp event. """ eh = self.event_handlers[module_name] eh.append((event_name, handler)) diff --git a/src/roster.py b/src/roster.py index eb898e5e..ef556021 100644 --- a/src/roster.py +++ b/src/roster.py @@ -19,18 +19,18 @@ from roster_sorting import SORTING_METHODS, GROUP_SORTING_METHODS from os import path as p from datetime import datetime from common import safeJID -from sleekxmpp.exceptions import IqError, IqTimeout +from slixmpp.exceptions import IqError, IqTimeout class Roster(object): """ - The proxy class to get the roster from SleekXMPP. + The proxy class to get the roster from slixmpp. Caches Contact and RosterGroup objects. """ def __init__(self): """ - node: the RosterSingle from SleekXMPP + node: the RosterSingle from slixmpp """ self.__node = None self.contact_filter = None # A tuple(function, *args) @@ -113,7 +113,7 @@ class Roster(object): return self.contacts[jid] def set_node(self, value): - """Set the SleekXMPP RosterSingle for our roster""" + """Set the slixmpp RosterSingle for our roster""" self.__node = value def get_groups(self, sort=''): diff --git a/src/tabs/adhoc_commands_list.py b/src/tabs/adhoc_commands_list.py index 87ee0c52..5a5068f0 100644 --- a/src/tabs/adhoc_commands_list.py +++ b/src/tabs/adhoc_commands_list.py @@ -11,7 +11,7 @@ log = logging.getLogger(__name__) from . import ListTab -from sleekxmpp.plugins.xep_0030.stanza.items import DiscoItem +from slixmpp.plugins.xep_0030.stanza.items import DiscoItem class AdhocCommandsListTab(ListTab): plugin_commands = {} diff --git a/src/tabs/muclisttab.py b/src/tabs/muclisttab.py index d7c68588..55d5c2bd 100644 --- a/src/tabs/muclisttab.py +++ b/src/tabs/muclisttab.py @@ -11,7 +11,7 @@ log = logging.getLogger(__name__) from . import ListTab -from sleekxmpp.plugins.xep_0030.stanza.items import DiscoItem +from slixmpp.plugins.xep_0030.stanza.items import DiscoItem class MucListTab(ListTab): """ diff --git a/src/tabs/xmltab.py b/src/tabs/xmltab.py index 57b55103..7cbc9fb6 100644 --- a/src/tabs/xmltab.py +++ b/src/tabs/xmltab.py @@ -11,8 +11,8 @@ import logging log = logging.getLogger(__name__) import curses -from sleekxmpp.xmlstream import matcher -from sleekxmpp.xmlstream.handler import Callback +from slixmpp.xmlstream import matcher +from slixmpp.xmlstream.handler import Callback from . import Tab diff --git a/src/xhtml.py b/src/xhtml.py index 48664311..b00fe9a9 100644 --- a/src/xhtml.py +++ b/src/xhtml.py @@ -14,7 +14,7 @@ poezio colors to xhtml code import re import curses -from sleekxmpp.xmlstream import ET +from slixmpp.xmlstream import ET from io import BytesIO from xml import sax -- cgit v1.2.3