@create $thing named SimpleTCPListner:SimpleTCPListner,STCPd,inetd @prop $inetd."ports" {} rc ;;$inetd.("ports") = {{7, "echo"}, {9, "discard"}, {13, "time"}, {17, "quoted"}, {79, "finger"}, {5222, "jabber"}, {5269, "jabber"}} @prop $inetd."quote" "MOO Quote of the Day!" rc @prop $inetd."server_software" "test 0.2" rc @prop $inetd."debug" #-1 rc @prop $inetd."admin" #-1 rc ;;$inetd.("aliases") = {"SimpleTCPListner", "STCPd", "inetd"} ;;$inetd.("object_size") = {6846, 1013718845} @verb $inetd:"initialize" this none this @program $inetd:initialize if (!player.wizard) return E_PERM; endif for port in ($list_utils:slice(this.ports, 1)) if (!this:is_listening(port)) listen(this, port); endif endfor . @verb $inetd:"is_listening" this none this @program $inetd:is_listening if (args[1] in $list_utils:slice(listeners(), 2)) return 1; endif . @verb $inetd:"do_login_command" this none this @program $inetd:do_login_command verbno = toint($string_utils:words(connection_name(player))[2]) in $list_utils:slice(this.ports, 1); verbcmd = "do_" + $list_utils:slice(this.ports, 2)[verbno]; this:(verbcmd)(); . @verb $inetd:"do_finger" this none this @program $inetd:do_finger query = read(player); if (length(query)) this:get_who_entry(query); else for x in (connected_players()) notify(player, x.name); endfor endif boot_player(player); . @verb $inetd:"do_quoted" none none none @program $inetd:do_quoted notify(player, this.quote); boot_player(player); . @verb $inetd:"do_time" this none this @program $inetd:do_time notify(player, ctime()); boot_player(player); . @verb $inetd:"get_who_entry" this none this @program $inetd:get_who_entry ply = args[1]; plid = $string_utils:match_player(ply); if (plid == #-3) notify(player, "Player Not Found"); return; elseif (plid == #-2) notify(player, "Ambigious Match"); return; " Really, according to RFC-1288, I should loop through all the different players and return them"; endif if (plid in connected_players()) plc = 1; idle = idle_seconds(plid); conn = connected_seconds(plid); else plc = 0; disc = plid.last_disconnect_time; endif loc = plid.location; if (valid(loc)) ltx = ((loc.name + " (") + tostr(loc)) + ")"; else ltx = "** Nowhere **"; endif notify(player, ((("Name: " + plid.name) + " (") + tostr(plid)) + ")"); if (plc) ite = $time_utils:english_time(idle); cte = $time_utils:english_time(conn); ite = $string_utils:to_list(ite, ", ")[1]; cte = $string_utils:to_list(cte, ", ")[1]; notify(player, ("connected: " + cte) + " ago"); notify(player, "idle: " + ite); else notify(player, "last disconnected: " + ctime(disc)); endif notify(player, "in: " + ltx); notify(player, "description: "); for line in ((typeof(lines = plid.description) != LIST) ? {lines} | lines) notify(player, tostr(line)); endfor . @verb $inetd:"do_echo" this none this @program $inetd:do_echo while ($network:is_connected(player)) notify(player, read(player)); endwhile . @verb $inetd:"do_discard" this none this @program $inetd:do_discard while ($network:is_connected(player)) read(player); endwhile . @verb $inetd:"do_jabber" this none this @program $inetd:do_jabber set_connection_option(player, "binary", 1); if (valid(this.admin)) notify(this.admin, (("jabber connection, (" + tostr(player)) + ") started:") + connection_name(player)); endif while ($network:is_connected(player)) line = read(player); if (!index(line, encode_binary({9}))) $jabberd:parse_line(player, line); endif endwhile if (valid(this.admin)) notify(this.admin, ("jabber connection, (" + tostr(player)) + ") ended."); endif .