From d1ccfd515a74debe8f6a526844577b4f02733841 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20H=C3=B6rist?= Date: Thu, 3 Jan 2019 00:37:00 +0100 Subject: [PATCH] MUC: Dont check for unique room id support This feature was remove from XEP-0045 in Version 1.25 (2012-02-08). We simply now use an uuid instead. --- gajim/common/connection.py | 16 --------------- gajim/common/connection_handlers_events.py | 6 ------ gajim/dialogs.py | 24 ++-------------------- 3 files changed, 2 insertions(+), 44 deletions(-) diff --git a/gajim/common/connection.py b/gajim/common/connection.py index 08777d8c8..c2a91600d 100644 --- a/gajim/common/connection.py +++ b/gajim/common/connection.py @@ -1653,22 +1653,6 @@ class Connection(CommonConnection, ConnectionHandlers): show=show, caps=ptype != 'unavailable') - def check_unique_room_id_support(self, server, instance): - if not app.account_is_connected(self.name): - return - iq = nbxmpp.Iq(typ='get', to=server) - iq.setAttr('id', 'unique1') - iq.addChild('unique', namespace=nbxmpp.NS_MUC_UNIQUE) - def _on_response(resp): - if not nbxmpp.isResultNode(resp): - app.nec.push_incoming_event(UniqueRoomIdNotSupportedEvent( - None, conn=self, instance=instance, server=server)) - return - app.nec.push_incoming_event(UniqueRoomIdSupportedEvent(None, - conn=self, instance=instance, server=server, - room_id=resp.getTag('unique').getData())) - self.connection.SendAndCallForResponse(iq, _on_response) - def join_gc(self, nick, room_jid, password, change_nick=False, rejoin=False): # FIXME: This room JID needs to be normalized; see #1364 diff --git a/gajim/common/connection_handlers_events.py b/gajim/common/connection_handlers_events.py index 04e4554d6..d5e865838 100644 --- a/gajim/common/connection_handlers_events.py +++ b/gajim/common/connection_handlers_events.py @@ -210,12 +210,6 @@ class InsecureSSLConnectionEvent(nec.NetworkIncomingEvent): class SSLErrorEvent(nec.NetworkIncomingEvent): name = 'ssl-error' -class UniqueRoomIdSupportedEvent(nec.NetworkIncomingEvent): - name = 'unique-room-id-supported' - -class UniqueRoomIdNotSupportedEvent(nec.NetworkIncomingEvent): - name = 'unique-room-id-not-supported' - class UpdateGCAvatarEvent(nec.NetworkIncomingEvent): name = 'update-gc-avatar' diff --git a/gajim/dialogs.py b/gajim/dialogs.py index e76640677..b84ec208f 100644 --- a/gajim/dialogs.py +++ b/gajim/dialogs.py @@ -30,8 +30,8 @@ from typing import List # pylint: disable=unused-import from typing import Tuple # pylint: disable=unused-import import os +import uuid import logging -from random import randrange from gi.repository import Gtk from gi.repository import Gdk @@ -1459,21 +1459,12 @@ class TransformChatToMUC: path = self.guests_store.get_path(iter_) self.guests_treeview.get_selection().select_path(path) - app.ged.register_event_handler('unique-room-id-supported', ged.GUI1, - self._nec_unique_room_id_supported) - app.ged.register_event_handler('unique-room-id-not-supported', - ged.GUI1, self._nec_unique_room_id_not_supported) - # show all self.window.show_all() self.xml.connect_signals(self) def on_chat_to_muc_window_destroy(self, widget): - app.ged.remove_event_handler('unique-room-id-supported', ged.GUI1, - self._nec_unique_room_id_supported) - app.ged.remove_event_handler('unique-room-id-not-supported', ged.GUI1, - self._nec_unique_room_id_not_supported) self.instances.remove(self) def on_chat_to_muc_window_key_press_event(self, widget, event): @@ -1486,11 +1477,7 @@ class TransformChatToMUC: server = model[row][0].strip() if server == '': return - app.connections[self.account].check_unique_room_id_support(server, self) - def _nec_unique_room_id_supported(self, obj): - if obj.instance != self: - return guest_list = [] guests = self.guests_treeview.get_selection().get_selected_rows() for guest in guests[1]: @@ -1498,7 +1485,7 @@ class TransformChatToMUC: guest_list.append(self.guests_store[iter_][2]) for guest in self.auto_jids: guest_list.append(guest) - room_jid = obj.room_id + '@' + obj.server + room_jid = str(uuid.uuid4()) + '@' + server app.automatic_rooms[self.account][room_jid] = {} app.automatic_rooms[self.account][room_jid]['invities'] = guest_list app.automatic_rooms[self.account][room_jid]['continue_tag'] = True @@ -1509,13 +1496,6 @@ class TransformChatToMUC: def on_cancel_button_clicked(self, widget): self.window.destroy() - def _nec_unique_room_id_not_supported(self, obj): - if obj.instance != self: - return - obj.room_id = app.nicks[self.account].lower().replace(' ', '') + \ - str(randrange(9999999)) - self._nec_unique_room_id_supported(obj) - class Dialog(Gtk.Dialog): def __init__(self, parent, title, buttons, default=None, on_response_ok=None, on_response_cancel=None):