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:
Michael Vetter
2020-02-20 08:11:58 +01:00
parent 6aa793fca6
commit 80dd3fdbb2
7 changed files with 72 additions and 17 deletions

View File

@@ -1854,14 +1854,18 @@ void
cons_logging_setting(void)
{
if (prefs_get_boolean(PREF_CHLOG))
cons_show("Chat logging (/logging chat) : ON");
cons_show("Chat logging (/logging chat) : ON");
else
cons_show("Chat logging (/logging chat) : OFF");
cons_show("Chat logging (/logging chat) : OFF");
if (prefs_get_boolean(PREF_GRLOG))
cons_show("Groupchat logging (/logging group) : ON");
cons_show("Groupchat logging (/logging group) : ON");
else
cons_show("Groupchat logging (/logging group) : OFF");
cons_show("Groupchat logging (/logging group) : OFF");
char *pref = prefs_get_string(PREF_HISTORY_COLOR_MUC);
cons_show("MUC history color (/logging group color) : %s", pref);
prefs_free_string(pref);
}
void

View File

@@ -380,7 +380,18 @@ mucwin_history(ProfMucWin *mucwin, const ProfMessage *const message)
g_string_append(line, message->plain);
}
win_print_history(window, message->timestamp, line->str);
// 'unanimous' all in one color (like always was)
// 'regular' colored like new messages too
char *muc_history_color = prefs_get_string(PREF_HISTORY_COLOR_MUC);
if (g_strcmp0(muc_history_color, "unanimous") == 0) {
win_print_history(window, message->timestamp, line->str);
} else {
// TODO: actually should call mucwin_incoming_msg() so that mentions and triggers are highlighted too.
// so should put code from sv_ev_room_message() in own function. so that we get the triggers etc.
win_println_incoming_muc_msg(window, '-', 0, message->jid->resourcepart, message->id, message->replace_id, message->plain);
}
g_free(muc_history_color);
g_string_free(line, TRUE);
plugins_on_room_history_message(mucwin->roomjid, nick, message->plain, message->timestamp);