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.
This commit is contained in:
Philipp Hörist 2019-01-03 00:37:00 +01:00
parent d622439a44
commit d1ccfd515a
3 changed files with 2 additions and 44 deletions

View File

@ -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

View File

@ -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'

View File

@ -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):