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