use NEC to handle connection type events
This commit is contained in:
parent
d676dbd900
commit
1a0533998f
|
@ -1287,8 +1287,10 @@ class Connection(CommonConnection, ConnectionHandlers):
|
|||
|
||||
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):
|
||||
|
|
|
@ -1267,4 +1267,8 @@ class NewAccountConnectedEvent(nec.NetworkIncomingEvent):
|
|||
|
||||
class NewAccountNotConnectedEvent(nec.NetworkIncomingEvent):
|
||||
name = 'new-account-not-connected'
|
||||
base_network_events = []
|
||||
|
||||
class ConnectionTypeEvent(nec.NetworkIncomingEvent):
|
||||
name = 'connection-type'
|
||||
base_network_events = []
|
|
@ -188,11 +188,6 @@ class Interface:
|
|||
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 @@ class Interface:
|
|||
'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],
|
||||
|
|
|
@ -2495,6 +2495,9 @@ class RosterWindow:
|
|||
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 @@ class RosterWindow:
|
|||
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)
|
||||
self._nec_our_show)
|
||||
gajim.ged.register_event_handler('connection-type', ged.GUI1,
|
||||
self._nec_connection_type)
|
Loading…
Reference in New Issue