comparison mod_ircd/mod_ircd.in.lua @ 482:9d62586e7aae

mod_ircd: hacked around it to make it "work" again, topics should be operational once again.
author Marco Cirillo <maranda@lightwitch.org>
date Mon, 28 Nov 2011 15:07:20 +0000
parents 99b246b37809
children f4ada087c743
comparison
equal deleted inserted replaced
481:355b4ecbe2dd 482:9d62586e7aae
303 session.send{from=muc_server, 332, session.nick, channel ,room.subject}; 303 session.send{from=muc_server, 332, session.nick, channel ,room.subject};
304 end 304 end
305 commands.NAMES(session, channel); 305 commands.NAMES(session, channel);
306 306
307 room:hook("subject-changed", function(changed) 307 room:hook("subject-changed", function(changed)
308 session.send((":%s TOPIC %s :%s"):format(changed.by, channel, changed.to or "")); 308 session.send((":%s TOPIC %s :%s"):format(changed.by.nick, channel, changed.to or ""));
309 end); 309 end);
310 310
311 room:hook("message", function(event) 311 room:hook("message", function(event)
312 if not event.body then return end 312 if not event.body then return end
313 local nick, body = event.nick, event.body; 313 local nick, body = event.nick, event.body;
445 session.send{from=muc_server, "PONG", args[1]}; 445 session.send{from=muc_server, "PONG", args[1]};
446 end 446 end
447 447
448 function commands.TOPIC(session, message) 448 function commands.TOPIC(session, message)
449 if not message then return end 449 if not message then return end
450 local channel, topic = message:match("^(%S+) :(.*)$"); 450 local channel, topic = message[1], message[2];
451 if not channel then
452 channel = message:match("^(%S+)");
453 end
454 if not channel then return end 451 if not channel then return end
455 local room = session.rooms[channel]; 452 local room = session.rooms[channel];
453
456 if topic then 454 if topic then
457 room:set_subject(topic) 455 room:set_subject(topic)
458 session.send((":%s TOPIC %s :%s"):format(session.nick, channel, room.subject or "")); 456 session.send((":%s TOPIC %s :%s"):format(room.nick, room.channel, room.subject or ""));
459 else
460 session.send((":%s TOPIC %s :%s"):format(session.nick, channel, room.subject or ""));
461 end 457 end
462 end 458 end
463 459
464 function commands.WHO(session, args) 460 function commands.WHO(session, args)
465 local channel = args[1]; 461 local channel = args[1];