[ejabberd] [PATCH] mod_shared_roster: Teach remove_user_from_group() and add_user_to_group() about special users

Badlop badlop at gmail.com
Fri Apr 24 13:58:29 MSD 2009

2009/2/23 Martin Langhoff <martin.langhoff at gmail.com>:
>  - @nearby@ - I wish I knew that this does

Maybe it groups user sessions by the client IP address range.

> The patch I have today - which could drop lots of superfluous things
> as only @online@ works:
> http://dev.laptop.org/git?p=users/martin/ejabberd-xs.git;a=blob;f=mod_shared_roster-simplified-online-patch.patch;h=6d707f75fef8be3a6731e81f0960849eade89153;hb=a4afc81e992fd6716c5061a190f6a5b6064281f2

In http://dev.laptop.org/git/users/martin/ejabberd-xs.git/tree/
I don't see any mod_shared_roster-simplified-online-patch.patch

> I have now ported part of this patch to 2.0.3 -- specifically,
> @online@ works. The patch is still carries some cruft, and I am
> wondering whether it's worth it to polish it into a more elegant patch
> that implements @online at .
> The key question is: If I bring it to a decent level, is it a
> desirable patch? Or is it just a bad idea to implement it as @online@,
> perhaps it requires a different approach, for example a "show only
> online" option to all shared rosters? (In which case, @all@ with that
> switch would behave just like @online@ today).
2009/4/20 Martin Langhoff <martin.langhoff at gmail.com>:
> For the record, I am happy to cleanup and rework patches, conform to
> commit message style, code style, release the copyright, etc. My goals
> are to minimise the patches I carry and to benefit the larger ejabberd
> community (and that includes P1 :-) ).
> Any hints?
2009/4/22 Martin Langhoff <martin.langhoff at gmail.com>:
> My patch also talked about '@online@', @recent@ and @nearby at . I have a
> patch that implements @online@ and works well on 2.0.x, if I clean it
> up, would it be interesting / desirable?
> (The same patch has bits of @recent@ and @nearby@ but they don't work.
> I'm thinking of removing the non-working cruft to focus on the well
> tested @online@).

The @recent@ patch was reported here:
I chatted with Mickael today and commented some ideas.

Conceptually, the directives @all@, @recent@ and @online@
can be generalized as: @recent?days=X@
where X is an integer from 0 up to 9999.
In that case:
    * @all@ = @recent?days=9999@
    * @recent@ = @recent?days=7@
    * @online@ = @recent?days=0@

If you wanted to describe 'no directive', you could use @recent?days=-1 at .

Of course, the way to get or filter the list of members in each of
these directives may be different for efficiency reasons.

The requirements that your patch should meet to be applied to ejabberd
trunk SVN:

R1. User interface: support those directives:
    * @all@ behaves as in ejabberd trunk
    * @online@ behaves as in your patch
    * @recent@ behaves like @recent?days=7@
    * @recent?days=X@ behaves as in your patch

R2. Data storage: store in group options:
    * {all_users, true|false}
    * {online_users, true|false}
    * {recent_users_days, Integer}

R3. Apply cleanly to one of: ejabberd trunk SVN, 2.0.x branch, 2.0.5 tag.

>From what you said, it seems your patch is quite close to this. The
remaining Tasks are only related to R1:
T1. Remove support for @nearby@
T2. Test/improve support for @recent@
T3. Add support for @recent?days=X@

If you provide a patch like that, I can take care of:
* Merge to trunk from whatever version the patch is built on.
* Update ejabberd Guide with the new directives, and add a Warning paragraph.
* Publish the resulting patch in the bug tracker, so it gets final review.
* If nobody reports any problem in a week, commit to trunk SVN.


More information about the ejabberd mailing list