Merge /chlog and /grlog commands into /logging

Instead of `/chlog on` we now have `/logging chat on`.
Instead of `/grlog on` we now have `/logging group on`.

Fix https://github.com/profanity-im/profanity/issues/1224
This commit is contained in:
Michael Vetter
2019-11-12 12:39:24 +01:00
parent 0945a30925
commit 9bc4dc3827
6 changed files with 67 additions and 56 deletions

View File

@@ -6692,30 +6692,29 @@ cmd_autoconnect(ProfWin *window, const char *const command, gchar **args)
}
gboolean
cmd_chlog(ProfWin *window, const char *const command, gchar **args)
cmd_logging(ProfWin *window, const char *const command, gchar **args)
{
if (args[0] == NULL) {
return FALSE;
cons_logging_setting();
return TRUE;
}
_cmd_set_boolean_preference(args[0], command, "Chat logging", PREF_CHLOG);
if (strcmp(args[0], "chat") == 0) {
_cmd_set_boolean_preference(args[1], command, "Chat logging", PREF_CHLOG);
// if set to off, disable history
if (strcmp(args[0], "off") == 0) {
prefs_set_boolean(PREF_HISTORY, FALSE);
// if set to off, disable history
if (strcmp(args[1], "off") == 0) {
prefs_set_boolean(PREF_HISTORY, FALSE);
}
} else if (strcmp(args[0], "group") == 0) {
_cmd_set_boolean_preference(args[1], command, "Groupchat logging", PREF_GRLOG);
} else {
cons_bad_cmd_usage(command);
}
return TRUE;
}
gboolean
cmd_grlog(ProfWin *window, const char *const command, gchar **args)
{
_cmd_set_boolean_preference(args[0], command, "Groupchat logging", PREF_GRLOG);
return TRUE;
}
gboolean
cmd_history(ProfWin *window, const char *const command, gchar **args)
{