Mercurial > prosody-modules
annotate mod_bookmarks/mod_bookmarks.lua @ 3229:e8963e328b26
mod_bookmarks: New module synchronising bookmarks to the new persistent mod_pep
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Sat, 18 Aug 2018 13:48:45 +0100 |
parents | |
children | ba0d444b64aa |
rev | line source |
---|---|
3229
e8963e328b26
mod_bookmarks: New module synchronising bookmarks to the new persistent mod_pep
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
1 local st = require "util.stanza" |
e8963e328b26
mod_bookmarks: New module synchronising bookmarks to the new persistent mod_pep
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
2 |
e8963e328b26
mod_bookmarks: New module synchronising bookmarks to the new persistent mod_pep
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
3 local mod_pep = module:depends "pep"; |
e8963e328b26
mod_bookmarks: New module synchronising bookmarks to the new persistent mod_pep
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
4 local private_storage = module:open_store("private", "map"); |
e8963e328b26
mod_bookmarks: New module synchronising bookmarks to the new persistent mod_pep
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
5 |
e8963e328b26
mod_bookmarks: New module synchronising bookmarks to the new persistent mod_pep
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
6 module:hook("account-disco-info", function (event) |
e8963e328b26
mod_bookmarks: New module synchronising bookmarks to the new persistent mod_pep
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
7 event.reply:tag("feature", { var = "urn:xmpp:bookmarks-conversion:0" }):up(); |
e8963e328b26
mod_bookmarks: New module synchronising bookmarks to the new persistent mod_pep
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
8 end); |
e8963e328b26
mod_bookmarks: New module synchronising bookmarks to the new persistent mod_pep
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
9 |
e8963e328b26
mod_bookmarks: New module synchronising bookmarks to the new persistent mod_pep
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
10 local function on_retrieve_private_xml(event) |
e8963e328b26
mod_bookmarks: New module synchronising bookmarks to the new persistent mod_pep
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
11 local stanza, session = event.stanza, event.origin; |
e8963e328b26
mod_bookmarks: New module synchronising bookmarks to the new persistent mod_pep
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
12 local query = stanza:get_child("query", "jabber:iq:private"); |
e8963e328b26
mod_bookmarks: New module synchronising bookmarks to the new persistent mod_pep
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
13 if query == nil then |
e8963e328b26
mod_bookmarks: New module synchronising bookmarks to the new persistent mod_pep
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
14 return; |
e8963e328b26
mod_bookmarks: New module synchronising bookmarks to the new persistent mod_pep
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
15 end |
e8963e328b26
mod_bookmarks: New module synchronising bookmarks to the new persistent mod_pep
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
16 |
e8963e328b26
mod_bookmarks: New module synchronising bookmarks to the new persistent mod_pep
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
17 local bookmarks = query:get_child("storage", "storage:bookmarks"); |
e8963e328b26
mod_bookmarks: New module synchronising bookmarks to the new persistent mod_pep
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
18 if bookmarks == nil then |
e8963e328b26
mod_bookmarks: New module synchronising bookmarks to the new persistent mod_pep
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
19 return; |
e8963e328b26
mod_bookmarks: New module synchronising bookmarks to the new persistent mod_pep
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
20 end |
e8963e328b26
mod_bookmarks: New module synchronising bookmarks to the new persistent mod_pep
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
21 |
e8963e328b26
mod_bookmarks: New module synchronising bookmarks to the new persistent mod_pep
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
22 module:log("debug", "Getting private %s", bookmarks); |
e8963e328b26
mod_bookmarks: New module synchronising bookmarks to the new persistent mod_pep
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
23 |
e8963e328b26
mod_bookmarks: New module synchronising bookmarks to the new persistent mod_pep
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
24 local username = session.username; |
e8963e328b26
mod_bookmarks: New module synchronising bookmarks to the new persistent mod_pep
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
25 local service = mod_pep.get_pep_service(username); |
e8963e328b26
mod_bookmarks: New module synchronising bookmarks to the new persistent mod_pep
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
26 module:log("debug", "%s", session.full_jid); |
e8963e328b26
mod_bookmarks: New module synchronising bookmarks to the new persistent mod_pep
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
27 local ok, id = service:get_last_item("storage:bookmarks", session.full_jid); |
e8963e328b26
mod_bookmarks: New module synchronising bookmarks to the new persistent mod_pep
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
28 if not ok then |
e8963e328b26
mod_bookmarks: New module synchronising bookmarks to the new persistent mod_pep
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
29 module:log("error", "Failed to PEP bookmarks’ last id of %s: %s", username, id); |
e8963e328b26
mod_bookmarks: New module synchronising bookmarks to the new persistent mod_pep
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
30 session.send(st.error_reply(stanza, "cancel", "internal-server-error", "Failed to retrive bookmarks from PEP")); |
e8963e328b26
mod_bookmarks: New module synchronising bookmarks to the new persistent mod_pep
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
31 return; |
e8963e328b26
mod_bookmarks: New module synchronising bookmarks to the new persistent mod_pep
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
32 end |
e8963e328b26
mod_bookmarks: New module synchronising bookmarks to the new persistent mod_pep
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
33 |
e8963e328b26
mod_bookmarks: New module synchronising bookmarks to the new persistent mod_pep
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
34 local ok, data = service:get_items("storage:bookmarks", session.full_jid, id); |
e8963e328b26
mod_bookmarks: New module synchronising bookmarks to the new persistent mod_pep
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
35 if not ok then |
e8963e328b26
mod_bookmarks: New module synchronising bookmarks to the new persistent mod_pep
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
36 module:log("error", "Failed to retrieve PEP bookmarks of %s: %s", username, data); |
e8963e328b26
mod_bookmarks: New module synchronising bookmarks to the new persistent mod_pep
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
37 session.send(st.error_reply(stanza, "cancel", "internal-server-error", "Failed to retrive bookmarks from PEP")); |
e8963e328b26
mod_bookmarks: New module synchronising bookmarks to the new persistent mod_pep
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
38 return; |
e8963e328b26
mod_bookmarks: New module synchronising bookmarks to the new persistent mod_pep
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
39 end |
e8963e328b26
mod_bookmarks: New module synchronising bookmarks to the new persistent mod_pep
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
40 |
e8963e328b26
mod_bookmarks: New module synchronising bookmarks to the new persistent mod_pep
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
41 local item = data[id]; |
e8963e328b26
mod_bookmarks: New module synchronising bookmarks to the new persistent mod_pep
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
42 local content = item.tags[1]; |
e8963e328b26
mod_bookmarks: New module synchronising bookmarks to the new persistent mod_pep
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
43 module:log("debug", "Sending back private for %s: %s", username, content); |
e8963e328b26
mod_bookmarks: New module synchronising bookmarks to the new persistent mod_pep
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
44 session.send(st.reply(stanza):query("jabber:iq:private"):add_child(content)); |
e8963e328b26
mod_bookmarks: New module synchronising bookmarks to the new persistent mod_pep
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
45 return true; |
e8963e328b26
mod_bookmarks: New module synchronising bookmarks to the new persistent mod_pep
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
46 end |
e8963e328b26
mod_bookmarks: New module synchronising bookmarks to the new persistent mod_pep
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
47 |
e8963e328b26
mod_bookmarks: New module synchronising bookmarks to the new persistent mod_pep
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
48 local function publish_to_pep(username, jid, bookmarks) |
e8963e328b26
mod_bookmarks: New module synchronising bookmarks to the new persistent mod_pep
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
49 local service = mod_pep.get_pep_service(username); |
e8963e328b26
mod_bookmarks: New module synchronising bookmarks to the new persistent mod_pep
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
50 local item = st.stanza("item", { xmlns = "http://jabber.org/protocol/pubsub", id = "current" }) |
e8963e328b26
mod_bookmarks: New module synchronising bookmarks to the new persistent mod_pep
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
51 :add_child(bookmarks); |
e8963e328b26
mod_bookmarks: New module synchronising bookmarks to the new persistent mod_pep
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
52 return service:publish("storage:bookmarks", jid, "current", item); |
e8963e328b26
mod_bookmarks: New module synchronising bookmarks to the new persistent mod_pep
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
53 end |
e8963e328b26
mod_bookmarks: New module synchronising bookmarks to the new persistent mod_pep
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
54 |
e8963e328b26
mod_bookmarks: New module synchronising bookmarks to the new persistent mod_pep
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
55 -- Synchronise Private XML to PEP. |
e8963e328b26
mod_bookmarks: New module synchronising bookmarks to the new persistent mod_pep
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
56 local function on_publish_private_xml(event) |
e8963e328b26
mod_bookmarks: New module synchronising bookmarks to the new persistent mod_pep
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
57 local stanza, session = event.stanza, event.origin; |
e8963e328b26
mod_bookmarks: New module synchronising bookmarks to the new persistent mod_pep
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
58 local query = stanza:get_child("query", "jabber:iq:private"); |
e8963e328b26
mod_bookmarks: New module synchronising bookmarks to the new persistent mod_pep
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
59 if query == nil then |
e8963e328b26
mod_bookmarks: New module synchronising bookmarks to the new persistent mod_pep
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
60 return; |
e8963e328b26
mod_bookmarks: New module synchronising bookmarks to the new persistent mod_pep
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
61 end |
e8963e328b26
mod_bookmarks: New module synchronising bookmarks to the new persistent mod_pep
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
62 |
e8963e328b26
mod_bookmarks: New module synchronising bookmarks to the new persistent mod_pep
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
63 local bookmarks = query:get_child("storage", "storage:bookmarks"); |
e8963e328b26
mod_bookmarks: New module synchronising bookmarks to the new persistent mod_pep
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
64 if bookmarks == nil then |
e8963e328b26
mod_bookmarks: New module synchronising bookmarks to the new persistent mod_pep
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
65 return; |
e8963e328b26
mod_bookmarks: New module synchronising bookmarks to the new persistent mod_pep
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
66 end |
e8963e328b26
mod_bookmarks: New module synchronising bookmarks to the new persistent mod_pep
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
67 |
e8963e328b26
mod_bookmarks: New module synchronising bookmarks to the new persistent mod_pep
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
68 module:log("debug", "Private bookmarks set by client, publishing to pep"); |
e8963e328b26
mod_bookmarks: New module synchronising bookmarks to the new persistent mod_pep
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
69 local ok, err = publish_to_pep(session.username, session.full_jid, bookmarks); |
e8963e328b26
mod_bookmarks: New module synchronising bookmarks to the new persistent mod_pep
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
70 if not ok then |
e8963e328b26
mod_bookmarks: New module synchronising bookmarks to the new persistent mod_pep
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
71 module:log("error", "Failed to publish to PEP bookmarks for %s: %s", session.username, err); |
e8963e328b26
mod_bookmarks: New module synchronising bookmarks to the new persistent mod_pep
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
72 session.send(st.error_reply(stanza, "cancel", "internal-server-error", "Failed to store bookmarks to PEP")); |
e8963e328b26
mod_bookmarks: New module synchronising bookmarks to the new persistent mod_pep
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
73 return; |
e8963e328b26
mod_bookmarks: New module synchronising bookmarks to the new persistent mod_pep
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
74 end |
e8963e328b26
mod_bookmarks: New module synchronising bookmarks to the new persistent mod_pep
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
75 |
e8963e328b26
mod_bookmarks: New module synchronising bookmarks to the new persistent mod_pep
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
76 session.send(st.reply(stanza)); |
e8963e328b26
mod_bookmarks: New module synchronising bookmarks to the new persistent mod_pep
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
77 return true; |
e8963e328b26
mod_bookmarks: New module synchronising bookmarks to the new persistent mod_pep
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
78 end |
e8963e328b26
mod_bookmarks: New module synchronising bookmarks to the new persistent mod_pep
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
79 |
e8963e328b26
mod_bookmarks: New module synchronising bookmarks to the new persistent mod_pep
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
80 local function on_resource_bind(event) |
e8963e328b26
mod_bookmarks: New module synchronising bookmarks to the new persistent mod_pep
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
81 local session = event.session; |
e8963e328b26
mod_bookmarks: New module synchronising bookmarks to the new persistent mod_pep
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
82 local username = session.username; |
e8963e328b26
mod_bookmarks: New module synchronising bookmarks to the new persistent mod_pep
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
83 |
e8963e328b26
mod_bookmarks: New module synchronising bookmarks to the new persistent mod_pep
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
84 local data, err = private_storage:get(username, "storage:storage:bookmarks"); |
e8963e328b26
mod_bookmarks: New module synchronising bookmarks to the new persistent mod_pep
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
85 if not data then |
e8963e328b26
mod_bookmarks: New module synchronising bookmarks to the new persistent mod_pep
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
86 module:log("debug", "No existing Private XML bookmarks for %s, migration already done: %s", username, err); |
e8963e328b26
mod_bookmarks: New module synchronising bookmarks to the new persistent mod_pep
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
87 return; |
e8963e328b26
mod_bookmarks: New module synchronising bookmarks to the new persistent mod_pep
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
88 end |
e8963e328b26
mod_bookmarks: New module synchronising bookmarks to the new persistent mod_pep
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
89 local bookmarks = st.deserialize(data); |
e8963e328b26
mod_bookmarks: New module synchronising bookmarks to the new persistent mod_pep
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
90 module:log("debug", "Got private bookmarks of %s: %s", username, bookmarks); |
e8963e328b26
mod_bookmarks: New module synchronising bookmarks to the new persistent mod_pep
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
91 |
e8963e328b26
mod_bookmarks: New module synchronising bookmarks to the new persistent mod_pep
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
92 module:log("debug", "Going to store PEP item for %s", username); |
e8963e328b26
mod_bookmarks: New module synchronising bookmarks to the new persistent mod_pep
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
93 local ok, err = publish_to_pep(username, session.host, bookmarks); |
e8963e328b26
mod_bookmarks: New module synchronising bookmarks to the new persistent mod_pep
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
94 if not ok then |
e8963e328b26
mod_bookmarks: New module synchronising bookmarks to the new persistent mod_pep
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
95 module:log("error", "Failed to store bookmarks to PEP for %s, aborting migration: %s", username, err); |
e8963e328b26
mod_bookmarks: New module synchronising bookmarks to the new persistent mod_pep
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
96 return; |
e8963e328b26
mod_bookmarks: New module synchronising bookmarks to the new persistent mod_pep
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
97 end |
e8963e328b26
mod_bookmarks: New module synchronising bookmarks to the new persistent mod_pep
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
98 module:log("debug", "Stored bookmarks to PEP for %s", username); |
e8963e328b26
mod_bookmarks: New module synchronising bookmarks to the new persistent mod_pep
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
99 |
e8963e328b26
mod_bookmarks: New module synchronising bookmarks to the new persistent mod_pep
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
100 local ok, err = private_storage:set(username, "storage:storage:bookmarks", nil); |
e8963e328b26
mod_bookmarks: New module synchronising bookmarks to the new persistent mod_pep
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
101 if not ok then |
e8963e328b26
mod_bookmarks: New module synchronising bookmarks to the new persistent mod_pep
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
102 module:log("error", "Failed to remove private bookmarks of %s: %s", username, err); |
e8963e328b26
mod_bookmarks: New module synchronising bookmarks to the new persistent mod_pep
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
103 return; |
e8963e328b26
mod_bookmarks: New module synchronising bookmarks to the new persistent mod_pep
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
104 end |
e8963e328b26
mod_bookmarks: New module synchronising bookmarks to the new persistent mod_pep
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
105 module:log("debug", "Removed private bookmarks of %s, migration done!", username); |
e8963e328b26
mod_bookmarks: New module synchronising bookmarks to the new persistent mod_pep
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
106 end |
e8963e328b26
mod_bookmarks: New module synchronising bookmarks to the new persistent mod_pep
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
107 |
e8963e328b26
mod_bookmarks: New module synchronising bookmarks to the new persistent mod_pep
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
108 module:hook("iq-get/bare/jabber:iq:private:query", on_retrieve_private_xml) |
e8963e328b26
mod_bookmarks: New module synchronising bookmarks to the new persistent mod_pep
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
109 module:hook("iq-set/bare/jabber:iq:private:query", on_publish_private_xml) |
e8963e328b26
mod_bookmarks: New module synchronising bookmarks to the new persistent mod_pep
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
110 module:hook("resource-bind", on_resource_bind) |