Package: ejabberd
Version: 2.0.0-7
Severity: wishlist

I found a very useful patch for mod_ctlextra here :
https://forge.process-one.net/browse/ejabberd-modules/mod_ctlextra/trunk/src/mod_ctlextra.erl?r1=509&r2=539&u=3&ignore=&k=

This patch adds 2 commands :

ejabberdctl srg-list-groups host | list the shared roster groups from host
ejabberdctl srg-get-info group host  |  get info of a specific group on host

They are very useful when using other shared rosters commands.
I've adapted the patch so that it can be added in debian/patches for version 2.0.0-7. It applies on ejabberd-2.0.0/src/mod_ctlextra.erl which is created by another patch in the package : mod_ctlextra.patch
So this patch should appear after mod_ctlextra.patch in debian/patches/series.

This is my first contribution, I hope my patch is correctly built.
It rebuilt the package successfully, the installation works too and finally, the new commands are available and work.

Please find attached the patch that could be added in debian/patches.
Merging the two patches can also be considered.

Regards,

--
Florian CARGOET <[EMAIL PROTECTED]>
Evolix - Informatique et Logiciels Libres http://www.evolix.fr/


--- ejabberd-2.0.0/src.orig/mod_ctlextra.erl	2008-07-02 01:25:08.000000000 +0200
+++ ejabberd-2.0.0/src/mod_ctlextra.erl	2008-07-02 01:37:47.000000000 +0200
@@ -46,7 +46,8 @@
 		{"srg-delete group host", "delete the group"},
 		{"srg-user-add user server group host", "add [EMAIL PROTECTED] to group on host"},
 		{"srg-user-del user server group host", "delete [EMAIL PROTECTED] from group on host"},
-			
+     {"srg-list-groups host", "list the shared roster groups from host"},
+     		{"srg-get-info group host", "get info of a specific group on host"},
 		% mod_vcard
 		{"vcard-get user host data [data2]", "get data from the vCard of the user"},
 		{"vcard-set user host data [data2] content", "set data to content on the vCard"},
@@ -177,6 +178,25 @@
 	{atomic, ok} = mod_shared_roster:remove_user_from_group(Host, {User, Server}, Group),
     ?STATUS_SUCCESS;
 
+ctl_process(_Val, ["srg-list-groups", Host]) ->
+    lists:foreach(
+        fun(SrgGroup) ->
+	                io:format("~s~n",[SrgGroup])
+        end,
+        lists:sort(mod_shared_roster:list_groups(Host))),
+    ?STATUS_SUCCESS;
+
+ctl_process(_Val, ["srg-get-info", Group, Host]) ->
+    Opts = mod_shared_roster:get_group_opts(Host,Group),
+    [io:format("~s: ~p~n", [Title, Value]) || {Title , Value} <- Opts],
+
+    Members = mod_shared_roster:get_group_explicit_users(Host,Group),
+    Members_string = [ " " ++ jlib:jid_to_string(jlib:make_jid(MUser, MServer, ""))
+                     || {MUser, MServer} <- Members],
+    io:format("members:~s~n", [Members_string]),
+
+    ?STATUS_SUCCESS;
+
 ctl_process(_Val, ["muc-purge", Days]) ->
 	{purged, Num_total, Num_purged, Names_purged} = muc_purge(list_to_integer(Days)),
 	io:format("Purged ~p chatrooms from a total of ~p on the server:~n~p~n", [Num_purged, Num_total, Names_purged]),

Reply via email to