Comparison

mod_csi_compat/mod_csi_compat.lua @ 1486:b3e692ee16b5

mod_csi_compat: Implement the google:queue protocol and map to mod_csi events
author Matthew Wild <mwild1@gmail.com>
date Fri, 15 Aug 2014 21:17:58 +0100
child 1865:db8b256f51ff
comparison
equal deleted inserted replaced
1485:d8c50448d0e7 1486:b3e692ee16b5
1 local st = require "util.stanza";
2
3 module:depends("csi");
4
5 module:add_feature("google:queue");
6
7 module:hook("iq-set/self/google:queue:query", function(event)
8 local origin, stanza = event.origin, event.stanza;
9 (origin.log or module._log)("debug", "Google queue invoked (CSI compat mode)")
10 local payload = stanza:get_child("query", "google:queue");
11 if payload:get_child("enable") then
12 module:fire_event("csi-client-inactive", event);
13 elseif payload:get_child("disable") then
14 module:fire_event("csi-client-active", event);
15 end
16 -- <flush/> is implemented as a noop, any IQ stanza would flush the queue anyways.
17 return origin.send(st.reply(stanza));
18 end, 10);