diff mod_default_bookmarks/mod_default_bookmarks.lua @ 4979:8f77452abc59

mod_default_bookmarks: Fix support for array of string config in bookmarks 2 part (thanks Menel)
author Kim Alvefur <zash@zash.se>
date Fri, 29 Jul 2022 17:53:56 +0200
parents 4c8b66da4dec
children
line wrap: on
line diff
--- a/mod_default_bookmarks/mod_default_bookmarks.lua	Mon Jul 25 19:28:38 2022 +0200
+++ b/mod_default_bookmarks/mod_default_bookmarks.lua	Fri Jul 29 17:53:56 2022 +0200
@@ -85,6 +85,9 @@
 			end
 			local ns = event.version or "urn:xmpp:bookmarks:1";
 			for i, bookmark in ipairs(bookmarks) do
+				if type(bookmark) ~= "table" then -- assume it's only a jid
+					bookmark = { jid = bookmark, name = jid.split(bookmark) };
+				end
 				local bm_jid = jid.prep(bookmark.jid);
 				if not bm_jid then
 					module:log("error", "Invalid JID in default_bookmarks[%d].jid = %q", i, bookmark.jid);