Mercurial > prosody-modules
changeset 483:f4ada087c743
mod_ircd: added listener port configuration, added utf8 checks to TOPIC, added check so that module wonn't get loaded if conference_server is unset.
author | Marco Cirillo <maranda@lightwitch.org> |
---|---|
date | Mon, 28 Nov 2011 15:28:10 +0000 |
parents | 9d62586e7aae |
children | 0b75c7d41b82 |
files | mod_ircd/mod_ircd.in.lua |
diffstat | 1 files changed, 11 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/mod_ircd/mod_ircd.in.lua Mon Nov 28 15:07:20 2011 +0000 +++ b/mod_ircd/mod_ircd.in.lua Mon Nov 28 15:28:10 2011 +0000 @@ -8,8 +8,13 @@ module = _G.module local module = _module -- -local component_jid, component_secret, muc_server = - module.host, nil, module:get_option("conference_server"); +local component_jid, component_secret, muc_server, port_number = + module.host, nil, module:get_option_string("conference_server"), module:get_option_number("listener_port", 7000); + +if not muc_server then + module:log ("error", "You need to set the MUC server! halting.") + return false; +end package.loaded["util.sha1"] = require "util.encodings"; local verse = require "verse" @@ -154,7 +159,7 @@ none = "" } -local irc_listener = { default_port = 7000, default_mode = "*l" }; +local irc_listener = { default_port = port_number, default_mode = "*l" }; local sessions = {}; local jids = {}; @@ -447,7 +452,9 @@ function commands.TOPIC(session, message) if not message then return end - local channel, topic = message[1], message[2]; + local channel, topic = message[1], message[2]; + channel = utf8_clean(channel); + topic = utf8_clean(topic); if not channel then return end local room = session.rooms[channel];