--- a/mod_archive_muc/mod_archive_muc.lua Tue Aug 10 09:26:52 2010 +0800
+++ b/mod_archive_muc/mod_archive_muc.lua Wed Aug 11 07:59:26 2010 +0800
@@ -23,11 +23,26 @@
------------------------------------------------------------
-- Utils
------------------------------------------------------------
+local function trim(s)
+ return (string.gsub(s, "^%s*(.-)%s*$", "%1"))
+end
+
+local function clean_up(t)
+ for i = #t, 1, -1 do
+ if type(t[i]) == 'table' then
+ clean_up(t[i]);
+ elseif type(t[i]) == 'string' and trim(t[i]) == '' then
+ table.remove(t, i);
+ end
+ end
+end
+
local function load_prefs(node, host)
return st.deserialize(dm.load(node, host, PREFS_DIR));
end
local function store_prefs(data, node, host)
+ clean_up(data);
dm.store(node, host, PREFS_DIR, st.preserialize(data));
end