;var p, new; if(!(| valid($irc_orb) |)) { new = $thing.spawn(); new.set_objname('irc_orb);} @add-parent $network to $irc_connection @at $irc_orb to $irc_connection @set $sys:startup-objects=+$irc_orb @program $irc_orb.startup() +access=root // Send something bogus that will flush the connection out. if (.interface()) { .interface().write("PONG", "restarting"); } else { .open_connection(); } . @av $irc_orb,interface @program $irc_orb.interface() +access=pub return interface; . @program $irc_orb.set_interface() +access=prot arg iface; interface = iface; . @program $irc_orb.pulse() +access=pub // write something out every so often just to make the driver check the // connection. I think we shouldn't have to do this. if (sender() != $heart) { throw(~access, "You're not my heart."); } .interface().write("PONG", "froopyfeh"); . @program $irc_orb.connection_going_away() +access=pub if (sender() != .interface()) { throw(~perm, "Sender must be interface"); } //.manager().debug(); (| .location().announce("The "+.name('noarticle)+" fizzles.") |); .open_connection(); . @av $irc_orb,server ["manhattan.ks.us.undernet.org", 6668] @program $irc_orb.open_connection() +access=priv .set_interface($irc_connection.new()); (> .interface().open_connection(@server) <); . @program $irc_orb.parse_line() +access=pub arg buf; var func, args, text, tmp; if (sender() != .interface()) { throw(~perm, "Sender must be interface"); } [func, args, text] = $irc_lib.parse_line(buf); //.manager().debug(func, args, text); if ((tmp = (| .(tosym("do_" + func))(args, text) |))) { switch (type(tmp)) { case 'list: //.manager().debug(tmp); .interface().write(@tmp); case 'error: .manager().tell("! ----------- Traceback -------------"); .manager().tell_traceback(traceback()); .manager().tell("! ----------- End -------------"); } } . @program $irc_orb.do_ping +access=priv arg args, text; return ["PONG", text]; . @program $irc_orb.do_privmsg +access=priv arg args, text; var nick, line; (| nick = args[1].explode("!")[1] |); switch (text) { case "chat", "mud": // This creates a DCC chat message (a type of CTCP message). IRC // clients want the ip address as a long int, so we use // $irc_lib.quad2num to find that out. line = "DCC CHAT chat"; // line += " " + $irc_lib.quad2num($sys.server_info('server_ip)); line += " 3461449336"; line += " " + $login_daemon.current_port().to_string(); (| .location().announce("The " + .name('noarticle) + " sparks.") |); return [["PRIVMSG", nick], `[1]+ line.to_buffer()+ `[1]]; } . @program $irc_orb.do_001 +access=priv arg args, text; // 001 is (hopefully) sent whenever we connect. (| .location().announce("The " + .name('noarticle) + " shimmers.") |); .