[JDEV] Static shared groups that show presence

vtjabber at dennis.veritime.com vtjabber at dennis.veritime.com
Tue Jul 30 09:57:09 CDT 2002


  After banging my head against the wall reading a bunch of out-of-date
and incomplete Jabber documentation on shared groups (mod_groups), I
finally resorted to reading and hacking the mod_groups.c code a little.

  I wanted to have some shared groups for our company's employees.
Here's what I was after:

  1. I wanted them to be <static/>, so only the administrator (me)
     could define the members of the group.  Good so far.

  2. I wanted the groups to drop into an employee roster without much
     work.  I didn't want them to be <require/>'d.  Registering with
     im.example.com/groups/groupname did the trick.  Good so far.

  3. I wanted the presence of all employees to be automatically sent to
     anyone that had the group listed in their roster.

     That is, if you registered with im.example.com/groups/accounting,
     and Mary is a member of the accounting group, you should get Mary's
     presence in your roster without having to subscribe to Mary
     specifically.

  As I found out, mod_groups.c doesn't allow #3 for <static/> groups.
Why, I can't be sure.  I tracked down what I believe to be the line that
makes the determination between a <static/> group and a normal group.  I
commented out a single if statement so that it runs the
presence-broadcasting code for all groups.

  Comments?  I want to make sure I've modified the correct line, and that
it won't have any unintended side-effects...

-Dan

-------------------------------------------------------------------------
Here's the diff from Jabber 1.4.2's source:
-------------------------------------------------------------------------
--- mod_groups.c       Fri Feb  8 02:39:28 2002
+++ mod_groups.c_new   Mon Jul 29 16:43:39 2002
@@ -823,7 +823,8 @@

         gt = GROUP_GET(mi,gid);

-        if(j_strcmp(xmlnode_get_attrib(cur,"type"),"both") == 0)
+        /* Make static groups also send presence */
+        /* if(j_strcmp(xmlnode_get_attrib(cur,"type"),"both") == 0) */
             mod_groups_presence_from(s,gt,m->packet->x);

         /* if we are new or our old priority was less then zero then "probe" the group members */




More information about the JDev mailing list