diff options
author | Mickaël Rémond <mickael.remond@process-one.net> | 2006-07-05 09:26:52 +0000 |
---|---|---|
committer | Mickaël Rémond <mickael.remond@process-one.net> | 2006-07-05 09:26:52 +0000 |
commit | 9fdef5c15f749750430870cd2ec8177157184f27 (patch) | |
tree | 875bd35a8ddc475a61b15e89b660a34939586873 /src/mod_shared_roster.erl | |
parent | * src/mod_shared_roster.erl: Delete the shared roster group now (diff) |
* src/mod_shared_roster.erl: The logged user (self) is now removed from
the shared roster list (EJAB-110).
SVN Revision: 584
Diffstat (limited to 'src/mod_shared_roster.erl')
-rw-r--r-- | src/mod_shared_roster.erl | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/mod_shared_roster.erl b/src/mod_shared_roster.erl index 711cae25..7477d31c 100644 --- a/src/mod_shared_roster.erl +++ b/src/mod_shared_roster.erl @@ -75,14 +75,22 @@ stop(Host) -> get_user_roster(Items, US) -> {U, S} = US, DisplayedGroups = get_user_displayed_groups(US), + %% Get shared roster users in all groups and remove self: SRUsers = lists:foldl( fun(Group, Acc1) -> lists:foldl( fun(User, Acc2) -> - dict:append(User, get_group_name(S, Group), Acc2) + if User == US -> Acc2; + true -> dict:append(User, + get_group_name(S, Group), + Acc2) + end end, Acc1, get_group_users(S, Group)) end, dict:new(), DisplayedGroups), + + %% If partially subscribed users are also in shared roster, show them as + %% totally subscribed: {NewItems1, SRUsersRest} = lists:mapfoldl( fun(Item, SRUsers1) -> @@ -96,6 +104,8 @@ get_user_roster(Items, US) -> {Item, SRUsers1} end end, SRUsers, Items), + + %% Export items in roster format: SRItems = [#roster{usj = {U, S, {U1, S1, ""}}, us = US, jid = {U1, S1, ""}, |