From d957a590f7b4d52b2308fcdaaa7e074f41d4fe91 Mon Sep 17 00:00:00 2001 From: Yann Leboulanger Date: Fri, 5 Nov 2010 11:09:33 +0100 Subject: [PATCH] whiteboard plugin: print disconnection reason in chat control --- plugins/whiteboard/plugin.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/plugins/whiteboard/plugin.py b/plugins/whiteboard/plugin.py index 614de00ac..91d61ee64 100644 --- a/plugins/whiteboard/plugin.py +++ b/plugins/whiteboard/plugin.py @@ -188,7 +188,7 @@ class WhiteboardPlugin(GajimPlugin): def _nec_jingle_disconnected(self, obj): for base in self.controls: if base.sid == obj.sid: - base.stop_whiteboard() + base.stop_whiteboard(reason = obj.reason) @log_calls('WhiteboardPlugin') def _nec_raw_message(self, obj): @@ -332,17 +332,20 @@ class Base(object): jingle.add_content('xhtml', content) jingle.start_session() - def stop_whiteboard(self): + def stop_whiteboard(self, reason=None): conn = gajim.connections[self.chat_control.account] self.sid = None session = conn.get_jingle_session(self.jid, media='xhtml') if session: session.end_session() + self.button.set_active(False) + if reason: + txt = _('Whiteboard stopped: %(reason)s') % {'reason': reason} + self.chat_control.print_conversation(txt, 'info') if not self.whiteboard: return hbox = self.chat_control.xml.get_object('chat_control_hbox') if self.whiteboard.hbox in hbox.get_children(): - self.button.set_active(False) if hasattr(self.whiteboard, 'hbox'): hbox.remove(self.whiteboard.hbox) self.whiteboard = None