mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-20 13:16:20 +00:00
Add option to color MUC history like regular messages
`/logging group color` has: * `unanimous` which will color it with one unanimous color. Like it was done always. * `regular` which colors it like regular incoming messages. Regards https://github.com/profanity-im/profanity/issues/1261
This commit is contained in:
@@ -238,6 +238,8 @@ static Autocomplete invite_ac;
|
||||
static Autocomplete status_ac;
|
||||
static Autocomplete status_state_ac;
|
||||
static Autocomplete logging_ac;
|
||||
static Autocomplete logging_group_ac;
|
||||
static Autocomplete logging_group_color_ac;
|
||||
static Autocomplete color_ac;
|
||||
static Autocomplete correction_ac;
|
||||
|
||||
@@ -944,6 +946,15 @@ cmd_ac_init(void)
|
||||
autocomplete_add(logging_ac, "chat");
|
||||
autocomplete_add(logging_ac, "group");
|
||||
|
||||
logging_group_ac = autocomplete_new();
|
||||
autocomplete_add(logging_group_ac, "on");
|
||||
autocomplete_add(logging_group_ac, "off");
|
||||
autocomplete_add(logging_group_ac, "color");
|
||||
|
||||
logging_group_color_ac = autocomplete_new();
|
||||
autocomplete_add(logging_group_color_ac, "unanimous");
|
||||
autocomplete_add(logging_group_color_ac, "regular");
|
||||
|
||||
color_ac = autocomplete_new();
|
||||
autocomplete_add(color_ac, "on");
|
||||
autocomplete_add(color_ac, "off");
|
||||
@@ -1261,6 +1272,8 @@ cmd_ac_reset(ProfWin *window)
|
||||
autocomplete_reset(status_ac);
|
||||
autocomplete_reset(status_state_ac);
|
||||
autocomplete_reset(logging_ac);
|
||||
autocomplete_reset(logging_group_ac);
|
||||
autocomplete_reset(logging_group_color_ac);
|
||||
autocomplete_reset(color_ac);
|
||||
autocomplete_reset(correction_ac);
|
||||
|
||||
@@ -1412,6 +1425,8 @@ cmd_ac_uninit(void)
|
||||
autocomplete_free(status_ac);
|
||||
autocomplete_free(status_state_ac);
|
||||
autocomplete_free(logging_ac);
|
||||
autocomplete_free(logging_group_ac);
|
||||
autocomplete_free(logging_group_color_ac);
|
||||
autocomplete_free(color_ac);
|
||||
autocomplete_free(correction_ac);
|
||||
}
|
||||
@@ -3727,7 +3742,12 @@ _logging_autocomplete(ProfWin *window, const char *const input, gboolean previou
|
||||
return result;
|
||||
}
|
||||
|
||||
result = autocomplete_param_with_func(input, "/logging group", prefs_autocomplete_boolean_choice, previous, NULL);
|
||||
result = autocomplete_param_with_ac(input, "/logging group", logging_group_ac, TRUE, previous);
|
||||
if (result) {
|
||||
return result;
|
||||
}
|
||||
|
||||
result = autocomplete_param_with_ac(input, "/logging group color", logging_group_color_ac, TRUE, previous);
|
||||
if (result) {
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1607,24 +1607,28 @@ static struct cmd_t command_defs[] =
|
||||
},
|
||||
|
||||
{ "/logging",
|
||||
parse_args, 2, 2, &cons_logging_setting,
|
||||
parse_args, 2, 3, &cons_logging_setting,
|
||||
CMD_NOSUBFUNCS
|
||||
CMD_MAINFUNC(cmd_logging)
|
||||
CMD_TAGS(
|
||||
CMD_TAG_CHAT)
|
||||
CMD_SYN(
|
||||
"/logging chat|group on|off")
|
||||
"/logging chat|group on|off",
|
||||
"/logging group color unanimous|regular")
|
||||
CMD_DESC(
|
||||
"Configure chat logging. "
|
||||
"Switch logging on or off. "
|
||||
"Chat logging will be enabled if /history is set to on. "
|
||||
"When disabling this option, /history will also be disabled. ")
|
||||
"When disabling this option, /history will also be disabled. "
|
||||
"Color MUC history unanimously or like regular MUC messages.")
|
||||
CMD_ARGS(
|
||||
{ "chat", "Regular chat logging" },
|
||||
{ "group", "Groupchat (room) logging" },
|
||||
{ "on|off", "Enable or disable logging." })
|
||||
{ "chat on|off", "Enable/Disable regular chat logging" },
|
||||
{ "group on|off", "Enable/Disable groupchat (room) logging" },
|
||||
{ "group color unanimous|regular", "Color MUC history unanimous or like regular MUC messages." })
|
||||
CMD_EXAMPLES(
|
||||
"/logging chat on",
|
||||
"/logging group off" )
|
||||
"/logging group off",
|
||||
"/logging group color regular" )
|
||||
},
|
||||
|
||||
{ "/states",
|
||||
|
||||
@@ -6721,12 +6721,22 @@ cmd_logging(ProfWin *window, const char *const command, gchar **args)
|
||||
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;
|
||||
} else if (g_strcmp0(args[0], "group") == 0) {
|
||||
if (g_strcmp0(args[1], "on") == 0 || g_strcmp0(args[1], "off") == 0) {
|
||||
_cmd_set_boolean_preference(args[1], command, "Groupchat logging", PREF_GRLOG);
|
||||
return TRUE;
|
||||
} else if (strcmp(args[1], "color") == 0 && args[2] != NULL) {
|
||||
if (g_strcmp0(args[2], "unanimous") == 0 || g_strcmp0(args[2], "regular") == 0) {
|
||||
prefs_set_string(PREF_HISTORY_COLOR_MUC, args[2]);
|
||||
cons_show("Groupchat logging color set to: %s", args[2]);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cons_bad_cmd_usage(command);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user