changeset 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 7d3060070d10
children 48e47198a9db
files mcabber/mcabber/screen.c
diffstat 1 files changed, 17 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mcabber/mcabber/screen.c	Sun Mar 21 15:13:48 2010 +0100
+++ b/mcabber/mcabber/screen.c	Sun Mar 21 15:14:24 2010 +0100
@@ -73,6 +73,10 @@
 static unsigned short int Log_Win_Height;
 static unsigned short int Roster_Width;
 
+// Default attention sign trigger levels
+static guint ui_attn_sign_prio_level_muc = ROSTER_UI_PRIO_MUC_HL_MESSAGE;
+static guint ui_attn_sign_prio_level     = ROSTER_UI_PRIO_ATTENTION_MESSAGE;
+
 static inline void check_offset(int);
 static void scr_cancel_current_completion(void);
 static void scr_end_current_completion(void);
@@ -1911,7 +1915,9 @@
   rOffset = offset;
 
   for (i=0; i<maxy && buddy; buddy = g_list_next(buddy)) {
-    unsigned short bflags, btype, ismsg, isgrp, ismuc, ishid, isspe;
+    unsigned short bflags, btype;
+    unsigned short ismsg, isgrp, ismuc, ishid, isspe;
+    guint isurg;
     gchar *rline_locale;
     GSList *resources, *p_res;
 
@@ -1923,6 +1929,7 @@
     isgrp = btype  & ROSTER_TYPE_GROUP;
     ismuc = btype  & ROSTER_TYPE_ROOM;
     isspe = btype  & ROSTER_TYPE_SPECIAL;
+    isurg = buddy_getuiprio(BUDDATA(buddy));
 
     if (rOffset > 0) {
       rOffset--;
@@ -1977,10 +1984,10 @@
         int color = get_color(COLOR_ROSTER);
         if ((!isspe) && (!isgrp)) { // Look for color rules
           GSList *head;
-          const char *jid = buddy_getjid(BUDDATA(buddy));
+          const char *bjid = buddy_getjid(BUDDATA(buddy));
           for (head = rostercolrules; head; head = g_slist_next(head)) {
             rostercolor *rc = head->data;
-            if (g_pattern_match_string(rc->compiled, jid) &&
+            if (g_pattern_match_string(rc->compiled, bjid) &&
                 (!strcmp("*", rc->status) || strchr(rc->status, status))) {
               color = compose_color(rc->color);
               break;
@@ -1996,6 +2003,13 @@
     else
       name[0] = 0;
 
+    if (pending == '#') {
+      // Attention sign?
+      if ((ismuc && isurg >= ui_attn_sign_prio_level_muc) ||
+          (!ismuc && isurg >= ui_attn_sign_prio_level))
+        pending = '!';
+    }
+
     if (isgrp) {
       if (ishid) {
         int group_count = 0;