Comparison

plugins/mod_version.lua @ 704:ef8d0d339172

mod_version: Removed and rearranged some code
author Waqas Hussain <waqas20@gmail.com>
date Tue, 13 Jan 2009 19:18:37 +0500
parent 615:4ae3e81513f3
child 758:b1885732e979
comparison
equal deleted inserted replaced
703:f9909efed20c 704:ef8d0d339172
19 19
20 20
21 21
22 local st = require "util.stanza"; 22 local st = require "util.stanza";
23 23
24 local log = require "util.logger".init("mod_version");
25
26 local xmlns_version = "jabber:iq:version" 24 local xmlns_version = "jabber:iq:version"
27 25
28 module:add_feature(xmlns_version); 26 module:add_feature(xmlns_version);
29 27
30 local function handle_version_request(session, stanza) 28 module:add_iq_handler({"c2s", "s2sin"}, xmlns_version, function(session, stanza)
31 if stanza.attr.type == "get" then 29 if stanza.attr.type == "get" then
32 session.send(st.reply(stanza):query(xmlns_version) 30 session.send(st.reply(stanza):query(xmlns_version)
33 :tag("name"):text("Prosody"):up() 31 :tag("name"):text("Prosody"):up()
34 :tag("version"):text("0.2"):up() 32 :tag("version"):text("0.2"):up()
35 :tag("os"):text("the best operating system ever!")); 33 :tag("os"):text("the best operating system ever!"));
36 end 34 end
37 end 35 end);
38
39 module:add_iq_handler("c2s", xmlns_version, handle_version_request);
40 module:add_iq_handler("s2sin", xmlns_version, handle_version_request);