Software /
code /
prosody-modules
Diff
mod_bookmarks/mod_bookmarks.lua @ 3235:bd8e94ff726b
mod_bookmarks: Expose publish_to_pep() to other modules.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Sat, 18 Aug 2018 17:25:44 +0100 |
parent | 3234:b1e25943a004 |
child | 3238:786ba175f2e5 |
line wrap: on
line diff
--- a/mod_bookmarks/mod_bookmarks.lua Sat Aug 18 16:55:52 2018 +0100 +++ b/mod_bookmarks/mod_bookmarks.lua Sat Aug 18 17:25:44 2018 +0100 @@ -42,8 +42,8 @@ return true; end -local function publish_to_pep(username, jid, bookmarks) - local service = mod_pep.get_pep_service(username); +function publish_to_pep(jid, bookmarks) + local service = mod_pep.get_pep_service(jid_split(jid)); local item = st.stanza("item", { xmlns = "http://jabber.org/protocol/pubsub", id = "current" }) :add_child(bookmarks); local options = { @@ -67,7 +67,7 @@ end module:log("debug", "Private bookmarks set by client, publishing to pep"); - local ok, err = publish_to_pep(session.username, session.full_jid, bookmarks); + local ok, err = publish_to_pep(session.full_jid, bookmarks); if not ok then module:log("error", "Failed to publish to PEP bookmarks for %s: %s", session.username, err); session.send(st.error_reply(stanza, "cancel", "internal-server-error", "Failed to store bookmarks to PEP")); @@ -97,7 +97,7 @@ module:log("debug", "Got private bookmarks of %s: %s", username, bookmarks); module:log("debug", "Going to store PEP item for %s", username); - local ok, err = publish_to_pep(username, session.host, bookmarks); + local ok, err = publish_to_pep(session.full_jid, bookmarks); if not ok then module:log("error", "Failed to store bookmarks to PEP for %s, aborting migration: %s", username, err); return;