summaryrefslogtreecommitdiff
path: root/src/mod_shared_roster_ldap.erl
diff options
context:
space:
mode:
authorLinus Jahn <lnj@kaidan.im>2022-07-16 23:23:48 +0200
committerbadlop <badlop@gmail.com>2022-08-11 12:45:20 +0200
commitd6b72f1c5dba891d6d1bb4a24bb297170b130a73 (patch)
tree8a7f2f8c097896001016b93480324c2107c3e9f0 /src/mod_shared_roster_ldap.erl
parentmod_roster: Respect MIX <annotate/> setting (diff)
mod_roster: Change hook type from #roster{} to #roster_item{}
The problem with #roster{} is that every new record entry is also stored in the mnesia roster table. Adding the mix_participant_id there makes no sense because the normal roster items are no MIX channels. Using \#roster_item{} for the hook and #roster{} for storing the normal items seems to be a better idea.
Diffstat (limited to '')
-rw-r--r--src/mod_shared_roster_ldap.erl11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/mod_shared_roster_ldap.erl b/src/mod_shared_roster_ldap.erl
index 216dd4ce..2b4ec1da 100644
--- a/src/mod_shared_roster_ldap.erl
+++ b/src/mod_shared_roster_ldap.erl
@@ -109,8 +109,8 @@ depends(_Host, _Opts) ->
%%--------------------------------------------------------------------
%% Hooks
%%--------------------------------------------------------------------
--spec get_user_roster([#roster{}], {binary(), binary()}) -> [#roster{}].
-get_user_roster(Items, {U, S} = US) ->
+-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) ->
@@ -135,10 +135,9 @@ get_user_roster(Items, {U, S} = US) ->
end
end,
SRUsers, Items),
- SRItems = [#roster{usj = {U, S, {U1, S1, <<"">>}},
- us = US, jid = {U1, S1, <<"">>},
- name = get_user_name(U1, S1), subscription = both,
- ask = none, groups = GroupNames}
+ SRItems = [#roster_item{jid = jid:make(U1, S1),
+ name = get_user_name(U1, S1), subscription = both,
+ ask = undefined, groups = GroupNames}
|| {{U1, S1}, GroupNames} <- dict:to_list(SRUsersRest)],
SRItems ++ NewItems1.