Annotate

plugins/mod_version.lua @ 540:ec03f6968fa8

Added function add_feature to modules API (for adding disco features)
author Waqas Hussain <waqas20@gmail.com>
date Thu, 04 Dec 2008 20:07:22 +0500
parent 519:cccd610a0ef9
child 541:3521e0851c9e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
519
cccd610a0ef9 Insert copyright/license headers
Matthew Wild <mwild1@gmail.com>
parents: 517
diff changeset
1 -- Prosody IM v0.1
cccd610a0ef9 Insert copyright/license headers
Matthew Wild <mwild1@gmail.com>
parents: 517
diff changeset
2 -- Copyright (C) 2008 Matthew Wild
cccd610a0ef9 Insert copyright/license headers
Matthew Wild <mwild1@gmail.com>
parents: 517
diff changeset
3 -- Copyright (C) 2008 Waqas Hussain
cccd610a0ef9 Insert copyright/license headers
Matthew Wild <mwild1@gmail.com>
parents: 517
diff changeset
4 --
cccd610a0ef9 Insert copyright/license headers
Matthew Wild <mwild1@gmail.com>
parents: 517
diff changeset
5 -- This program is free software; you can redistribute it and/or
cccd610a0ef9 Insert copyright/license headers
Matthew Wild <mwild1@gmail.com>
parents: 517
diff changeset
6 -- modify it under the terms of the GNU General Public License
cccd610a0ef9 Insert copyright/license headers
Matthew Wild <mwild1@gmail.com>
parents: 517
diff changeset
7 -- as published by the Free Software Foundation; either version 2
cccd610a0ef9 Insert copyright/license headers
Matthew Wild <mwild1@gmail.com>
parents: 517
diff changeset
8 -- of the License, or (at your option) any later version.
cccd610a0ef9 Insert copyright/license headers
Matthew Wild <mwild1@gmail.com>
parents: 517
diff changeset
9 --
cccd610a0ef9 Insert copyright/license headers
Matthew Wild <mwild1@gmail.com>
parents: 517
diff changeset
10 -- This program is distributed in the hope that it will be useful,
cccd610a0ef9 Insert copyright/license headers
Matthew Wild <mwild1@gmail.com>
parents: 517
diff changeset
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
cccd610a0ef9 Insert copyright/license headers
Matthew Wild <mwild1@gmail.com>
parents: 517
diff changeset
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
cccd610a0ef9 Insert copyright/license headers
Matthew Wild <mwild1@gmail.com>
parents: 517
diff changeset
13 -- GNU General Public License for more details.
cccd610a0ef9 Insert copyright/license headers
Matthew Wild <mwild1@gmail.com>
parents: 517
diff changeset
14 --
cccd610a0ef9 Insert copyright/license headers
Matthew Wild <mwild1@gmail.com>
parents: 517
diff changeset
15 -- You should have received a copy of the GNU General Public License
cccd610a0ef9 Insert copyright/license headers
Matthew Wild <mwild1@gmail.com>
parents: 517
diff changeset
16 -- along with this program; if not, write to the Free Software
cccd610a0ef9 Insert copyright/license headers
Matthew Wild <mwild1@gmail.com>
parents: 517
diff changeset
17 -- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
cccd610a0ef9 Insert copyright/license headers
Matthew Wild <mwild1@gmail.com>
parents: 517
diff changeset
18 --
cccd610a0ef9 Insert copyright/license headers
Matthew Wild <mwild1@gmail.com>
parents: 517
diff changeset
19
cccd610a0ef9 Insert copyright/license headers
Matthew Wild <mwild1@gmail.com>
parents: 517
diff changeset
20
188
0d9f03009b8a mod_version is here
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
21
0d9f03009b8a mod_version is here
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
22 local st = require "util.stanza";
0d9f03009b8a mod_version is here
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
23
0d9f03009b8a mod_version is here
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
24 local log = require "util.logger".init("mod_version");
0d9f03009b8a mod_version is here
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
25
0d9f03009b8a mod_version is here
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
26 local xmlns_version = "jabber:iq:version"
0d9f03009b8a mod_version is here
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
27
421
63be85693710 Modules now sending disco replies
Waqas Hussain <waqas20@gmail.com>
parents: 314
diff changeset
28 require "core.discomanager".set("version", xmlns_version);
63be85693710 Modules now sending disco replies
Waqas Hussain <waqas20@gmail.com>
parents: 314
diff changeset
29
188
0d9f03009b8a mod_version is here
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
30 local function handle_version_request(session, stanza)
219
f06e97f525bc Fixed some whitespace.
Waqas Hussain <waqas20@gmail.com>
parents: 189
diff changeset
31 if stanza.attr.type == "get" then
f06e97f525bc Fixed some whitespace.
Waqas Hussain <waqas20@gmail.com>
parents: 189
diff changeset
32 session.send(st.reply(stanza):query(xmlns_version)
517
afd9f6590fd0 lxmppd -> Prosody
Matthew Wild <mwild1@gmail.com>
parents: 438
diff changeset
33 :tag("name"):text("Prosody"):up()
afd9f6590fd0 lxmppd -> Prosody
Matthew Wild <mwild1@gmail.com>
parents: 438
diff changeset
34 :tag("version"):text("0.1"):up()
298
985710ea308b Small fix for mod_version
Matthew Wild <mwild1@gmail.com>
parents: 219
diff changeset
35 :tag("os"):text("the best operating system ever!"));
219
f06e97f525bc Fixed some whitespace.
Waqas Hussain <waqas20@gmail.com>
parents: 189
diff changeset
36 end
188
0d9f03009b8a mod_version is here
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
37 end
0d9f03009b8a mod_version is here
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
38
438
193f9dd64f17 Bumper commit for the new modulemanager API \o/ Updates all the modules, though some more changes may be in store.
Matthew Wild <mwild1@gmail.com>
parents: 421
diff changeset
39 module:add_iq_handler("c2s", xmlns_version, handle_version_request);
193f9dd64f17 Bumper commit for the new modulemanager API \o/ Updates all the modules, though some more changes may be in store.
Matthew Wild <mwild1@gmail.com>
parents: 421
diff changeset
40 module:add_iq_handler("s2sin", xmlns_version, handle_version_request);