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
poezio
slixmpp
Commits
7c3e6195
Commit
7c3e6195
authored
Sep 21, 2014
by
Link Mauve
Committed by
louiz’
Sep 28, 2014
Browse files
Remove all deprecated alias in the core of slixmpp, and wherever they were used.
parent
61f89eef
Changes
29
Hide whitespace changes
Inline
Side-by-side
docs/create_plugin.rst
View file @
7c3e6195
...
...
@@ -29,7 +29,7 @@ in the future.
First Steps
-----------
Every plugin inherits from the class :mod:`
b
ase
_p
lugin <slixmpp.plugins.base.
b
ase
_p
lugin
>
`,
Every plugin inherits from the class :mod:`
B
ase
P
lugin <slixmpp.plugins.base.
B
ase
P
lugin`,
and must include a ``plugin_init`` method. While the
plugins distributed with Slixmpp must be placed in the plugins directory
``slixmpp/plugins`` to be loaded, custom plugins may be loaded from any
...
...
@@ -56,9 +56,9 @@ attribute.
as a tutorial for creating Slixmpp plugins.
"""
from slixmpp.plugins.base import
b
ase
_p
lugin
from slixmpp.plugins.base import
B
ase
P
lugin
class xep_0077(
b
ase
_p
lugin):
class xep_0077(
B
ase
P
lugin):
"""
XEP-0077 In-Band Registration
"""
...
...
@@ -81,7 +81,7 @@ call in a method named ``post_init`` which will be called once the plugin has
been loaded; by doing so we advertise that we can do registrations only after we
finish activating the plugin.
The ``post_init`` method needs to call ``
b
ase
_p
lugin.post_init(self)``
The ``post_init`` method needs to call ``
B
ase
P
lugin.post_init(self)``
which will mark that ``post_init`` has been called for the plugin. Once the
Slixmpp object begins processing, ``post_init`` will be called on any plugins
that have not already run ``post_init``. This allows you to register plugins and
...
...
@@ -94,7 +94,7 @@ does not automatically load plugin dependencies for you.
.. code-block:: python
def post_init(self):
b
ase
_p
lugin.post_init(self)
B
ase
P
lugin.post_init(self)
self.xmpp['xep_0030'].add_feature("jabber:iq:register")
Creating Custom Stanza Objects
...
...
@@ -347,7 +347,7 @@ method ``setForm`` which will take the names of the fields we wish to include.
# Add a blank field
reg.addField(field)
iq.reply().set
P
ayload(reg.xml)
iq.reply().set
_p
ayload(reg.xml)
iq.send()
Note how we are able to access our ``Registration`` stanza object with
...
...
@@ -421,7 +421,7 @@ to the IQ reply.
...
def _sendError(self, iq, code, error_type, name, text=''):
iq.reply().set
P
ayload(iq['register'].xml)
iq.reply().set
_p
ayload(iq['register'].xml)
iq.error()
iq['error']['code'] = code
iq['error']['type'] = error_type
...
...
@@ -464,7 +464,7 @@ component examples below for how to respond to this event.
if self.backend.register(iq['from'].bare, iq['register']):
# Successful registration
self.xmpp.event('registered_user', iq)
iq.reply().set
P
ayload(iq['register'].xml)
iq.reply().set
_p
ayload(iq['register'].xml)
iq.send()
else:
# Conflicting registration
...
...
@@ -491,8 +491,8 @@ and that we specified the form fields we wish to use with
def __init__(self, jid, password):
slixmpp.componentxmpp.ComponentXMPP.__init__(self, jid, password, 'localhost', 8888)
self.register
P
lugin('xep_0030')
self.register
P
lugin('xep_0077')
self.register
_p
lugin('xep_0030')
self.register
_p
lugin('xep_0077')
self.plugin['xep_0077'].setForm('username', 'password')
self.add_event_handler("registered_user", self.reg)
...
...
@@ -500,11 +500,11 @@ and that we specified the form fields we wish to use with
def reg(self, iq):
msg = "Welcome! %s" % iq['register']['username']
self.send
M
essage(iq['from'], msg, mfrom=self.fulljid)
self.send
_m
essage(iq['from'], msg, mfrom=self.fulljid)
def unreg(self, iq):
msg = "Bye! %s" % iq['register']['username']
self.send
M
essage(iq['from'], msg, mfrom=self.fulljid)
self.send
_m
essage(iq['from'], msg, mfrom=self.fulljid)
**Congratulations!** We now have a basic, functioning implementation of
XEP-0077.
...
...
@@ -523,7 +523,7 @@ with some additional registration fields implemented.
as a tutorial for creating Slixmpp plugins.
"""
from slixmpp.plugins.base import
b
ase
_p
lugin
from slixmpp.plugins.base import
B
ase
P
lugin
from slixmpp.xmlstream.handler.callback import Callback
from slixmpp.xmlstream.matcher.xpath import MatchXPath
from slixmpp.xmlstream import ElementBase, ET, JID, register_stanza_plugin
...
...
@@ -589,7 +589,7 @@ with some additional registration fields implemented.
def unregister(self, jid):
del self.users[jid]
class xep_0077(
b
ase
_p
lugin):
class xep_0077(
B
ase
P
lugin):
"""
XEP-0077 In-Band Registration
"""
...
...
@@ -608,7 +608,7 @@ with some additional registration fields implemented.
register_stanza_plugin(Iq, Registration)
def post_init(self):
b
ase
_p
lugin.post_init(self)
B
ase
P
lugin.post_init(self)
self.xmpp['xep_0030'].add_feature("jabber:iq:register")
def __handleRegistration(self, iq):
...
...
@@ -634,7 +634,7 @@ with some additional registration fields implemented.
if self.backend.register(iq['from'].bare, iq['register']):
# Successful registration
self.xmpp.event('registered_user', iq)
iq.reply().set
P
ayload(iq['register'].xml)
iq.reply().set
_p
ayload(iq['register'].xml)
iq.send()
else:
# Conflicting registration
...
...
@@ -666,11 +666,11 @@ with some additional registration fields implemented.
# Add a blank field
reg.addField(field)
iq.reply().set
P
ayload(reg.xml)
iq.reply().set
_p
ayload(reg.xml)
iq.send()
def _sendError(self, iq, code, error_type, name, text=''):
iq.reply().set
P
ayload(iq['register'].xml)
iq.reply().set
_p
ayload(iq['register'].xml)
iq.error()
iq['error']['code'] = code
iq['error']['type'] = error_type
...
...
docs/getting_started/echobot.rst
View file @
7c3e6195
...
...
@@ -348,7 +348,7 @@ to :meth:`slixmpp.clientxmpp.ClientXMPP`.
To begin responding to messages, you'll see we called :meth:`slixmpp.basexmpp.BaseXMPP.process`
which will start the event handling, send queue, and XML reader threads. It will also call
the :meth:`slixmpp.plugins.base.
b
ase
_p
lugin.post_init` method on all registered plugins. By
the :meth:`slixmpp.plugins.base.
B
ase
P
lugin.post_init` method on all registered plugins. By
passing ``block=True`` to :meth:`slixmpp.basexmpp.BaseXMPP.process` we are running the
main processing loop in the main thread of execution. The :meth:`slixmpp.basexmpp.BaseXMPP.process`
call will not return until after Slixmpp disconnects. If you need to run the client in the background
...
...
docs/xmpp_tdg.rst
View file @
7c3e6195
...
...
@@ -36,7 +36,7 @@ Updated Code
.. code-block:: python
def handleIncomingMessage(self, message):
self.xmpp.send
M
essage(message["from"], message["body"])
self.xmpp.send
_m
essage(message["from"], message["body"])
`View full source <http://github.com/legastero/xmpp-tdg/blob/master/code/EchoBot/EchoBot.py>`_ |
`View original code <http://github.com/remko/xmpp-tdg/blob/master/code/EchoBot/EchoBot.py>`_
...
...
@@ -86,7 +86,7 @@ Updated Code
"uri": self.url + "/" + message.user,
"user" : message.user, "message" : message.text }
for subscriberJID in self.backend.getSubscriberJIDs(message.user) :
self.xmpp.send
M
essage(subscriberJID, body, mhtml=htmlBody)
self.xmpp.send
_m
essage(subscriberJID, body, mhtml=htmlBody)
`View full source <http://github.com/legastero/xmpp-tdg/blob/master/code/CheshiR/Bot.py>`_ |
`View original code <http://github.com/remko/xmpp-tdg/blob/master/code/CheshiR/Bot.py>`_
...
...
@@ -145,7 +145,7 @@ Example 14-4. (Page 220)
Like several previous examples, a needed change is to replace
``subscription["from"]`` with ``subscription["from"].jid`` because the
``BaseXMPP`` method ``make
P
resence`` requires the JID to be a string.
``BaseXMPP`` method ``make
_p
resence`` requires the JID to be a string.
A correction needs to be made in ``handleXMPPPresenceProbe`` because a line was
left out of the original implementation; the variable ``user`` is undefined. The
...
...
@@ -154,7 +154,7 @@ JID of the user can be extracted from the presence stanza's ``from`` attribute.
Since this implementation of CheshiR uses an XMPP component, it must
include a ``from`` attribute in all messages that it sends. Adding the
``from`` attribute is done by including ``mfrom=self.xmpp.jid`` in calls to
``self.xmpp.send
M
essage``.
``self.xmpp.send
_m
essage``.
Updated Code
~~~~~~~~~~~~
...
...
@@ -162,19 +162,19 @@ Updated Code
.. code-block:: python
def handleXMPPPresenceProbe(self, event) :
self.xmpp.send
P
resence(pto = event["from"])
self.xmpp.send
_p
resence(pto = event["from"])
def handleXMPPPresenceSubscription(self, subscription) :
if subscription["type"] == "subscribe" :
userJID = subscription["from"].jid
self.xmpp.send
P
resence
S
ubscription(pto=userJID, ptype="subscribed")
self.xmpp.send
P
resence(pto = userJID)
self.xmpp.send
P
resence
S
ubscription(pto=userJID, ptype="subscribe")
self.xmpp.send
_p
resence
_s
ubscription(pto=userJID, ptype="subscribed")
self.xmpp.send
_p
resence(pto = userJID)
self.xmpp.send
_p
resence
_s
ubscription(pto=userJID, ptype="subscribe")
def handleMessageAddedToBackend(self, message) :
body = message.user + ": " + message.text
for subscriberJID in self.backend.getSubscriberJIDs(message.user) :
self.xmpp.send
M
essage(subscriberJID, body, mfrom=self.xmpp.jid)
self.xmpp.send
_m
essage(subscriberJID, body, mfrom=self.xmpp.jid)
`View full source <http://github.com/legastero/xmpp-tdg/blob/master/code/CheshiR/SimpleComponent.py>`_ |
`View original code <http://github.com/remko/xmpp-tdg/blob/master/code/CheshiR/SimpleComponent.py>`_
...
...
@@ -239,7 +239,7 @@ Updated Code
userJID = subscription["from"].jid
user = self.backend.getUserFromJID(userJID)
contactJID = subscription["to"]
self.xmpp.send
P
resence
S
ubscription(
self.xmpp.send
_p
resence
_s
ubscription(
pfrom=contactJID, pto=userJID, ptype="subscribed", pnick=user)
self.sendPresenceOfContactToUser(contactJID=contactJID, userJID=userJID)
if contactJID == self.componentDomain :
...
...
examples/echo_component.py
View file @
7c3e6195
...
...
@@ -95,10 +95,10 @@ if __name__ == '__main__':
# may have interdependencies, the order in which you register them does
# not matter.
xmpp
=
EchoComponent
(
args
.
jid
,
args
.
password
,
args
.
server
,
args
.
port
)
xmpp
.
register
P
lugin
(
'xep_0030'
)
# Service Discovery
xmpp
.
register
P
lugin
(
'xep_0004'
)
# Data Forms
xmpp
.
register
P
lugin
(
'xep_0060'
)
# PubSub
xmpp
.
register
P
lugin
(
'xep_0199'
)
# XMPP Ping
xmpp
.
register
_p
lugin
(
'xep_0030'
)
# Service Discovery
xmpp
.
register
_p
lugin
(
'xep_0004'
)
# Data Forms
xmpp
.
register
_p
lugin
(
'xep_0060'
)
# PubSub
xmpp
.
register
_p
lugin
(
'xep_0199'
)
# XMPP Ping
# Connect to the XMPP server and start processing XMPP stanzas.
xmpp
.
connect
()
...
...
slixmpp/basexmpp.py
View file @
7c3e6195
...
...
@@ -779,23 +779,3 @@ class BaseXMPP(XMLStream):
pass
else
:
log
.
exception
(
exception
)
# Restore the old, lowercased name for backwards compatibility.
basexmpp
=
BaseXMPP
# To comply with PEP8, method names now use underscores.
# Deprecated method names are re-mapped for backwards compatibility.
BaseXMPP
.
registerPlugin
=
BaseXMPP
.
register_plugin
BaseXMPP
.
makeIq
=
BaseXMPP
.
make_iq
BaseXMPP
.
makeIqGet
=
BaseXMPP
.
make_iq_get
BaseXMPP
.
makeIqResult
=
BaseXMPP
.
make_iq_result
BaseXMPP
.
makeIqSet
=
BaseXMPP
.
make_iq_set
BaseXMPP
.
makeIqError
=
BaseXMPP
.
make_iq_error
BaseXMPP
.
makeIqQuery
=
BaseXMPP
.
make_iq_query
BaseXMPP
.
makeQueryRoster
=
BaseXMPP
.
make_query_roster
BaseXMPP
.
makeMessage
=
BaseXMPP
.
make_message
BaseXMPP
.
makePresence
=
BaseXMPP
.
make_presence
BaseXMPP
.
sendMessage
=
BaseXMPP
.
send_message
BaseXMPP
.
sendPresence
=
BaseXMPP
.
send_presence
BaseXMPP
.
sendPresenceSubscription
=
BaseXMPP
.
send_presence_subscription
slixmpp/clientxmpp.py
View file @
7c3e6195
...
...
@@ -300,11 +300,3 @@ class ClientXMPP(BaseXMPP):
dictated by the server. The same as :attr:`boundjid`.
"""
self
.
client_roster
=
self
.
roster
[
jid
]
# To comply with PEP8, method names now use underscores.
# Deprecated method names are re-mapped for backwards compatibility.
ClientXMPP
.
updateRoster
=
ClientXMPP
.
update_roster
ClientXMPP
.
delRosterItem
=
ClientXMPP
.
del_roster_item
ClientXMPP
.
getRoster
=
ClientXMPP
.
get_roster
ClientXMPP
.
registerFeature
=
ClientXMPP
.
register_feature
slixmpp/plugins/base.py
View file @
7c3e6195
...
...
@@ -351,6 +351,3 @@ class BasePlugin(object):
Only needed if the plugin has circular dependencies.
"""
pass
base_plugin
=
BasePlugin
slixmpp/plugins/gmail_notify.py
View file @
7c3e6195
...
...
@@ -7,10 +7,10 @@
"""
import
logging
from
.
import
b
ase
from
slixmpp.plugins
import
B
ase
Plugin
from
..
xmlstream
.
handler
.
callback
import
Callback
from
..
xmlstream
.
matcher
.
xpath
import
MatchXPath
from
..
xmlstream
.
stanzabase
import
register
S
tanza
P
lugin
,
ElementBase
,
ET
,
JID
from
..
xmlstream
.
stanzabase
import
register
_s
tanza
_p
lugin
,
ElementBase
,
ET
,
JID
from
..
stanza
.
iq
import
Iq
...
...
@@ -90,7 +90,7 @@ class NewMail(ElementBase):
plugin_attrib
=
'new-mail'
class
gmail_notify
(
base
.
b
ase
_p
lugin
):
class
gmail_notify
(
B
ase
P
lugin
):
"""
Google Talk: Gmail Notifications
"""
...
...
@@ -112,9 +112,9 @@ class gmail_notify(base.base_plugin):
NewMail
.
name
)),
self
.
handle_new_mail
))
register
S
tanza
P
lugin
(
Iq
,
GmailQuery
)
register
S
tanza
P
lugin
(
Iq
,
MailBox
)
register
S
tanza
P
lugin
(
Iq
,
NewMail
)
register
_s
tanza
_p
lugin
(
Iq
,
GmailQuery
)
register
_s
tanza
_p
lugin
(
Iq
,
MailBox
)
register
_s
tanza
_p
lugin
(
Iq
,
NewMail
)
self
.
last_result_time
=
None
...
...
slixmpp/plugins/xep_0004/stanza/form.py
View file @
7c3e6195
...
...
@@ -237,21 +237,16 @@ class Form(ElementBase):
return
new
Form
.
setType
=
Form
.
set_type
Form
.
addField
=
Form
.
add_field
Form
.
addItem
=
Form
.
add_item
Form
.
addReported
=
Form
.
add_reported
Form
.
delFields
=
Form
.
del_fields
Form
.
delInstructions
=
Form
.
del_instructions
Form
.
delItems
=
Form
.
del_items
Form
.
delReported
=
Form
.
del_reported
Form
.
getFields
=
Form
.
get_fields
Form
.
getInstructions
=
Form
.
get_instructions
Form
.
getItems
=
Form
.
get_items
Form
.
getReported
=
Form
.
get_reported
Form
.
getValues
=
Form
.
get_values
Form
.
setFields
=
Form
.
set_fields
Form
.
setInstructions
=
Form
.
set_instructions
Form
.
setItems
=
Form
.
set_items
Form
.
setReported
=
Form
.
set_reported
Form
.
setValues
=
Form
.
set_values
slixmpp/plugins/xep_0009/remote.py
View file @
7c3e6195
...
...
@@ -453,7 +453,7 @@ class RemoteSession(object):
def
_notify
(
self
,
event
):
log
.
debug
(
"RPC Session as %s started."
,
self
.
_client
.
boundjid
.
full
)
self
.
_client
.
send
P
resence
()
self
.
_client
.
send
_p
resence
()
self
.
_event
.
set
()
pass
...
...
@@ -733,10 +733,10 @@ class Remote(object):
'''
client
=
slixmpp
.
ClientXMPP
(
jid
,
password
)
#? Register plug-ins.
client
.
register
P
lugin
(
'xep_0004'
)
# Data Forms
client
.
register
P
lugin
(
'xep_0009'
)
# Jabber-RPC
client
.
register
P
lugin
(
'xep_0030'
)
# Service Discovery
client
.
register
P
lugin
(
'xep_0060'
)
# PubSub
client
.
register
P
lugin
(
'xep_0199'
)
# XMPP Ping
client
.
register
_p
lugin
(
'xep_0004'
)
# Data Forms
client
.
register
_p
lugin
(
'xep_0009'
)
# Jabber-RPC
client
.
register
_p
lugin
(
'xep_0030'
)
# Service Discovery
client
.
register
_p
lugin
(
'xep_0060'
)
# PubSub
client
.
register
_p
lugin
(
'xep_0199'
)
# XMPP Ping
return
cls
.
new_session_with_client
(
client
,
callback
)
slixmpp/plugins/xep_0009/rpc.py
View file @
7c3e6195
...
...
@@ -55,7 +55,7 @@ class XEP_0009(BasePlugin):
self
.
xmpp
[
'xep_0030'
].
add_identity
(
'automation'
,
'rpc'
)
def
make_iq_method_call
(
self
,
pto
,
pmethod
,
params
):
iq
=
self
.
xmpp
.
make
IqS
et
()
iq
=
self
.
xmpp
.
make
_iq_s
et
()
iq
.
attrib
[
'to'
]
=
pto
iq
.
attrib
[
'from'
]
=
self
.
xmpp
.
boundjid
.
full
iq
.
enable
(
'rpc_query'
)
...
...
@@ -64,7 +64,7 @@ class XEP_0009(BasePlugin):
return
iq
def
make_iq_method_response
(
self
,
pid
,
pto
,
params
):
iq
=
self
.
xmpp
.
make
IqR
esult
(
pid
)
iq
=
self
.
xmpp
.
make
_iq_r
esult
(
pid
)
iq
.
attrib
[
'to'
]
=
pto
iq
.
attrib
[
'from'
]
=
self
.
xmpp
.
boundjid
.
full
iq
.
enable
(
'rpc_query'
)
...
...
@@ -72,7 +72,7 @@ class XEP_0009(BasePlugin):
return
iq
def
make_iq_method_response_fault
(
self
,
pid
,
pto
,
params
):
iq
=
self
.
xmpp
.
make
IqR
esult
(
pid
)
iq
=
self
.
xmpp
.
make
_iq_r
esult
(
pid
)
iq
.
attrib
[
'to'
]
=
pto
iq
.
attrib
[
'from'
]
=
self
.
xmpp
.
boundjid
.
full
iq
.
enable
(
'rpc_query'
)
...
...
@@ -81,7 +81,7 @@ class XEP_0009(BasePlugin):
return
iq
# def make_iq_method_error(self, pto, pid, pmethod, params, code, type, condition):
# iq = self.xmpp.make
IqE
rror(pid)
# iq = self.xmpp.make
_iq_e
rror(pid)
# iq.attrib['to'] = pto
# iq.attrib['from'] = self.xmpp.boundjid.full
# iq['error']['code'] = code
...
...
slixmpp/plugins/xep_0030/__init__.py
View file @
7c3e6195
...
...
@@ -19,5 +19,4 @@ register_plugin(XEP_0030)
# Retain some backwards compatibility
xep_0030
=
XEP_0030
XEP_0030
.
getInfo
=
XEP_0030
.
get_info
XEP_0030
.
getItems
=
XEP_0030
.
get_items
XEP_0030
.
make_static
=
XEP_0030
.
restore_defaults
slixmpp/plugins/xep_0045.py
View file @
7c3e6195
...
...
@@ -154,7 +154,7 @@ class XEP_0045(BasePlugin):
got_online
=
False
if
pr
[
'muc'
][
'room'
]
not
in
self
.
rooms
.
keys
():
return
entry
=
pr
[
'muc'
].
get
S
tanza
V
alues
()
entry
=
pr
[
'muc'
].
get
_s
tanza
_v
alues
()
entry
[
'show'
]
=
pr
[
'show'
]
entry
[
'status'
]
=
pr
[
'status'
]
entry
[
'alt_nick'
]
=
pr
[
'nick'
]
...
...
@@ -210,7 +210,7 @@ class XEP_0045(BasePlugin):
def
configureRoom
(
self
,
room
,
form
=
None
,
ifrom
=
None
):
if
form
is
None
:
form
=
self
.
getRoomConfig
(
room
,
ifrom
=
ifrom
)
iq
=
self
.
xmpp
.
make
IqS
et
()
iq
=
self
.
xmpp
.
make
_iq_s
et
()
iq
[
'to'
]
=
room
if
ifrom
is
not
None
:
iq
[
'from'
]
=
ifrom
...
...
@@ -230,7 +230,7 @@ class XEP_0045(BasePlugin):
def
joinMUC
(
self
,
room
,
nick
,
maxhistory
=
"0"
,
password
=
''
,
wait
=
False
,
pstatus
=
None
,
pshow
=
None
,
pfrom
=
None
):
""" Join the specified room, requesting 'maxhistory' lines of history.
"""
stanza
=
self
.
xmpp
.
make
P
resence
(
pto
=
"%s/%s"
%
(
room
,
nick
),
pstatus
=
pstatus
,
pshow
=
pshow
,
pfrom
=
pfrom
)
stanza
=
self
.
xmpp
.
make
_p
resence
(
pto
=
"%s/%s"
%
(
room
,
nick
),
pstatus
=
pstatus
,
pshow
=
pshow
,
pfrom
=
pfrom
)
x
=
ET
.
Element
(
'{http://jabber.org/protocol/muc}x'
)
if
password
:
passelement
=
ET
.
Element
(
'{http://jabber.org/protocol/muc}password'
)
...
...
@@ -254,7 +254,7 @@ class XEP_0045(BasePlugin):
self
.
ourNicks
[
room
]
=
nick
def
destroy
(
self
,
room
,
reason
=
''
,
altroom
=
''
,
ifrom
=
None
):
iq
=
self
.
xmpp
.
make
IqS
et
()
iq
=
self
.
xmpp
.
make
_iq_s
et
()
if
ifrom
is
not
None
:
iq
[
'from'
]
=
ifrom
iq
[
'to'
]
=
room
...
...
@@ -286,7 +286,7 @@ class XEP_0045(BasePlugin):
else
:
item
=
ET
.
Element
(
'{http://jabber.org/protocol/muc#admin}item'
,
{
'affiliation'
:
affiliation
,
'jid'
:
jid
})
query
.
append
(
item
)
iq
=
self
.
xmpp
.
make
IqS
et
(
query
)
iq
=
self
.
xmpp
.
make
_iq_s
et
(
query
)
iq
[
'to'
]
=
room
iq
[
'from'
]
=
ifrom
# For now, swallow errors to preserve existing API
...
...
@@ -309,7 +309,7 @@ class XEP_0045(BasePlugin):
query
=
ET
.
Element
(
'{http://jabber.org/protocol/muc#admin}query'
)
item
=
ET
.
Element
(
'item'
,
{
'role'
:
role
,
'nick'
:
nick
})
query
.
append
(
item
)
iq
=
self
.
xmpp
.
make
IqS
et
(
query
)
iq
=
self
.
xmpp
.
make
_iq_s
et
(
query
)
iq
[
'to'
]
=
room
result
=
iq
.
send
()
if
result
is
False
or
result
[
'type'
]
!=
'result'
:
...
...
@@ -318,7 +318,7 @@ class XEP_0045(BasePlugin):
def
invite
(
self
,
room
,
jid
,
reason
=
''
,
mfrom
=
''
):
""" Invite a jid to a room."""
msg
=
self
.
xmpp
.
make
M
essage
(
room
)
msg
=
self
.
xmpp
.
make
_m
essage
(
room
)
msg
[
'from'
]
=
mfrom
x
=
ET
.
Element
(
'{http://jabber.org/protocol/muc#user}x'
)
invite
=
ET
.
Element
(
'{http://jabber.org/protocol/muc#user}invite'
,
{
'to'
:
jid
})
...
...
@@ -334,13 +334,13 @@ class XEP_0045(BasePlugin):
""" Leave the specified room.
"""
if
msg
:
self
.
xmpp
.
send
P
resence
(
pshow
=
'unavailable'
,
pto
=
"%s/%s"
%
(
room
,
nick
),
pstatus
=
msg
,
pfrom
=
pfrom
)
self
.
xmpp
.
send
_p
resence
(
pshow
=
'unavailable'
,
pto
=
"%s/%s"
%
(
room
,
nick
),
pstatus
=
msg
,
pfrom
=
pfrom
)
else
:
self
.
xmpp
.
send
P
resence
(
pshow
=
'unavailable'
,
pto
=
"%s/%s"
%
(
room
,
nick
),
pfrom
=
pfrom
)
self
.
xmpp
.
send
_p
resence
(
pshow
=
'unavailable'
,
pto
=
"%s/%s"
%
(
room
,
nick
),
pfrom
=
pfrom
)
del
self
.
rooms
[
room
]
def
getRoomConfig
(
self
,
room
,
ifrom
=
''
):
iq
=
self
.
xmpp
.
make
IqG
et
(
'http://jabber.org/protocol/muc#owner'
)
iq
=
self
.
xmpp
.
make
_iq_g
et
(
'http://jabber.org/protocol/muc#owner'
)
iq
[
'to'
]
=
room
iq
[
'from'
]
=
ifrom
# For now, swallow errors to preserve existing API
...
...
@@ -359,7 +359,7 @@ class XEP_0045(BasePlugin):
query
=
ET
.
Element
(
'{http://jabber.org/protocol/muc#owner}query'
)
x
=
ET
.
Element
(
'{jabber:x:data}x'
,
type
=
'cancel'
)
query
.
append
(
x
)
iq
=
self
.
xmpp
.
make
IqS
et
(
query
)
iq
=
self
.
xmpp
.
make
_iq_s
et
(
query
)
iq
[
'to'
]
=
room
iq
[
'from'
]
=
ifrom
iq
.
send
()
...
...
@@ -368,7 +368,7 @@ class XEP_0045(BasePlugin):
query
=
ET
.
Element
(
'{http://jabber.org/protocol/muc#owner}query'
)
x
=
config
.
getXML
(
'submit'
)
query
.
append
(
x
)
iq
=
self
.
xmpp
.
make
IqS
et
(
query
)
iq
=
self
.
xmpp
.
make
_iq_s
et
(
query
)
iq
[
'to'
]
=
room
iq
[
'from'
]
=
ifrom
iq
.
send
()
...
...
slixmpp/plugins/xep_0050/adhoc.py
View file @
7c3e6195
...
...
@@ -57,8 +57,8 @@ class XEP_0050(BasePlugin):
relevant to a command's session.
Methods:
plugin_init -- Overrides
b
ase
_p
lugin.plugin_init
post_init -- Overrides
b
ase
_p
lugin.post_init
plugin_init -- Overrides
B
ase
P
lugin.plugin_init
post_init -- Overrides
B
ase
P
lugin.post_init
new_session -- Return a new session ID.
prep_handlers -- Placeholder. May call with a list of handlers
to prepare them for use with the session storage
...
...
slixmpp/plugins/xep_0065/proxy.py
View file @
7c3e6195
...
...
@@ -12,7 +12,7 @@ from slixmpp.exceptions import XMPPError
from
slixmpp.xmlstream
import
register_stanza_plugin
from
slixmpp.xmlstream.handler
import
Callback
from
slixmpp.xmlstream.matcher
import
StanzaPath
from
slixmpp.plugins.base
import
b
ase
_p
lugin
from
slixmpp.plugins.base
import
B
ase
P
lugin
from
slixmpp.plugins.xep_0065
import
stanza
,
Socks5
...
...
@@ -20,7 +20,7 @@ from slixmpp.plugins.xep_0065 import stanza, Socks5
log
=
logging
.
getLogger
(
__name__
)
class
XEP_0065
(
b
ase
_p
lugin
):
class
XEP_0065
(
B
ase
P
lugin
):
name
=
'xep_0065'
description
=
"Socks5 Bytestreams"
...
...
slixmpp/plugins/xep_0323/sensordata.py
View file @
7c3e6195
...
...
@@ -83,9 +83,9 @@ class XEP_0323(BasePlugin):
sequence number (unique between the client/sensor pair)
Methods:
plugin_init -- Overrides
b
ase
_p
lugin.plugin_init
post_init -- Overrides
b
ase
_p
lugin.post_init
plugin_end -- Overrides
b
ase
_p
lugin.plugin_end
plugin_init -- Overrides
B
ase
P
lugin.plugin_init
post_init -- Overrides
B
ase
P
lugin.post_init
plugin_end -- Overrides
B
ase
P
lugin.plugin_end
Sensor side
-----------
...
...
slixmpp/plugins/xep_0325/control.py
View file @
7c3e6195
...
...
@@ -79,9 +79,9 @@ class XEP_0325(BasePlugin):
sequence number (unique between the client/sensor pair)
Methods:
plugin_init -- Overrides
b
ase
_p
lugin.plugin_init
post_init -- Overrides
b
ase
_p
lugin.post_init
plugin_end -- Overrides
b
ase
_p
lugin.plugin_end
plugin_init -- Overrides
B
ase
P
lugin.plugin_init
post_init -- Overrides
B
ase
P
lugin.post_init
plugin_end -- Overrides
B
ase
P
lugin.plugin_end
Sensor side
-----------
...
...
slixmpp/stanza/error.py
View file @
7c3e6195
...
...
@@ -162,13 +162,3 @@ class Error(ElementBase):
def
del_redirect
(
self
):
self
.
_del_sub
(
'{%s}redirect'
%
self
.
condition_ns
)
# To comply with PEP8, method names now use underscores.
# Deprecated method names are re-mapped for backwards compatibility.
Error
.
getCondition
=
Error
.
get_condition
Error
.
setCondition
=
Error
.
set_condition
Error
.
delCondition
=
Error
.
del_condition
Error
.
getText
=
Error
.
get_text
Error
.
setText
=
Error
.
set_text
Error
.
delText
=
Error
.
del_text
slixmpp/stanza/htmlim.py
View file @
7c3e6195
...
...
@@ -12,10 +12,3 @@ from slixmpp.plugins.xep_0071 import XHTML_IM as HTMLIM
register_stanza_plugin
(
Message
,
HTMLIM
)
# To comply with PEP8, method names now use underscores.
# Deprecated method names are re-mapped for backwards compatibility.
HTMLIM
.
setBody
=
HTMLIM
.
set_body
HTMLIM
.
getBody
=
HTMLIM
.
get_body
HTMLIM
.
delBody
=
HTMLIM
.
del_body
slixmpp/stanza/iq.py
View file @
7c3e6195
...
...
@@ -246,11 +246,3 @@ class Iq(RootStanza):
else
:
StanzaBase
.
_set_stanza_values
(
self
,
values
)
return
self
# To comply with PEP8, method names now use underscores.
# Deprecated method names are re-mapped for backwards compatibility.
Iq
.
setPayload
=
Iq
.
set_payload
Iq
.
getQuery
=
Iq
.
get_query
Iq
.
setQuery
=
Iq
.
set_query
Iq
.
delQuery
=
Iq
.
del_query
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