Software / code / prosody
Comparison
plugins/mod_ping.lua @ 4129:c86b68abe12e
mod_ping: Use util.datetime to generate timestamp in ad-hoc command response (instead of the current use of os.date, which doesn't take timezone into account).
| author | Waqas Hussain <waqas20@gmail.com> |
|---|---|
| date | Sat, 29 Jan 2011 04:42:05 +0500 |
| parent | 3486:8a46bb70016f |
| child | 5776:bd0ff8ae98a8 |
comparison
equal
deleted
inserted
replaced
| 4128:b6d072a3668d | 4129:c86b68abe12e |
|---|---|
| 20 module:hook("iq/bare/urn:xmpp:ping:ping", ping_handler); | 20 module:hook("iq/bare/urn:xmpp:ping:ping", ping_handler); |
| 21 module:hook("iq/host/urn:xmpp:ping:ping", ping_handler); | 21 module:hook("iq/host/urn:xmpp:ping:ping", ping_handler); |
| 22 | 22 |
| 23 -- Ad-hoc command | 23 -- Ad-hoc command |
| 24 | 24 |
| 25 local datetime = require "util.datetime".datetime; | |
| 26 | |
| 25 function ping_command_handler (self, data, state) | 27 function ping_command_handler (self, data, state) |
| 26 local now = os.date("%Y-%m-%dT%X"); | 28 local now = datetime(); |
| 27 return { info = "Pong\n"..now, status = "completed" }; | 29 return { info = "Pong\n"..now, status = "completed" }; |
| 28 end | 30 end |
| 29 | 31 |
| 30 local adhoc_new = module:require "adhoc".new; | 32 local adhoc_new = module:require "adhoc".new; |
| 31 local descriptor = adhoc_new("Ping", "ping", ping_command_handler); | 33 local descriptor = adhoc_new("Ping", "ping", ping_command_handler); |