diff --git a/src/common/jingle.py b/src/common/jingle.py index 9795f3db7..5b910372e 100644 --- a/src/common/jingle.py +++ b/src/common/jingle.py @@ -364,7 +364,11 @@ class JingleSession(object): creator = content['creator'] name = content['name'] if (creator, name) in self.contents: - self.contents[(creator, name)].destroy() + content = self.contents[(creator, name)] + #TODO: this will fail if content is not an RTP content + self.connection.dispatch('JINGLE_DISCONNECTED', + (self.peerjid, self.sid, content.media, 'removed')) + content.destroy() if len(self.contents) == 0: reason = xmpp.Node('reason') reason.setTag('success') @@ -399,7 +403,7 @@ class JingleSession(object): self.__content_reject(content) self.contents[(content.creator, content.name)].destroy() - self.connection.dispatch('JINGLE_INCOMING', (self.initiator, self.sid, + self.connection.dispatch('JINGLE_INCOMING', (self.peerjid, self.sid, contents)) def __sessionInitiateCB(self, stanza, jingle, error, action): @@ -442,7 +446,7 @@ class JingleSession(object): self.state = JingleStates.pending # Send event about starting a session - self.connection.dispatch('JINGLE_INCOMING', (self.initiator, self.sid, + self.connection.dispatch('JINGLE_INCOMING', (self.peerjid, self.sid, contents)) def __broadcastCB(self, stanza, jingle, error, action): @@ -462,7 +466,8 @@ class JingleSession(object): text = '%s (%s)' % (reason, text) else: text = reason#TODO - self.connection.dispatch('JINGLE_DISCONNECTED', (self.peerjid, self.sid, text)) + self.connection.dispatch('JINGLE_DISCONNECTED', + (self.peerjid, self.sid, None, text)) def __broadcastAllCB(self, stanza, jingle, error, action): ''' Broadcast the stanza to all content handlers. ''' @@ -598,7 +603,8 @@ class JingleSession(object): else: text = reason self.connection.delete_jingle(self) - self.connection.dispatch('JINGLE_DISCONNECTED', (self.peerjid, self.sid, text)) + self.connection.dispatch('JINGLE_DISCONNECTED', + (self.peerjid, self.sid, None, text)) def __content_add(self, content): #TODO: test @@ -630,7 +636,9 @@ class JingleSession(object): stanza, jingle = self.__make_jingle('content-remove') self.__append_content(jingle, content) self.connection.connection.send(stanza) - #TODO: dispatch something? + #TODO: this will fail if content is not an RTP content + self.connection.dispatch('JINGLE_DISCONNECTED', + (self.peerjid, self.sid, content.media, 'removed')) def content_negociated(self, media): self.connection.dispatch('JINGLE_CONNECTED', (self.peerjid, self.sid, diff --git a/src/gajim.py b/src/gajim.py index 15733dc81..5f2413576 100644 --- a/src/gajim.py +++ b/src/gajim.py @@ -2164,15 +2164,17 @@ class Interface: def handle_event_jingle_disconnected(self, account, data): # ('JINGLE_DISCONNECTED', account, (peerjid, sid, reason)) - peerjid, sid, reason = data + peerjid, sid, media, reason = data jid = gajim.get_jid_without_resource(peerjid) resource = gajim.get_resource_from_jid(peerjid) ctrl = self.msg_win_mgr.get_control(peerjid, account) if not ctrl: ctrl = self.msg_win_mgr.get_control(jid, account) if ctrl: - ctrl.set_audio_state('stop', sid=sid, reason=reason) - ctrl.set_video_state('stop', sid=sid, reason=reason) + if media in ('audio', None): + ctrl.set_audio_state('stop', sid=sid, reason=reason) + if media in ('video', None): + ctrl.set_video_state('stop', sid=sid, reason=reason) dialog = dialogs.VoIPCallReceivedDialog.get_dialog(peerjid, sid) if dialog: dialog.dialog.destroy()