Remove all deprecated alias in the core of slixmpp, and wherever they were used.

This commit is contained in:
Emmanuel Gil Peyrot
2014-09-21 18:51:06 +02:00
committed by Florent Le Coz
parent 61f89eef2e
commit 7c3e61950d
29 changed files with 80 additions and 206 deletions
-3
View File
@@ -351,6 +351,3 @@ class BasePlugin(object):
Only needed if the plugin has circular dependencies.
"""
pass
base_plugin = BasePlugin
+6 -6
View File
@@ -7,10 +7,10 @@
"""
import logging
from . import base
from slixmpp.plugins import BasePlugin
from .. xmlstream.handler.callback import Callback
from .. xmlstream.matcher.xpath import MatchXPath
from .. xmlstream.stanzabase import registerStanzaPlugin, ElementBase, ET, JID
from .. xmlstream.stanzabase import register_stanza_plugin, ElementBase, ET, JID
from .. stanza.iq import Iq
@@ -90,7 +90,7 @@ class NewMail(ElementBase):
plugin_attrib = 'new-mail'
class gmail_notify(base.base_plugin):
class gmail_notify(BasePlugin):
"""
Google Talk: Gmail Notifications
"""
@@ -112,9 +112,9 @@ class gmail_notify(base.base_plugin):
NewMail.name)),
self.handle_new_mail))
registerStanzaPlugin(Iq, GmailQuery)
registerStanzaPlugin(Iq, MailBox)
registerStanzaPlugin(Iq, NewMail)
register_stanza_plugin(Iq, GmailQuery)
register_stanza_plugin(Iq, MailBox)
register_stanza_plugin(Iq, NewMail)
self.last_result_time = None
-5
View File
@@ -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
+6 -6
View File
@@ -453,7 +453,7 @@ class RemoteSession(object):
def _notify(self, event):
log.debug("RPC Session as %s started.", self._client.boundjid.full)
self._client.sendPresence()
self._client.send_presence()
self._event.set()
pass
@@ -733,10 +733,10 @@ class Remote(object):
'''
client = slixmpp.ClientXMPP(jid, password)
#? Register plug-ins.
client.registerPlugin('xep_0004') # Data Forms
client.registerPlugin('xep_0009') # Jabber-RPC
client.registerPlugin('xep_0030') # Service Discovery
client.registerPlugin('xep_0060') # PubSub
client.registerPlugin('xep_0199') # XMPP Ping
client.register_plugin('xep_0004') # Data Forms
client.register_plugin('xep_0009') # Jabber-RPC
client.register_plugin('xep_0030') # Service Discovery
client.register_plugin('xep_0060') # PubSub
client.register_plugin('xep_0199') # XMPP Ping
return cls.new_session_with_client(client, callback)
+4 -4
View File
@@ -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.makeIqSet()
iq = self.xmpp.make_iq_set()
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.makeIqResult(pid)
iq = self.xmpp.make_iq_result(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.makeIqResult(pid)
iq = self.xmpp.make_iq_result(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.makeIqError(pid)
# iq = self.xmpp.make_iq_error(pid)
# iq.attrib['to'] = pto
# iq.attrib['from'] = self.xmpp.boundjid.full
# iq['error']['code'] = code
-1
View File
@@ -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
+12 -12
View File
@@ -154,7 +154,7 @@ class XEP_0045(BasePlugin):
got_online = False
if pr['muc']['room'] not in self.rooms.keys():
return
entry = pr['muc'].getStanzaValues()
entry = pr['muc'].get_stanza_values()
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.makeIqSet()
iq = self.xmpp.make_iq_set()
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.makePresence(pto="%s/%s" % (room, nick), pstatus=pstatus, pshow=pshow, pfrom=pfrom)
stanza = self.xmpp.make_presence(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.makeIqSet()
iq = self.xmpp.make_iq_set()
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.makeIqSet(query)
iq = self.xmpp.make_iq_set(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.makeIqSet(query)
iq = self.xmpp.make_iq_set(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.makeMessage(room)
msg = self.xmpp.make_message(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.sendPresence(pshow='unavailable', pto="%s/%s" % (room, nick), pstatus=msg, pfrom=pfrom)
self.xmpp.send_presence(pshow='unavailable', pto="%s/%s" % (room, nick), pstatus=msg, pfrom=pfrom)
else:
self.xmpp.sendPresence(pshow='unavailable', pto="%s/%s" % (room, nick), pfrom=pfrom)
self.xmpp.send_presence(pshow='unavailable', pto="%s/%s" % (room, nick), pfrom=pfrom)
del self.rooms[room]
def getRoomConfig(self, room, ifrom=''):
iq = self.xmpp.makeIqGet('http://jabber.org/protocol/muc#owner')
iq = self.xmpp.make_iq_get('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.makeIqSet(query)
iq = self.xmpp.make_iq_set(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.makeIqSet(query)
iq = self.xmpp.make_iq_set(query)
iq['to'] = room
iq['from'] = ifrom
iq.send()
+2 -2
View File
@@ -57,8 +57,8 @@ class XEP_0050(BasePlugin):
relevant to a command's session.
Methods:
plugin_init -- Overrides base_plugin.plugin_init
post_init -- Overrides base_plugin.post_init
plugin_init -- Overrides BasePlugin.plugin_init
post_init -- Overrides BasePlugin.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
+2 -2
View File
@@ -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 base_plugin
from slixmpp.plugins.base import BasePlugin
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(base_plugin):
class XEP_0065(BasePlugin):
name = 'xep_0065'
description = "Socks5 Bytestreams"
+3 -3
View File
@@ -83,9 +83,9 @@ class XEP_0323(BasePlugin):
sequence number (unique between the client/sensor pair)
Methods:
plugin_init -- Overrides base_plugin.plugin_init
post_init -- Overrides base_plugin.post_init
plugin_end -- Overrides base_plugin.plugin_end
plugin_init -- Overrides BasePlugin.plugin_init
post_init -- Overrides BasePlugin.post_init
plugin_end -- Overrides BasePlugin.plugin_end
Sensor side
-----------
+3 -3
View File
@@ -79,9 +79,9 @@ class XEP_0325(BasePlugin):
sequence number (unique between the client/sensor pair)
Methods:
plugin_init -- Overrides base_plugin.plugin_init
post_init -- Overrides base_plugin.post_init
plugin_end -- Overrides base_plugin.plugin_end
plugin_init -- Overrides BasePlugin.plugin_init
post_init -- Overrides BasePlugin.post_init
plugin_end -- Overrides BasePlugin.plugin_end
Sensor side
-----------