( MUF-Mail v1.08 Programmer: Sjade of HoloMUCK This program is an entirely self-contained mailer for MUF systems of type 2.2 or better. All that needs doing to set up this pro- gram is to have a 'mail' or some such action connected to the program and everything is set to go. If there are any problems or questions, Sjade can be found on HoloMUCK 128.135.120.46 port 5757 most of the time. This program may be distributed freely by electronic means only in its original form. Please respect the rights of the author. ) : mailer_daemon trigger @ getlink "mailer_daemon" getpropstr atoi dbref dup player? not if pop #-1 then ; : mail_read_help me @ "# read message #" notify me @ "a message again" notify me @ "c switch to message #" notify me @ "d delete" notify me @ "f forward" notify me @ "h datestamps and headers" notify me @ "? help" notify me @ "q quit" notify me @ "r reply" notify ; : mail_send_help me @ "c carbon copy" notify me @ "q quit" notify me @ "v view mail before sending" notify me @ "s send mail" notify me @ "? help" notify ; : mail_edit_help me @ "#- back up one line" notify me @ "#+x^y substitute x for y in last line" notify me @ "#ln line number toggle" notify me @ "#? help" notify ; : number_sub me @ "tempmailmessage" getpropstr atoi intostr "%c" subst trigger @ getlink me @ intostr "-m" strcat getpropstr atoi intostr "%total" subst ; : delete_beta_mail_outside_loop me @ intostr "/" strcat 3 pick strcat "/" strcat over intostr strcat trigger @ getlink swap prop-exists? not if me @ intostr "/" strcat 3 pick strcat "/s" strcat trigger @ getlink swap getpropstr me @ intostr "/" strcat 4 pick atoi 1 - intostr strcat "/s" strcat trigger @ getlink swap rot 0 addprop me @ intostr "/" strcat 3 pick strcat "/a" strcat trigger @ getlink swap getpropstr me @ intostr "/" strcat 4 pick atoi 1 - intostr strcat "/a" strcat trigger @ getlink swap rot 0 addprop me @ intostr "/" strcat 3 pick strcat "/d" strcat trigger @ getlink swap getpropstr me @ intostr "/" strcat 4 pick atoi 1 - intostr strcat "/d" strcat trigger @ getlink swap rot 0 addprop me @ intostr "/" strcat 3 pick strcat "/a" strcat trigger @ getlink swap remove_prop me @ intostr "/" strcat 3 pick strcat "/s" strcat trigger @ getlink swap remove_prop me @ intostr "/" strcat 3 pick strcat "/d" strcat trigger @ getlink swap remove_prop exit else me @ intostr "/" strcat 3 pick strcat "/" strcat over intostr strcat trigger @ getlink swap getpropstr me @ intostr "/" strcat 4 pick atoi 1 - intostr strcat "/" strcat 3 pick intostr strcat trigger @ getlink swap rot 0 addprop me @ intostr "/" strcat 3 pick strcat "/" strcat over intostr strcat trigger @ getlink swap remove_prop 1 + delete_beta_mail_outside_loop then ; : delete_beta_mail_inside_loop 3 pick atoi 3 pick atoi swap > if pop pop pop exit then delete_beta_mail_outside_loop pop 1 swap atoi 1 + intostr swap delete_beta_mail_inside_loop ; : delete_current_message me @ intostr "/" strcat 3 pick strcat "/" strcat over intostr strcat trigger @ getlink swap prop-exists? not if pop exit else me @ intostr "/" strcat 3 pick strcat "/" strcat over intostr strcat trigger @ getlink swap remove_prop 1 + delete_current_message then ; : delete_beta_mail 1 delete_current_message me @ intostr "/" strcat over strcat "/s" strcat trigger @ getlink swap remove_prop me @ intostr "/" strcat over strcat "/a" strcat trigger @ getlink swap remove_prop me @ intostr "/" strcat over strcat "/d" strcat trigger @ getlink swap remove_prop trigger @ getlink me @ intostr "-m" strcat getpropstr "1" stringcmp not if pop me @ "tempmailmessage" remove_prop trigger @ getlink me @ intostr "-m" strcat remove_prop exit else atoi 1 + intostr trigger @ getlink me @ intostr "-m" strcat getpropstr swap 1 delete_beta_mail_inside_loop me @ intostr "-m" strcat trigger @ getlink swap getpropstr atoi 1 - intostr me @ intostr "-m" strcat trigger @ getlink swap rot 0 addprop me @ "tempmailmessage" remove_prop then ; : outside_send_loop dup intostr "tempmail-" swap strcat me @ swap prop-exists? not if pop 4 rotate dup .pmatch #-1 dbcmp not if pop me @ "tempmail-a" getpropstr else "/RL/" strcat me @ "tempmail-a" getpropstr strcat then over "a" strcat trigger @ getlink swap rot 0 addprop me @ "tempmail-d" getpropstr over "d" strcat trigger @ getlink swap rot 0 addprop me @ "tempmail-s" getpropstr swap "s" strcat trigger @ getlink swap rot 0 addprop pop exit then dup intostr "tempmail-" swap strcat me @ swap getpropstr 3 pick 3 pick intostr strcat trigger @ getlink swap rot 0 addprop 1 + outside_send_loop ; : inside_send_loop dup 0 = if pop exit then over trigger @ getlink swap .pmatch dup #-1 dbcmp if pop mailer_daemon then dup #-1 dbcmp if pop pop swap pop 1 - inside_send_loop exit then dup intostr "-m" strcat trigger @ getlink swap getpropstr atoi 1 + swap dup "% You have new mail." notify dup name "Mail sent to " swap strcat "." strcat me @ swap notify intostr dup "-m" strcat trigger @ getlink swap 4 pick intostr 0 addprop "/" strcat swap intostr strcat "/" strcat 1 outside_send_loop 1 - inside_send_loop ; : send_beta_mail " " explode inside_send_loop ; : show_temp_mail dup intostr "tempmail-" swap strcat me @ swap prop-exists? not if pop exit then dup intostr "tempmail-" swap strcat me @ swap getpropstr over intostr dup strlen 1 = if "0" swap strcat then "> " strcat swap strcat me @ swap notify 1 + show_temp_mail ; : delete_temp_mail_loop dup intostr "tempmail-" swap strcat me @ swap prop-exists? not if pop pop exit then dup intostr "tempmail-" swap strcat me @ swap remove_prop 1 + delete_temp_mail_loop ; : delete_temp_mail me @ "tempmail-s" remove_prop me @ "tempmail-a" remove_prop me @ "tempmail-d" remove_prop me @ "lnswitch" remove_prop 1 delete_temp_mail_loop ; : cc_check dup 0 = if pop exit then over .pmatch #-1 dbcmp if over dup "!" instr swap "@" instr or if swap over 2 + rotate dup "" stringcmp if " " strcat then swap strcat over 1 + 0 swap - rotate else swap pop then 1 - cc_check exit then swap .pmatch name dup 3 pick 3 + pick swap instr if pop 1 - cc_check else over 2 + rotate dup "" stringcmp if " " strcat then swap strcat over 1 + 0 swap - rotate 1 - cc_check then ; : carbon_copy me @ "Cc:" notify read .sstrip " " explode cc_check me @ "Recipient list: " 3 pick strcat notify ; : send_options me @ "[ c q s v ? ]" notify read dup "" stringcmp not if pop " " then dup "?cqvs" swap instr not if pop me @ "Just do what is in []'s, please." notify send_options else dup "q" 1 strncmp not if pop 1 delete_temp_mail exit else dup "v" 1 strncmp not if pop 1 show_temp_mail send_options else dup "s" 1 strncmp not if pop dup send_beta_mail 1 delete_temp_mail exit else dup "?" 1 strncmp not if pop mail_send_help send_options else dup "c" 1 strncmp not if pop carbon_copy send_options else send_beta_mail send_options then then then then then then ; : get_message_to_send dup 100 > if notify me @ "MAIL> Maximum lines reached." notify exit then me @ "lnswitch" getpropstr "on" stringcmp not if dup intostr ">" strcat me @ swap notify then read dup "." stringcmp not if pop exit else dup "#-" 2 strncmp not if pop dup 1 = if me @ "MAIL> No lines in buffer" notify get_message_to_send else "tempmail-" over 1 - intostr strcat me @ swap remove_prop me @ "MAIL> Backing up to line " 3 pick 1 - intostr strcat notify 1 - get_message_to_send then else dup "#?" 2 strncmp not if mail_edit_help pop get_message_to_send else dup "#ln" 3 strncmp not if me @ "lnswitch" getpropstr "on" stringcmp not if me @ "lnswitch" "off" 0 addprop else me @ "lnswitch" "on" 0 addprop then pop get_message_to_send else dup "#+" 2 strncmp not if 2 strcut swap pop dup "^" instr 1 - strcut 1 strcut swap pop "tempmail-" 4 pick 1 - intostr strcat me @ swap getpropstr rot rot swap subst dup me @ "MAIL> Newline: " rot strcat notify "tempmail-" 3 pick 1 - intostr strcat me @ swap rot 0 addprop get_message_to_send else over intostr "tempmail-" swap strcat me @ swap rot 0 addprop 1 + get_message_to_send then then then then then ; : do_send me @ "Please enter a subject (. to abort):" notify read dup "." stringcmp not if me @ "MAIL> Mail unsent, quit requested." notify delete_temp_mail exit then me @ "tempmailmessage" getpropstr dup "" stringcmp not if pop else trigger @ getlink me @ intostr "/" strcat rot strcat "/s" strcat getpropstr dup "RE:" instr if dup ")" instr 1 + strcut swap pop then "(RE: " swap strcat ") " strcat swap strcat then me @ "tempmail-s" rot 0 addprop me @ "tempmail-d" systime intostr "/0" strcat 0 addprop me @ "Enter message; '.' to end, '#?' for help." notify me @ "lnswitch" "on" 0 addprop 1 get_message_to_send 1 = if me @ "MAIL> Mail unsent, quit requested." notify 1 delete_temp_mail exit then me @ "tempmail-a" me @ intostr 0 addprop send_options ; : pad dup strlen 1 = if " " swap strcat then ; : list_headers dup intostr trigger @ getlink swap "/" swap strcat "/s" strcat me @ intostr swap strcat getpropstr not if pop exit then me @ intostr "/" strcat over intostr strcat "" over "/d" strcat trigger @ getlink swap getpropstr dup "/" instr strcut swap pop dup "0" strcmp not if swap pop "N> " swap then dup "1" strcmp not if swap pop "U> " swap then dup "2" strcmp not if swap pop " " swap then pop 3 pick intostr pad strcat " " strcat over "/a" strcat trigger @ getlink swap getpropstr dup number? if atoi dbref name else dup "/RL/" rinstr 1 - strcut pop then strcat dup strlen 22 > if 22 strcut pop else " " over strlen strcut swap pop strcat then " " strcat over "/d" strcat trigger @ getlink swap getpropstr dup "/" instr strcut pop atoi ctime strcat " \"" strcat swap "/s" strcat trigger @ getlink swap getpropstr strcat "\"" strcat dup strlen 78 > if 78 strcut pop else " " dup strcat over strlen strcut swap pop strcat then me @ swap notify 1 + list_headers ; : read_beta_mail_loop over over intostr strcat trigger @ getlink swap prop-exists? not if pop pop exit else over over intostr strcat trigger @ getlink swap getpropstr me @ swap notify dup 15 % 0 = if me @ ">>Press then for more<<" notify read pop then 1 + read_beta_mail_loop then ; : read_beta_mail dup dup 0 < swap trigger @ getlink me @ intostr "-m" strcat getpropstr atoi > or if me @ "MAIL> Invalid message number." notify exit then me @ "tempmailmessage" 3 pick intostr 0 addprop me @ intostr "/" strcat over intostr strcat "/d" strcat trigger @ getlink swap getpropstr "/2" "/0" subst "/2" "/1" subst me @ intostr "/" strcat 3 pick intostr strcat "/d" strcat trigger @ getlink swap rot 0 addprop me @ intostr "/" strcat over intostr strcat "/s" strcat trigger @ getlink swap getpropstr me @ "Subject: " rot strcat notify me @ intostr "/" strcat over intostr strcat "/d" strcat trigger @ getlink swap getpropstr dup "/" instr strcut pop atoi ctime me @ "Receipt: " rot strcat notify me @ intostr "/" strcat over intostr strcat "/a" strcat trigger @ getlink swap getpropstr me @ "From: " rot dup number? if atoi dbref name else dup "/RL/" rinstr 1 - strcut pop then strcat notify me @ " " notify dup me @ intostr "/" strcat swap intostr strcat "/" strcat 1 read_beta_mail_loop me @ " " notify ; : get_mail_to_forward me @ intostr "/" strcat 3 pick strcat "/" strcat over intostr strcat trigger @ getlink over prop-exists? not if pop pop me @ intostr "/" strcat over strcat "/s" strcat trigger @ getlink swap getpropstr me @ "tempmail-s" rot 0 addprop me @ intostr "/" strcat swap strcat "/a" strcat trigger @ getlink swap getpropstr me @ "tempmail-a" rot 0 addprop me @ "tempmail-d" systime intostr "/0" strcat 0 addprop exit else trigger @ getlink swap getpropstr "tempmail-" 3 pick intostr strcat me @ swap rot 0 addprop 1 + get_mail_to_forward then ; : read_options me @ "[ # a c d f h q r ? - %c of %total ]" number_sub notify trigger @ getlink me @ intostr "-m" strcat getpropstr atoi 0 = if me @ "Your mailbox is now empty." notify exit else read dup "" stringcmp not if pop " " then then dup dup atoi 0 = swap "acdfhqr?" swap instr not and if pop me @ "Just do what is in []'s, please." notify read_options exit then dup "?" 1 strncmp not if pop mail_read_help read_options exit else dup "c" 1 strncmp not if pop "Message to switch to>" me @ swap notify read .sstrip atoi dup dup 0 < swap trigger @ getlink me @ intostr "-m" strcat getpropstr atoi > or if pop me @ "MAIL> Invalid message number." notify read_options exit else me @ "tempmailmessage" rot intostr 0 addprop read_options exit then else dup "q" 1 strncmp not if me @ "tempmailmessage" remove_prop 1 delete_temp_mail pop exit then dup "h" 1 strncmp not if pop 1 list_headers read_options exit then dup atoi 0 = not if atoi read_beta_mail pop read_options exit then dup "a" 1 strncmp not if pop me @ "tempmailmessage" getpropstr "" stringcmp not if me @ "MAIL> No current message." notify read_options else me @ "tempmailmessage" getpropstr atoi read_beta_mail pop read_options then exit then dup "r" 1 strncmp not if pop me @ "tempmailmessage" getpropstr "" stringcmp not if me @ "MAIL> No current message." notify read_options else me @ "tempmailmessage" getpropstr me @ intostr "/" strcat swap strcat "/a" strcat trigger @ getlink swap getpropstr atoi dbref name me @ "MAIL> Entering send mode..." notify do_send me @ "MAIL> Returning to read mode..." notify pop read_options then exit then dup "d" 1 strncmp not if pop me @ "tempmailmessage" getpropstr "" stringcmp not if me @ "MAIL> No current message." notify read_options else me @ "tempmailmessage" getpropstr delete_beta_mail read_options then exit then dup "f" 1 strncmp not if pop me @ "tempmailmessage" getpropstr dup "" stringcmp not if pop me @ "MAIL> No current message." notify read_options else 1 get_mail_to_forward me @ "Enter list of recipients:" notify read .sstrip dup "" stringcmp not if pop exit else "" swap " " explode cc_check send_beta_mail 1 delete_temp_mail read_options else then then then then then ; : read_beta_mail trigger @ getlink me @ intostr "-m" strcat getpropstr atoi not if me @ "No mail for " me @ name strcat "." strcat notify exit then read_options ; : beta_mail_main .sstrip dup "%help" 5 strncmp not if me @ "Read options:" notify mail_read_help me @ "Send options:" notify mail_send_help exit then dup "" stringcmp not if pop trigger @ getlink me @ intostr "-lr" strcat systime intostr 0 addprop me @ "Opening inbox..." notify read_beta_mail trigger @ getlink me @ intostr "-m" strcat getpropstr dup not if pop else atoi begin dup while trigger @ getlink me @ intostr "/" strcat 3 pick intostr strcat "/d" strcat getpropstr "/1" "/0" subst trigger @ getlink me @ intostr "/" strcat 4 pick intostr strcat "/d" strcat rot 0 addprop 1 - loop pop then me @ "Done." notify exit then "" swap " " explode cc_check "Recipient list: " over strcat me @ swap notify dup "" stringcmp not if me @ "MAIL> No recipients! Quit now or make sure to carbon copy." notify then do_send pop me @ "Done." notify ;