comparison mod_bookmarks/mod_bookmarks.lua @ 3544:7893115bf382

mod_bookmarks: Return true when a stanza has been sent.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Tue, 02 Apr 2019 16:41:07 +0200
parents 11629f04ddd0
children 7575399ae544
comparison
equal deleted inserted replaced
3543:11629f04ddd0 3544:7893115bf382
37 session.send(st.reply(stanza):add_child(query)); 37 session.send(st.reply(stanza):add_child(query));
38 else 38 else
39 module:log("error", "Failed to retrieve PEP bookmarks of %s: %s", jid, id); 39 module:log("error", "Failed to retrieve PEP bookmarks of %s: %s", jid, id);
40 session.send(st.error_reply(stanza, "cancel", "internal-server-error", "Failed to retrive bookmarks from PEP")); 40 session.send(st.error_reply(stanza, "cancel", "internal-server-error", "Failed to retrive bookmarks from PEP"));
41 end 41 end
42 return; 42 return true;
43 end 43 end
44 if not id or not item then 44 if not id or not item then
45 module:log("debug", "Got no PEP bookmarks item for %s, returning empty private bookmarks", jid); 45 module:log("debug", "Got no PEP bookmarks item for %s, returning empty private bookmarks", jid);
46 session.send(st.reply(stanza):add_child(query)); 46 session.send(st.reply(stanza):add_child(query));
47 return 47 return true;
48 end 48 end
49 module:log("debug", "Got item %s: %s", id, item); 49 module:log("debug", "Got item %s: %s", id, item);
50 50
51 local content = item.tags[1]; 51 local content = item.tags[1];
52 module:log("debug", "Sending back private for %s: %s", jid, content); 52 module:log("debug", "Sending back private for %s: %s", jid, content);
77 module:log("debug", "Private bookmarks set by client, publishing to pep"); 77 module:log("debug", "Private bookmarks set by client, publishing to pep");
78 local ok, err = publish_to_pep(session.full_jid, bookmarks); 78 local ok, err = publish_to_pep(session.full_jid, bookmarks);
79 if not ok then 79 if not ok then
80 module:log("error", "Failed to publish to PEP bookmarks for %s@%s: %s", session.username, session.host, err); 80 module:log("error", "Failed to publish to PEP bookmarks for %s@%s: %s", session.username, session.host, err);
81 session.send(st.error_reply(stanza, "cancel", "internal-server-error", "Failed to store bookmarks to PEP")); 81 session.send(st.error_reply(stanza, "cancel", "internal-server-error", "Failed to store bookmarks to PEP"));
82 return; 82 return true;
83 end 83 end
84 84
85 session.send(st.reply(stanza)); 85 session.send(st.reply(stanza));
86 return true; 86 return true;
87 end 87 end