diff options
author | Badlop <badlop@process-one.net> | 2018-12-21 14:46:54 +0100 |
---|---|---|
committer | Badlop <badlop@process-one.net> | 2018-12-21 15:15:00 +0100 |
commit | 011cf55eb569046ece4383d0f4710c0f9183988d (patch) | |
tree | 3fb183eab6d571ee4b5312943f1728a9f6bc8f56 /src | |
parent | We are handling groupchat in other branch now (diff) |
Handle persist=false in roster items (#2722)
Diffstat (limited to 'src')
-rw-r--r-- | src/prosody2ejabberd.erl | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/src/prosody2ejabberd.erl b/src/prosody2ejabberd.erl index e9b77e8e3..663d01f69 100644 --- a/src/prosody2ejabberd.erl +++ b/src/prosody2ejabberd.erl @@ -307,22 +307,24 @@ convert_roster_item(LUser, LServer, JIDstring, LuaList) -> InitR = #roster{usj = {LUser, LServer, LJID}, us = {LUser, LServer}, jid = LJID}, - Roster = - lists:foldl( - fun({<<"groups">>, Val}, R) -> + lists:foldl( + fun({<<"groups">>, Val}, [R]) -> Gs = lists:flatmap( fun({G, true}) -> [G]; (_) -> [] end, Val), - R#roster{groups = Gs}; - ({<<"subscription">>, Sub}, R) -> - R#roster{subscription = misc:binary_to_atom(Sub)}; - ({<<"ask">>, <<"subscribe">>}, R) -> - R#roster{ask = out}; - ({<<"name">>, Name}, R) -> - R#roster{name = Name} - end, InitR, LuaList), - [Roster] + [R#roster{groups = Gs}]; + ({<<"subscription">>, Sub}, [R]) -> + [R#roster{subscription = misc:binary_to_atom(Sub)}]; + ({<<"ask">>, <<"subscribe">>}, [R]) -> + [R#roster{ask = out}]; + ({<<"name">>, Name}, [R]) -> + [R#roster{name = Name}]; + ({<<"persist">>, false}, _) -> + []; + (_, []) -> + [] + end, [InitR], LuaList) catch _:{bad_jid, _} -> [] end. |