Annotate

plugins/mod_version.lua @ 188:0d9f03009b8a

mod_version is here
author Matthew Wild <mwild1@gmail.com>
date Thu, 30 Oct 2008 21:26:53 +0000
child 189:3f0e3a07b491
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
188
0d9f03009b8a mod_version is here
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
1
0d9f03009b8a mod_version is here
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
2 local st = require "util.stanza";
0d9f03009b8a mod_version is here
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
3 local send = require "core.sessionmanager".send_to_session;
0d9f03009b8a mod_version is here
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
4
0d9f03009b8a mod_version is here
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
5 local log = require "util.logger".init("mod_version");
0d9f03009b8a mod_version is here
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
6
0d9f03009b8a mod_version is here
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
7 local xmlns_version = "jabber:iq:version"
0d9f03009b8a mod_version is here
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
8
0d9f03009b8a mod_version is here
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
9 local function handle_version_request(session, stanza)
0d9f03009b8a mod_version is here
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
10 if stanza.attr.type == "get" then
0d9f03009b8a mod_version is here
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
11 session.send(st.reply(stanza)
0d9f03009b8a mod_version is here
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
12 :query(xmlns_version)
0d9f03009b8a mod_version is here
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
13 :tag("name"):text("lxmppd"):up()
0d9f03009b8a mod_version is here
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
14 :tag("version"):text("pre-alpha"):up()
0d9f03009b8a mod_version is here
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
15 :tag("os"):text("The best one"));
0d9f03009b8a mod_version is here
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
16 end
0d9f03009b8a mod_version is here
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
17 end
0d9f03009b8a mod_version is here
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
18
0d9f03009b8a mod_version is here
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
19 add_iq_handler("c2s", xmlns_version, handle_version_request);
0d9f03009b8a mod_version is here
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
20 add_iq_handler("s2s", xmlns_version, handle_version_request);