comparison mcabber/mcabber/screen.c @ 1977:1d8f9135e000

Use smarter message flag in the main status line The attention sign (!) is used when a personal message is unread, or if we're highlighted in a MUC room.
author Mikael Berthe <mikael@lilotux.net>
date Sat, 26 Mar 2011 13:37:33 +0100
parents acbebd68c7f0
children 0870005f7efc
comparison
equal deleted inserted replaced
1976:e6beab22099b 1977:1d8f9135e000
1491 // if you call top_panel()/update_panels() later. 1491 // if you call top_panel()/update_panels() later.
1492 void scr_update_main_status(int forceupdate) 1492 void scr_update_main_status(int forceupdate)
1493 { 1493 {
1494 char *sm = from_utf8(xmpp_getstatusmsg()); 1494 char *sm = from_utf8(xmpp_getstatusmsg());
1495 const char *info = settings_opt_get("info"); 1495 const char *info = settings_opt_get("info");
1496 guint prio = 0;
1497 gpointer unread_ptr;
1498 char unreadchar;
1499
1500 unread_ptr = unread_msg(NULL);
1501 if (unread_ptr) {
1502 prio = buddy_getuiprio(unread_ptr);
1503 // If there's an unerad buffer but no priority set, let's consider the
1504 // priority is 1.
1505 if (!prio && buddy_getflags(unread_ptr) & ROSTER_FLAG_MSG)
1506 prio = 1;
1507 }
1508
1509 // Status bar unread message flag
1510 if (prio >= ROSTER_UI_PRIO_MUC_HL_MESSAGE)
1511 unreadchar = '!';
1512 else if (prio > 0)
1513 unreadchar = '#';
1514 else
1515 unreadchar = ' ';
1496 1516
1497 werase(mainstatusWnd); 1517 werase(mainstatusWnd);
1498 if (info) { 1518 if (info) {
1499 char *info_locale = from_utf8(info); 1519 char *info_locale = from_utf8(info);
1500 mvwprintw(mainstatusWnd, 0, 0, "%c[%c] %s %s", 1520 mvwprintw(mainstatusWnd, 0, 0, "%c[%c] %s %s", unreadchar,
1501 (unread_msg(NULL) ? '#' : ' '),
1502 imstatus2char[xmpp_getstatus()], 1521 imstatus2char[xmpp_getstatus()],
1503 info_locale, (sm ? sm : "")); 1522 info_locale, (sm ? sm : ""));
1504 g_free(info_locale); 1523 g_free(info_locale);
1505 } else 1524 } else
1506 mvwprintw(mainstatusWnd, 0, 0, "%c[%c] %s", 1525 mvwprintw(mainstatusWnd, 0, 0, "%c[%c] %s", unreadchar,
1507 (unread_msg(NULL) ? '#' : ' '),
1508 imstatus2char[xmpp_getstatus()], (sm ? sm : "")); 1526 imstatus2char[xmpp_getstatus()], (sm ? sm : ""));
1509 if (forceupdate) { 1527 if (forceupdate) {
1510 top_panel(inputPanel); 1528 top_panel(inputPanel);
1511 update_panels(); 1529 update_panels();
1512 } 1530 }