diff --git a/src/common/connection.py b/src/common/connection.py index 39a0cc5ca3a195f9fa12352564bad7f7f39f31d6..36595d8d8b951e05213b0be05faab99eb47cf01f 100644 --- a/src/common/connection.py +++ b/src/common/connection.py @@ -194,14 +194,9 @@ class Connection(ConnectionHandlers): self.secret_hmac = str(random.random())[2:] # END __init__ - def put_event(self, ev): - if ev[0] in gajim.handlers: - log.debug('Sending %s event to GUI: %s' % (ev[0], ev[1:])) - gajim.handlers[ev[0]](self.name, ev[1]) - def dispatch(self, event, data): '''always passes account name as first param''' - self.put_event((event, data)) + gajim.interface.dispatch(event, self.name, data) def _reconnect(self): diff --git a/src/common/zeroconf/connection_zeroconf.py b/src/common/zeroconf/connection_zeroconf.py index c23f4a125e7f1226df31f6df6ecc49ca41d44f70..c5a93b4b894392ade397ae731f48ef04e77992d3 100644 --- a/src/common/zeroconf/connection_zeroconf.py +++ b/src/common/zeroconf/connection_zeroconf.py @@ -137,9 +137,7 @@ class ConnectionZeroconf(ConnectionHandlersZeroconf): # END __init__ def dispatch(self, event, data): - if event in gajim.handlers: - gajim.handlers[event](self.name, data) - + gajim.interface.dispatch(event, self.name, data) def _reconnect(self): # Do not try to reco while we are already trying diff --git a/src/gajim.py b/src/gajim.py index c461ea23f6a7d496ed5aa69fd0d49e187fbd497d..87784d83dd55ba0caecd94e41727e384457b3866 100644 --- a/src/gajim.py +++ b/src/gajim.py @@ -2359,7 +2359,17 @@ class Interface: 'PUBSUB_NODE_REMOVED': self.handle_event_pubsub_node_removed, 'PUBSUB_NODE_NOT_REMOVED': self.handle_event_pubsub_node_not_removed, } - gajim.handlers = self.handlers + + def dispatch(self, event, account, data): + ''' + Dispatches an network event to the event handlers of this class + ''' + if event not in self.handlers: + log.warning('Unknown event %s dispatched to GUI: %s' % (event, data)) + else: + log.debug('Event %s distpached to GUI: %s' % (event, data)) + self.handlers[event](account, data) + ################################################################################ ### Methods dealing with gajim.events