Philipp Hörist pushed to branch gajim_1.1 at gajim / gajim
Commits: 6ed2094b by Philipp Hörist at 2018-12-22T12:53:33Z Add more log output when calling handlers
- - - - - f93797e2 by Philipp Hörist at 2018-12-22T12:53:50Z Send active instead of gone as last chatstate
- Also attempt to fix #9446
- - - - - 29eea2f1 by Philipp Hörist at 2018-12-22T12:54:22Z Check if event was not consumed
Fixes #9096
- - - - -
3 changed files:
- gajim/common/ged.py - gajim/common/modules/chatstates.py - gajim/gui_interface.py
Changes:
===================================== gajim/common/ged.py ===================================== @@ -24,6 +24,7 @@ Global Events Dispatcher module.
import logging import traceback +import inspect
from nbxmpp import NodeProcessed
@@ -84,13 +85,19 @@ class GlobalEventsDispatcher: Error: %s''', handler, priority, event_name, error)
def raise_event(self, event_name, *args, **kwargs): - log.debug('%s Args: %s', event_name, str(args)) + log.debug('Raise event: %s', event_name) if event_name in self.handlers: node_processed = False # Iterate over a copy of the handlers list, so while iterating # the original handlers list can be modified for _priority, handler in list(self.handlers[event_name]): try: + if inspect.ismethod(handler): + log.debug('Call handler %s on %s', + handler.__name__, + handler.__self__) + else: + log.debug('Call handler %s', handler.__name__) if handler(*args, **kwargs): return True except NodeProcessed:
===================================== gajim/common/modules/chatstates.py ===================================== @@ -171,6 +171,11 @@ class Chatstate: if contact is not None: contact = contact.as_contact() else: + # Contact not found, maybe we left the group chat + # or the contact was removed from the roster + log.info( + 'Contact %s not found, reset chatstate', jid) + self._chatstates.pop(jid, None) self._last_mouse_activity.pop(jid, None) self._last_keyboard_activity.pop(jid, None) continue @@ -206,14 +211,21 @@ class Chatstate: current_state = self._chatstates.get(contact.jid) setting = app.config.get('outgoing_chat_state_notifications') if setting == 'disabled': - # Send a last 'gone' state after user disabled chatstates + # Send a last 'active' state after user disabled chatstates if current_state is not None: - log.info('Send: %-10s - %s', State.GONE, contact.jid) - app.nec.push_outgoing_event( - MessageOutgoingEvent(None, - account=self._account, - jid=contact.jid, - chatstate=str(State.GONE))) + log.info('Send: %-10s - %s', State.ACTIVE, contact.jid) + + event_attrs = {'account': self._account, + 'jid': contact.jid, + 'chatstate': str(State.ACTIVE)} + + if contact.is_groupchat(): + app.nec.push_outgoing_event( + GcMessageOutgoingEvent(None, **event_attrs)) + else: + app.nec.push_outgoing_event( + MessageOutgoingEvent(None, **event_attrs)) + self._chatstates.pop(contact.jid, None) self._last_mouse_activity.pop(contact.jid, None) self._last_keyboard_activity.pop(contact.jid, None)
===================================== gajim/gui_interface.py ===================================== @@ -1694,18 +1694,24 @@ class Interface: self.roster.open_event(account, fjid, event) elif type_ == 'gc-invitation': event = app.events.get_first_event(account, jid, type_) + if event is None: + return dialogs.InvitationReceivedDialog(account, event.room_jid, jid, event.password, event.reason, event.is_continued) app.events.remove_events(account, jid, event) self.roster.draw_contact(jid, account) elif type_ == 'subscription_request': event = app.events.get_first_event(account, jid, type_) + if event is None: + return dialogs.SubscriptionRequestWindow(jid, event.text, account, event.nick) app.events.remove_events(account, jid, event) self.roster.draw_contact(jid, account) elif type_ == 'unsubscribed': event = app.events.get_first_event(account, jid, type_) + if event is None: + return self.show_unsubscribed_dialog(account, event.contact) app.events.remove_events(account, jid, event) self.roster.draw_contact(jid, account)
View it on GitLab: https://dev.gajim.org/gajim/gajim/compare/436eb2dfb0bda16302c87607ad4b702f70...