]> granicus.if.org Git - ejabberd/commitdiff
Support several groups separated by ; in add_rosteritem command
authorBadlop <badlop@process-one.net>
Fri, 4 Nov 2016 17:44:15 +0000 (18:44 +0100)
committerBadlop <badlop@process-one.net>
Fri, 4 Nov 2016 17:45:27 +0000 (18:45 +0100)
src/mod_admin_extra.erl

index 8ce11b8722db122d6793a630eca887b27f513629..48732ea35c4a60ae1e27c1a180757091f784619a 100644 (file)
@@ -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">>,