65 #define compose_color(col) (COLOR_PAIR(col->color_pair)|col->color_attrib) |
65 #define compose_color(col) (COLOR_PAIR(col->color_pair)|col->color_attrib) |
66 |
66 |
67 #define DEFAULT_LOG_WIN_HEIGHT (5+2) |
67 #define DEFAULT_LOG_WIN_HEIGHT (5+2) |
68 #define DEFAULT_ROSTER_WIDTH 24 |
68 #define DEFAULT_ROSTER_WIDTH 24 |
69 #define CHAT_WIN_HEIGHT (maxY-1-Log_Win_Height) |
69 #define CHAT_WIN_HEIGHT (maxY-1-Log_Win_Height) |
|
70 |
|
71 #define DEFAULT_ATTENTION_CHAR '!' |
70 |
72 |
71 const char *LocaleCharSet = "C"; |
73 const char *LocaleCharSet = "C"; |
72 |
74 |
73 static unsigned short int Log_Win_Height; |
75 static unsigned short int Log_Win_Height; |
74 static unsigned short int Roster_Width; |
76 static unsigned short int Roster_Width; |
1529 roster_msg_setflag(winId, special, TRUE); |
1531 roster_msg_setflag(winId, special, TRUE); |
1530 update_roster = TRUE; |
1532 update_roster = TRUE; |
1531 } |
1533 } |
1532 } |
1534 } |
1533 |
1535 |
|
1536 static unsigned int attention_sign(void) |
|
1537 { |
|
1538 guint sign; |
|
1539 const char *as = settings_opt_get("attention_char"); |
|
1540 if (!as) |
|
1541 return DEFAULT_ATTENTION_CHAR; |
|
1542 sign = get_char(as); |
|
1543 if (get_char_width(as) != 1 || !iswprint(sign)) // XXX Better use a guard |
|
1544 return DEFAULT_ATTENTION_CHAR; |
|
1545 return sign; |
|
1546 } |
|
1547 |
1534 // scr_update_main_status(forceupdate) |
1548 // scr_update_main_status(forceupdate) |
1535 // Redraw the main (bottom) status line. |
1549 // Redraw the main (bottom) status line. |
1536 // You can set forceupdate to FALSE in order to optimize screen refresh |
1550 // You can set forceupdate to FALSE in order to optimize screen refresh |
1537 // if you call top_panel()/update_panels() later. |
1551 // if you call top_panel()/update_panels() later. |
1538 void scr_update_main_status(int forceupdate) |
1552 void scr_update_main_status(int forceupdate) |
1539 { |
1553 { |
1540 char *sm = from_utf8(xmpp_getstatusmsg()); |
1554 char *sm = from_utf8(xmpp_getstatusmsg()); |
1541 const char *info = settings_opt_get("info"); |
1555 const char *info = settings_opt_get("info"); |
1542 guint prio = 0; |
1556 guint prio = 0; |
1543 gpointer unread_ptr; |
1557 gpointer unread_ptr; |
1544 char unreadchar; |
1558 guint unreadchar; |
1545 |
1559 |
1546 unread_ptr = unread_msg(NULL); |
1560 unread_ptr = unread_msg(NULL); |
1547 if (unread_ptr) { |
1561 if (unread_ptr) { |
1548 prio = buddy_getuiprio(unread_ptr); |
1562 prio = buddy_getuiprio(unread_ptr); |
1549 // If there's an unerad buffer but no priority set, let's consider the |
1563 // If there's an unerad buffer but no priority set, let's consider the |
1552 prio = 1; |
1566 prio = 1; |
1553 } |
1567 } |
1554 |
1568 |
1555 // Status bar unread message flag |
1569 // Status bar unread message flag |
1556 if (prio >= ROSTER_UI_PRIO_MUC_HL_MESSAGE) |
1570 if (prio >= ROSTER_UI_PRIO_MUC_HL_MESSAGE) |
1557 unreadchar = '!'; |
1571 unreadchar = attention_sign(); |
1558 else if (prio > 0) |
1572 else if (prio > 0) |
1559 unreadchar = '#'; |
1573 unreadchar = '#'; |
1560 else |
1574 else |
1561 unreadchar = ' '; |
1575 unreadchar = ' '; |
1562 |
1576 |
1563 werase(mainstatusWnd); |
1577 werase(mainstatusWnd); |
1564 if (info) { |
1578 if (info) { |
1565 char *info_locale = from_utf8(info); |
1579 char *info_locale = from_utf8(info); |
1566 mvwprintw(mainstatusWnd, 0, 0, "%c[%c] %s %s", unreadchar, |
1580 mvwprintw(mainstatusWnd, 0, 0, "%lc[%c] %s %s", unreadchar, |
1567 imstatus2char[xmpp_getstatus()], |
1581 imstatus2char[xmpp_getstatus()], |
1568 info_locale, (sm ? sm : "")); |
1582 info_locale, (sm ? sm : "")); |
1569 g_free(info_locale); |
1583 g_free(info_locale); |
1570 } else |
1584 } else |
1571 mvwprintw(mainstatusWnd, 0, 0, "%c[%c] %s", unreadchar, |
1585 mvwprintw(mainstatusWnd, 0, 0, "%lc[%c] %s", unreadchar, |
1572 imstatus2char[xmpp_getstatus()], (sm ? sm : "")); |
1586 imstatus2char[xmpp_getstatus()], (sm ? sm : "")); |
1573 if (forceupdate) { |
1587 if (forceupdate) { |
1574 top_panel(inputPanel); |
1588 top_panel(inputPanel); |
1575 update_panels(); |
1589 update_panels(); |
1576 } |
1590 } |
2168 |
2182 |
2169 if (pending == '#') { |
2183 if (pending == '#') { |
2170 // Attention sign? |
2184 // Attention sign? |
2171 if ((ismuc && isurg >= ui_attn_sign_prio_level_muc) || |
2185 if ((ismuc && isurg >= ui_attn_sign_prio_level_muc) || |
2172 (!ismuc && isurg >= ui_attn_sign_prio_level)) |
2186 (!ismuc && isurg >= ui_attn_sign_prio_level)) |
2173 pending = '!'; |
2187 pending = attention_sign(); |
2174 } |
2188 } |
2175 |
2189 |
2176 if (isgrp) { |
2190 if (isgrp) { |
2177 if (ishid) { |
2191 if (ishid) { |
2178 int group_count = 0; |
2192 int group_count = 0; |
2179 foreach_group_member(BUDDATA(buddy), increment_if_buddy_not_filtered, |
2193 foreach_group_member(BUDDATA(buddy), increment_if_buddy_not_filtered, |
2180 &group_count); |
2194 &group_count); |
2181 snprintf(rline, 4*Roster_Width, "%s%c+++ %s (%i)", space, pending, name, |
2195 snprintf(rline, 4*Roster_Width, "%s%lc+++ %s (%i)", space, pending, |
2182 group_count); |
2196 name, group_count); |
2183 /* Do not display the item count if there isn't enough space */ |
2197 /* Do not display the item count if there isn't enough space */ |
2184 if (g_utf8_strlen(rline, 4*Roster_Width) >= Roster_Width) |
2198 if (g_utf8_strlen(rline, 4*Roster_Width) >= Roster_Width) |
2185 snprintf(rline, 4*Roster_Width, "%s%c+++ %s", space, pending, name); |
2199 snprintf(rline, 4*Roster_Width, "%s%lc+++ %s", space, pending, name); |
2186 } |
2200 } |
2187 else |
2201 else |
2188 snprintf(rline, 4*Roster_Width, "%s%c--- %s", space, pending, name); |
2202 snprintf(rline, 4*Roster_Width, "%s%lc--- %s", space, pending, name); |
2189 } else if (isspe) { |
2203 } else if (isspe) { |
2190 snprintf(rline, 4*Roster_Width, "%s%c%s", space, pending, name); |
2204 snprintf(rline, 4*Roster_Width, "%s%lc%s", space, pending, name); |
2191 } else { |
2205 } else { |
2192 char sepleft = '['; |
2206 char sepleft = '['; |
2193 char sepright = ']'; |
2207 char sepright = ']'; |
2194 if (btype & ROSTER_TYPE_USER) { |
2208 if (btype & ROSTER_TYPE_USER) { |
2195 guint subtype = buddy_getsubscription(BUDDATA(buddy)); |
2209 guint subtype = buddy_getsubscription(BUDDATA(buddy)); |
2198 if (!(subtype & sub_from)) { |
2212 if (!(subtype & sub_from)) { |
2199 sepleft = '{'; |
2213 sepleft = '{'; |
2200 sepright = '}'; |
2214 sepright = '}'; |
2201 } |
2215 } |
2202 } |
2216 } |
2203 snprintf(rline, 4*Roster_Width, |
2217 snprintf(rline, 4*Roster_Width, "%s%lc%c%c%c %s", |
2204 "%s%c%c%c%c %s", space, pending, sepleft, status, sepright, name); |
2218 space, pending, sepleft, status, sepright, name); |
2205 } |
2219 } |
2206 |
2220 |
2207 rline_locale = from_utf8(rline); |
2221 rline_locale = from_utf8(rline); |
2208 mvwprintw(rosterWnd, i, x_pos, "%s", rline_locale); |
2222 mvwprintw(rosterWnd, i, x_pos, "%s", rline_locale); |
2209 g_free(rline_locale); |
2223 g_free(rline_locale); |