"__PACKAGE__ is the objectid of the generic MCP package "__NEW__ is the object id of the new object resulting from the @create command "__REGISTRY__ is the value of $mcp.registry "To add the package, become a wizard and type: " @add-package __NEW__ to __REGISTRY__ @create __PACKAGE__ named dns-net-beryllium-status:dns-net-beryllium-status @prop __NEW__."mail_icon" "0" rc ;;__NEW__.("messages_in") = {{"ico_exec", {"index", "cmd"}}, {"msg_get", {"type", "from"}}, {"msg_exec", {"cmd"}}} ;;__NEW__.("messages_out") = {{"ico_add", {}}, {"ico_upd", {}}, {"ico_del", {}}, {"ico_clr", {}}, {"msg_add", {"text", "cmd", "cache"}}, {"msg_force", {"text", "cmd"}}, {"msg_clear", {}}} ;;__NEW__.("aliases") = {"dns-net-beryllium-status"} @verb __NEW__:"initialize_connection" this none this @program __NEW__:initialize_connection "Usage: :initialize_connection()"; ""; {version} = args; connection = caller; messages = $list_utils:slice(this.messages_in); connection:register_handlers(messages); this:initialize_tray(); this:send_msg_force(connection, tostr("Welcome to ", $network.MOO_name, ". There are currently ", l = length(connected_players()), " player", (l == 1) ? "" | "s", " connected."), "url:"); . @verb __NEW__:"initialize_tray" this none this rxd @program __NEW__:initialize_tray "Usage: :initialize_tray()"; "Set up all icons in the icon-tray of a client"; if (!$perm_utils:controls(caller_perms(), this)) return E_PERM; endif this:send_ico_clr($mcp:session_for(player)); this:send_ico_add($mcp:session_for(player), {"mode", "normal"}, {"img0", "-5"}, {"hint", "There are no new messages."}, {"cmd", "@read new"}); this:update_mail(player); . @verb __NEW__:"handle_ico_exec" this none this rxd @program __NEW__:handle_ico_exec if (caller != this) return E_PERM; endif {session, index, cmd, @args} = args; index = tostr(index); user = session.connection; if (index == this.mail_icon) if (cmd == "@read new") force_input(user, cmd); endif endif . @verb __NEW__:"send_msg_force" this none this rxd @program __NEW__:send_msg_force {session, text, cmd} = args; if ((caller == this) || $perm_utils:controls(caller_perms(), session.connection)) return pass(session, text, cmd); else return 1; endif . @verb __NEW__:"send_add send_msg_add" this none this rxd @program __NEW__:send_add {session, text, cmd, cache} = args; if ((caller == this) || $perm_utils:controls(caller_perms(), session.connection)) return pass(session, text, cmd, cache); endif . @verb __NEW__:"send_clear" this none this rxd @program __NEW__:send_clear {session} = args; if ((caller == this) || $perm_utils:controls(caller_perms(), session.connection)) return pass(session); endif . @verb __NEW__:"status_all" this none this rxd @program __NEW__:status_all if (caller_perms().wizard) for p in (connected_players()) $command_utils:suspend_if_needed(0); if (`{this, {1, 0}} in $mcp:session_for(p).packages ! E_INVIND => 0') this:send_msg_force($mcp:session_for(p), args[1], args[2]); endif endfor else raise(E_PERM); endif . @verb __NEW__:"handle_msg_exec" this none this rd @program __NEW__:handle_msg_exec if (caller != this) return E_PERM; endif {session, cmd, @args} = args; user = session.connection; if (cmd == "k $agenda") argstr = ""; $agenda:look_self(); endif . @verb __NEW__:"update_mail" this none this rxd @program __NEW__:update_mail if (!($perm_utils:controls(caller_perms(), this) || ((caller == player) && (args[1] == player)))) raise(E_PERM); endif {user} = args; session = $mcp:session_for(user); if ((!valid(session)) || (!({this, {1, 0}} in session.packages))) return 0; endif nm = user:length_all_msgs() - user:length_date_le(user:get_current_message()[2]); if (nm == 0) hint = "There are no new messages."; mode = "normal"; elseif (nm == 1) hint = "There is 1 message waiting."; mode = "blink"; else hint = tostr("There are ", nm, " messages waiting."); mode = "blink"; endif this:send_ico_upd(session, {"index", this.mail_icon}, {"mode", mode}, {"hint", hint}); .