mirror of
https://github.com/processone/ejabberd.git
synced 2024-12-30 17:43:57 +01:00
Support several groups separated by ; in add_rosteritem command
This commit is contained in:
parent
49d3b7ec1d
commit
bd060bc1bb
@ -377,6 +377,7 @@ get_commands_spec() ->
|
|||||||
|
|
||||||
#ejabberd_commands{name = add_rosteritem, tags = [roster],
|
#ejabberd_commands{name = add_rosteritem, tags = [roster],
|
||||||
desc = "Add an item to a user's roster (supports ODBC)",
|
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,
|
module = ?MODULE, function = add_rosteritem,
|
||||||
args = [{localuser, binary}, {localserver, binary},
|
args = [{localuser, binary}, {localserver, binary},
|
||||||
{user, binary}, {server, 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).
|
ejabberd_router:route(jid:remove_resource(LJID), LJID, ResIQ).
|
||||||
|
|
||||||
build_roster_item(U, S, {add, Nick, Subs, Group}) ->
|
build_roster_item(U, S, {add, Nick, Subs, Group}) ->
|
||||||
|
GNames = binary:split(Group,<<";">>, [global]),
|
||||||
|
GroupEls = [{xmlel, <<"group">>, [], [{xmlcdata, GName}]} || GName <- GNames],
|
||||||
{xmlel, <<"item">>,
|
{xmlel, <<"item">>,
|
||||||
[{<<"jid">>, jid:to_string(jid:make(U, S, <<>>))},
|
[{<<"jid">>, jid:to_string(jid:make(U, S, <<>>))},
|
||||||
{<<"name">>, Nick},
|
{<<"name">>, Nick},
|
||||||
{<<"subscription">>, Subs}],
|
{<<"subscription">>, Subs}],
|
||||||
[{xmlel, <<"group">>, [], [{xmlcdata, Group}]}]
|
GroupEls
|
||||||
};
|
};
|
||||||
build_roster_item(U, S, remove) ->
|
build_roster_item(U, S, remove) ->
|
||||||
{xmlel, <<"item">>,
|
{xmlel, <<"item">>,
|
||||||
|
Loading…
Reference in New Issue
Block a user