mcbot/cmds/xmpp.lua
author Mikael Berthe <mikael@lilotux.net>
Fri, 01 Apr 2011 08:23:28 +0200
changeset 52 4efe459ca7f1
parent 51 a3e9f8f9d969
permissions -rw-r--r--
xmpp: fix new link description (RFC6122)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
25
788c62c29e18 Add a simple xmpp command
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
     1
788c62c29e18 Add a simple xmpp command
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
     2
-- Ugly module with hardcoded URLs to the XMPP draft URLs...
51
a3e9f8f9d969 xmpp: update links (new XMPP RFC)
Mikael Berthe <mikael@lilotux.net>
parents: 25
diff changeset
     3
-- Also, see http://datatracker.ietf.org/doc/
25
788c62c29e18 Add a simple xmpp command
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
     4
788c62c29e18 Add a simple xmpp command
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
     5
local xmpp = { ["desc"] = "Give URLs to XMPP documents" }
788c62c29e18 Add a simple xmpp command
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
     6
788c62c29e18 Add a simple xmpp command
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
     7
function xmpp.cmd (args)
51
a3e9f8f9d969 xmpp: update links (new XMPP RFC)
Mikael Berthe <mikael@lilotux.net>
parents: 25
diff changeset
     8
    --[[
25
788c62c29e18 Add a simple xmpp command
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
     9
    local xmppbaseurl = "http://datatracker.ietf.org/doc/"
788c62c29e18 Add a simple xmpp command
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    10
    local urls = {}
788c62c29e18 Add a simple xmpp command
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    11
788c62c29e18 Add a simple xmpp command
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    12
    urls["3920"] = {
788c62c29e18 Add a simple xmpp command
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    13
        ["desc"] = "Core",
788c62c29e18 Add a simple xmpp command
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    14
        ["url"] = xmppbaseurl.."draft-ietf-xmpp-3920bis/",
788c62c29e18 Add a simple xmpp command
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    15
    }
788c62c29e18 Add a simple xmpp command
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    16
    urls["3921"] = {
788c62c29e18 Add a simple xmpp command
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    17
        ["desc"] = "Instant Messaging and Presence",
788c62c29e18 Add a simple xmpp command
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    18
        ["url"] = xmppbaseurl.."draft-ietf-xmpp-3921bis/",
788c62c29e18 Add a simple xmpp command
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    19
    }
51
a3e9f8f9d969 xmpp: update links (new XMPP RFC)
Mikael Berthe <mikael@lilotux.net>
parents: 25
diff changeset
    20
    --]]
a3e9f8f9d969 xmpp: update links (new XMPP RFC)
Mikael Berthe <mikael@lilotux.net>
parents: 25
diff changeset
    21
a3e9f8f9d969 xmpp: update links (new XMPP RFC)
Mikael Berthe <mikael@lilotux.net>
parents: 25
diff changeset
    22
    local xmppbaseurl = "http://tools.ietf.org/html/"
a3e9f8f9d969 xmpp: update links (new XMPP RFC)
Mikael Berthe <mikael@lilotux.net>
parents: 25
diff changeset
    23
    local urls = {}
a3e9f8f9d969 xmpp: update links (new XMPP RFC)
Mikael Berthe <mikael@lilotux.net>
parents: 25
diff changeset
    24
a3e9f8f9d969 xmpp: update links (new XMPP RFC)
Mikael Berthe <mikael@lilotux.net>
parents: 25
diff changeset
    25
    urls["6120"] = {
a3e9f8f9d969 xmpp: update links (new XMPP RFC)
Mikael Berthe <mikael@lilotux.net>
parents: 25
diff changeset
    26
        ["desc"] = "Core",
a3e9f8f9d969 xmpp: update links (new XMPP RFC)
Mikael Berthe <mikael@lilotux.net>
parents: 25
diff changeset
    27
        ["url"] = xmppbaseurl.."rfc6120",
a3e9f8f9d969 xmpp: update links (new XMPP RFC)
Mikael Berthe <mikael@lilotux.net>
parents: 25
diff changeset
    28
    }
a3e9f8f9d969 xmpp: update links (new XMPP RFC)
Mikael Berthe <mikael@lilotux.net>
parents: 25
diff changeset
    29
    urls["6121"] = {
a3e9f8f9d969 xmpp: update links (new XMPP RFC)
Mikael Berthe <mikael@lilotux.net>
parents: 25
diff changeset
    30
        ["desc"] = "Instant Messaging and Presence",
a3e9f8f9d969 xmpp: update links (new XMPP RFC)
Mikael Berthe <mikael@lilotux.net>
parents: 25
diff changeset
    31
        ["url"] = xmppbaseurl.."rfc6121",
a3e9f8f9d969 xmpp: update links (new XMPP RFC)
Mikael Berthe <mikael@lilotux.net>
parents: 25
diff changeset
    32
    }
a3e9f8f9d969 xmpp: update links (new XMPP RFC)
Mikael Berthe <mikael@lilotux.net>
parents: 25
diff changeset
    33
    urls["6122"] = {
52
4efe459ca7f1 xmpp: fix new link description (RFC6122)
Mikael Berthe <mikael@lilotux.net>
parents: 51
diff changeset
    34
        ["desc"] = "Address Format",
51
a3e9f8f9d969 xmpp: update links (new XMPP RFC)
Mikael Berthe <mikael@lilotux.net>
parents: 25
diff changeset
    35
        ["url"] = xmppbaseurl.."rfc6122",
a3e9f8f9d969 xmpp: update links (new XMPP RFC)
Mikael Berthe <mikael@lilotux.net>
parents: 25
diff changeset
    36
    }
25
788c62c29e18 Add a simple xmpp command
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    37
788c62c29e18 Add a simple xmpp command
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    38
    local r = "XMPP is the eXtensible Messaging and Presence Protocol. See:\n"
788c62c29e18 Add a simple xmpp command
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    39
    for k, urltable in pairs(urls) do
788c62c29e18 Add a simple xmpp command
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    40
        r = r .. urltable.desc..": <"..urltable.url..">\n"
788c62c29e18 Add a simple xmpp command
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    41
    end
788c62c29e18 Add a simple xmpp command
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    42
    r = r:gsub("\n+$", "")
788c62c29e18 Add a simple xmpp command
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    43
788c62c29e18 Add a simple xmpp command
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    44
    return r
788c62c29e18 Add a simple xmpp command
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    45
end
788c62c29e18 Add a simple xmpp command
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    46
788c62c29e18 Add a simple xmpp command
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    47
mcbot_register_command("xmpp", xmpp)