Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Maxime Buquet
poezio
Commits
9c3fece9
Commit
9c3fece9
authored
Jul 24, 2014
by
louiz’
Browse files
Use slixmpp
parent
459471d7
Changes
22
Hide whitespace changes
Inline
Side-by-side
plugins/gpg/__init__.py
View file @
9c3fece9
...
...
@@ -106,7 +106,7 @@ to upload you public key on a public server.
"""
from
gpg
import
gnupg
from
sl
eek
xmpp.xmlstream.stanzabase
import
JID
from
sl
i
xmpp.xmlstream.stanzabase
import
JID
from
xml.etree
import
cElementTree
as
ET
import
xml.sax.saxutils
...
...
plugins/iq_show.py
View file @
9c3fece9
...
...
@@ -3,8 +3,8 @@ Show the exchanged IQs (useful for debugging).
"""
from
plugin
import
BasePlugin
from
sl
eek
xmpp.xmlstream.matcher
import
StanzaPath
from
sl
eek
xmpp.xmlstream.handler
import
Callback
from
sl
i
xmpp.xmlstream.matcher
import
StanzaPath
from
sl
i
xmpp.xmlstream.handler
import
Callback
class
Plugin
(
BasePlugin
):
def
init
(
self
):
...
...
plugins/replace.py
View file @
9c3fece9
...
...
@@ -58,7 +58,7 @@ import tabs
import
datetime
import
random
import
re
from
sl
eek
xmpp.xmlstream.stanzabase
import
JID
from
sl
i
xmpp.xmlstream.stanzabase
import
JID
class
Plugin
(
BasePlugin
):
def
init
(
self
):
...
...
plugins/uptime.py
View file @
9c3fece9
...
...
@@ -13,7 +13,7 @@ Command
"""
from
plugin
import
BasePlugin
from
common
import
parse_secs_to_str
,
safeJID
from
sl
eek
xmpp.xmlstream
import
ET
from
sl
i
xmpp.xmlstream
import
ET
class
Plugin
(
BasePlugin
):
def
init
(
self
):
...
...
src/bookmark.py
View file @
9c3fece9
...
...
@@ -11,7 +11,7 @@ bookmarks, both local and remote.
import
logging
from
sys
import
version_info
from
sl
eek
xmpp.plugins.xep_0048
import
Bookmarks
,
Conference
from
sl
i
xmpp.plugins.xep_0048
import
Bookmarks
,
Conference
from
common
import
safeJID
from
config
import
config
...
...
src/common.py
View file @
9c3fece9
...
...
@@ -11,7 +11,7 @@ Various useful functions.
from
sys
import
version_info
from
datetime
import
datetime
,
timedelta
from
sl
eek
xmpp
import
JID
,
InvalidJID
from
sl
i
xmpp
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 sl
eek
xmpp.Message message: The message to check.
:param sl
i
xmpp.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:`sl
eek
xmpp.JID` object from a string.
Construct a :py:class:`sl
i
xmpp.JID` object from a string.
Used to avoid tracebacks during is stringprep fails
(fall back to a JID with an empty string).
...
...
src/config.py
View file @
9c3fece9
...
...
@@ -454,7 +454,7 @@ def setup_logging():
log
=
logging
.
getLogger
(
__name__
)
def
post_logging_setup
():
# common imports sl
eek
xmpp, which creates then its loggers, so
# common imports sl
i
xmpp, which creates then its loggers, so
# it needs to be after logger configuration
from
common
import
safeJID
as
JID
global
safeJID
...
...
src/connection.py
View file @
9c3fece9
...
...
@@ -14,15 +14,15 @@ log = logging.getLogger(__name__)
import
getpass
import
sl
eek
xmpp
from
sl
eek
xmpp.plugins.xep_0184
import
XEP_0184
import
sl
i
xmpp
from
sl
i
xmpp.plugins.xep_0184
import
XEP_0184
import
common
import
fixes
from
common
import
safeJID
from
config
import
config
,
options
class
Connection
(
sl
eek
xmpp
.
ClientXMPP
):
class
Connection
(
sl
i
xmpp
.
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
sl
eek
xmpp
.
ClientXMPP
.
__init__
(
self
,
jid
,
password
,
sl
i
xmpp
.
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
)
sl
eek
xmpp
.
ClientXMPP
.
send_raw
(
self
,
data
,
now
,
reconnect
)
sl
i
xmpp
.
ClientXMPP
.
send_raw
(
self
,
data
,
now
,
reconnect
)
class
MatchAll
(
sl
eek
xmpp
.
xmlstream
.
matcher
.
base
.
MatcherBase
):
class
MatchAll
(
sl
i
xmpp
.
xmlstream
.
matcher
.
base
.
MatcherBase
):
"""
Callback to retrieve all the stanzas for the XML tab
"""
...
...
src/contact.py
View file @
9c3fece9
...
...
@@ -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
)
...
...
src/core/commands.py
View file @
9c3fece9
...
...
@@ -11,9 +11,9 @@ from datetime import datetime
from
gettext
import
gettext
as
_
from
xml.etree
import
cElementTree
as
ET
from
sl
eek
xmpp.xmlstream.stanzabase
import
StanzaBase
from
sl
eek
xmpp.xmlstream.handler
import
Callback
from
sl
eek
xmpp.xmlstream.matcher
import
StanzaPath
from
sl
i
xmpp.xmlstream.stanzabase
import
StanzaBase
from
sl
i
xmpp.xmlstream.handler
import
Callback
from
sl
i
xmpp.xmlstream.matcher
import
StanzaPath
import
bookmark
import
common
...
...
src/core/core.py
View file @
9c3fece9
...
...
@@ -19,7 +19,7 @@ from threading import Event
from
datetime
import
datetime
from
gettext
import
gettext
as
_
from
sl
eek
xmpp.xmlstream.handler
import
Callback
from
sl
i
xmpp.xmlstream.handler
import
Callback
import
bookmark
import
connection
...
...
src/core/handlers.py
View file @
9c3fece9
...
...
@@ -11,9 +11,9 @@ import time
from
hashlib
import
sha1
from
gettext
import
gettext
as
_
from
sl
eek
xmpp
import
InvalidJID
from
sl
eek
xmpp.stanza
import
Message
from
sl
eek
xmpp.xmlstream.stanzabase
import
StanzaBase
from
sl
i
xmpp
import
InvalidJID
from
sl
i
xmpp.stanza
import
Message
from
sl
i
xmpp.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 sl
eek
xmpp ssl_cert event
Check the server certificate using the sl
i
xmpp ssl_cert event
"""
if
config
.
get
(
'ignore_certificate'
,
False
):
return
...
...
src/fixes.py
View file @
9c3fece9
"""
Module used to provide fixes for sl
eek
xmpp functions not yet fixed
Module used to provide fixes for sl
i
xmpp functions not yet fixed
upstream.
TODO: Check that they are fixed and remove those hacks
"""
from
sl
eek
xmpp.stanza
import
Message
from
sl
eek
xmpp.xmlstream
import
ET
from
sl
i
xmpp.stanza
import
Message
from
sl
i
xmpp.xmlstream
import
ET
import
logging
...
...
src/multiuserchat.py
View file @
9c3fece9
...
...
@@ -8,7 +8,7 @@
"""
Implementation of the XEP-0045: Multi-User Chat.
Add some facilities that are not available on the XEP_0045
sl
eek
plugin
sl
ix
plugin
"""
from
gettext
import
gettext
as
_
...
...
src/plugin.py
View file @
9c3fece9
...
...
@@ -339,21 +339,21 @@ class PluginAPI(object):
"""
return
self
.
plugin_manager
.
del_event_handler
(
module
,
*
args
,
**
kwargs
)
def
add_sl
eek
_event_handler
(
self
,
module
,
event_name
,
handler
):
def
add_sl
ix
_event_handler
(
self
,
module
,
event_name
,
handler
):
"""
Add an event handler for a sl
eek
xmpp event.
Add an event handler for a sl
i
xmpp 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_sl
eek
_event_handler
(
self
,
module
,
event_name
,
handler
):
def
del_sl
ix
_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.
...
...
src/plugin_manager.py
View file @
9c3fece9
...
...
@@ -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 sl
eek
xmpp event.
it is a sl
i
xmpp event.
"""
eh
=
self
.
event_handlers
[
module_name
]
eh
.
append
((
event_name
,
handler
))
...
...
src/roster.py
View file @
9c3fece9
...
...
@@ -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
sl
eek
xmpp.exceptions
import
IqError
,
IqTimeout
from
sl
i
xmpp.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
=
''
):
...
...
src/tabs/adhoc_commands_list.py
View file @
9c3fece9
...
...
@@ -11,7 +11,7 @@ log = logging.getLogger(__name__)
from
.
import
ListTab
from
sl
eek
xmpp.plugins.xep_0030.stanza.items
import
DiscoItem
from
sl
i
xmpp.plugins.xep_0030.stanza.items
import
DiscoItem
class
AdhocCommandsListTab
(
ListTab
):
plugin_commands
=
{}
...
...
src/tabs/muclisttab.py
View file @
9c3fece9
...
...
@@ -11,7 +11,7 @@ log = logging.getLogger(__name__)
from
.
import
ListTab
from
sl
eek
xmpp.plugins.xep_0030.stanza.items
import
DiscoItem
from
sl
i
xmpp.plugins.xep_0030.stanza.items
import
DiscoItem
class
MucListTab
(
ListTab
):
"""
...
...
src/tabs/xmltab.py
View file @
9c3fece9
...
...
@@ -11,8 +11,8 @@ import logging
log
=
logging
.
getLogger
(
__name__
)
import
curses
from
sl
eek
xmpp.xmlstream
import
matcher
from
sl
eek
xmpp.xmlstream.handler
import
Callback
from
sl
i
xmpp.xmlstream
import
matcher
from
sl
i
xmpp.xmlstream.handler
import
Callback
from
.
import
Tab
...
...
Prev
1
2
Next
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment