1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-06-09 21:30:42 +00:00

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_TAG_CHAT)
CMD_SYN(
"/logging chat|group on|off",
"/logging group color unanimous|regular")
"/logging chat|group on|off")
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. "
"Color MUC history unanimously or like regular MUC messages.")
"When disabling this option, /history will also be disabled. ")
CMD_ARGS(
{ "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." })
{ "group on|off", "Enable/Disable groupchat (room) logging." })
CMD_EXAMPLES(
"/logging chat on",
"/logging group off",
"/logging group color regular" )
"/logging group off")
},
{ "/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) {
_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;
}
}
}

View File

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

View File

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

View File

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

@ -365,27 +365,16 @@ mucwin_history(ProfMucWin *mucwin, const ProfMessage *const message)
{
assert(mucwin != NULL);
ProfWin *window = (ProfWin*)mucwin;
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)
// 'regular' colored like new messages too
char *muc_history_color = prefs_get_string(PREF_HISTORY_COLOR_MUC);
mucwin_incoming_msg(mucwin, message, mentions, triggers, FALSE);
if (g_strcmp0(muc_history_color, "unanimous") == 0) {
win_print_history(window, message);
} 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);
g_slist_free(mentions);
g_list_free_full(triggers, free);
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);
}

View File

@ -1223,29 +1223,19 @@ win_print_history(ProfWin *window, const ProfMessage *const message)
{
g_date_time_ref(message->timestamp);
int flags = 0;
char *display_name;
if (message->type == PROF_MSG_TYPE_MUC) {
display_name = strdup(message->from_jid->resourcepart);
int flags = 0;
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(muc_history_color, "unanimous") == 0) {
flags = NO_COLOUR_FROM;
}
g_free(muc_history_color);
if (g_strcmp0(jidp->barejid, message->from_jid->barejid) == 0) {
display_name = strdup("me");
} else {
const char *jid = connection_get_fulljid();
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);
display_name = roster_get_msg_display_name(message->from_jid->barejid, message->from_jid->resourcepart);
}
jid_destroy(jidp);
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);

View File

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

View File

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