Skip to content

Commit

Permalink
feat: show where we're logging to with empty /log command
Browse files Browse the repository at this point in the history
  • Loading branch information
JFreegman committed Feb 11, 2024
1 parent 2be8efc commit f43c683
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/global_commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -722,23 +722,22 @@ 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;
}

const char *swch = argv[1];

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;
}

Expand Down

0 comments on commit f43c683

Please sign in to comment.