From e6641858454c8aaf817137ce6a2650d1c906dd71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20H=C3=B6rist?= Date: Wed, 3 Oct 2018 12:27:59 +0200 Subject: [PATCH] Add debug commandline options To easier simulate connectivity loss --- gajim/application.py | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/gajim/application.py b/gajim/application.py index 274852847..9d08e8174 100644 --- a/gajim/application.py +++ b/gajim/application.py @@ -138,6 +138,21 @@ class GajimApplication(Gtk.Application): GLib.OptionArg.NONE, _('Start a new chat')) + self.add_main_option( + 'simulate-network-lost', + 0, + GLib.OptionFlags.NONE, + GLib.OptionArg.NONE, + _('Simulate loss of connectivity')) + + self.add_main_option( + 'simulate-network-connected', + 0, + GLib.OptionFlags.NONE, + GLib.OptionArg.NONE, + _('Simulate regaining connectivity')) + + self.add_main_option_entries(self._get_remaining_entry()) self.connect('handle-local-options', self._handle_local_options) @@ -255,10 +270,11 @@ class GajimApplication(Gtk.Application): # Parse all options that should be executed on a remote instance options = command_line.get_options_dict() - remote_commands = ['ipython', - 'show-next-pending-event', - 'start-chat', - ] + remote_commands = [ + 'ipython', + 'show-next-pending-event', + 'start-chat', + ] remaining = options.lookup_value(GLib.OPTION_REMAINING, GLib.VariantType.new('as')) @@ -268,6 +284,14 @@ class GajimApplication(Gtk.Application): self.activate_action(cmd) return 0 + if options.contains('simulate-network-lost'): + app.interface.network_status_changed(None, False) + return 0 + + if options.contains('simulate-network-connected'): + app.interface.network_status_changed(None, True) + return 0 + if remaining is not None: self._open_uris(remaining.unpack()) return 0