Switch to edit mode.
Name(s): bonk_on_mail1: ":notify_mail(from,recipients[,msgnums])"
2: " Updated to be more accurate by Catspaw (#7921)"
3: " used by $mail_agent:raw_send to notify this player about mail being sent"
4: " from <from> to <recipients>. <msgnums> if given gives the message number(s) assigned (in the event that the corresponding recipient actually kept the mail)"
5: if (!this:connected())
6: return
7: elseif (!$perm_utils:controls(caller_perms(), this))
8: raise(E_PERM)
9: else
10: {from, recipients, ?msgnums = {}} = args
11: "... msgnums may be shorter than recipients or may have some slots filled"
12: "... with 0's if msg numbers are not available for some recipients."
13: if ((t = this in recipients) && (length(msgnums) >= t && msgnums[t]))
14: "... you are getting the mail and moreover your :receive_message kept it."
15: namelist = $string_utils:english_list($list_utils:map_arg($mail_agent, "name", setremove(recipients, this)), "")
16: this:tell("<font color=#FFFF00>The Postman arrives, hands you new spam from ", typeof(from) == $OBJ ? from:nn() | from, namelist ? " (which was also sent to " + namelist + ")" | "", ", then departs.</font>")
17: this.location:announce_all_but({this}, "The Postman arrives, hands some new spam to ", this:title(), ", then departs.")
18: if (!this:mail_option("expert"))
19: this:tell("<font color=#FFFF00>Type `<A xch_cmd=\"@mail on me\">@mail on me</A>' for info on reading it.</font>")
20: endif
21: else
22: "... vanilla notification; somebody got sent mail and you're finding out."
23: namelist = $string_utils:english_list({@t ? {"You"} | {}, @$list_utils:map_arg($mail_agent, "name", setremove(recipients, this))}, "")
24: if (from == $no_one)
25: this:tell("<font color=#FFFF00>", namelist, length(recipients) == 1 ? " has" | " have", " just been sent new spam.</font>")
26: else
27: this:tell("<font color=#FFFF00>", namelist, length(recipients) == 1 ? " has" | " have", " just been sent new spam by ", typeof(from) == $OBJ ? from:nn() | from, ".</font>")
28: endif
29: endif
30: endif
31: "Last modified by Dax (#789) on Tue May 3 13:49:43 2005 MDT."