comparison mod_bookmarks2/mod_bookmarks2.lua @ 3738:9cd6d602ad1b

mod_bookmarks2: Simplify for loop (thanks MattJ!).
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Wed, 13 Nov 2019 15:51:59 +0100
parents 310061f6e1df
children 1ed3d86eeaed
comparison
equal deleted inserted replaced
3737:49e65a7e9415 3738:9cd6d602ad1b
53 end 53 end
54 return true; 54 return true;
55 end 55 end
56 56
57 local storage = st.stanza("storage", { xmlns = "storage:bookmarks" }); 57 local storage = st.stanza("storage", { xmlns = "storage:bookmarks" });
58 for i in ipairs(ret) do 58 for _, item_id in ipairs(ret) do
59 local item = ret[ret[i]]; 59 local item = ret[item_id];
60 local conference = st.stanza("conference"); 60 local conference = st.stanza("conference");
61 conference.attr.jid = item.attr.id; 61 conference.attr.jid = item.attr.id;
62 local bookmark = item:get_child("conference", "urn:xmpp:bookmarks:0"); 62 local bookmark = item:get_child("conference", "urn:xmpp:bookmarks:0");
63 conference.attr.name = bookmark.attr.name; 63 conference.attr.name = bookmark.attr.name;
64 conference.attr.autojoin = bookmark.attr.autojoin; 64 conference.attr.autojoin = bookmark.attr.autojoin;