]> granicus.if.org Git - ejabberd/commitdiff
Handle persist=false in roster items (#2722)
authorBadlop <badlop@process-one.net>
Fri, 21 Dec 2018 13:46:54 +0000 (14:46 +0100)
committerBadlop <badlop@process-one.net>
Fri, 21 Dec 2018 14:15:00 +0000 (15:15 +0100)
src/prosody2ejabberd.erl

index e9b77e8e3190a2957a9316fa547a1aad27f5ad80..663d01f69bca71a551582d55793fb16734337ca2 100644 (file)
@@ -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.