fix jingle negotiation from an XMPP point of view

This commit is contained in:
Yann Leboulanger 2018-04-06 23:34:26 +02:00 committed by Philipp Hörist
parent dfb7b4a0dd
commit c49f9d60ab
4 changed files with 13 additions and 15 deletions

View File

@ -264,17 +264,17 @@ class ChatControl(ChatControlBase):
act.connect("activate", func) act.connect("activate", func)
self.parent_win.window.add_action(act) 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, 'toggle-audio-' + self.control_id, None,
GLib.Variant.new_boolean(False)) GLib.Variant.new_boolean(False))
act.connect('change-state', self._on_audio) self.audio_action.connect('change-state', self._on_audio)
self.parent_win.window.add_action(act) 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, 'toggle-video-' + self.control_id,
None, GLib.Variant.new_boolean(False)) None, GLib.Variant.new_boolean(False))
act.connect('change-state', self._on_video) self.video_action.connect('change-state', self._on_video)
self.parent_win.window.add_action(act) self.parent_win.window.add_action(self.video_action)
def update_actions(self): def update_actions(self):
win = self.parent_win.window win = self.parent_win.window
@ -526,7 +526,8 @@ class ChatControl(ChatControlBase):
if state in ('connection_received', 'connecting'): if state in ('connection_received', 'connecting'):
setattr(self, jingle_type + '_sid', sid) 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)() getattr(self, 'update_' + jingle_type)()
@ -724,7 +725,8 @@ class ChatControl(ChatControlBase):
content = session.get_content(jingle_type) content = session.get_content(jingle_type)
if content: if content:
session.remove_content(content.creator, content.name) 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)() getattr(self, 'update_' + jingle_type)()
def on_jingle_button_toggled(self, state, jingle_type): def on_jingle_button_toggled(self, state, jingle_type):
@ -768,9 +770,6 @@ class ChatControl(ChatControlBase):
fixed.set_no_show_all(True) fixed.set_no_show_all(True)
self.close_jingle_content(jingle_type) 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): def set_lock_image(self):
loggable = self.session and self.session.is_loggable() loggable = self.session and self.session.is_loggable()

View File

@ -43,7 +43,7 @@ class JingleRTPContent(JingleContent):
def __init__(self, session, media, transport=None): def __init__(self, session, media, transport=None):
if transport is None: if transport is None:
transport = JingleTransportICEUDP(None) transport = JingleTransportICEUDP(None)
JingleContent.__init__(self, session, transport) JingleContent.__init__(self, session, transport, None)
self.media = media self.media = media
self._dtmf_running = False self._dtmf_running = False
self.farstream_media = { self.farstream_media = {

View File

@ -633,8 +633,7 @@ class JingleSession:
if content_type: if content_type:
try: try:
if transport: if transport:
content = content_type( content = content_type(self, transport=transport)
self, transport=transport, senders=senders)
self.add_content(element['name'], self.add_content(element['name'],
content, 'peer') content, 'peer')
contents.append(content) contents.append(content)

View File

@ -1238,7 +1238,7 @@ class Interface:
# TODO: conditional blocking if peer is not in roster # TODO: conditional blocking if peer is not in roster
account = obj.conn.name account = obj.conn.name
content_types = obj.contents.media content_types = [obj.contents.media]
# check type of jingle session # check type of jingle session
if 'audio' in content_types or 'video' in content_types: if 'audio' in content_types or 'video' in content_types: