comparison mod_ircd/mod_ircd.in.lua @ 498:2865eaf43c74

mod_ircd: remove some duped code.
author Marco Cirillo <maranda@lightwitch.org>
date Mon, 05 Dec 2011 21:31:03 +0000
parents 94756b0657b4
children 30e33292d738
comparison
equal deleted inserted replaced
497:94756b0657b4 498:2865eaf43c74
250 jids[full_jid]["nicks_changing"] = {}; 250 jids[full_jid]["nicks_changing"] = {};
251 251
252 if session.nick then nicks[session.nick] = session; end 252 if session.nick then nicks[session.nick] = session; end
253 end 253 end
254 local function send_motd(session) 254 local function send_motd(session)
255 local nick = session.nick; 255 local nick = session.nick;
256 session.send{from = muc_server, "001", nick, "Welcome in the IRC to MUC XMPP Gateway, "..nick}; 256
257 session.send{from = muc_server, "002", nick, "Your host is "..muc_server.." running Prosody "..prosody.version}; 257 if session.username and session.nick then -- send MOTD only if username and nick are set
258 session.send{from = muc_server, "003", nick, "This server was created the "..os.date(nil, prosody.start_time)} 258 session.send{from = muc_server, "001", nick, "Welcome in the IRC to MUC XMPP Gateway, "..nick};
259 session.send{from = muc_server, "004", nick, table.concat({muc_server, "mod_ircd(alpha-0.8)", "i", "aoqv"}, " ")}; 259 session.send{from = muc_server, "002", nick, "Your host is "..muc_server.." running Prosody "..prosody.version};
260 session.send((":%s %s %s %s :%s"):format(muc_server, "005", nick, "CHANTYPES=# PREFIX=(qaov)~&@+", "are supported by this server")); 260 session.send{from = muc_server, "003", nick, "This server was created the "..os.date(nil, prosody.start_time)}
261 session.send((":%s %s %s %s :%s"):format(muc_server, "005", nick, "STATUSMSG=~&@+", "are supported by this server")); 261 session.send{from = muc_server, "004", nick, table.concat({muc_server, "mod_ircd(alpha-0.8)", "i", "aoqv"}, " ")};
262 session.send{from = muc_server, "375", nick, "- "..muc_server.." Message of the day -"}; 262 session.send((":%s %s %s %s :%s"):format(muc_server, "005", nick, "CHANTYPES=# PREFIX=(qaov)~&@+", "are supported by this server"));
263 session.send{from = muc_server, "372", nick, "-"}; 263 session.send((":%s %s %s %s :%s"):format(muc_server, "005", nick, "STATUSMSG=~&@+", "are supported by this server"));
264 session.send{from = muc_server, "372", nick, "- Please be warned that this is only a partial irc implementation,"}; 264 session.send{from = muc_server, "375", nick, "- "..muc_server.." Message of the day -"};
265 session.send{from = muc_server, "372", nick, "- it's made to facilitate users transiting away from irc to XMPP."}; 265 session.send{from = muc_server, "372", nick, "-"};
266 session.send{from = muc_server, "372", nick, "-"}; 266 session.send{from = muc_server, "372", nick, "- Please be warned that this is only a partial irc implementation,"};
267 session.send{from = muc_server, "372", nick, "- Prosody is _NOT_ an IRC Server and it never will."}; 267 session.send{from = muc_server, "372", nick, "- it's made to facilitate users transiting away from irc to XMPP."};
268 session.send{from = muc_server, "372", nick, "- We also would like to remind you that this plugin is provided as is,"}; 268 session.send{from = muc_server, "372", nick, "-"};
269 session.send{from = muc_server, "372", nick, "- it's still an Alpha and it's still a work in progress, use it at your sole"}; 269 session.send{from = muc_server, "372", nick, "- Prosody is _NOT_ an IRC Server and it never will."};
270 session.send{from = muc_server, "372", nick, "- risk as there's a not so little chance something will break."}; 270 session.send{from = muc_server, "372", nick, "- We also would like to remind you that this plugin is provided as is,"};
271 271 session.send{from = muc_server, "372", nick, "- it's still an Alpha and it's still a work in progress, use it at your sole"};
272 session.send{from = nick, "MODE", nick, "+i"}; -- why -> Invisible mode setting, 272 session.send{from = muc_server, "372", nick, "- risk as there's a not so little chance something will break."};
273 -- enforce by default on most servers (since the source host doesn't show it's sensible to have it "set") 273 session.send{from = nick, "MODE", nick, "+i"}; -- why -> Invisible mode setting,
274 end -- enforce by default on most servers (since the source host doesn't show it's sensible to have it "set")
274 end 275 end
275 276
276 function commands.NICK(session, args) 277 function commands.NICK(session, args)
277 local nick = args[1]; 278 local nick = args[1];
278 nick = nick:gsub("[^%w_]",""); 279 nick = nick:gsub("[^%w_]","");