Mercurial > prosody-modules
diff mod_archive/mod_archive.lua @ 172:ac826882a8cf
mod_archive: The element auto MAY include a 'scope' attribute; Added message hook.
author | shinysky<shinysky1986(AT)gmail.com> |
---|---|
date | Sun, 13 Jun 2010 23:47:50 +0800 |
parents | fd8d76daad97 |
children | 62f47a93b5b7 |
line wrap: on
line diff
--- 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); +