Software / code / prosody
Comparison
plugins/mod_ping.lua @ 6054:7a5ddbaf758d
Merge 0.9->0.10
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Wed, 02 Apr 2014 17:41:38 +0100 |
| parent | 6012:7e8a624272bf |
| child | 8729:c519c778f2b2 |
comparison
equal
deleted
inserted
replaced
| 6053:2f93a04564b2 | 6054:7a5ddbaf758d |
|---|---|
| 1 -- Prosody IM | 1 -- Prosody IM |
| 2 -- Copyright (C) 2008-2010 Matthew Wild | 2 -- Copyright (C) 2008-2010 Matthew Wild |
| 3 -- Copyright (C) 2008-2010 Waqas Hussain | 3 -- Copyright (C) 2008-2010 Waqas Hussain |
| 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 local st = require "util.stanza"; | 9 local st = require "util.stanza"; |
| 10 | 10 |
| 11 module:add_feature("urn:xmpp:ping"); | 11 module:add_feature("urn:xmpp:ping"); |
| 12 | 12 |
| 13 local function ping_handler(event) | 13 local function ping_handler(event) |
| 14 if event.stanza.attr.type == "get" then | 14 return event.origin.send(st.reply(event.stanza)); |
| 15 event.origin.send(st.reply(event.stanza)); | |
| 16 return true; | |
| 17 end | |
| 18 end | 15 end |
| 19 | 16 |
| 20 module:hook("iq/bare/urn:xmpp:ping:ping", ping_handler); | 17 module:hook("iq-get/bare/urn:xmpp:ping:ping", ping_handler); |
| 21 module:hook("iq/host/urn:xmpp:ping:ping", ping_handler); | 18 module:hook("iq-get/host/urn:xmpp:ping:ping", ping_handler); |
| 22 | 19 |
| 23 -- Ad-hoc command | 20 -- Ad-hoc command |
| 24 | 21 |
| 25 local datetime = require "util.datetime".datetime; | 22 local datetime = require "util.datetime".datetime; |
| 26 | 23 |