Software /
code /
prosody
Comparison
plugins/mod_ping.lua @ 2011:8159497c86e3
mod_ping: Updated to use events (which also fixes a few minor issues).
author | Waqas Hussain <waqas20@gmail.com> |
---|---|
date | Sun, 18 Oct 2009 18:26:58 +0500 |
parent | 1523:841d61be198f |
child | 2923:b7049746bd29 |
comparison
equal
deleted
inserted
replaced
2010:1a4f14ea39b6 | 2011:8159497c86e3 |
---|---|
4 -- | 4 -- |
5 -- This project is MIT/X11 licensed. Please see the | 5 -- This project is MIT/X11 licensed. Please see the |
6 -- COPYING file in the source package for more information. | 6 -- COPYING file in the source package for more information. |
7 -- | 7 -- |
8 | 8 |
9 | |
10 | |
11 local st = require "util.stanza"; | 9 local st = require "util.stanza"; |
12 | 10 |
13 module:add_feature("urn:xmpp:ping"); | 11 module:add_feature("urn:xmpp:ping"); |
14 | 12 |
15 module:add_iq_handler({"c2s", "s2sin"}, "urn:xmpp:ping", | 13 local function ping_handler(event) |
16 function(session, stanza) | 14 if event.stanza.attr.type == "get" then |
17 if stanza.attr.type == "get" then | 15 event.origin.send(st.reply(event.stanza)); |
18 session.send(st.reply(stanza)); | 16 return true; |
19 end | 17 end |
20 end); | 18 end |
19 | |
20 module:hook("iq/bare/urn:xmpp:ping:ping", ping_handler); | |
21 module:hook("iq/host/urn:xmpp:ping:ping", ping_handler); |