Remove unanimous MAM display

For some time users could choose to have the old way "unanimous" where
all the MUC history is just grey (or whatever was set). Now it is always
just displayed like regular new incoming MUC text.
This commit is contained in:
Michael Vetter
2020-04-25 17:13:22 +02:00
parent 570863df1b
commit 85520ecdc5
9 changed files with 18 additions and 62 deletions

View File

@@ -1610,22 +1610,18 @@ static struct cmd_t command_defs[] =
CMD_TAGS( CMD_TAGS(
CMD_TAG_CHAT) CMD_TAG_CHAT)
CMD_SYN( CMD_SYN(
"/logging chat|group on|off", "/logging chat|group on|off")
"/logging group color unanimous|regular")
CMD_DESC( CMD_DESC(
"Configure chat logging. " "Configure chat logging. "
"Switch logging on or off. " "Switch logging on or off. "
"Chat logging will be enabled if /history is set to on. " "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( CMD_ARGS(
{ "chat on|off", "Enable/Disable regular chat logging." }, { "chat on|off", "Enable/Disable regular chat logging." },
{ "group on|off", "Enable/Disable groupchat (room) logging." }, { "group on|off", "Enable/Disable groupchat (room) logging." })
{ "group color unanimous|regular", "Color MUC history unanimous or like regular MUC messages." })
CMD_EXAMPLES( CMD_EXAMPLES(
"/logging chat on", "/logging chat on",
"/logging group off", "/logging group off")
"/logging group color regular" )
}, },
{ "/states", { "/states",

View File

@@ -6715,12 +6715,6 @@ cmd_logging(ProfWin *window, const char *const command, gchar **args)
if (g_strcmp0(args[1], "on") == 0 || g_strcmp0(args[1], "off") == 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); _cmd_set_boolean_preference(args[1], command, "Groupchat logging", PREF_GRLOG);
return TRUE; 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;
}
} }
} }

View File

@@ -1755,7 +1755,6 @@ _get_group(preference_t pref)
case PREF_STATUSBAR_ROOM: case PREF_STATUSBAR_ROOM:
case PREF_TITLEBAR_MUC_TITLE_JID: case PREF_TITLEBAR_MUC_TITLE_JID:
case PREF_TITLEBAR_MUC_TITLE_NAME: case PREF_TITLEBAR_MUC_TITLE_NAME:
case PREF_HISTORY_COLOR_MUC:
case PREF_SLASH_GUARD: case PREF_SLASH_GUARD:
return PREF_GROUP_UI; return PREF_GROUP_UI;
case PREF_STATES: case PREF_STATES:
@@ -2065,8 +2064,6 @@ _get_key(preference_t pref)
return "sendfile"; return "sendfile";
case PREF_CORRECTION_ALLOW: case PREF_CORRECTION_ALLOW:
return "correction.allow"; return "correction.allow";
case PREF_HISTORY_COLOR_MUC:
return "history.muc.color";
case PREF_AVATAR_CMD: case PREF_AVATAR_CMD:
return "avatar.cmd"; return "avatar.cmd";
case PREF_SLASH_GUARD: case PREF_SLASH_GUARD:
@@ -2207,8 +2204,6 @@ _get_default_string(preference_t pref)
return "automatic"; return "automatic";
case PREF_COLOR_NICK: case PREF_COLOR_NICK:
return "false"; return "false";
case PREF_HISTORY_COLOR_MUC:
return "unanimous";
case PREF_AVATAR_CMD: case PREF_AVATAR_CMD:
return "xdg-open"; return "xdg-open";
default: default:

View File

