From bd060bc1bb0b5078ddc00189556256418cac1a6f Mon Sep 17 00:00:00 2001 From: Badlop Date: Fri, 4 Nov 2016 18:44:15 +0100 Subject: [PATCH] Support several groups separated by ; in add_rosteritem command --- src/mod_admin_extra.erl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/mod_admin_extra.erl b/src/mod_admin_extra.erl index 8ce11b872..48732ea35 100644 --- a/src/mod_admin_extra.erl +++ b/src/mod_admin_extra.erl @@ -377,6 +377,7 @@ get_commands_spec() -> #ejabberd_commands{name = add_rosteritem, tags = [roster], desc = "Add an item to a user's roster (supports ODBC)", + longdesc = "Group can be several groups separated by ; for example: \"g1;g2;g3\"", module = ?MODULE, function = add_rosteritem, args = [{localuser, binary}, {localserver, binary}, {user, binary}, {server, binary}, @@ -1204,11 +1205,13 @@ push_roster_item(LU, LS, R, U, S, Action) -> ejabberd_router:route(jid:remove_resource(LJID), LJID, ResIQ). build_roster_item(U, S, {add, Nick, Subs, Group}) -> + GNames = binary:split(Group,<<";">>, [global]), + GroupEls = [{xmlel, <<"group">>, [], [{xmlcdata, GName}]} || GName <- GNames], {xmlel, <<"item">>, [{<<"jid">>, jid:to_string(jid:make(U, S, <<>>))}, {<<"name">>, Nick}, {<<"subscription">>, Subs}], - [{xmlel, <<"group">>, [], [{xmlcdata, Group}]}] + GroupEls }; build_roster_item(U, S, remove) -> {xmlel, <<"item">>,