aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMickaël Rémond <mickael.remond@process-one.net>2006-07-05 08:52:21 +0000
committerMickaël Rémond <mickael.remond@process-one.net>2006-07-05 08:52:21 +0000
commit110c5290b23c505139850ae51042e50ad36a2d29 (patch)
tree3616ef96d52a376d58035a85c2844228a321c469 /src
parent* src/web/ejabberd_web_admin.erl: More flexible parsing the shared (diff)
* src/mod_shared_roster.erl: Delete the shared roster group now
correctly delete its user entries (EJAB-112). SVN Revision: 583
Diffstat (limited to 'src')
-rw-r--r--src/mod_shared_roster.erl12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/mod_shared_roster.erl b/src/mod_shared_roster.erl
index e6b18c5a4..711cae25f 100644
--- a/src/mod_shared_roster.erl
+++ b/src/mod_shared_roster.erl
@@ -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,