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.c55
-rw-r--r--src/ui/ui.h3
2 files changed, 50 insertions, 8 deletions
diff --git a/src/ui/console.c b/src/ui/console.c
index 6fd6fc38..2be41b14 100644
--- a/src/ui/console.c
+++ b/src/ui/console.c
@@ -301,8 +301,27 @@ cons_show_typing(const char *const barejid)
     cons_alert();
 }
 
+char*
+_room_triggers_to_string(GList *triggers)
+{
+    GString *triggers_str = g_string_new("");
+    GList *curr = triggers;
+    while (curr) {
+        g_string_append_printf(triggers_str, "\"%s\"", (char*)curr->data);
+        curr = g_list_next(curr);
+        if (curr) {
+            g_string_append(triggers_str, ", ");
+        }
+    }
+
+    char *result = triggers_str->str;
+    g_string_free(triggers_str, FALSE);
+    return result;
+}
+
 void
-cons_show_incoming_room_message(const char *const nick, const char *const room, const int win_index)
+cons_show_incoming_room_message(const char *const nick, const char *const room, const int win_index, gboolean mention,
+    GList *triggers, int unread)
 {
     ProfWin *const console = wins_get_console();
 
@@ -311,13 +330,35 @@ cons_show_incoming_room_message(const char *const nick, const char *const room,
         ui_index = 0;
     }
 
-    if (nick) {
-        win_vprint(console, '-', 0, NULL, 0, THEME_INCOMING, "", "<< room message: %s in %s (win %d)", nick, room, ui_index);
-    } else {
-        win_vprint(console, '-', 0, NULL, 0, THEME_INCOMING, "", "<< room message: %s (win %d)", room, ui_index);
-    }
+    char *muc_show = prefs_get_string(PREF_CONSOLE_MUC);
 
-    cons_alert();
+    if (g_strcmp0(muc_show, "all") == 0) {
+        if (mention) {
+            win_vprint(console, '-', 0, NULL, 0, THEME_INCOMING, "", "<< room mention: %s in %s (win %d)", nick, room, ui_index);
+        } else if (triggers) {
+            char *triggers_str = _room_triggers_to_string(triggers);
+            win_vprint(console, '-', 0, NULL, 0, THEME_INCOMING, "", "<< room trigger %s: %s in %s (win %d)", triggers_str, nick, room, ui_index);
+            free(triggers_str);
+        } else {
+            win_vprint(console, '-', 0, NULL, 0, THEME_INCOMING, "", "<< room message: %s in %s (win %d)", nick, room, ui_index);
+        }
+        cons_alert();
+
+    } else if (g_strcmp0(muc_show, "first") == 0) {
+        if (mention) {
+            win_vprint(console, '-', 0, NULL, 0, THEME_INCOMING, "", "<< room mention: %s in %s (win %d)", nick, room, ui_index);
+            cons_alert();
+        } else if (triggers) {
+            char *triggers_str = _room_triggers_to_string(triggers);
+            win_vprint(console, '-', 0, NULL, 0, THEME_INCOMING, "", "<< room trigger %s: %s in %s (win %d)", triggers_str, nick, room, ui_index);
+            free(triggers_str);
+            cons_alert();
+        } else if (unread == 0) {
+            win_vprint(console, '-', 0, NULL, 0, THEME_INCOMING, "", "<< room message: %s (win %d)", room, ui_index);
+            cons_alert();
+        }
+    }
+    prefs_free_string(muc_show);
 }
 
 void
diff --git a/src/ui/ui.h b/src/ui/ui.h
index 86f68d3c..835fd890 100644
--- a/src/ui/ui.h
+++ b/src/ui/ui.h
@@ -257,7 +257,8 @@ void cons_show_disco_info(const char *from, GSList *identities, GSList *features
 void cons_show_room_invite(const char *const invitor, const char *const room, const char *const reason);
 void cons_check_version(gboolean not_available_msg);
 void cons_show_typing(const char *const barejid);
-void cons_show_incoming_room_message(const char *const nick, const char *const room, const int win_index);
+void cons_show_incoming_room_message(const char *const nick, const char *const room, const int win_index,
+    gboolean mention, GList *triggers, int unread);
 void cons_show_incoming_message(const char *const short_from, const int win_index);
 void cons_show_incoming_private_message(const char *const nick, const char *const room, const int win_index);
 void cons_show_room_invites(GSList *invites);
-16 12:15:34 -0400 Implement (basic form) of :reply' href='/akspecs/aerc/commit/commands/account/reply.go?h=0.4.0&id=475b697bdfd7a5821282174f14f8d904e47aff4d'>475b697 ^
2a09617 ^
f5a4d93 ^
8be59ca ^


f5a4d93 ^
475b697 ^

8be59ca ^











475b697 ^
753adb9 ^




ce0d0e8 ^

753adb9 ^
217e85a ^



475b697 ^




c610c3c ^
475b697 ^
38e7165 ^


475b697 ^
38e7165 ^
475b697 ^
38e7165 ^
c610c3c ^
38e7165 ^
c610c3c ^
38e7165 ^
c610c3c ^
38e7165 ^
475b697 ^
38e7165 ^

c610c3c ^
38e7165 ^

c610c3c ^
38e7165 ^


c610c3c ^
ce0d0e8 ^
ce0d0e8 ^
475b697 ^

7f97e0b ^
38e7165 ^

7f97e0b ^
38e7165 ^




7f97e0b ^
475b697 ^



cef784b ^

ca2cd00 ^
475b697 ^
38e7165 ^




475b697 ^
8be59ca ^










475b697 ^
38e7165 ^
511fea3 ^
38e7165 ^
511fea3 ^
5701b6e ^



















8be59ca ^
5701b6e ^
8be59ca ^

38e7165 ^
c610c3c ^
38e7165 ^
8be59ca ^
38e7165 ^
8be59ca ^





38e7165 ^
cf50b98 ^

c610c3c ^
cf50b98 ^









38e7165 ^

cf50b98 ^


38e7165 ^



















c610c3c ^
38e7165 ^









8be59ca ^
475b697 ^


cf50b98 ^
c610c3c ^

cf50b98 ^






1894a7e ^
cf50b98 ^






1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248