From c49f9d60abbc66ac3d9e3a8a2f18d81cb6af8fad Mon Sep 17 00:00:00 2001 From: Yann Leboulanger Date: Fri, 6 Apr 2018 23:34:26 +0200 Subject: [PATCH] fix jingle negotiation from an XMPP point of view --- gajim/chat_control.py | 21 ++++++++++----------- gajim/common/jingle_rtp.py | 2 +- gajim/common/jingle_session.py | 3 +-- gajim/gui_interface.py | 2 +- 4 files changed, 13 insertions(+), 15 deletions(-) diff --git a/gajim/chat_control.py b/gajim/chat_control.py index 4c87ee452..c359f55a8 100644 --- a/gajim/chat_control.py +++ b/gajim/chat_control.py @@ -264,17 +264,17 @@ class ChatControl(ChatControlBase): act.connect("activate", func) self.parent_win.window.add_action(act) - act = Gio.SimpleAction.new_stateful( + self.audio_action = Gio.SimpleAction.new_stateful( 'toggle-audio-' + self.control_id, None, GLib.Variant.new_boolean(False)) - act.connect('change-state', self._on_audio) - self.parent_win.window.add_action(act) + self.audio_action.connect('change-state', self._on_audio) + self.parent_win.window.add_action(self.audio_action) - act = Gio.SimpleAction.new_stateful( + self.video_action = Gio.SimpleAction.new_stateful( 'toggle-video-' + self.control_id, None, GLib.Variant.new_boolean(False)) - act.connect('change-state', self._on_video) - self.parent_win.window.add_action(act) + self.video_action.connect('change-state', self._on_video) + self.parent_win.window.add_action(self.video_action) def update_actions(self): win = self.parent_win.window @@ -526,7 +526,8 @@ class ChatControl(ChatControlBase): if state in ('connection_received', 'connecting'): setattr(self, jingle_type + '_sid', sid) - getattr(self, '_' + jingle_type + '_button').set_active(jingle_state != self.JINGLE_STATE_NULL) + v = GLib.Variant.new_boolean(jingle_state != self.JINGLE_STATE_NULL) + getattr(self, jingle_type + '_action').change_state(v) getattr(self, 'update_' + jingle_type)() @@ -724,7 +725,8 @@ class ChatControl(ChatControlBase): content = session.get_content(jingle_type) if content: session.remove_content(content.creator, content.name) - getattr(self, '_' + jingle_type + '_button').set_active(False) + v = GLib.Variant.new_boolean(False) + getattr(self, jingle_type + '_action').change_state(v) getattr(self, 'update_' + jingle_type)() def on_jingle_button_toggled(self, state, jingle_type): @@ -768,9 +770,6 @@ class ChatControl(ChatControlBase): fixed.set_no_show_all(True) self.close_jingle_content(jingle_type) - img = getattr(self, '_' + jingle_type + '_button').get_property('image') - img.set_from_file(path_to_img) - def set_lock_image(self): loggable = self.session and self.session.is_loggable() diff --git a/gajim/common/jingle_rtp.py b/gajim/common/jingle_rtp.py index 523456476..51f4fc9f2 100644 --- a/gajim/common/jingle_rtp.py +++ b/gajim/common/jingle_rtp.py @@ -43,7 +43,7 @@ class JingleRTPContent(JingleContent): def __init__(self, session, media, transport=None): if transport is None: transport = JingleTransportICEUDP(None) - JingleContent.__init__(self, session, transport) + JingleContent.__init__(self, session, transport, None) self.media = media self._dtmf_running = False self.farstream_media = { diff --git a/gajim/common/jingle_session.py b/gajim/common/jingle_session.py index fb7d376b4..62577befb 100644 --- a/gajim/common/jingle_session.py +++ b/gajim/common/jingle_session.py @@ -633,8 +633,7 @@ class JingleSession: if content_type: try: if transport: - content = content_type( - self, transport=transport, senders=senders) + content = content_type(self, transport=transport) self.add_content(element['name'], content, 'peer') contents.append(content) diff --git a/gajim/gui_interface.py b/gajim/gui_interface.py index 593cfcfbb..7ffb19f63 100644 --- a/gajim/gui_interface.py +++ b/gajim/gui_interface.py @@ -1238,7 +1238,7 @@ class Interface: # TODO: conditional blocking if peer is not in roster account = obj.conn.name - content_types = obj.contents.media + content_types = [obj.contents.media] # check type of jingle session if 'audio' in content_types or 'video' in content_types: