1 Change roster item colors on chatstate change |
1 Change roster item colors on chatstate change |
2 |
2 |
3 diff -r 7718e7f796d4 mcabber/contrib/themes/light.txt |
3 diff -r f17324b6c882 mcabber/contrib/themes/light.txt |
4 --- a/mcabber/contrib/themes/light.txt Wed May 15 12:53:03 2013 +0300 |
4 --- a/mcabber/contrib/themes/light.txt Tue Nov 11 21:21:09 2014 +0200 |
5 +++ b/mcabber/contrib/themes/light.txt Wed May 15 12:53:55 2013 +0300 |
5 +++ b/mcabber/contrib/themes/light.txt Tue Nov 11 22:35:16 2014 +0200 |
6 @@ -14,7 +14,6 @@ |
6 @@ -14,7 +14,6 @@ |
7 set color_bgrostersel = green |
7 set color_bgrostersel = green |
8 set color_rostersel = yellow |
8 set color_rostersel = yellow |
9 set color_rosterselmsg = red |
9 set color_rosterselmsg = red |
10 -set color_rosternewmsg = red |
10 -set color_rosternewmsg = red |
11 set color_readmark = red |
11 set color_readmark = red |
12 |
12 |
13 # vim:set ft=conf: |
13 # vim:set ft=conf: |
14 diff -r 7718e7f796d4 mcabber/contrib/themes/light2.txt |
14 diff -r f17324b6c882 mcabber/contrib/themes/light2.txt |
15 --- a/mcabber/contrib/themes/light2.txt Wed May 15 12:53:03 2013 +0300 |
15 --- a/mcabber/contrib/themes/light2.txt Tue Nov 11 21:21:09 2014 +0200 |
16 +++ b/mcabber/contrib/themes/light2.txt Wed May 15 12:53:55 2013 +0300 |
16 +++ b/mcabber/contrib/themes/light2.txt Tue Nov 11 22:35:16 2014 +0200 |
17 @@ -14,7 +14,6 @@ |
17 @@ -14,7 +14,6 @@ |
18 set color_bgrostersel = black |
18 set color_bgrostersel = black |
19 set color_rostersel = brightgreen |
19 set color_rostersel = brightgreen |
20 set color_rosterselmsg = red |
20 set color_rosterselmsg = red |
21 -set color_rosternewmsg = red |
21 -set color_rosternewmsg = red |
22 set color_readmark = red |
22 set color_readmark = red |
23 |
23 |
24 # vim:set ft=conf: |
24 # vim:set ft=conf: |
25 diff -r 7718e7f796d4 mcabber/contrib/themes/oliver.txt |
25 diff -r f17324b6c882 mcabber/contrib/themes/oliver.txt |
26 --- a/mcabber/contrib/themes/oliver.txt Wed May 15 12:53:03 2013 +0300 |
26 --- a/mcabber/contrib/themes/oliver.txt Tue Nov 11 21:21:09 2014 +0200 |
27 +++ b/mcabber/contrib/themes/oliver.txt Wed May 15 12:53:55 2013 +0300 |
27 +++ b/mcabber/contrib/themes/oliver.txt Tue Nov 11 22:35:16 2014 +0200 |
28 @@ -14,7 +14,6 @@ |
28 @@ -14,7 +14,6 @@ |
29 set color_bgrostersel = yellow |
29 set color_bgrostersel = yellow |
30 set color_rostersel = blue |
30 set color_rostersel = blue |
31 set color_rosterselmsg = red |
31 set color_rosterselmsg = red |
32 -set color_rosternewmsg = red |
32 -set color_rosternewmsg = red |
33 set color_readmark = red |
33 set color_readmark = red |
34 |
34 |
35 # vim:set ft=conf: |
35 # vim:set ft=conf: |
36 diff -r 7718e7f796d4 mcabber/doc/help/en/hlp_color.txt |
36 diff -r f17324b6c882 mcabber/doc/help/en/hlp_color.txt |
37 --- a/mcabber/doc/help/en/hlp_color.txt Wed May 15 12:53:03 2013 +0300 |
37 --- a/mcabber/doc/help/en/hlp_color.txt Tue Nov 11 21:21:09 2014 +0200 |
38 +++ b/mcabber/doc/help/en/hlp_color.txt Wed May 15 12:53:55 2013 +0300 |
38 +++ b/mcabber/doc/help/en/hlp_color.txt Tue Nov 11 22:35:16 2014 +0200 |
39 @@ -11,6 +11,7 @@ |
39 @@ -11,6 +11,7 @@ |
40 Set a color rule (or overwrite, if it already exists). The status is string containing all statuses the roster item can have for the rule to match, or * if any status is OK. Wildcard is the file-matching wildcard that will be applied to JID. Color is the wanted color. |
40 Set a color rule (or overwrite, if it already exists). The status is string containing all statuses the roster item can have for the rule to match, or * if any status is OK. Wildcard is the file-matching wildcard that will be applied to JID. Color is the wanted color. |
41 If color is -, the rule is removed. |
41 If color is -, the rule is removed. |
42 If more than one rule matches, the color from the last created (not overwritten) is used. |
42 If more than one rule matches, the color from the last created (not overwritten) is used. |
43 + Also mask can contain symbols '!', '#', '+' and '.', that represent buddies with urgent condition, with new messages, that are typing and that have ceased typing. These symbols have higher priority than status ones. |
43 + Also mask can contain symbols '!', '#', '+' and '.', that represent buddies with urgent condition, with new messages, that are typing and that have ceased typing. These symbols have higher priority than status ones. |
44 /color mucnick nick (color|-) |
44 /color mucnick nick (color|-) |
45 Marks the nick to be colored by given color. If a MUC has colored nicks, this one will be used. If color is -, the color is marked as chosen automatically, which means it will not be used in 'preset' coloring mode, but will stay the same in 'on' coloring mode. |
45 Marks the nick to be colored by given color. If a MUC has colored nicks, this one will be used. If color is -, the color is marked as chosen automatically, which means it will not be used in 'preset' coloring mode, but will stay the same in 'on' coloring mode. |
46 /color muc (jid|.|*) [on|preset|off|-] |
46 /color muc (jid|.|*) [on|preset|off|-] |
47 diff -r 7718e7f796d4 mcabber/doc/help/uk/hlp_color.txt |
47 diff -r f17324b6c882 mcabber/doc/help/uk/hlp_color.txt |
48 --- a/mcabber/doc/help/uk/hlp_color.txt Wed May 15 12:53:03 2013 +0300 |
48 --- a/mcabber/doc/help/uk/hlp_color.txt Tue Nov 11 21:21:09 2014 +0200 |
49 +++ b/mcabber/doc/help/uk/hlp_color.txt Wed May 15 12:53:55 2013 +0300 |
49 +++ b/mcabber/doc/help/uk/hlp_color.txt Tue Nov 11 22:35:16 2014 +0200 |
50 @@ -11,6 +11,7 @@ |
50 @@ -11,6 +11,7 @@ |
51 Додає нове чи змінює існуюче правило кольору. "Статус" складений з літер статусу, до яких докладається це правило (наприклад "n_d?"). Зірочка ("*") відповідає будь-якому статусу. "Маска" подібна до файлової маски й докладається до jid. Правило встановлює колір контактів, що йому відповідають. |
51 Додає нове чи змінює існуюче правило кольору. "Статус" складений з літер статусу, до яких докладається це правило (наприклад "n_d?"). Зірочка ("*") відповідає будь-якому статусу. "Маска" подібна до файлової маски й докладається до jid. Правило встановлює колір контактів, що йому відповідають. |
52 Щоб вилучити правило, вкажіть колір "-". |
52 Щоб вилучити правило, вкажіть колір "-". |
53 Коли є декілька правил, що відповідають контакту, спрацьовує останнє додане (_не_ змінене). |
53 Коли є декілька правил, що відповідають контакту, спрацьовує останнє додане (_не_ змінене). |
54 + Також рядок статусів може містити символи '!', '#', '+' та '.', що відповідають користувачам, які відповідно мають негайні події, нові повідомлення, друкують та друкували але спинилися. Ці символи мають більший пріоритет ніж символи статусів. |
54 + Також рядок статусів може містити символи '!', '#', '+' та '.', що відповідають користувачам, які відповідно мають негайні події, нові повідомлення, друкують та друкували але спинилися. Ці символи мають більший пріоритет ніж символи статусів. |
55 /color muc (jid|.|*) [on|preset|off|-] |
55 /color muc (jid|.|*) [on|preset|off|-] |
56 Встановлює режим забарвлення прізвиськ у чаті. Якщо замість jid вказано * режим докладається до всіх чатів, для яких не визначено особистого правила (з вказанням jid). |
56 Встановлює режим забарвлення прізвиськ у чаті. Якщо замість jid вказано * режим докладається до всіх чатів, для яких не визначено особистого правила (з вказанням jid). |
57 У режимі on забарвлюються усі прізвиська, у режимі preset - лише ті, для яких колір встановлено командою /color mucnick, а режим off вимикає забарвлення прізвиськ. Режим - прибирає з вказаних jid особисті режими забарвлення. Тоді до них докладається глобальний. Глобальний режим прибрати не можна. |
57 У режимі on забарвлюються усі прізвиська, у режимі preset - лише ті, для яких колір встановлено командою /color mucnick, а режим off вимикає забарвлення прізвиськ. Режим - прибирає з вказаних jid особисті режими забарвлення. Тоді до них докладається глобальний. Глобальний режим прибрати не можна. |
58 diff -r 7718e7f796d4 mcabber/mcabber/screen.c |
58 diff -r f17324b6c882 mcabber/mcabber/screen.c |
59 --- a/mcabber/mcabber/screen.c Wed May 15 12:53:03 2013 +0300 |
59 --- a/mcabber/mcabber/screen.c Tue Nov 11 21:21:09 2014 +0200 |
60 +++ b/mcabber/mcabber/screen.c Wed May 15 12:53:55 2013 +0300 |
60 +++ b/mcabber/mcabber/screen.c Tue Nov 11 22:35:16 2014 +0200 |
61 @@ -440,7 +440,7 @@ |
61 @@ -222,6 +222,8 @@ |
|
62 |
|
63 /* Functions */ |
|
64 |
|
65 +static unsigned int attention_sign(void); |
|
66 + |
|
67 static int find_color(const char *name) |
|
68 { |
|
69 int result; |
|
70 @@ -445,7 +447,7 @@ |
62 "roster", |
71 "roster", |
63 "rostersel", |
72 "rostersel", |
64 "rosterselmsg", |
73 "rosterselmsg", |
65 - "rosternewmsg", |
74 - "rosternewmsg", |
66 + "rosternewmsg", /* not removing this to not break binary compatibility with mainstream */ |
75 + "rosternewmsg", /* not removing this to not break binary compatibility with mainstream */ |
67 "info", |
76 "info", |
68 "msgin", |
77 "msgin", |
69 "readmark", |
78 "readmark", |
70 @@ -513,10 +513,6 @@ |
79 @@ -519,10 +521,6 @@ |
71 init_pair(i+1, ((color) ? find_color(color) : COLOR_RED), |
80 init_pair(i+1, ((color) ? find_color(color) : COLOR_RED), |
72 find_color(backselected)); |
81 find_color(backselected)); |
73 break; |
82 break; |
74 - case COLOR_ROSTERNMSG: |
83 - case COLOR_ROSTERNMSG: |
75 - init_pair(i+1, ((color) ? find_color(color) : COLOR_RED), |
84 - init_pair(i+1, ((color) ? find_color(color) : COLOR_RED), |
76 - find_color(background)); |
85 - find_color(background)); |
77 - break; |
86 - break; |
78 case COLOR_INFO: |
87 case COLOR_INFO: |
79 init_pair(i+1, ((color) ? find_color(color) : COLOR_WHITE), |
88 init_pair(i+1, ((color) ? find_color(color) : COLOR_WHITE), |
80 find_color(background)); |
89 find_color(background)); |
81 @@ -815,6 +811,21 @@ |
90 @@ -826,6 +824,24 @@ |
82 settings_set_guard("color_rosterselmsg", scr_color_guard); |
|
83 settings_set_guard("color_rosternewmsg", scr_color_guard); |
91 settings_set_guard("color_rosternewmsg", scr_color_guard); |
|
92 settings_set_guard("color_timestamp", scr_color_guard); |
84 |
93 |
85 + { // Add default rule only if user has not defined one already |
94 + { // Add default rule only if user has not defined one already |
86 + GSList *rel; |
95 + GSList *rel; |
87 + gboolean found = FALSE; |
96 + gboolean found = FALSE; |
88 + for (rel = rostercolrules; rel; rel = rel->next) { |
97 + for (rel = rostercolrules; rel; rel = rel->next) { |
89 + rostercolor *rule = rel->data; |
98 + rostercolor *rule = rel->data; |
90 + if ((strchr(rule->status, '#') || strchr(rule->status, '!')) |
99 + if ((strchr(rule->status, '#') || strchr(rule->status, attention_sign())) |
91 + && (!strcmp(rule->wildcard, "*"))) { |
100 + && (!strcmp(rule->wildcard, "*"))) { |
92 + found = TRUE; |
101 + found = TRUE; |
93 + break; |
102 + break; |
94 + } |
103 + } |
95 + } |
104 + } |
96 + if (!found) |
105 + if (!found) { |
97 + scr_roster_color("#!", "*", "red"); |
106 + char statuses[3] = "#!"; |
|
107 + statuses[1] = attention_sign(); |
|
108 + scr_roster_color(statuses, "*", "red"); |
|
109 + } |
98 + } |
110 + } |
99 + |
111 + |
100 getmaxyx(stdscr, maxY, maxX); |
112 getmaxyx(stdscr, maxY, maxX); |
101 Log_Win_Height = DEFAULT_LOG_WIN_HEIGHT; |
113 Log_Win_Height = DEFAULT_LOG_WIN_HEIGHT; |
102 // Note scr_draw_main_window() should be called early after scr_init_curses() |
114 // Note scr_draw_main_window() should be called early after scr_init_curses() |
103 @@ -2082,6 +2093,10 @@ |
115 @@ -2168,6 +2184,10 @@ |
104 // for unfolded groups. |
116 // for unfolded groups. |
105 if (ismsg && (!isgrp || ishid)) { |
117 if (ismsg && (!isgrp || ishid)) { |
106 pending = '#'; |
118 pending = '#'; |
107 + // Attention sign? |
119 + // Attention sign? |
108 + if ((ismuc && isurg >= ui_attn_sign_prio_level_muc) || |
120 + if ((ismuc && isurg >= ui_attn_sign_prio_level_muc) || |
109 + (!ismuc && isurg >= ui_attn_sign_prio_level)) |
121 + (!ismuc && isurg >= ui_attn_sign_prio_level)) |
110 + pending = '!'; |
122 + pending = attention_sign(); |
111 } |
123 } |
112 |
124 |
113 if (ismuc) { |
125 if (ismuc) { |
114 @@ -2105,24 +2120,22 @@ |
126 @@ -2191,24 +2211,22 @@ |
115 for (n = 0; n < maxx; n++) |
127 for (n = 0; n < maxx; n++) |
116 waddch(rosterWnd, ' '); |
128 waddch(rosterWnd, ' '); |
117 } else { |
129 } else { |
118 - if (pending == '#') |
130 - if (pending == '#') |
119 - wattrset(rosterWnd, get_color(COLOR_ROSTERNMSG)); |
131 - wattrset(rosterWnd, get_color(COLOR_ROSTERNMSG)); |
147 } |
159 } |
148 + wattrset(rosterWnd, color); |
160 + wattrset(rosterWnd, color); |
149 } |
161 } |
150 |
162 |
151 if (Roster_Width > prefix_length) |
163 if (Roster_Width > prefix_length) |
152 @@ -2130,13 +2143,6 @@ |
164 @@ -2216,13 +2234,6 @@ |
153 else |
165 else |
154 name[0] = 0; |
166 name[0] = 0; |
155 |
167 |
156 - if (pending == '#') { |
168 - if (pending == '#') { |
157 - // Attention sign? |
169 - // Attention sign? |
158 - if ((ismuc && isurg >= ui_attn_sign_prio_level_muc) || |
170 - if ((ismuc && isurg >= ui_attn_sign_prio_level_muc) || |
159 - (!ismuc && isurg >= ui_attn_sign_prio_level)) |
171 - (!ismuc && isurg >= ui_attn_sign_prio_level)) |
160 - pending = '!'; |
172 - pending = attention_sign(); |
161 - } |
173 - } |
162 - |
174 - |
163 if (isgrp) { |
175 if (isgrp) { |
164 if (ishid) { |
176 if (ishid) { |
165 int group_count = 0; |
177 int group_count = 0; |
166 diff -r 7718e7f796d4 mcabber/mcabber/screen.h |
178 diff -r f17324b6c882 mcabber/mcabber/screen.h |
167 --- a/mcabber/mcabber/screen.h Wed May 15 12:53:03 2013 +0300 |
179 --- a/mcabber/mcabber/screen.h Tue Nov 11 21:21:09 2014 +0200 |
168 +++ b/mcabber/mcabber/screen.h Wed May 15 12:53:55 2013 +0300 |
180 +++ b/mcabber/mcabber/screen.h Tue Nov 11 22:35:16 2014 +0200 |
169 @@ -47,7 +47,7 @@ |
181 @@ -47,7 +47,7 @@ |
170 COLOR_ROSTER, |
182 COLOR_ROSTER, |
171 COLOR_ROSTERSEL, |
183 COLOR_ROSTERSEL, |
172 COLOR_ROSTERSELNMSG, |
184 COLOR_ROSTERSELNMSG, |
173 - COLOR_ROSTERNMSG, |
185 - COLOR_ROSTERNMSG, |
174 + COLOR_ROSTERNMSG, /* not removing this to not break binary compatibility with mainstream */ |
186 + COLOR_ROSTERNMSG, /* not removing this to not break binary compatibility with mainstream */ |
175 COLOR_INFO, |
187 COLOR_INFO, |
176 COLOR_MSGIN, |
188 COLOR_MSGIN, |
177 COLOR_READMARK, |
189 COLOR_READMARK, |
178 diff -r 7718e7f796d4 mcabber/mcabberrc.example |
190 diff -r f17324b6c882 mcabber/mcabberrc.example |
179 --- a/mcabber/mcabberrc.example Wed May 15 12:53:03 2013 +0300 |
191 --- a/mcabber/mcabberrc.example Tue Nov 11 21:21:09 2014 +0200 |
180 +++ b/mcabber/mcabberrc.example Wed May 15 12:53:55 2013 +0300 |
192 +++ b/mcabber/mcabberrc.example Tue Nov 11 22:35:16 2014 +0200 |
181 @@ -423,15 +423,24 @@ |
193 @@ -429,16 +429,25 @@ |
182 #set color_bgrostersel = cyan |
194 #set color_bgrostersel = cyan |
183 #set color_rostersel = blue |
195 #set color_rostersel = blue |
184 #set color_rosterselmsg = red |
196 #set color_rosterselmsg = red |
185 -#set color_rosternewmsg = red |
197 -#set color_rosternewmsg = red |
186 #set color_readmark = red |
198 #set color_readmark = red |
|
199 #set color_timestamp = brightblue |
187 |
200 |
188 -# You can color roster items by their status and JID. For example, to have |
201 -# You can color roster items by their status and JID. For example, to have |
189 -# all roster items white, just all contacts from jabber.org that are away, |
202 -# all roster items white, just all contacts from jabber.org that are away, |
190 -# not available or do not disturb yellow, you do this: |
203 -# not available or do not disturb yellow, you do this: |
191 +# You can color roster items by their status, state and JID. For example, |
204 +# You can color roster items by their status, state and JID. For example, |