From fb19f74fd07b01b2da55b1d31dcb53546f0f160c Mon Sep 17 00:00:00 2001 From: jfreegman Date: Sat, 10 Feb 2024 16:25:25 -0500 Subject: [PATCH 1/2] feat: show where we're logging to with empty /log command --- src/global_commands.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/global_commands.c b/src/global_commands.c index 37583766f..c02e4639d 100644 --- a/src/global_commands.c +++ b/src/global_commands.c @@ -722,15 +722,14 @@ void cmd_log(WINDOW *window, ToxWindow *self, Toxic *toxic, int argc, char (*arg struct chatlog *log = self->chatwin->log; if (argc == 0) { - const char *msg; - if (log->log_on) { - msg = "Logging for this window is ON; type \"/log off\" to disable. (Logs are not encrypted)"; + line_info_add(self, c_config, false, NULL, NULL, SYS_MSG, 0, 0, + "Logging to: %s\nType \"/log off\" to disable. Logs are not encrypted.", log->path); } else { - msg = "Logging for this window is OFF; type \"/log on\" to enable."; + line_info_add(self, c_config, false, NULL, NULL, SYS_MSG, 0, 0, + "Logging for this window is OFF; type \"/log on\" to enable."); } - line_info_add(self, c_config, false, NULL, NULL, SYS_MSG, 0, 0, "%s", msg); return; } @@ -738,7 +737,7 @@ void cmd_log(WINDOW *window, ToxWindow *self, Toxic *toxic, int argc, char (*arg if (!strcmp(swch, "1") || !strcmp(swch, "on")) { if (log_enable(log) == 0) { - line_info_add(self, c_config, false, NULL, NULL, SYS_MSG, 0, 0, "Logging to: %s", log->path); + line_info_add(self, c_config, false, NULL, NULL, SYS_MSG, 0, 0, "Logging enabled to: %s", log->path); return; } From 726d0980bc6be8508d74da458e4a4bf300832539 Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Sat, 10 Feb 2024 21:26:18 +0000 Subject: [PATCH 2/2] Restyled by astyle --- src/global_commands.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/global_commands.c b/src/global_commands.c index c02e4639d..9f28d816a 100644 --- a/src/global_commands.c +++ b/src/global_commands.c @@ -724,7 +724,7 @@ void cmd_log(WINDOW *window, ToxWindow *self, Toxic *toxic, int argc, char (*arg if (argc == 0) { if (log->log_on) { line_info_add(self, c_config, false, NULL, NULL, SYS_MSG, 0, 0, - "Logging to: %s\nType \"/log off\" to disable. Logs are not encrypted.", log->path); + "Logging to: %s\nType \"/log off\" to disable. Logs are not encrypted.", log->path); } else { line_info_add(self, c_config, false, NULL, NULL, SYS_MSG, 0, 0, "Logging for this window is OFF; type \"/log on\" to enable.");