comparison mcabber/mcabber/screen.c @ 1804:35a1250c111a

Display urgent/attention sign in the roster UI
author Mikael Berthe <mikael@lilotux.net>
date Sun, 21 Mar 2010 15:14:24 +0100
parents b135572fcd26
children e6d355e50d7a
comparison
equal deleted inserted replaced
1803:7d3060070d10 1804:35a1250c111a
70 70
71 const char *LocaleCharSet = "C"; 71 const char *LocaleCharSet = "C";
72 72
73 static unsigned short int Log_Win_Height; 73 static unsigned short int Log_Win_Height;
74 static unsigned short int Roster_Width; 74 static unsigned short int Roster_Width;
75
76 // Default attention sign trigger levels
77 static guint ui_attn_sign_prio_level_muc = ROSTER_UI_PRIO_MUC_HL_MESSAGE;
78 static guint ui_attn_sign_prio_level = ROSTER_UI_PRIO_ATTENTION_MESSAGE;
75 79
76 static inline void check_offset(int); 80 static inline void check_offset(int);
77 static void scr_cancel_current_completion(void); 81 static void scr_cancel_current_completion(void);
78 static void scr_end_current_completion(void); 82 static void scr_end_current_completion(void);
79 static void scr_insert_text(const char*); 83 static void scr_insert_text(const char*);
1909 1913
1910 buddy = buddylist; 1914 buddy = buddylist;
1911 rOffset = offset; 1915 rOffset = offset;
1912 1916
1913 for (i=0; i<maxy && buddy; buddy = g_list_next(buddy)) { 1917 for (i=0; i<maxy && buddy; buddy = g_list_next(buddy)) {
1914 unsigned short bflags, btype, ismsg, isgrp, ismuc, ishid, isspe; 1918 unsigned short bflags, btype;
1919 unsigned short ismsg, isgrp, ismuc, ishid, isspe;
1920 guint isurg;
1915 gchar *rline_locale; 1921 gchar *rline_locale;
1916 GSList *resources, *p_res; 1922 GSList *resources, *p_res;
1917 1923
1918 bflags = buddy_getflags(BUDDATA(buddy)); 1924 bflags = buddy_getflags(BUDDATA(buddy));
1919 btype = buddy_gettype(BUDDATA(buddy)); 1925 btype = buddy_gettype(BUDDATA(buddy));
1921 ismsg = bflags & ROSTER_FLAG_MSG; 1927 ismsg = bflags & ROSTER_FLAG_MSG;
1922 ishid = bflags & ROSTER_FLAG_HIDE; 1928 ishid = bflags & ROSTER_FLAG_HIDE;
1923 isgrp = btype & ROSTER_TYPE_GROUP; 1929 isgrp = btype & ROSTER_TYPE_GROUP;
1924 ismuc = btype & ROSTER_TYPE_ROOM; 1930 ismuc = btype & ROSTER_TYPE_ROOM;
1925 isspe = btype & ROSTER_TYPE_SPECIAL; 1931 isspe = btype & ROSTER_TYPE_SPECIAL;
1932 isurg = buddy_getuiprio(BUDDATA(buddy));
1926 1933
1927 if (rOffset > 0) { 1934 if (rOffset > 0) {
1928 rOffset--; 1935 rOffset--;
1929 continue; 1936 continue;
1930 } 1937 }
1975 wattrset(rosterWnd, get_color(COLOR_ROSTERNMSG)); 1982 wattrset(rosterWnd, get_color(COLOR_ROSTERNMSG));
1976 else { 1983 else {
1977 int color = get_color(COLOR_ROSTER); 1984 int color = get_color(COLOR_ROSTER);
1978 if ((!isspe) && (!isgrp)) { // Look for color rules 1985 if ((!isspe) && (!isgrp)) { // Look for color rules
1979 GSList *head; 1986 GSList *head;
1980 const char *jid = buddy_getjid(BUDDATA(buddy)); 1987 const char *bjid = buddy_getjid(BUDDATA(buddy));
1981 for (head = rostercolrules; head; head = g_slist_next(head)) { 1988 for (head = rostercolrules; head; head = g_slist_next(head)) {
1982 rostercolor *rc = head->data; 1989 rostercolor *rc = head->data;
1983 if (g_pattern_match_string(rc->compiled, jid) && 1990 if (g_pattern_match_string(rc->compiled, bjid) &&
1984 (!strcmp("*", rc->status) || strchr(rc->status, status))) { 1991 (!strcmp("*", rc->status) || strchr(rc->status, status))) {
1985 color = compose_color(rc->color); 1992 color = compose_color(rc->color);
1986 break; 1993 break;
1987 } 1994 }
1988 } 1995 }
1993 2000
1994 if (Roster_Width > 7) 2001 if (Roster_Width > 7)
1995 g_utf8_strncpy(name, buddy_getname(BUDDATA(buddy)), Roster_Width-7); 2002 g_utf8_strncpy(name, buddy_getname(BUDDATA(buddy)), Roster_Width-7);
1996 else 2003 else
1997 name[0] = 0; 2004 name[0] = 0;
2005
2006 if (pending == '#') {
2007 // Attention sign?
2008 if ((ismuc && isurg >= ui_attn_sign_prio_level_muc) ||
2009 (!ismuc && isurg >= ui_attn_sign_prio_level))
2010 pending = '!';
2011 }
1998 2012
1999 if (isgrp) { 2013 if (isgrp) {
2000 if (ishid) { 2014 if (ishid) {
2001 int group_count = 0; 2015 int group_count = 0;
2002 foreach_group_member(BUDDATA(buddy), increment_if_buddy_not_filtered, 2016 foreach_group_member(BUDDATA(buddy), increment_if_buddy_not_filtered,