25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-12-22 17:28:25 +01: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 * src/web/ejabberd_web_admin.erl: More flexible parsing the shared
roster members list from the configuration form. 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> 2006-06-19 Alexey Shchepin <alexey@sevcom.net>

View File

@ -197,8 +197,15 @@ create_group(Host, Group, Opts) ->
mnesia:transaction(F). mnesia:transaction(F).
delete_group(Host, Group) -> delete_group(Host, Group) ->
GroupHost = {Group, Host},
F = fun() -> 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, end,
mnesia:transaction(F). mnesia:transaction(F).
@ -297,7 +304,8 @@ add_user_to_group(Host, US, Group) ->
mnesia:transaction(F). mnesia:transaction(F).
remove_user_from_group(Host, US, Group) -> 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() -> F = fun() ->
mnesia:delete_object(R) mnesia:delete_object(R)
end, end,