# HG changeset patch # User shinysky # Date 1276444070 -28800 # Node ID ac826882a8cf541bd48eb5a724a4a6afb78af9e3 # Parent d15c7d86db117dd42ffdd1ec3907a3a45dc3be5b mod_archive: The element auto MAY include a 'scope' attribute; Added message hook. diff -r d15c7d86db11 -r ac826882a8cf mod_archive/mod_archive.lua --- a/mod_archive/mod_archive.lua Sat Jun 12 23:58:10 2010 +0200 +++ b/mod_archive/mod_archive.lua Sun Jun 13 23:47:50 2010 +0800 @@ -133,7 +133,7 @@ push = push:up(); for _, res in pairs(user and user.sessions or NULL) do -- broadcast to all resources if res.presence then -- to resource - push.attr.to = res.full_jid; -- TODO how to gen the message that new modes're set? + push.attr.to = res.full_jid; res.send(push); end end @@ -204,7 +204,9 @@ return false; end local setting = data:child_with_name(elem.name) - setting.attr["save"] = elem.attr["save"]; + for k, v in pairs(elem.attr) do + setting.attr[k] = v; + end store_prefs(data, node, host); origin.send(st.reply(stanza)); return true; @@ -240,6 +242,13 @@ return true; end +local function msg_handler(data) + module:log("debug", "-- Enter msg_handler()"); + local origin, stanza = data.origin, data.stanza; + module:log("debug", "-- msg:\n%s", tostring(stanza)); + return nil; +end + module:hook("iq/self/urn:xmpp:archive:pref", preferences_handler); module:hook("iq/self/urn:xmpp:archive:itemremove", itemremove_handler); module:hook("iq/self/urn:xmpp:archive:sessionremove", sessionremove_handler); @@ -251,3 +260,6 @@ module:hook("iq/self/urn:xmpp:archive:retrieve", retrieve_handler); module:hook("iq/self/urn:xmpp:archive:save", save_handler); +module:hook("message/full", msg_handler, 10); +module:hook("message/bare", msg_handler, 10); +