talons

Fork of Claws Mail https://www.claws-mail
Log | Files | Refs | README | LICENSE

commit 9570a00c49015c359d048085cdb303efedec7e18
parent 47be3fdc7f951da289bb7851b3d53910ef64649f
Author: Colin Leroy <colin@colino.net>
Date:   Wed, 20 Mar 2013 11:34:34 +0100

Fix bug #2891, "Ability to toggle debug mode for a running instance"
Patch by Darko Coruga

Diffstat:
Mdoc/man/claws-mail.1 | 5+++++
Msrc/main.c | 11++++++++++-
2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/doc/man/claws-mail.1 b/doc/man/claws-mail.1 @@ -131,6 +131,8 @@ This list is not complete. .br \fB \-\-debug\fR .br +\fB \-\-toggle\-debug\fR +.br \fB \-\-help\fR .br \fB \-\-version\fR @@ -326,6 +328,9 @@ exit Claws Mail \fB\-\-debug\fR for debug mode .TP +\fB\-\-toggle-debug\fR +toggle debug mode of a running Claws Mail instance +.TP \fB\-\-version\fR display version number and exit .TP diff --git a/src/main.c b/src/main.c @@ -231,6 +231,7 @@ static struct RemoteCmd { gboolean subscribe; const gchar *subscribe_uri; const gchar *target; + gboolean debug; } cmd; SessionStats session_stats; @@ -1139,7 +1140,8 @@ int main(int argc, char *argv[]) if (cmd.status || cmd.status_full || cmd.search || cmd.statistics || cmd.reset_statistics || - cmd.cancel_receiving || cmd.cancel_sending) { + cmd.cancel_receiving || cmd.cancel_sending || + cmd.debug) { puts("0 Claws Mail not running."); lock_socket_remove(); return 0; @@ -2057,6 +2059,8 @@ static void parse_cmd_opt(int argc, char *argv[]) cmd.online_mode = ONLINE_MODE_ONLINE; } else if (!strncmp(argv[i], "--offline", 9)) { cmd.online_mode = ONLINE_MODE_OFFLINE; + } else if (!strncmp(argv[i], "--toggle-debug", 14)) { + cmd.debug = TRUE; } else if (!strncmp(argv[i], "--statistics", 12)) { cmd.statistics = TRUE; } else if (!strncmp(argv[i], "--reset-statistics", 18)) { @@ -2099,6 +2103,7 @@ static void parse_cmd_opt(int argc, char *argv[]) g_print("%s\n", _(" --offline switch to offline mode")); g_print("%s\n", _(" --exit --quit -q exit Claws Mail")); g_print("%s\n", _(" --debug debug mode")); + g_print("%s\n", _(" --toggle-debug toggle debug mode")); g_print("%s\n", _(" --help -h display this help and exit")); g_print("%s\n", _(" --version -v output version information and exit")); g_print("%s\n", _(" --version-full -V output version and built-in features information and exit")); @@ -2474,6 +2479,8 @@ static gint prohibit_duplicate_launch(void) fd_write(uxsock, "online\n", 6); } else if (cmd.online_mode == ONLINE_MODE_OFFLINE) { fd_write(uxsock, "offline\n", 7); + } else if (cmd.debug) { + fd_write(uxsock, "debug\n", 7); } else if (cmd.status || cmd.status_full) { gchar buf[BUFFSIZE]; gint i; @@ -2662,6 +2669,8 @@ static void lock_socket_input_cb(gpointer data, main_window_toggle_work_offline(mainwin, FALSE, FALSE); } else if (!strncmp(buf, "offline", 7)) { main_window_toggle_work_offline(mainwin, TRUE, FALSE); + } else if (!strncmp(buf, "debug", 5)) { + debug_set_mode(debug_get_mode() ? FALSE : TRUE); } else if (!strncmp(buf, "status-full", 11) || !strncmp(buf, "status", 6)) { gchar *status;