mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-24 16:23:40 +01:00
Fix dialyzer warning
This commit is contained in:
parent
5406693a1e
commit
9ba645503b
@ -328,42 +328,45 @@ publish_pep_xmpp_bookmarks(JID, Data) ->
|
|||||||
PepBookmarks when is_list(PepBookmarks) ->
|
PepBookmarks when is_list(PepBookmarks) ->
|
||||||
put(mod_private_pep_update, true),
|
put(mod_private_pep_update, true),
|
||||||
PepBookmarksMap = lists:foldl(fun pubsub_item_to_map/2, #{}, PepBookmarks),
|
PepBookmarksMap = lists:foldl(fun pubsub_item_to_map/2, #{}, PepBookmarks),
|
||||||
ToDelete =
|
{ToDelete, Ret} =
|
||||||
lists:foldl(
|
lists:foldl(
|
||||||
fun(#bookmark_conference{jid = BookmarkJID} = Bookmark, Map2) ->
|
fun(#bookmark_conference{jid = BookmarkJID} = Bookmark, {Map2, Ret2}) ->
|
||||||
PB = storage_bookmark_to_xmpp_bookmark(Bookmark),
|
PB = storage_bookmark_to_xmpp_bookmark(Bookmark),
|
||||||
case maps:take(jid:tolower(BookmarkJID), Map2) of
|
case maps:take(jid:tolower(BookmarkJID), Map2) of
|
||||||
{StoredBookmark, Map3} when StoredBookmark == PB ->
|
{StoredBookmark, Map3} when StoredBookmark == PB ->
|
||||||
Map3;
|
{Map3, Ret2};
|
||||||
{_, Map4} ->
|
{_, Map4} ->
|
||||||
mod_pubsub:publish_item(
|
{Map4,
|
||||||
|
err_ret(Ret2, mod_pubsub:publish_item(
|
||||||
LBJID, LServer, ?NS_PEP_BOOKMARKS, JID,
|
LBJID, LServer, ?NS_PEP_BOOKMARKS, JID,
|
||||||
jid:encode(BookmarkJID), [xmpp:encode(PB)], PubOpts, all),
|
jid:encode(BookmarkJID), [xmpp:encode(PB)], PubOpts, all))};
|
||||||
Map4;
|
|
||||||
_ ->
|
_ ->
|
||||||
mod_pubsub:publish_item(
|
{Map2,
|
||||||
|
err_ret(Ret2, mod_pubsub:publish_item(
|
||||||
LBJID, LServer, ?NS_PEP_BOOKMARKS, JID,
|
LBJID, LServer, ?NS_PEP_BOOKMARKS, JID,
|
||||||
jid:encode(BookmarkJID), [xmpp:encode(PB)], PubOpts, all),
|
jid:encode(BookmarkJID), [xmpp:encode(PB)], PubOpts, all))}
|
||||||
Map2
|
|
||||||
end
|
end
|
||||||
end, PepBookmarksMap, Bookmarks),
|
end, {PepBookmarksMap, ok}, Bookmarks),
|
||||||
|
Ret4 =
|
||||||
maps:fold(
|
maps:fold(
|
||||||
fun(DeleteJid, _, _) ->
|
fun(DeleteJid, _, Ret3) ->
|
||||||
mod_pubsub:delete_item(LBJID, ?NS_PEP_BOOKMARKS, JID, jid:encode(DeleteJid))
|
err_ret(Ret3, mod_pubsub:delete_item(LBJID, ?NS_PEP_BOOKMARKS,
|
||||||
end, ok, ToDelete),
|
JID, jid:encode(DeleteJid)))
|
||||||
|
end, Ret, ToDelete),
|
||||||
erase(mod_private_pep_update),
|
erase(mod_private_pep_update),
|
||||||
ok;
|
Ret4;
|
||||||
{error, #stanza_error{reason = 'item-not-found'}} ->
|
{error, #stanza_error{reason = 'item-not-found'}} ->
|
||||||
put(mod_private_pep_update, true),
|
put(mod_private_pep_update, true),
|
||||||
lists:foreach(
|
Ret7 =
|
||||||
fun(#bookmark_conference{jid = BookmarkJID} = Bookmark) ->
|
lists:foldl(
|
||||||
|
fun(#bookmark_conference{jid = BookmarkJID} = Bookmark, Ret5) ->
|
||||||
PB = storage_bookmark_to_xmpp_bookmark(Bookmark),
|
PB = storage_bookmark_to_xmpp_bookmark(Bookmark),
|
||||||
mod_pubsub:publish_item(
|
err_ret(Ret5, mod_pubsub:publish_item(
|
||||||
LBJID, LServer, ?NS_PEP_BOOKMARKS, JID,
|
LBJID, LServer, ?NS_PEP_BOOKMARKS, JID,
|
||||||
jid:encode(BookmarkJID), [xmpp:encode(PB)], PubOpts, all)
|
jid:encode(BookmarkJID), [xmpp:encode(PB)], PubOpts, all))
|
||||||
end, Bookmarks),
|
end, ok, Bookmarks),
|
||||||
erase(mod_private_pep_update),
|
erase(mod_private_pep_update),
|
||||||
ok;
|
Ret7;
|
||||||
_ ->
|
_ ->
|
||||||
ok
|
ok
|
||||||
end;
|
end;
|
||||||
@ -374,6 +377,11 @@ publish_pep_xmpp_bookmarks(JID, Data) ->
|
|||||||
ok
|
ok
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
err_ret({error, _} = E, _) ->
|
||||||
|
E;
|
||||||
|
err_ret(ok, E) ->
|
||||||
|
E.
|
||||||
|
|
||||||
-spec pubsub_publish_item(binary(), binary(), jid(), jid(),
|
-spec pubsub_publish_item(binary(), binary(), jid(), jid(),
|
||||||
binary(), [xmlel()]) -> any().
|
binary(), [xmlel()]) -> any().
|
||||||
pubsub_publish_item(LServer, ?NS_STORAGE_BOOKMARKS,
|
pubsub_publish_item(LServer, ?NS_STORAGE_BOOKMARKS,
|
||||||
|
Loading…
Reference in New Issue
Block a user