Mail Room #47
Aliases: Mail Room
26 verbs · 42 properties · 0 children
Verbs
| Verb | Spec | Flags | Definer | Lines |
|---|---|---|---|---|
working_on | this none this | rxd | #47 | 1 |
parse_invoke | this none this | rxd | #47 | 40 |
init_session | this none this | rxd | #47 | 19 |
pri*nt | any none none | rd | #47 | 12 |
message_with_headers | this none this | rxd | #47 | 1 |
subj*ect: | any any any | rd | #47 | 9 |
set_subject | this none this | rxd | #47 | 7 |
sending | this none this | rxd | #47 | 9 |
to*: | any any any | rd | #47 | 9 |
also*-to: cc*: | any any any | rd | #47 | 7 |
not-to*: uncc*: | any any any | rd | #47 | 36 |
parse_recipients | this none this | rxd | #47 | 15 |
recipient_names | this none this | rxd | #47 | 1 |
make_message | this none this | rxd | #47 | 1 |
name_list | this none this | rxd | #47 | 2 |
parse_msg_headers | this none this | rxd | #47 | 41 |
check_answer_flags | this none this | rxd | #47 | 36 |
reply-to*: replyto*: | any any any | rd | #47 | 11 |
send | none none none | rd | #47 | 47 |
who | any none none | rxd | #47 | 19 |
showlists | any none none | rd | #47 | 6 |
subsc*ribe | any at/to any | rd | #47 | 26 |
unsubsc*ribe | any out of/from inside/from any | rd | #47 | 24 |
retain_session_on_exit | this none this | rxd | #47 | 1 |
no_littering_msg | this none this | rxd | #47 | 2 |
local_editing_info | this none this | rxd | #47 | 6 |
Properties
| Property | Definer | Flags | Owner | Value |
|---|---|---|---|---|
replytos | #47 | | #36 | {} |
recipients | #47 | | #36 | {} |
subjects | #47 | | #36 | {} |
sending | #47 | | #36 | {} |
readable | #50 | r | #36 | {} |
times | #50 | r | #36 | {} |
commands2 | #50 | rc | #36 | list of 2{{"say", "emote", "lis*t", "ins*ert", "n*ext,p*rev", "enter", "del*ete", "f*ind", "s*ubst", "m*ove,c*opy", "join*l", "fill"}, {"y*ank", "w*hat", "subj*ect", "to", "also-to", "reply-to", "showlists,unsubscribe", "who", "pri*nt", "send", "abort", "q*uit,done,pause"}} |
help | #50 | rc | #36 | {} |
no_text_msg | #50 | rc | #36 | "Message body is empty." |
commands | #50 | rc | #36 | list of 8{{"subj*ect", "[<text>]"}, {"to", "[<rcpt>..]"}, {"also-to", "[<rcpt>..]"}, {"reply-to", "[<rcpt>..]"}, {"who", "[<rcpt>..]"}, {"pri*nt", ""}, {"send", ""}, {"showlists,unsubscribe", ""}} |
invoke_task | #50 | r | #36 | 0 |
exit_on_abort | #50 | rc | #36 | 1 |
previous_session_msg | #50 | rc | #36 | "You need to either SEND it or ABORT it before you can start another message." |
stateprops | #50 | r | #36 | list of 8{{"sending", 0}, {"replytos", {}}, {"recipients", {}}, {"subjects", ""}, {"texts", {}}, {"changes", 0}, {"inserting", 1}, {"readable", 0}} |
depart_msg | #50 | rc | #36 | "The sky ruptures with a thunderous peal, and %n %<is/are> summoned above to commune with the Elder Gods." |
return_msg | #50 | rc | #36 | "A largish toad hops into view and fattens up into %n." |
no_littering_msg | #50 | rc | #36 | list of 4{"Saving your message so that you can finish it later.", "To come back, give the `@send' command with no arguments.", "Please come back and SEND or ABORT if you don't intend to be working on this", "message in the immediate future. Keep Our MOO Clean! No Littering!"} |
no_change_msg | #50 | rc | #36 | <clear> |
change_msg | #50 | rc | #36 | <clear> |
nothing_loaded_msg | #50 | rc | #36 | "You're not editing anything!" |
texts | #50 | | #36 | {} |
active | #50 | r | #36 | {} |
changes | #50 | | #36 | {} |
inserting | #50 | | #36 | {} |
original | #50 | r | #36 | {} |
who_location_msg | #3 | rc | #36 | "%L [mailing]" |
free_home | #3 | rc | #36 | <clear> |
victim_ejection_msg | #3 | rc | #36 | <clear> |
ejection_msg | #3 | rc | #36 | <clear> |
oejection_msg | #3 | rc | #36 | <clear> |
residents | #3 | rc | #36 | <clear> |
free_entry | #3 | rc | #36 | 1 |
entrances | #3 | c | #36 | {} |
blessed_object | #3 | rc | #36 | #-1 |
blessed_task | #3 | rc | #36 | 562290767 |
exits | #3 | c | #36 | {} |
dark | #3 | rc | #36 | <clear> |
ctype | #3 | rc | #36 | <clear> |
key | #1 | c | #36 | <clear> |
aliases | #1 | rc | #36 | {"Mail Room"} |
description | #1 | rc | #36 | <clear> |
object_size | #1 | r | #36 | {25748, -1090650497} |
Ancestry
Ancestors (nearest first): #50 Generic Editor → #3 generic room → #1 Root Class
Children: none
Call graph
Showing 48 of 65 verbs; 17 not shown.
Source
working_on
Referenced by
- #47:init_session line 8:
this:working_on
Source
1return this:ok(who = args[1]) && tostr("a letter ", this:sending(who) ? "(in transit) " | "", "to ", this:recipient_names(who), (subject = `this.subjects[who] ! ANY') && tostr(" entitled \"", subject, "\""));
parse_invoke
Referenced by
none
Source
1"invoke(rcptstrings,verb[,subject]) for a @send"; 2"invoke(1,verb,rcpts,subject,replyto,body) if no parsing is needed"; 3"invoke(2,verb,msg,flags,replytos) for an @answer"; 4if (!(which = args[1])) 5player:tell_lines({tostr("Usage: ", args[2], " <list-of-recipients>"), tostr(" ", args[2], " to continue with a previous draft")}); 6elseif (typeof(which) == LIST) 7"...@send..."; 8if (rcpts = this:parse_recipients({}, which)) 9if (replyto = player:mail_option("replyto")) 10replyto = this:parse_recipients({}, replyto, ".mail_options: "); 11endif 12if (0 == (subject = {@args, 0}[3])) 13if (player:mail_option("nosubject")) 14subject = ""; 15else 16player:tell("Subject:"); 17subject = $command_utils:read(); 18endif 19endif 20return {rcpts, subject, replyto, {}}; 21endif 22elseif (which == 1) 23return args[3..6]; 24elseif (!(to_subj = this:parse_msg_headers(msg = args[3], flags = args[4]))) 25else 26include = {}; 27if ("include" in flags) 28prefix = "> "; 29for line in ($mail_agent:to_text(@msg)) 30if (!line) 31prefix = "> "; 32include = {@include, prefix}; 33else 34include = {@include, @this:fill_string("> " + line, 70, prefix)}; 35endif 36endfor 37endif 38return {@to_subj, args[5], include}; 39endif 40return 0;
init_session
Referenced by
none
Source
1{who, recip, subj, replyto, msg} = args; 2if (this:ok(who)) 3this.sending[who] = 0; 4this.recipients[who] = recip; 5this.subjects[who] = subj; 6this.replytos[who] = replyto || {}; 7this:load(who, msg); 8this.active[who]:tell("Composing ", this:working_on(who)); 9p = this.active[who]; 10"if (p:mail_option(\"enter\") && !args[5])"; 11"Changed from above so that @reply can take advantage of @mailoption +enter. Ho_Yan 11/9/94"; 12if (p:mail_option("enter")) 13if (typeof(lines = $command_utils:read_lines()) == ERR) 14p:tell(lines); 15else 16this:insert_line(p in this.active, lines, 0); 17endif 18endif 19endif
pri*nt
Referenced by
none
Source
1if (!dobjstr) 2plyr = player; 3elseif ($command_utils:player_match_result(plyr = $string_utils:match_player(dobjstr), dobjstr)[1]) 4return; 5endif 6if ((plyr != player) && (!this:readable(plyr in this.active))) 7player:tell(plyr.name, "(", plyr, ") has not published anything here."); 8elseif (typeof(msg = this:message_with_headers(plyr in this.active)) != LIST) 9player:tell(msg); 10else 11player:display_message({((plyr == player) ? "Your" | tostr(plyr.name, "(", plyr, ")'s")) + " message so far:", ""}, player:msg_text(@msg)); 12endif
message_with_headers
Referenced by
- #47:pri*nt line 8:
this:message_with_headers - #47:send line 9:
this:message_with_headers
Source
1return (this:readable(who = args[1]) || this:ok(who)) && $mail_agent:make_message(this.active[who], this.recipients[who], {this.subjects[who], this.replytos[who]}, this:text(who));
subj*ect:
Referenced by
none
Source
1if (!(who = this:loaded(player))) 2player:tell(this:nothing_loaded_msg()); 3elseif (!argstr) 4player:tell(this.subjects[who]); 5elseif (ERR == typeof(subj = this:set_subject(who, argstr))) 6player:tell(subj); 7else 8player:tell(subj ? ("Setting the subject line for your message to \"" + subj) + "\"." | "Deleting the subject line for your message."); 9endif
set_subject
Referenced by
- #47:subj*ect: line 5:
this:set_subject
Source
1if (!(fuckup = this:ok(who = args[1]))) 2return fuckup; 3else 4this.subjects[who] = subj = args[2]; 5this:set_changed(who, 1); 6return subj; 7endif
sending
Referenced by
- #47:working_on line 1:
this:sending - #47:send line 6:
this:sending - #47:retain_session_on_exit line 1:
this:sending
Source
1if (!(fuckup = this:ok(who = args[1]))) 2return fuckup; 3elseif ((!(task = this.sending[who])) || $code_utils:task_valid(task)) 4return task; 5else 6"... uh oh... sending task crashed..."; 7this:set_changed(who, 1); 8return this.sending[who] = 0; 9endif
to*:
Referenced by
none
Source
1if (!(who = this:loaded(player))) 2player:tell(this:nothing_loaded_msg()); 3elseif (!args) 4player:tell("Your message is currently to ", this:recipient_names(who), "."); 5else 6this.recipients[who] = this:parse_recipients({}, args); 7this:set_changed(who, 1); 8player:tell("Your message is now to ", this:recipient_names(who), "."); 9endif
also*-to: cc*:
Referenced by
none
Source
1if (!(who = this:loaded(player))) 2player:tell(this:nothing_loaded_msg()); 3else 4this.recipients[who] = this:parse_recipients(this.recipients[who], args); 5this:set_changed(who, 1); 6player:tell("Your message is now to ", this:recipient_names(who), "."); 7endif
not-to*: uncc*:
Referenced by
none
Source
1if (!(who = this:loaded(player))) 2player:tell(this:nothing_loaded_msg()); 3else 4recips = this.recipients[who]; 5nonmrs = {}; 6mrs = {}; 7for o in (recips) 8if ($object_utils:isa(o, $mail_recipient)) 9mrs = {@mrs, o}; 10else 11nonmrs = {@nonmrs, o}; 12endif 13endfor 14for a in (args) 15if (!a) 16player:tell("\"\"?"); 17return; 18elseif (valid(aobj = $mail_agent:match_recipient(a)) && (aobj in recips)) 19elseif ($failed_match != (aobj = $string_utils:literal_object(a))) 20if (!(aobj in recips)) 21player:tell(aobj, " was not a recipient."); 22return; 23endif 24elseif ((a[1] == "*") && valid(aobj = $string_utils:match(a[2..$], mrs, "aliases"))) 25elseif ((a[1] != "*") && valid(aobj = $string_utils:match(a, nonmrs, "aliases"))) 26elseif (valid(aobj = $string_utils:match(a, recips, "aliases"))) 27else 28player:tell("couldn't find \"", a, "\" in To: list."); 29return; 30endif 31recips = setremove(recips, aobj); 32endfor 33this.recipients[who] = recips; 34this:set_changed(who, 1); 35player:tell("Your message is now to ", this:recipient_names(who), "."); 36endif
parse_recipients
Referenced by
- #40:@quick*send line 15:
$mail_editor:parse_recipients - #47:parse_invoke line 8:
this:parse_recipients - #47:parse_invoke line 10:
this:parse_recipients - #47:to*: line 6:
this:parse_recipients - #47:also*-to: line 4:
this:parse_recipients - #47:check_answer_flags line 32:
this:parse_recipients - #47:reply-to*: line 5:
this:parse_recipients - #47:who line 2:
this:parse_recipients - #47:subsc*ribe line 10:
this:parse_recipients - #47:unsubsc*ribe line 8:
this:parse_recipients - #65:parse_replyto line 7:
$mail_editor:parse_recipients - #91:@send line 22:
$mail_editor:parse_recipients - #91:@send line 22:
$mail_editor:parse_recipients
Source
1"parse_recipients(prev_list,list_of_strings) -- parses list of strings and adds any resulting player objects to prev_list. Optional 3rd arg is prefixed to any mismatch error messages"; 2{recips, l, ?cmd_id = ""} = args; 3cmd_id = cmd_id || ""; 4for s in ((typeof(l) == LIST) ? l | {l}) 5if (typeof(s) != STR) 6if ($mail_agent:is_recipient(s)) 7recips = setadd(recips, s); 8else 9player:tell(cmd_id, s, " is not a valid mail recipient."); 10endif 11elseif (!$mail_agent:match_failed(md = $mail_agent:match_recipient(s), s, cmd_id)) 12recips = setadd(recips, md); 13endif 14endfor 15return recips;
recipient_names
Referenced by
- #47:working_on line 1:
this:recipient_names - #47:to*: line 4:
this:recipient_names - #47:to*: line 8:
this:recipient_names - #47:also*-to: line 6:
this:recipient_names - #47:not-to*: line 35:
this:recipient_names
Source
1return this:ok(who = args[1]) && $mail_agent:name_list(@this.recipients[who]);
make_message
Referenced by
none
Source
1return $mail_agent:make_message(@args);
name_list
Referenced by
none
Source
1"(obsolete verb... see $mail_agent:name_list)"; 2return $mail_agent:(verb)(@args[1]);
parse_msg_headers
Referenced by
- #40:@quickr*eply line 15:
$mail_editor:parse_msg_headers - #47:parse_invoke line 24:
this:parse_msg_headers
Source
1"parse_msg_headers(msg,flags)"; 2" parses msg to extract reply recipients and construct a subject line"; 3" if the \"all\" flag is present, reply goes to all of the original recipients"; 4" returns a list {recipients, subjectline} or 0 in case of error."; 5{msg, flags} = args; 6replyall = "all" in flags; 7objects = {}; 8if ("followup" in flags) 9"...look for first non-player recipient in To: line..."; 10for o in ($mail_agent:parse_address_field(msg[3])) 11if (objects) 12break o; 13elseif ($object_utils:isa(o, $mail_recipient)) 14objects = {o}; 15endif 16endfor 17endif 18objects = objects || $mail_agent:parse_address_field(msg[2] + (replyall ? msg[3] | "")); 19for line in (msg[5..("" in {@msg, ""}) - 1]) 20if (rt = index(line, "Reply-to:") == 1) 21objects = $mail_agent:parse_address_field(line); 22endif 23endfor 24recips = {}; 25for o in (objects) 26if (o == #0) 27player:tell("Sorry, but I can't parse the header of that message."); 28return 0; 29elseif ((!valid(o)) || (!(is_player(o) || ($mail_recipient in $object_utils:ancestors(o))))) 30player:tell(o, " is no longer a valid player or maildrop; ignoring that recipient."); 31elseif (o != player) 32recips = setadd(recips, o); 33endif 34endfor 35subject = msg[4]; 36if (subject == " ") 37subject = ""; 38elseif (subject && (index(subject, "Re: ") != 1)) 39subject = "Re: " + subject; 40endif 41return {recips, subject};
check_answer_flags
Referenced by
- #40:@answer line 6:
$mail_editor:check_answer_flags - #40:@quickr*eply line 9:
$mail_editor:check_answer_flags
Source
1flags = {}; 2for o in ({"all", "include", "followup"}) 3if (player:mail_option(o)) 4flags = {@flags, o}; 5endif 6endfor 7reply_to = player:mail_option("replyto") || {}; 8flaglist = "+1#include -1#noinclude +2#all -2#sender 0#replyto +3#followup "; 9for a in (args) 10if (i = index(a, "=")) 11value = a[i + 1..$]; 12a = a[1..i - 1]; 13else 14value = ""; 15endif 16if ((typeof(a) != STR) || ((i = index(flaglist, "#" + a)) < 3)) 17player:tell("Unrecognized answer/reply option: ", a); 18return 0; 19elseif (i != rindex(flaglist, "#" + a)) 20player:tell("Ambiguous answer/reply option: ", a); 21return 0; 22elseif (j = index("0123456789", flaglist[i - 1]) - 1) 23if (value) 24player:tell("Flag does not take a value: ", a); 25return 0; 26endif 27f = {"include", "all", "followup"}[j]; 28flags = (flaglist[i - 2] == "+") ? setadd(flags, f) | setremove(flags, f); 29if (f == "all") 30flags = setremove(flags, "followup"); 31endif 32elseif ((!value) || (value = this:parse_recipients({}, $string_utils:explode(value), "replyto flag: "))) 33reply_to = value || {}; 34endif 35endfor 36return {flags, reply_to};
reply-to*: replyto*:
Referenced by
none
Source
1if (!(who = this:loaded(player))) 2player:tell(this:nothing_loaded_msg()); 3else 4if (args) 5this.replytos[who] = rt = this:parse_recipients({}, args); 6this:set_changed(who, 1); 7else 8rt = this.replytos[who]; 9endif 10player:tell(rt ? ("Replies will go to " + $mail_agent:name_list(@this.replytos[who])) + "." | "Reply-to field is empty."); 11endif
send
Referenced by
none
Source
1"WIZARDLY"; 2if (!(who = this:loaded(player))) 3player:notify(this:nothing_loaded_msg()); 4elseif (!(recips = this.recipients[who])) 5player:notify("Umm... your message isn't addressed to anyone."); 6elseif (this:sending(who)) 7player:notify("Again? ... relax... it'll get there eventually."); 8else 9msg = this:message_with_headers(who); 10this.sending[who] = old_sending = task_id(); 11this:set_changed(who, 0); 12player:notify("Sending..."); 13"... this sucker can suspend BIG TIME..."; 14result = $mail_agent:raw_send(msg, recips, player); 15"... the world changes..."; 16who = player in this.active; 17if (who && (this.sending[who] == old_sending)) 18"... same editing session; no problemo..."; 19previous = ""; 20this.sending[who] = 0; 21else 22"... uh oh, different session... tiptoe quietly out..."; 23"... Don't mess with the session."; 24previous = "(prior send) "; 25endif 26if (!(e = result[1])) 27player:notify(tostr(previous, (typeof(e) == ERR) ? e | ("Bogus recipients: " + $string_utils:from_list(result[2])))); 28player:notify(tostr(previous, "Mail not sent.")); 29previous || this:set_changed(who, 1); 30elseif (length(result) == 1) 31player:notify(tostr(previous, "Mail not actually sent to anyone.")); 32previous || this:set_changed(who, 1); 33else 34player:notify(tostr(previous, "Mail actually sent to ", $mail_agent:name_list(@listdelete(result, 1)))); 35if (previous) 36"...don't even think about it..."; 37elseif (player.location == this) 38if (ticks_left() < 10000) 39suspend(0); 40endif 41this:done(); 42elseif (!this:changed(who)) 43"... player is gone, no further edits..."; 44this:kill_session(who); 45endif 46endif 47endif
who
Referenced by
none
Source
1if (dobjstr) 2if (!(recips = this:parse_recipients({}, args))) 3"parse_recipients has already complained about anything it doesn't like"; 4return; 5endif 6elseif (caller != player) 7return E_PERM; 8elseif (!(who = this:loaded(player))) 9player:tell(this:nothing_loaded_msg()); 10return; 11else 12recips = this.recipients[who]; 13endif 14resolve = $mail_agent:resolve_addr(recips, player); 15if (resolve[1]) 16player:tell("Bogus addresses: ", $string_utils:english_list(resolve[1])); 17else 18player:tell(dobjstr ? ("Mail to " + $mail_agent:name_list(@recips)) + " actually goes to " | "Your mail will actually go to ", $mail_agent:name_list(@resolve[2])); 19endif
showlists
Referenced by
none
Source
1player:tell_lines({"Available aliases:", ""}); 2for c in ((dobjstr == "all") ? $object_utils:descendants($mail_recipient) | $mail_agent.contents) 3if (c:is_usable_by(player) || c:is_readable_by(player)) 4c:look_self(); 5endif 6endfor
subsc*ribe
Referenced by
none
Source
1player:tell("This command is obsolete. Use @subscribe instead. See `help @subscribe'"); 2return; 3if (!iobjstr) 4player:tell("Usage: ", verb, " [<list-of-people/lists>] to <list>"); 5return; 6elseif ($mail_agent:match_failed(iobj = $mail_agent:match(iobjstr), iobjstr)) 7return; 8endif 9rstrs = dobjstr ? $string_utils:explode(dobjstr) | {"me"}; 10recips = this:parse_recipients({}, rstrs); 11outcomes = iobj:add_forward(@recips); 12if (typeof(outcomes) != LIST) 13player:tell(outcomes); 14return; 15endif 16added = {}; 17for r in [1..length(recips)] 18if ((t = typeof(e = outcomes[r])) == OBJ) 19added = setadd(added, recips[r]); 20else 21player:tell(verb, " ", recips[r].name, " to ", iobj.name, ": ", e); 22endif 23endfor 24if (added) 25player:tell($string_utils:english_list($list_utils:map_arg(2, $string_utils, "pronoun_sub", "%(name) (%#)", added)), " added to ", iobj.name, " (", iobj, ")"); 26endif
unsubsc*ribe
Referenced by
none
Source
1if (!iobjstr) 2player:tell("Usage: ", verb, " [<list-of-people/lists>] from <list>"); 3return; 4elseif ($mail_agent:match_failed(iobj = $mail_agent:match(iobjstr), iobjstr)) 5return; 6endif 7rstrs = dobjstr ? $string_utils:explode(dobjstr) | {"me"}; 8recips = this:parse_recipients({}, rstrs); 9outcomes = iobj:delete_forward(@recips); 10if (typeof(outcomes) != LIST) 11player:tell(outcomes); 12return; 13endif 14removed = {}; 15for r in [1..length(recips)] 16if (typeof(e = outcomes[r]) == ERR) 17player:tell(verb, " ", recips[r].name, " from ", iobj.name, ": ", (e == E_INVARG) ? "Not on list." | e); 18else 19removed = setadd(removed, recips[r]); 20endif 21endfor 22if (removed) 23player:tell($string_utils:english_list($list_utils:map_arg(2, $string_utils, "pronoun_sub", "%(name) (%#)", removed)), " removed from ", iobj.name, " (", iobj, ")"); 24endif
retain_session_on_exit
Referenced by
none
Source
1return this:ok(who = args[1]) && (this:sending(who) || pass(@args));
no_littering_msg
Referenced by
none
Source
1"recall that this only gets called if :retain_session_on_exit returns true"; 2return (this:ok(who = player in this.active) && (!this:changed(who))) ? {"Your message is in transit."} | this.(verb);
local_editing_info
Referenced by
none
Source
1lines = {"To: " + (toline = $mail_agent:name_list(@args[1])), "Subject: " + $string_utils:trim(subject = args[2])}; 2if (args[3]) 3lines = {@lines, "Reply-to: " + $mail_agent:name_list(@args[3])}; 4endif 5lines = {@lines, "", @args[4]}; 6return {tostr("MOOMail", subject ? ("(" + subject) + ")" | (("-to(" + toline) + ")")), lines, "@@sendmail"};