summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaweł Chmielowski <pawel@process-one.net>2022-08-24 11:14:32 +0200
committerPaweł Chmielowski <pawel@process-one.net>2022-08-24 11:14:32 +0200
commitcfc8746d29c42ca252a2104bf537629fa704b502 (patch)
tree8ce9f70cccd9086d87b879abada4af056e2e9839
parentFix mucsub unsubscribe notification payload to have muc_unsubcribe in it (diff)
Update roster_get hook in mod_shared_roster_ldap to use #roster_item{}
-rw-r--r--src/mod_shared_roster_ldap.erl37
1 files changed, 14 insertions, 23 deletions
diff --git a/src/mod_shared_roster_ldap.erl b/src/mod_shared_roster_ldap.erl
index 2b4ec1da..36ed63c9 100644
--- a/src/mod_shared_roster_ldap.erl
+++ b/src/mod_shared_roster_ldap.erl
@@ -112,29 +112,20 @@ depends(_Host, _Opts) ->
-spec get_user_roster([#roster_item{}], {binary(), binary()}) -> [#roster_item{}].
get_user_roster(Items, US) ->
SRUsers = get_user_to_groups_map(US, true),
- {NewItems1, SRUsersRest} = lists:mapfoldl(fun (Item,
- SRUsers1) ->
- {_, _, {U1, S1, _}} =
- Item#roster.usj,
- US1 = {U1, S1},
- case dict:find(US1,
- SRUsers1)
- of
- {ok, GroupNames} ->
- {Item#roster{subscription
- =
- both,
- groups =
- Item#roster.groups ++ GroupNames,
- ask =
- none},
- dict:erase(US1,
- SRUsers1)};
- error ->
- {Item, SRUsers1}
- end
- end,
- SRUsers, Items),
+ {NewItems1, SRUsersRest} = lists:mapfoldl(
+ fun(Item = #roster_item{jid = #jid{luser = U1, lserver = S1}}, SRUsers1) ->
+ US1 = {U1, S1},
+ case dict:find(US1, SRUsers1) of
+ {ok, GroupNames} ->
+ {Item#roster_item{subscription = both,
+ groups = Item#roster_item.groups ++ GroupNames,
+ ask = none},
+ dict:erase(US1, SRUsers1)};
+ error ->
+ {Item, SRUsers1}
+ end
+ end,
+ SRUsers, Items),
SRItems = [#roster_item{jid = jid:make(U1, S1),
name = get_user_name(U1, S1), subscription = both,
ask = undefined, groups = GroupNames}