tags 273908 + pending patch
thanks bts

The attached patch should add this feature. It will be added to
gabber2 in the next upload.



-- 
 .''`. Goedson Teixeira Paixao <[EMAIL PROTECTED]>
: :' : Jabber ID: [EMAIL PROTECTED] - http://www.jabber.org/
`. `'  Key fingerprint: 20FC AD60 E8C8 D2EB 064A  8F5B EED8 D4CC 1DEB 8EAE
  `-   Signed/encypted mail preferred
#! /bin/sh /usr/share/dpatch/dpatch-run
## 17_display_count_of_contacts_in_group.dpatch by  Goedson Teixeira Paixao 
<[EMAIL PROTECTED]>
##
## DP: Show number of available people in a group

@DPATCH@
diff -urNad gabber2-1.9.4+cvs20040709~/src/RosterController.cc 
gabber2-1.9.4+cvs20040709/src/RosterController.cc
--- gabber2-1.9.4+cvs20040709~/src/RosterController.cc  2005-12-10 
21:36:45.900932216 -0200
+++ gabber2-1.9.4+cvs20040709/src/RosterController.cc   2005-12-10 
21:30:19.807627000 -0200
@@ -629,7 +629,7 @@
         else if (node->get_type() == "group")
         {
             GroupNode* gnode = static_cast<GroupNode*>(node);
-            Glib::ustring name = "<markup><b>" + gnode->get_name() + 
"</b></markup>";
+            Glib::ustring name = "<markup><b>" + gnode->get_name() + 
Util::substitute(" (%d)", gnode->get_available_count())+"</b></markup>";
             g_value_set_string(value, name.c_str());
         }
         else
diff -urNad gabber2-1.9.4+cvs20040709~/src/RosterModel.cc 
gabber2-1.9.4+cvs20040709/src/RosterModel.cc
--- gabber2-1.9.4+cvs20040709~/src/RosterModel.cc       2005-12-10 
21:36:45.190040288 -0200
+++ gabber2-1.9.4+cvs20040709/src/RosterModel.cc        2005-12-10 
21:30:21.651347000 -0200
@@ -366,3 +366,18 @@
     mRoster.clear();
     mNodeMap.clear();
 }
+
+gint GroupNode::get_available_count(void) {
+  RosterNodeList &children = get_children();
+  gint available_count = 0;
+
+  for(RosterNodeList::iterator it = children.begin();
+      it != children.end(); ++it)
+    {
+      Roster::Item& item(static_cast<RosterItemNode*>(*it)->get_item());
+      if (item.isAvailable()) { 
+         available_count ++;
+      }
+    }
+  return available_count;
+}
diff -urNad gabber2-1.9.4+cvs20040709~/src/RosterModel.hh 
gabber2-1.9.4+cvs20040709/src/RosterModel.hh
--- gabber2-1.9.4+cvs20040709~/src/RosterModel.hh       2004-06-16 
13:36:40.000000000 -0300
+++ gabber2-1.9.4+cvs20040709/src/RosterModel.hh        2005-12-10 
21:30:58.433755000 -0200
@@ -102,6 +102,11 @@
     */
     std::string get_name(void) const
     { return mName; }
+  
+    /**
+    * Get the number of online contacts in this group
+    */ 
+    gint get_available_count(void);
 
     // RosterNode impl
     std::string get_type(void)

Attachment: signature.asc
Description: Digital signature

Reply via email to