about summary refs log tree commit diff stats
path: root/src/ui
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/console.c12
-rw-r--r--src/ui/mucwin.c49
-rw-r--r--src/ui/ui.h6
-rw-r--r--src/ui/window.c12
4 files changed, 51 insertions, 28 deletions
diff --git a/src/ui/console.c b/src/ui/console.c
index c0abbc36..b60dd75e 100644
--- a/src/ui/console.c
+++ b/src/ui/console.c
@@ -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
diff --git a/src/ui/mucwin.c b/src/ui/mucwin.c
index f1370c88..2005ce28 100644
--- a/src/ui/mucwin.c
+++ b/src/ui/mucwin.c
@@ -361,28 +361,47 @@ mucwin_nick_change(ProfMucWin *mucwin, const char *const nick)
 }
 
 void
-mucwin_history(ProfMucWin *mucwin, const char *const nick, GDateTime *timestamp, const char *const message)
+mucwin_history(ProfMucWin *mucwin, const ProfMessage *const message)
 {
     assert(mucwin != NULL);
 
     ProfWin *window = (ProfWin*)mucwin;
-    GString *line = g_string_new("");
+    char *nick = message->jid->resourcepart;
 
-    if (strncmp(message, "/me ", 4) == 0) {
-        g_string_append(line, "*");
-        g_string_append(line, nick);
-        g_string_append(line, " ");
-        g_string_append(line, message + 4);
+    // '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) {
+        GString *line = g_string_new("");
+
+        if (strncmp(message->plain, "/me ", 4) == 0) {
+            g_string_append(line, "*");
+            g_string_append(line, nick);
+            g_string_append(line, " ");
+            g_string_append(line, message->plain + 4);
+        } else {
+            g_string_append(line, nick);
+            g_string_append(line, ": ");
+            g_string_append(line, message->plain);
+        }
+
+        win_print_history(window, message->timestamp, line->str);
+
+        g_string_free(line, TRUE);
     } else {
-        g_string_append(line, nick);
-        g_string_append(line, ": ");
-        g_string_append(line, message);
-    }
+        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);
 
-    win_print_history(window, timestamp, line->str);
-    g_string_free(line, TRUE);
+        mucwin_incoming_msg(mucwin, message, mentions, triggers);
+
+        g_slist_free(mentions);
+        g_list_free_full(triggers, free);
+    }
 
-    plugins_on_room_history_message(mucwin->roomjid, nick, message, timestamp);
+    g_free(muc_history_color);
+    plugins_on_room_history_message(mucwin->roomjid, nick, message->plain, message->timestamp);
 }
 
 static void
@@ -530,7 +549,7 @@ mucwin_outgoing_msg(ProfMucWin *mucwin, const char *const message, const char *c
 }
 
 void
-mucwin_incoming_msg(ProfMucWin *mucwin, ProfMessage *message, GSList *mentions, GList *triggers)
+mucwin_incoming_msg(ProfMucWin *mucwin, const ProfMessage *const message, GSList *mentions, GList *triggers)
 {
     assert(mucwin != NULL);
     int flags = 0;
diff --git a/src/ui/ui.h b/src/ui/ui.h
index 77bdc1d5..8790e464 100644
--- a/src/ui/ui.h
+++ b/src/ui/ui.h
@@ -3,6 +3,7 @@
  * vim: expandtab:ts=4:sts=4:sw=4
  *
  * Copyright (C) 2012 - 2019 James Booth <boothj5@gmail.com>
+ * Copyright (C) 2019 - 2020 Michael Vetter <jubalh@iodoru.org>
  *
  * This file is part of Profanity.
  *
@@ -56,7 +57,6 @@
 #define NO_COLOUR_DATE  16
 #define UNTRUSTED       32
 
-
 // core UI
 void ui_init(void);
 void ui_load_colours(void);
@@ -157,9 +157,9 @@ void mucwin_occupant_affiliation_change(ProfMucWin *mucwin, const char *const ni
 void mucwin_occupant_role_and_affiliation_change(ProfMucWin *mucwin, const char *const nick,
     const char *const role, const char *const affiliation, const char *const actor, const char *const reason);
 void mucwin_roster(ProfMucWin *mucwin, GList *occupants, const char *const presence);
-void mucwin_history(ProfMucWin *mucwin, const char *const nick, GDateTime *timestamp, const char *const message);
+void mucwin_history(ProfMucWin *mucwin, const ProfMessage *const message);
 void mucwin_outgoing_msg(ProfMucWin *mucwin, const char *const message, const char *const id, prof_enc_t enc_mode, const char *const replace_id);
-void mucwin_incoming_msg(ProfMucWin *mucwin, ProfMessage *message, GSList *mentions, GList *triggers);
+void mucwin_incoming_msg(ProfMucWin *mucwin, const ProfMessage *const message, GSList *mentions, GList *triggers);
 void mucwin_subject(ProfMucWin *mucwin, const char *const nick, const char *const subject);
 void mucwin_requires_config(ProfMucWin *mucwin);
 void mucwin_info(ProfMucWin *mucwin);
diff --git a/src/ui/window.c b/src/ui/window.c
index 8b948dbd..815e6e93 100644
--- a/src/ui/window.c
+++ b/src/ui/window.c
@@ -1436,12 +1436,12 @@ static void
 _win_print_internal(ProfWin *window, const char show_char, int pad_indent, GDateTime *time,
     int flags, theme_item_t theme_item, const char *const from, const char *const message, DeliveryReceipt *receipt)
 {
-    // flags : 1st bit =  0/1 - me/not me
-    //         2nd bit =  0/1 - date/no date
-    //         3rd bit =  0/1 - eol/no eol
-    //         4th bit =  0/1 - color from/no color from
-    //         5th bit =  0/1 - color date/no date
-    //         6th bit =  0/1 - trusted/untrusted
+    // flags : 1st bit =  0/1 - me/not me. define: NO_ME
+    //         2nd bit =  0/1 - date/no date. define: NO_DATE
+    //         3rd bit =  0/1 - eol/no eol. define: NO_EOL
+    //         4th bit =  0/1 - color from/no color from. define: NO_COLOUR_FROM
+    //         5th bit =  0/1 - color date/no date. define: NO_COLOUR_DATE
+    //         6th bit =  0/1 - trusted/untrusted. define: UNTRUSTED
     gboolean me_message = FALSE;
     int offset = 0;
     int colour = theme_attrs(THEME_ME);