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) ->
|
||||
put(mod_private_pep_update, true),
|
||||
PepBookmarksMap = lists:foldl(fun pubsub_item_to_map/2, #{}, PepBookmarks),
|
||||
ToDelete =
|
||||
{ToDelete, Ret} =
|
||||
lists:foldl(
|
||||
fun(#bookmark_conference{jid = BookmarkJID} = Bookmark, Map2) ->
|
||||
fun(#bookmark_conference{jid = BookmarkJID} = Bookmark, {Map2, Ret2}) ->
|
||||
PB = storage_bookmark_to_xmpp_bookmark(Bookmark),
|
||||
case maps:take(jid:tolower(BookmarkJID), Map2) of
|
||||
{StoredBookmark, Map3} when StoredBookmark == PB ->
|
||||
Map3;
|
||||
{Map3, Ret2};
|
||||
{_, Map4} ->
|
||||
mod_pubsub:publish_item(
|
||||
LBJID, LServer, ?NS_PEP_BOOKMARKS, JID,
|
||||
jid:encode(BookmarkJID), [xmpp:encode(PB)], PubOpts, all),
|
||||
Map4;
|
||||
{Map4,
|
||||
err_ret(Ret2, mod_pubsub:publish_item(
|
||||
LBJID, LServer, ?NS_PEP_BOOKMARKS, JID,
|
||||
jid:encode(BookmarkJID), [xmpp:encode(PB)], PubOpts, all))};
|
||||
_ ->
|
||||
mod_pubsub:publish_item(
|
||||
LBJID, LServer, ?NS_PEP_BOOKMARKS, JID,
|
||||
jid:encode(BookmarkJID), [xmpp:encode(PB)], PubOpts, all),
|
||||
Map2
|
||||
{Map2,
|
||||
err_ret(Ret2, mod_pubsub:publish_item(
|
||||
LBJID, LServer, ?NS_PEP_BOOKMARKS, JID,
|
||||
jid:encode(BookmarkJID), [xmpp:encode(PB)], PubOpts, all))}
|
||||
end
|
||||
end, PepBookmarksMap, Bookmarks),
|
||||
end, {PepBookmarksMap, ok}, Bookmarks),
|
||||
Ret4 =
|
||||
maps:fold(
|
||||
fun(DeleteJid, _, _) ->
|
||||
mod_pubsub:delete_item(LBJID, ?NS_PEP_BOOKMARKS, JID, jid:encode(DeleteJid))
|
||||
end, ok, ToDelete),
|
||||
fun(DeleteJid, _, Ret3) ->
|
||||
err_ret(Ret3, mod_pubsub:delete_item(LBJID, ?NS_PEP_BOOKMARKS,
|
||||
JID, jid:encode(DeleteJid)))
|
||||
end, Ret, ToDelete),
|
||||
erase(mod_private_pep_update),
|
||||
ok;
|
||||
Ret4;
|
||||
{error, #stanza_error{reason = 'item-not-found'}} ->
|
||||
put(mod_private_pep_update, true),
|
||||
lists:foreach(
|
||||
fun(#bookmark_conference{jid = BookmarkJID} = Bookmark) ->
|
||||
Ret7 =
|
||||
lists:foldl(
|
||||
fun(#bookmark_conference{jid = BookmarkJID} = Bookmark, Ret5) ->
|
||||
PB = storage_bookmark_to_xmpp_bookmark(Bookmark),
|
||||
mod_pubsub:publish_item(
|
||||
err_ret(Ret5, mod_pubsub:publish_item(
|
||||
LBJID, LServer, ?NS_PEP_BOOKMARKS, JID,
|
||||
jid:encode(BookmarkJID), [xmpp:encode(PB)], PubOpts, all)
|
||||
end, Bookmarks),
|
||||
jid:encode(BookmarkJID), [xmpp:encode(PB)], PubOpts, all))
|
||||
end, ok, Bookmarks),
|
||||
erase(mod_private_pep_update),
|
||||
ok;
|
||||
Ret7;
|
||||
_ ->
|
||||
ok
|
||||
end;
|
||||
@ -374,6 +377,11 @@ publish_pep_xmpp_bookmarks(JID, Data) ->
|
||||
ok
|
||||
end.
|
||||
|
||||
err_ret({error, _} = E, _) ->
|
||||
E;
|
||||
err_ret(ok, E) ->
|
||||
E.
|
||||
|
||||
-spec pubsub_publish_item(binary(), binary(), jid(), jid(),
|
||||
binary(), [xmlel()]) -> any().
|
||||
pubsub_publish_item(LServer, ?NS_STORAGE_BOOKMARKS,
|
||||
|
Loading…
Reference in New Issue
Block a user