Software /
code /
prosody-modules
Comparison
mod_default_bookmarks/mod_default_bookmarks.lua @ 4858:727f147aac4d
mod_default_bookmarks: Minor refactor to do some checks earlier
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sat, 08 Jan 2022 02:21:54 +0100 |
parent | 4857:3f6711c1c66a |
child | 4859:33208c3ae586 |
comparison
equal
deleted
inserted
replaced
4857:3f6711c1c66a | 4858:727f147aac4d |
---|---|
51 return reply; | 51 return reply; |
52 end | 52 end |
53 | 53 |
54 if mod_bookmarks_available then | 54 if mod_bookmarks_available then |
55 local mod_bookmarks = module:depends(mod_bookmarks_available); | 55 local mod_bookmarks = module:depends(mod_bookmarks_available); |
56 local function on_bookmarks_empty(event) | 56 if mod_bookmarks.publish_to_pep then |
57 local session = event.session; | 57 local function on_bookmarks_empty(event) |
58 if mod_bookmarks.publish_to_pep then | 58 local session = event.session; |
59 local bookmarks = get_default_bookmarks(session.username); | 59 local bookmarks = get_default_bookmarks(session.username); |
60 if bookmarks then | 60 if bookmarks then |
61 mod_bookmarks.publish_to_pep(session.full_jid, bookmarks); | 61 mod_bookmarks.publish_to_pep(session.full_jid, bookmarks); |
62 end | 62 end |
63 else | |
64 module:log("error", "Method for publishing legacy bookmarks not exposed by mod_bookmarks") | |
65 end | 63 end |
64 module:hook("bookmarks/empty", on_bookmarks_empty); | |
65 else | |
66 module:log("error", "Method for publishing legacy bookmarks not exposed by mod_bookmarks") | |
66 end | 67 end |
67 module:hook("bookmarks/empty", on_bookmarks_empty); | |
68 else | 68 else |
69 local function on_private_xml_get(event) | 69 local function on_private_xml_get(event) |
70 local origin, stanza = event.origin, event.stanza; | 70 local origin, stanza = event.origin, event.stanza; |
71 local tag = stanza.tags[1].tags[1]; | 71 local tag = stanza.tags[1].tags[1]; |
72 local key = tag.name..":"..tag.attr.xmlns; | 72 local key = tag.name..":"..tag.attr.xmlns; |