@@ -167,7 +167,6 @@ typedef enum {
PREF_OMEMO_SENDFILE, PREF_OMEMO_SENDFILE,
PREF_OCCUPANTS_WRAP, PREF_OCCUPANTS_WRAP,
PREF_CORRECTION_ALLOW, PREF_CORRECTION_ALLOW,
PREF_HISTORY_COLOR_MUC,
PREF_AVATAR_CMD, PREF_AVATAR_CMD,
PREF_SLASH_GUARD, PREF_SLASH_GUARD,
PREF_MAM, PREF_MAM,

View File

@@ -1871,10 +1871,6 @@ cons_logging_setting(void)
cons_show("Groupchat logging (/logging group) : ON"); cons_show("Groupchat logging (/logging group) : ON");
else 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 void

View File

@@ -365,27 +365,16 @@ mucwin_history(ProfMucWin *mucwin, const ProfMessage *const message)
{ {
assert(mucwin != NULL); assert(mucwin != NULL);
ProfWin *window = (ProfWin*)mucwin;
char *nick = message->from_jid->resourcepart; char *nick = message->from_jid->resourcepart;
char *mynick = muc_nick(mucwin->roomjid);
GSList *mentions = get_mentions(prefs_get_boolean(PREF_NOTIFY_MENTION_WHOLE_WORD), prefs_get_boolean(PREF_NOTIFY_MENTION_CASE_SENSITIVE), message->plain, mynick);
GList *triggers = prefs_message_get_triggers(message->plain);
// 'unanimous' all in one color (like always was) mucwin_incoming_msg(mucwin, message, mentions, triggers, FALSE);
// '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) { g_slist_free(mentions);
win_print_history(window, message); g_list_free_full(triggers, free);
} else {
char *mynick = muc_nick(mucwin->roomjid);
GSList *mentions = get_mentions(prefs_get_boolean(PREF_NOTIFY_MENTION_WHOLE_WORD), prefs_get_boolean(PREF_NOTIFY_MENTION_CASE_SENSITIVE), message->plain, mynick);
GList *triggers = prefs_message_get_triggers(message->plain);
mucwin_incoming_msg(mucwin, message, mentions, triggers, FALSE);
g_slist_free(mentions);
g_list_free_full(triggers, free);
}
g_free(muc_history_color);
plugins_on_room_history_message(mucwin->roomjid, nick, message->plain, message->timestamp); plugins_on_room_history_message(mucwin->roomjid, nick, message->plain, message->timestamp);
} }

View File

@@ -1223,29 +1223,19 @@ win_print_history(ProfWin *window, const ProfMessage *const message)
{ {
g_date_time_ref(message->timestamp); g_date_time_ref(message->timestamp);
int flags = 0;
char *display_name; char *display_name;
if (message->type == PROF_MSG_TYPE_MUC) { int flags = 0;
display_name = strdup(message->from_jid->resourcepart); const char *jid = connection_get_fulljid();
Jid *jidp = jid_create(jid);
char *muc_history_color = prefs_get_string(PREF_HISTORY_COLOR_MUC); if (g_strcmp0(jidp->barejid, message->from_jid->barejid) == 0) {
if (g_strcmp0(muc_history_color, "unanimous") == 0) { display_name = strdup("me");
flags = NO_COLOUR_FROM;
}
g_free(muc_history_color);
} else { } else {
const char *jid = connection_get_fulljid(); display_name = roster_get_msg_display_name(message->from_jid->barejid, message->from_jid->resourcepart);
Jid *jidp = jid_create(jid);
if (g_strcmp0(jidp->barejid, message->from_jid->barejid) == 0) {
display_name = strdup("me");
} else {
display_name = roster_get_msg_display_name(message->from_jid->barejid, message->from_jid->resourcepart);
}
jid_destroy(jidp);
} }
jid_destroy(jidp);
buffer_append(window->layout->buffer, "-", 0, message->timestamp, flags, THEME_TEXT_HISTORY, display_name, NULL, message->plain, NULL, NULL); buffer_append(window->layout->buffer, "-", 0, message->timestamp, flags, THEME_TEXT_HISTORY, display_name, NULL, message->plain, NULL, NULL);
_win_print_internal(window, "-", 0, message->timestamp, flags, THEME_TEXT_HISTORY, display_name, message->plain, NULL); _win_print_internal(window, "-", 0, message->timestamp, flags, THEME_TEXT_HISTORY, display_name, message->plain, NULL);

View File

@@ -151,4 +151,3 @@ console.chat=
console.private= console.private=
inputwin.position= inputwin.position=
correction.char= correction.char=
history.muc.color=

View File

@@ -83,7 +83,6 @@ receipt.sent=bold_red
[ui] [ui]
correction.char=+ correction.char=+
history.muc.color=regular
color.occupants.nick=true color.occupants.nick=true
beep=false beep=false
flash=false flash=false
@@ -163,4 +162,3 @@ statusbar.tabs=10
statusbar.tablen=7 statusbar.tablen=7
statusbar.show.name=true statusbar.show.name=true
statusbar.show.number=true statusbar.show.number=true
history.muc.color=regular