mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-30 16:36:29 +01:00
Handle persist=false in roster items (#2722)
This commit is contained in:
parent
e9d537527c
commit
011cf55eb5
@ -307,22 +307,24 @@ convert_roster_item(LUser, LServer, JIDstring, LuaList) ->
|
|||||||
InitR = #roster{usj = {LUser, LServer, LJID},
|
InitR = #roster{usj = {LUser, LServer, LJID},
|
||||||
us = {LUser, LServer},
|
us = {LUser, LServer},
|
||||||
jid = LJID},
|
jid = LJID},
|
||||||
Roster =
|
lists:foldl(
|
||||||
lists:foldl(
|
fun({<<"groups">>, Val}, [R]) ->
|
||||||
fun({<<"groups">>, Val}, R) ->
|
|
||||||
Gs = lists:flatmap(
|
Gs = lists:flatmap(
|
||||||
fun({G, true}) -> [G];
|
fun({G, true}) -> [G];
|
||||||
(_) -> []
|
(_) -> []
|
||||||
end, Val),
|
end, Val),
|
||||||
R#roster{groups = Gs};
|
[R#roster{groups = Gs}];
|
||||||
({<<"subscription">>, Sub}, R) ->
|
({<<"subscription">>, Sub}, [R]) ->
|
||||||
R#roster{subscription = misc:binary_to_atom(Sub)};
|
[R#roster{subscription = misc:binary_to_atom(Sub)}];
|
||||||
({<<"ask">>, <<"subscribe">>}, R) ->
|
({<<"ask">>, <<"subscribe">>}, [R]) ->
|
||||||
R#roster{ask = out};
|
[R#roster{ask = out}];
|
||||||
({<<"name">>, Name}, R) ->
|
({<<"name">>, Name}, [R]) ->
|
||||||
R#roster{name = Name}
|
[R#roster{name = Name}];
|
||||||
end, InitR, LuaList),
|
({<<"persist">>, false}, _) ->
|
||||||
[Roster]
|
[];
|
||||||
|
(_, []) ->
|
||||||
|
[]
|
||||||
|
end, [InitR], LuaList)
|
||||||
catch _:{bad_jid, _} ->
|
catch _:{bad_jid, _} ->
|
||||||
[]
|
[]
|
||||||
end.
|
end.
|
||||||
|
Loading…
Reference in New Issue
Block a user