I want to have a custom Ejabberd registry mechanism, and as I test, I try to set arbitrary data to the user's friend list.
I replaced the contents of the get_user_roster function in the mod_roster.erl file with a hard-coded element, but it still does not appear on the client. I know that the method works, there are no errors.
Is there anything else I need to override? or is my code wrong? Any insight would be appreciated.
My code is shown below:
get_user_roster(Acc, US) ->
?INFO_MSG("Mod Roster get_user_roster ~p XX ~p XX ~p XX ~p",[Acc, US, roster, #roster.us]),
#roster{us = US, jid = "test#localhost", name = "Test Name", subscription = "both", ask = "none", askmessage = "ASk Message"},
case catch mnesia:dirty_index_read(roster, US, #roster.us) of
Items when is_list(Items) ->
?INFO_MSG("Mod Roster get_user_roster items ~p",[Items]),
FItems = lists:filter(fun(#roster{subscription = none, ask = in}) -> false; (_) -> true end, Items),
?INFO_MSG("Mod Roster get_user_roster fitems ~p",[FItems]),
FItems ++ Acc;
_ ->
?INFO_MSG("No Items",[]),
Acc
end.
source
share