changeset e694ca90429e in /home/hg/repos/gajim

details:http://hg.gajim.org/gajim?cmd=changeset;node=e694ca90429e
description: use NEC to handle connection type events

diffstat:

 src/common/connection.py                 |  4 +++-
 src/common/connection_handlers_events.py |  4 ++++
 src/gui_interface.py                     |  6 ------
 src/roster_window.py                     |  7 ++++++-
 4 files changed, 13 insertions(+), 8 deletions(-)

diffs (74 lines):

diff -r c717413e7ffa -r e694ca90429e src/common/connection.py
--- a/src/common/connection.py  Sun Nov 07 18:50:24 2010 +0100
+++ b/src/common/connection.py  Sun Nov 07 22:45:01 2010 +0100
@@ -1287,8 +1287,10 @@
 
     def _register_handlers(self, con, con_type):
         self.peerhost = con.get_peerhost()
+        gajim.con_types[self.name] = con_type
         # notify the gui about con_type
-        self.dispatch('CON_TYPE', con_type)
+        gajim.nec.push_incoming_event(ConnectionTypeEvent(None,
+            conn=self, connection_type=con_type))
         ConnectionHandlers._register_handlers(self, con, con_type)
 
     def __on_auth(self, con, auth):
diff -r c717413e7ffa -r e694ca90429e src/common/connection_handlers_events.py
--- a/src/common/connection_handlers_events.py  Sun Nov 07 18:50:24 2010 +0100
+++ b/src/common/connection_handlers_events.py  Sun Nov 07 22:45:01 2010 +0100
@@ -1267,4 +1267,8 @@
 
 class NewAccountNotConnectedEvent(nec.NetworkIncomingEvent):
     name = 'new-account-not-connected'
+    base_network_events = []
+
+class ConnectionTypeEvent(nec.NetworkIncomingEvent):
+    name = 'connection-type'
     base_network_events = []
\ No newline at end of file
diff -r c717413e7ffa -r e694ca90429e src/gui_interface.py
--- a/src/gui_interface.py      Sun Nov 07 18:50:24 2010 +0100
+++ b/src/gui_interface.py      Sun Nov 07 22:45:01 2010 +0100
@@ -188,11 +188,6 @@
         if ctrl and ctrl.type_id == message_control.TYPE_GC:
             ctrl.print_conversation('Error %s: %s' % (obj.errcode, obj.errmsg))
 
-    def handle_event_con_type(self, account, con_type):
-        # ('CON_TYPE', account, con_type) which can be 'ssl', 'tls', 'plain'
-        gajim.con_types[account] = con_type
-        self.roster.draw_account(account)
-
     def handle_event_connection_lost(self, account, array):
         # ('CONNECTION_LOST', account, [title, text])
         path = gtkgui_helpers.get_icon_path('gajim-connection_lost', 48)
@@ -1812,7 +1807,6 @@
             'GC_SUBJECT': [self.handle_event_gc_subject],
             'GC_CONFIG_CHANGE': [self.handle_event_gc_config_change],
             'BAD_PASSPHRASE': [self.handle_event_bad_passphrase],
-            'CON_TYPE': [self.handle_event_con_type],
             'CONNECTION_LOST': [self.handle_event_connection_lost],
             'FILE_REQUEST': [self.handle_event_file_request],
             'FILE_REQUEST_ERROR': [self.handle_event_file_request_error],
diff -r c717413e7ffa -r e694ca90429e src/roster_window.py
--- a/src/roster_window.py      Sun Nov 07 18:50:24 2010 +0100
+++ b/src/roster_window.py      Sun Nov 07 22:45:01 2010 +0100
@@ -2495,6 +2495,9 @@
             model[self.status_message_menuitem_iter][3] = True
         self.on_status_changed(obj.conn.name, obj.show)
 
+    def _nec_connection_type(self, obj):
+        self.draw_account(obj.conn.name)
+
 
################################################################################
 ### Menu and GUI callbacks
 ### FIXME: order callbacks in itself...
@@ -6228,4 +6231,6 @@
         gajim.ged.register_event_handler('anonymous-auth', ged.GUI1,
             self._nec_anonymous_auth)
         gajim.ged.register_event_handler('our-show', ged.GUI1,
-            self._nec_our_show)
\ No newline at end of file
+            self._nec_our_show)
+        gajim.ged.register_event_handler('connection-type', ged.GUI1,
+            self._nec_connection_type)
\ No newline at end of file
_______________________________________________
Commits mailing list
[email protected]
http://lists.gajim.org/cgi-bin/listinfo/commits

Reply via email to