diff options
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> | 2016-09-20 16:29:55 +0900 |
---|---|---|
committer | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> | 2016-09-20 16:52:11 +0900 |
commit | 5a5c1fe9920f0a6c571e8c33f650371879de35dd (patch) | |
tree | 510ee5c2e5cbd224986acb5c77bd4a0056801375 | |
parent | f252f66b5093e76bb0c0b7dea2020e4f70da9598 (diff) | |
download | poezio-5a5c1fe9920f0a6c571e8c33f650371879de35dd.tar.gz poezio-5a5c1fe9920f0a6c571e8c33f650371879de35dd.tar.bz2 poezio-5a5c1fe9920f0a6c571e8c33f650371879de35dd.tar.xz poezio-5a5c1fe9920f0a6c571e8c33f650371879de35dd.zip |
Stop using deprecated aliases from slixmpp.
-rw-r--r-- | poezio/common.py | 5 | ||||
-rw-r--r-- | poezio/core/core.py | 2 | ||||
-rw-r--r-- | poezio/core/handlers.py | 8 | ||||
-rw-r--r-- | poezio/fixes.py | 2 | ||||
-rw-r--r-- | poezio/multiuserchat.py | 2 | ||||
-rw-r--r-- | poezio/tabs/muctab.py | 22 |
6 files changed, 21 insertions, 20 deletions
diff --git a/poezio/common.py b/poezio/common.py index 85bbdffe..4eff202c 100644 --- a/poezio/common.py +++ b/poezio/common.py @@ -249,14 +249,15 @@ def find_delayed_tag(message): :rtype: :py:class:`tuple` """ - delay_tag = message.find('{urn:xmpp:delay}delay') + find_delay = message.xml.find + delay_tag = find_delay('{urn:xmpp:delay}delay') if delay_tag is not None: delayed = True date = _datetime_tuple(delay_tag.attrib['stamp']) else: # We support the OLD and deprecated XEP: http://xmpp.org/extensions/xep-0091.html # But it sucks, please, Jabber servers, don't do this :( - delay_tag = message.find('{jabber:x:delay}x') + delay_tag = find_delay('{jabber:x:delay}x') if delay_tag is not None: delayed = True date = _datetime_tuple(delay_tag.attrib['stamp']) diff --git a/poezio/core/core.py b/poezio/core/core.py index b3aea9a6..6d20fdf7 100644 --- a/poezio/core/core.py +++ b/poezio/core/core.py @@ -928,7 +928,7 @@ class Core(object): Takes a stanza of the form <message type='error'><error/></message> and return a well formed string containing the error informations """ - sender = stanza.attrib['from'] + sender = stanza['from'] msg = stanza['error']['type'] condition = stanza['error']['condition'] code = stanza['error']['code'] diff --git a/poezio/core/handlers.py b/poezio/core/handlers.py index e8f1dd68..cf1c71f5 100644 --- a/poezio/core/handlers.py +++ b/poezio/core/handlers.py @@ -146,7 +146,7 @@ class HandlerCore: if jid.bare in self.core.pending_invites: return # there are 2 'x' tags in the messages, making message['x'] useless - invite = StanzaBase(self.core.xmpp, xml=message.find('{http://jabber.org/protocol/muc#user}x/{http://jabber.org/protocol/muc#user}invite')) + invite = StanzaBase(self.core.xmpp, xml=message.xml.find('{http://jabber.org/protocol/muc#user}x/{http://jabber.org/protocol/muc#user}invite')) inviter = invite['from'] reason = invite['reason'] password = invite['password'] @@ -200,7 +200,7 @@ class HandlerCore: When receiving private message from a muc OR a normal message (from one of our contacts) """ - if message.find('{http://jabber.org/protocol/muc#user}x/{http://jabber.org/protocol/muc#user}invite') != None: + if message.xml.find('{http://jabber.org/protocol/muc#user}x/{http://jabber.org/protocol/muc#user}invite') != None: return if message['type'] == 'groupchat': return @@ -1025,7 +1025,7 @@ class HandlerCore: """ room_from = message['from'] tab = self.core.get_tab_by_name(room_from, tabs.MucTab) - status_codes = set([s.attrib['code'] for s in message.findall('{%s}x/{%s}status' % (tabs.NS_MUC_USER, tabs.NS_MUC_USER))]) + status_codes = {s.attrib['code'] for s in message.xml.findall('{%s}x/{%s}status' % (tabs.NS_MUC_USER, tabs.NS_MUC_USER))} if '101' in status_codes: self.core.information('Your affiliation in the room %s changed' % room_from, 'Info') elif tab and status_codes: @@ -1312,7 +1312,7 @@ class HandlerCore: status = iq['command']['status'] xform = iq.xml.find('{http://jabber.org/protocol/commands}command/{jabber:x:data}x') if xform is not None: - form = self.core.xmpp.plugin['xep_0004'].buildForm(xform) + form = self.core.xmpp.plugin['xep_0004'].build_form(xform) else: form = None diff --git a/poezio/fixes.py b/poezio/fixes.py index 3840a093..8259f5db 100644 --- a/poezio/fixes.py +++ b/poezio/fixes.py @@ -45,7 +45,7 @@ def get_room_form(xmpp, room, callback): xform = result.xml.find('{http://jabber.org/protocol/muc#owner}query/{jabber:x:data}x') if xform is None: return callback(None) - form = xmpp.plugin['xep_0004'].buildForm(xform) + form = xmpp.plugin['xep_0004'].build_form(xform) return callback(form) iq = xmpp.make_iq_get(ito=room) diff --git a/poezio/multiuserchat.py b/poezio/multiuserchat.py index 9f231b2f..90d03572 100644 --- a/poezio/multiuserchat.py +++ b/poezio/multiuserchat.py @@ -189,7 +189,7 @@ def configure_room(xmpp, room, form): iq = xmpp.make_iq_set() iq['to'] = room query = ET.Element('{http://jabber.org/protocol/muc#owner}query') - form = form.getXML('submit') + form['type'] = 'submit' query.append(form) iq.append(query) iq.send() diff --git a/poezio/tabs/muctab.py b/poezio/tabs/muctab.py index a6a87580..6d1439c0 100644 --- a/poezio/tabs/muctab.py +++ b/poezio/tabs/muctab.py @@ -1085,7 +1085,7 @@ class MucTab(ChatTab): from_room = presence['from'].bare xpath = '{%s}x/{%s}status' % (NS_MUC_USER, NS_MUC_USER) status_codes = set() - for status_code in presence.findall(xpath): + for status_code in presence.xml.findall(xpath): status_codes.add(status_code.attrib['code']) # Check if it's not an error presence. @@ -1280,8 +1280,8 @@ class MucTab(ChatTab): self.core.on_user_rejoined_private_conversation(self.name, from_nick) def on_user_nick_change(self, presence, user, from_nick, from_room): - new_nick = presence.find('{%s}x/{%s}item' % (NS_MUC_USER, NS_MUC_USER) - ).attrib['nick'] + new_nick = presence.xml.find('{%s}x/{%s}item' % (NS_MUC_USER, NS_MUC_USER) + ).attrib['nick'] if user.nick == self.own_nick: self.own_nick = new_nick # also change our nick in all private discussions of this room @@ -1315,10 +1315,10 @@ class MucTab(ChatTab): When someone is banned from a muc """ self.users.remove(user) - by = presence.find('{%s}x/{%s}item/{%s}actor' % - (NS_MUC_USER, NS_MUC_USER, NS_MUC_USER)) - reason = presence.find('{%s}x/{%s}item/{%s}reason' % - (NS_MUC_USER, NS_MUC_USER, NS_MUC_USER)) + by = presence.xml.find('{%s}x/{%s}item/{%s}actor' % + (NS_MUC_USER, NS_MUC_USER, NS_MUC_USER)) + reason = presence.xml.find('{%s}x/{%s}item/{%s}reason' % + (NS_MUC_USER, NS_MUC_USER, NS_MUC_USER)) by = by.attrib['jid'] if by is not None else None info_col = dump_tuple(get_theme().COLOR_INFORMATION_TEXT) @@ -1383,10 +1383,10 @@ class MucTab(ChatTab): When someone is kicked from a muc """ self.users.remove(user) - actor_elem = presence.find('{%s}x/{%s}item/{%s}actor' % - (NS_MUC_USER, NS_MUC_USER, NS_MUC_USER)) - reason = presence.find('{%s}x/{%s}item/{%s}reason' % - (NS_MUC_USER, NS_MUC_USER, NS_MUC_USER)) + actor_elem = presence.xml.find('{%s}x/{%s}item/{%s}actor' % + (NS_MUC_USER, NS_MUC_USER, NS_MUC_USER)) + reason = presence.xml.find('{%s}x/{%s}item/{%s}reason' % + (NS_MUC_USER, NS_MUC_USER, NS_MUC_USER)) by = None info_col = dump_tuple(get_theme().COLOR_INFORMATION_TEXT) char_kick = get_theme().CHAR_KICK |