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:
parent
d622439a44
commit
d1ccfd515a
|
@ -1653,22 +1653,6 @@ class Connection(CommonConnection, ConnectionHandlers):
|
||||||
show=show,
|
show=show,
|
||||||
caps=ptype != 'unavailable')
|
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,
|
def join_gc(self, nick, room_jid, password, change_nick=False,
|
||||||
rejoin=False):
|
rejoin=False):
|
||||||
# FIXME: This room JID needs to be normalized; see #1364
|
# FIXME: This room JID needs to be normalized; see #1364
|
||||||
|
|
|
@ -210,12 +210,6 @@ class InsecureSSLConnectionEvent(nec.NetworkIncomingEvent):
|
||||||
class SSLErrorEvent(nec.NetworkIncomingEvent):
|
class SSLErrorEvent(nec.NetworkIncomingEvent):
|
||||||
name = 'ssl-error'
|
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):
|
class UpdateGCAvatarEvent(nec.NetworkIncomingEvent):
|
||||||
name = 'update-gc-avatar'
|
name = 'update-gc-avatar'
|
||||||
|
|
||||||
|
|
|
@ -30,8 +30,8 @@ from typing import List # pylint: disable=unused-import
|
||||||
from typing import Tuple # pylint: disable=unused-import
|
from typing import Tuple # pylint: disable=unused-import
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
import uuid
|
||||||
import logging
|
import logging
|
||||||
from random import randrange
|
|
||||||
|
|
||||||
from gi.repository import Gtk
|
from gi.repository import Gtk
|
||||||
from gi.repository import Gdk
|
from gi.repository import Gdk
|
||||||
|
@ -1459,21 +1459,12 @@ class TransformChatToMUC:
|
||||||
path = self.guests_store.get_path(iter_)
|
path = self.guests_store.get_path(iter_)
|
||||||
self.guests_treeview.get_selection().select_path(path)
|
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
|
# show all
|
||||||
self.window.show_all()
|
self.window.show_all()
|
||||||
|
|
||||||
self.xml.connect_signals(self)
|
self.xml.connect_signals(self)
|
||||||
|
|
||||||
def on_chat_to_muc_window_destroy(self, widget):
|
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)
|
self.instances.remove(self)
|
||||||
|
|
||||||
def on_chat_to_muc_window_key_press_event(self, widget, event):
|
def on_chat_to_muc_window_key_press_event(self, widget, event):
|
||||||
|
@ -1486,11 +1477,7 @@ class TransformChatToMUC:
|
||||||
server = model[row][0].strip()
|
server = model[row][0].strip()
|
||||||
if server == '':
|
if server == '':
|
||||||
return
|
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 = []
|
guest_list = []
|
||||||
guests = self.guests_treeview.get_selection().get_selected_rows()
|
guests = self.guests_treeview.get_selection().get_selected_rows()
|
||||||
for guest in guests[1]:
|
for guest in guests[1]:
|
||||||
|
@ -1498,7 +1485,7 @@ class TransformChatToMUC:
|
||||||
guest_list.append(self.guests_store[iter_][2])
|
guest_list.append(self.guests_store[iter_][2])
|
||||||
for guest in self.auto_jids:
|
for guest in self.auto_jids:
|
||||||
guest_list.append(guest)
|
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] = {}
|
||||||
app.automatic_rooms[self.account][room_jid]['invities'] = guest_list
|
app.automatic_rooms[self.account][room_jid]['invities'] = guest_list
|
||||||
app.automatic_rooms[self.account][room_jid]['continue_tag'] = True
|
app.automatic_rooms[self.account][room_jid]['continue_tag'] = True
|
||||||
|
@ -1509,13 +1496,6 @@ class TransformChatToMUC:
|
||||||
def on_cancel_button_clicked(self, widget):
|
def on_cancel_button_clicked(self, widget):
|
||||||
self.window.destroy()
|
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):
|
class Dialog(Gtk.Dialog):
|
||||||
def __init__(self, parent, title, buttons, default=None,
|
def __init__(self, parent, title, buttons, default=None,
|
||||||
on_response_ok=None, on_response_cancel=None):
|
on_response_ok=None, on_response_cancel=None):
|
||||||
|
|
Loading…
Reference in New Issue