25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-10-13 15:16:49 +02:00

* src/mod_shared_roster.erl: Delete the shared roster group now

correctly delete its user entries (EJAB-112).

SVN Revision: 583
This commit is contained in:
Mickaël Rémond 2006-07-05 08:52:21 +00:00
parent 230d66b168
commit 110c5290b2
2 changed files with 12 additions and 2 deletions

View File

@ -2,6 +2,8 @@
* src/web/ejabberd_web_admin.erl: More flexible parsing the shared
roster members list from the configuration form.
* src/mod_shared_roster.erl: Delete the shared roster group now
correctly delete its user entries.
2006-06-19 Alexey Shchepin <alexey@sevcom.net>

View File

@ -197,8 +197,15 @@ create_group(Host, Group, Opts) ->
mnesia:transaction(F).
delete_group(Host, Group) ->
GroupHost = {Group, Host},
F = fun() ->
mnesia:delete({sr_group, {Group, Host}})
%% Delete the group ...
mnesia:delete({sr_group, GroupHost}),
%% ... and its users
Users = mnesia:index_read(sr_user, GroupHost, #sr_user.group_host),
lists:foreach(fun(UserEntry) ->
mnesia:delete_object(UserEntry)
end, Users)
end,
mnesia:transaction(F).
@ -297,7 +304,8 @@ add_user_to_group(Host, US, Group) ->
mnesia:transaction(F).
remove_user_from_group(Host, US, Group) ->
R = #sr_user{us = US, group_host = {Group, Host}},
GroupHost = {Group, Host},
R = #sr_user{us = US, group_host = GroupHost},
F = fun() ->
mnesia:delete_object(R)
end,