comparison mod_bookmarks2/mod_bookmarks2.lua @ 4845:6e17df6becec

mod_bookmarks2: Actually fix the right wrong codepath
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Tue, 04 Jan 2022 22:59:24 +0100
parents cc17708ba777
children ad7767a9f3ea
comparison
equal deleted inserted replaced
4844:cc17708ba777 4845:6e17df6becec
80 local username = session.username; 80 local username = session.username;
81 local jid = username.."@"..session.host; 81 local jid = username.."@"..session.host;
82 local service = mod_pep.get_pep_service(username); 82 local service = mod_pep.get_pep_service(username);
83 local ok, ret = service:get_items(namespace, session.full_jid); 83 local ok, ret = service:get_items(namespace, session.full_jid);
84 if not ok then 84 if not ok then
85 if ret == "item-not-found" then 85 module:log("error", "Failed to retrieve PEP bookmarks of %s: %s", jid, ret);
86 module:log("debug", "Got no PEP bookmarks item for %s, returning empty legacy PEP bookmarks", jid); 86 session.send(st.error_reply(stanza, "cancel", ret, "Failed to retrive bookmarks from PEP"));
87 session.send(st.reply(stanza):add_child(query));
88 else
89 module:log("error", "Failed to retrieve PEP bookmarks of %s: %s", jid, ret);
90 session.send(st.error_reply(stanza, "cancel", ret, "Failed to retrive bookmarks from PEP"));
91 end
92 return true; 87 return true;
93 end 88 end
94 89
95 local storage = generate_legacy_storage(ret); 90 local storage = generate_legacy_storage(ret);
96 91
120 local username = session.username; 115 local username = session.username;
121 local jid = username.."@"..session.host; 116 local jid = username.."@"..session.host;
122 local service = mod_pep.get_pep_service(username); 117 local service = mod_pep.get_pep_service(username);
123 local ok, ret = service:get_items(namespace, session.full_jid); 118 local ok, ret = service:get_items(namespace, session.full_jid);
124 if not ok then 119 if not ok then
125 module:log("error", "Failed to retrieve PEP bookmarks of %s: %s", jid, ret); 120 if ret == "item-not-found" then
126 session.send(st.error_reply(stanza, "cancel", ret, "Failed to retrive bookmarks from PEP")); 121 module:log("debug", "Got no PEP bookmarks item for %s, returning empty private bookmarks", jid);
122 session.send(st.reply(stanza):add_child(query));
123 else
124 module:log("error", "Failed to retrieve PEP bookmarks of %s: %s", jid, ret);
125 session.send(st.error_reply(stanza, "cancel", ret, "Failed to retrive bookmarks from PEP"));
126 end
127 return true; 127 return true;
128 end 128 end
129 129
130 local storage = generate_legacy_storage(ret); 130 local storage = generate_legacy_storage(ret);
131 131