Multiple Signatures for BrandyMail 14
The code adds support for multiple signatures when sending +mail, as well as maintaining support for the already existing single-signature code.
Commands:
@create,
@dolist,
@drain,
@edit,
@pemit,
@set,
@startup,
@switch,
@teleport,
@trigger,
@wait.
Functions:
after(),
and(),
before(),
center(),
con(),
default(),
eq(),
escape(),
extract(),
get(),
get_eval(),
gt(),
hasattr(),
hasflag(),
iter(),
lcstr(),
ljust(),
match(),
matchall(),
mid(),
mudname(),
name(),
neq(),
not(),
objeval(),
or(),
pos(),
repeat(),
secure(),
setdiff(),
setq(),
setunion(),
sign(),
space(),
squish(),
strlen(),
strmatch(),
sub(),
switch(),
time(),
trim(),
type(),
u(),
ucstr(),
ulocal(),
v(),
words().
Instructions
Copy and paste the below code into a compatible MUSH or MUX.
MUSHCode for Multiple Signatures for BrandyMail 14
#
# Multiple Signatures for BrandyMail 14
#
# Version 1.1 (17/12/98)
# Coded by Greg Kempe (kempe@iafrica.com)
# BrandyMail coded by Brandy@CrystalMUSH
# Server: TinyMUSH 2.2.3, BrandyMail 14
#
# CHANGES IN 1.1:
# o Evaluation problem with %t, %b and function calls etc in signatures etc
# fixed
# o STORE_LETTER and GET_SIG_TEXT (on #10) updated
#
# HOWTO:
# o To apply the patches, change all occurrences of #17 to the dbref of your
# Parent Mail Object, all occurrences of #13 to the dbref of your Mail
# System object, and all occurrences of #22 to the dbref of your help
# object.
# Change all occurrences of #10 to the dbref of an object owned by a wizard
# and set inherit (used by the GET_SIG_TEXT function - see below)
#
# NB: If you have added some other patches that affect the attributes listed
# below, I strongly advise against just overwriting them with these
# versions. The modified sections should, instead, be copied across
# manually (they are clearly marked by comments.)
#
# DISCLAIMER: I am not liable for any damages to your DB caused by this code.
# It shouldn't, though, do anything funny, so don't worry too much.
# The patches are in no way official and aren't supported by
# Brandy.
# Please contact me with any oddities, so that I can update the
# patch code.
#
# DESCRIPTION:
#
# The code adds support for multiple signatures when sending +mail, as well as
# maintaining support for the already existing single-signature code.
# Signatures are easily selected and whenever a signature other than the
# default is selected, a message is shown in +proof and if a new message is
# begun. The signature text is help on unrestricted attributes on the player
# A help entry is included.
#
# Modified (or added) attributes and descriptions:
#
# &MAIL_COMMAND : shows a message about the current signature
# &PROOF_COMMAND : ditto - obeys FORMAT config option
# &FORWARD_MAIL2 : ditto
# &REPLY_COMMAND : ditto
# &REPLYALL_COMMAND : ditto
# &SIG_MSG : the message for above. Obeys FORMAT config option.
# - : added a line to the help displayed by '-'
# &STORE_LETTER : adds the required signature
# &GET_SIG_NAME : returns a player's current signature name
# &GET_SIG_TEXT : returns the (evaluated) text of a player's signature
# NB: above attribute MUST be set on a wiz-owned object
# set INHERIT, since none of the BrandyMail objects
# are set INHERIT but this function needs global perms.
#
# &HELP_MAIL : Mail Signatures added to index
# &HELP_MAIL_SIGNATURES
# : Text for multi-signature help
# &HELP_MAIL_OPTIONS : Mail Signatures added to 'See Also: '
#
# New commands (on #13):
# &SIG_CMD : +sig[s]
# &SIG_SELECT_CMD : +sig <sig name>
# &SIG_ADD_CMD : +sig/add <sig name>
# &SIG_DEL_CMD : +sig/del <sig name>
# &SIG_VIEW_CMD : +sig/view <sig name>
#
# New mailbox attributes:
# &SIG-CURRENT : name of current signature (blank or 'default' for default)
# &SIG-LIST : list of sig names (or blank for just the default sig)
#
# NOTE: If the two above attributes are blank, they are set when the user uses any
# of the +sig commands. ie. they do NOT have to be set manually upon
# installation of this patch.
#
# New attributes on player (non-restricted):
#
# &MAIL_SIG : default sig used (if SIG-CURRENT is blank or set to default)
# &MAIL_SIG_<sig> : text for other signatures
#
##############################################################################
#
# Let the code begin...
#
##############################################################################
&get_sig_name #17=switch(get(%1/SIG-CURRENT),,default,get(%1/SIG-CURRENT))
&get_sig_text #17=u(#10/get_sig_text,%0,%1)
&get_sig_text #10=objeval(%0,u(%0/MAIL_SIG[switch(%1,default,,_%1)]))
@set #10/get_sig_text=visual
&MAIL_COMMAND #13=$+mail *=*: @swi/first [setq(0, get(%vm/mailbox_%#))]1 = or(strmatch(escape(%0), *[*), strmatch(escape(%1), *[*)),{@pemit %# = u(nofunc)},not(strmatch(type(%#), PLAYER)),{@pemit %# = u(not_player)},eq(strlen(%q0), 0), {@swi/first [setq(6, get(%vm/global-mail-aliases))][setq(1, ulocal(identify_to_list, {%0}, %vm))][setq(2, u(get_aliases, {%0}, #0, %q6, ))][setq(3, setunion(%q1 [ulocal(expand_aliases, %q2, #0, %b, %q6, )], ))]1 = strmatch(%q1, *ABORT*),{@pemit %# = secure(after(before(%q1, ENDABORT), ABORT))},eq(words(%q3), 0),{@pemit %# = You must specify a destination for this piece of mail.},{@create %N's Mailbox; @set [setq(4, con(me))]%q4 = quiet; @drain %q4; &debug_mail %q4 = +mail %0=%1; @tel %q4 = %vm; &mailbox_%# %vm = %q4; @tr %vm/add_mailbox = %q4; &owner_dbref %q4 = %#; @startup %q4 = {@drain me; @no me}; @set %q4 = safe; ¤t_folder %q4 = ulocal(get_inbox, %#); &folder-list %q4 = get(%q4/current_folder); &mail-in-progress %q4 = true; &mail-in-progress-to %q4 = u(pretty_dist, %q2, #0, , %q6, %q1); &mail-in-progress-to-expanded %q4 = %q3; &mail-in-progress-subject %q4 = %1; @pemit %# = u(enter_msg); @no %q4}},{@wait %q0 = {&debug_mail %q0 = +mail %0=%1; @swi/first [setq(1, ulocal(identify_to_list, {%0}, %q0))][setq(7, get(%q0/alias-list))][setq(6, get(%vm/global-mail-aliases))][setq(2, u(get_aliases, {%0}, %q0, %q6, %q7))]1 = strmatch(get(%q0/mail-in-progress), true),{@pemit %# = You are already in the middle of sending a message. %bYou must complete that one before you begin another.; @no %q0},eq(strlen(%0), 0),{@pemit %# = You must specify a destination for this piece of mail.; @no %q0},strmatch(%q1, *ABORT*),{@pemit %# = secure(after(before(%q1, ENDABORT), ABORT)); @no %q0},{&mail-in-progress %q0 = true; &mail-in-progress-to %q0 = u(pretty_dist, %q2, %q0, %q7, %q6, %q1); &mail-in-progress-to-expanded %q0 = %q1 [ulocal(expand_aliases, %q2, %q0, %b, %q6, %q7)]; &mail-in-progress-subject %q0 = %1; @swi/first hasattr(%q0, mail-in-progress-to-expanded) = 0,{@pemit %# = You must specify a destination for this piece of mail.; &mail-in-progress %q0 = false; &mail-in-progress-to %q0 = ; &mail-in-progress-to-expanded %q0 = ; &mail-in-progress-subject %q0 = ; @no %q0},{@pemit %# = u(enter_msg)[u(sig_msg)]; @no %q0}}}}
&PROOF_COMMAND #13=$+proof: @swi/first [setq(0, get(%vm/mailbox_%#))]0 = strmatch(type(%#), PLAYER),{@pemit %# = u(not_player)},strlen(%q0),{@pemit %# = You are not currently writing a mail message.},{@wait %q0 = {&debug_mail %q0 = +proof; @pemit %# = switch(get(%q0/mail-in-progress),false, You are not currently writing a mail message.,{[setq(1, get(%q0/mail-in-progress-cc))][setq(2, get(%q0/mail-in-progress-bcc))][setq(3, get(%q0/mail-in-progress-flags))][setq(4, u(get_format_option, get(%#/mail_config_options)))][switch(%q4, standard, {[u(equal_line)]%r})]To:[space(7)][trim(get(%q0/mail-in-progress-to))][switch(words(%q1), 0,, %rCc:[space(7)][trim(%q1)])][switch(words(%q2), 0,, %rBcc:[space(6)][trim(%q2)])]%rSubject:%b%b[trim(get(%q0/mail-in-progress-subject))][switch(words(%q3), 0,, %rFlags:%b%b%b%b)][switch(match(%q3, u), 0,, [v(mail_flag_u)]%b%b)][switch(match(%q3, rr), 0,, [v(mail_flag_rr)]%b%b)][switch(match(%q3, r), 0,, [v(mail_flag_r)]%b%b)][switch(match(%q3, p), 0,, [v(mail_flag_p)]%b%b)][switch(or(strmatch(%q4, compact), strmatch(u(get_sig_name, %q0), default),),1,,%rSig:[space(5)] [u(get_sig_name, %q0)])][switch(%q4, standard, {%r[u(dash_line)]%r%r},%rText:[space(5)])][get_eval(%q0/mail-in-progress-body)][switch(%q4, standard, {%r%r[u(equal_line)]})]%r[u(finish_msg)]}); @swi and(v(spell_checker_available), hasflag(v(spell_checker), connect), strmatch(get(%q0/mail-in-progress), true)) = 1,{@pemit v(spell_checker) = StartSpelling %# 0 0 subject 0; @pemit v(spell_checker) = get(%q0/mail-in-progress-subject); @pemit v(spell_checker) = StopSpelling; @pemit v(spell_checker) = StartSpelling %# 0 0 text 0; @pemit v(spell_checker) = get(%q0/mail-in-progress-body); @pemit v(spell_checker) = StopSpelling}; @no %q0}}
&FORWARD_MAIL2 #13=$+forward *=*: @swi/first [setq(0, get(%vm/mailbox_%#))]1 = not(strmatch(type(%#), PLAYER)),{@pemit %# = u(not_player)},or(strmatch(escape(%0), *[*), strmatch(escape(%1), *[*)), {@pemit %# = u(nofunc)},eq(strlen(%q0), 0), {@pemit %# = u(nomail, ulocal(get_inbox))},{@wait %q0 = {&debug_mail %q0 = +forward %0=%1; @swi/first [setq(1, u(get_folder_in_list, %q0))][setq(2, ulocal(expand_single_letter_range, trim(%1), %q1, u(get_folder_current_letter, %q0)))][setq(3, ulocal(identify_to_list, {%0}, %q0))][setq(7, get(%vm/global-mail-aliases))][setq(8, get(%q0/alias-list))][setq(4, u(get_aliases, {%0}, %q0, %q7, %q8))][setq(5,setunion(%q3 [ulocal(expand_aliases, %q4, %q0, %b, %q7, %q8)], ))][setq(6,[u(pretty_dist, %q4, %q0, %q8, %q7, %q3)])]1 = eq(strlen(%0), 0), {@pemit %# = You must specify a destination to forward this pieceof mail to.;@no %q0},strmatch(get(%q0/mail-in-progress), true),{@pemit %# = You are already in the middle of sending a message. You must complete that one before you can forward another.; @no %q0},eq(words(%q1), 0), {@pemit %# = u(nomail, u(get_active_folder, %q0));@no %q0},strmatch(%q2, *ABORT*), {@pemit %# = after(before(%q2, ENDABORT), ABORT); @no %q0},eq(words(%q2), 0), {@pemit %# = u(no_match, +forward, ulocal(format_request, trim(%1)), u(get_active_folder, %q0)); @no %q0},strmatch(%q3, *ABORT*),{@pemit %# = secure(after(before(%q3, ENDABORT), ABORT));@no %q0},{&[u(which_current_letter, %q0)] %q0 = %q2;&mail-in-progress %q0 = true; &mail-in-progress-to %q0 = %q6; &mail-in-progress-to-expanded %q0 = %q5; &mail-in-progress-flags %q0 = setunion(get(%q0/mail-in-progress-flags) F, );&mail-in-progress-body %q0 = [setq(9, u(get_src_dbref, %q0, %q2))]Received from:%b%b[name(get(%q9/owner_dbref))]%r[u(%q9/out-[u(get_src_num, %q0, %q2)]-text)]%r%r---- Below this line are comments added by %N ----%r; &mail-in-progress-subject %q0 = [setq(9, get(%q9/out-[u(get_src_num, %q0, %q2)]-subject))]switch(mid(%q9, 0, 4), Fwd:, %q9, Fwd:%b%b%q9); @pemit %# = You may now enter text to send along with the message to forward.[u(sig_msg)]; @no %q0}}}
&REPLY_COMMAND #13=$+reply*: @swi/first [setq(0, get(%vm/mailbox_%#))]1 = strmatch(%0, all*),,not(strmatch(type(%#), PLAYER)),{@pemit %# = u(not_player)},strmatch(escape(%0), *[*), {@pemit %# = u(nofunc)},eq(strlen(%q0), 0), {@pemit %# = u(nomail, ulocal(get_inbox, %#))},{@wait %q0 = {&debug_mail %q0 = +reply%0; @swi/first [setq(1, u(get_folder_in_list, %q0))][setq(2, ulocal(expand_single_letter_range, trim(%0), %q1, u(get_folder_current_letter, %q0)))][setq(4, u(get_src_dbref, %q0, %q2))][setq(5, u(get_src_num, %q0, %q2))][setq(6, default(%q4/out-%q5-sender, get(%q4/owner_dbref)))]1 = strmatch(get(%q0/mail-in-progress), true),{@pemit %# = You are already in the middle of sending a message. You must complete that one before you reply to this one.; @no %q0},eq(words(%q1), 0), {@pemit %# = u(nomail, u(get_active_folder, %q0));@no %q0},strmatch(%q2, *ABORT*), {@pemit %# = after(before(%q2, ENDABORT), ABORT); @no %q0},eq(words(%q2), 0), {@pemit %# = u(no_match, +reply, ulocal(format_request, trim(%0)), u(get_active_folder, %q0)); @no %q0},not(strmatch(type(%q6), PLAYER)), {@pemit %# = Originator of letter [u(convert_nums, %q2, %q1)][ulocal(format_request, trim(%0))] in folder '[u(get_active_folder, %q0)]' is no longer a player.; @no %q0},{&[u(which_current_letter, %q0)] %q0 = %q2;&mail-in-progress %q0 = true; &mail-in-progress-to %q0 = name(%q6); &mail-in-progress-to-expanded %q0 = %q6; &mail-in-progress-subject %q0 = [setq(3, get(%q4/out-%q5-subject))][setq(7, get(%q0/in-%q2-subject))]switch(words(%q7), 0, switch(mid(%q3, 0, 3), Re:, %q3, Re:%b%b%q3),%q7); @pemit %# = u(enter_msg)[u(sig_msg)]; @no %q0}}}
&REPLYALL_COMMAND #13=$+replyall*: @swi/first [setq(0, get(%vm/mailbox_%#))]1 = not(strmatch(type(%#), PLAYER)),{@pemit %# = u(not_player)},strmatch(escape(%0), *[*), {@pemit %# = u(nofunc)},eq(strlen(%q0), 0), {@pemit %# = u(nomail, ulocal(get_inbox, %#))},{@wait %q0 = {&debug_mail %q0 = +replyall%0; @swi/first [setq(1, u(get_folder_in_list, %q0))][setq(2, ulocal(expand_single_letter_range, trim(%0), %q1, u(get_folder_current_letter, %q0)))][setq(4, u(get_src_dbref, %q0, %q2))][setq(5, u(get_src_num, %q0, %q2))]1 = strmatch(get(%q0/mail-in-progress), true),{@pemit %# = You are already in the middle of sending a message. You must complete that one before you reply to this one.; @no %q0},eq(words(%q1), 0),{@pemit %# = u(nomail, u(get_active_folder, %q0));@no %q0},strmatch(%q2, *ABORT*), {@pemit %# = after(before(%q2, ENDABORT), ABORT); @no %q0},eq(words(%q2), 0), {@pemit %# = u(no_match, +replyall, ulocal(format_request, trim(%0)), u(get_active_folder, %q0)); @no %q0},not(hasattr(%q4, out-%q5-replyall_to)), {@pemit %# = +replyall:%b%bUnable to perform this function on the specified letter[ulocal(format_request, trim(%0))] in folder '[u(get_active_folder, %q0)]'.;@no %q0},{&[u(which_current_letter, %q0)] %q0 = %q2;&mail-in-progress %q0 = true; &mail-in-progress-to %q0 = u(pretty_dist, get(%q4/out-%q5-replyall_to)); &mail-in-progress-to-expanded %q0 = get(%q4/out-%q5-replyall_to); &mail-in-progress-subject %q0 = [setq(3, get(%q4/out-%q5-subject))][setq(7, get(%q0/in-%q2-subject))]switch(words(%q7),0,switch(mid(%q3, 0, 3),Re:,%q3,Re:%b%b%q3),%q7);@pemit %# = u(enter_msg)[u(sig_msg)]; @no %q0}}}
&SIG_MSG #17=[switch(or(strmatch(u(get_sig_name, %q0), default), strmatch(u(get_format_option, get(%#/mail_config_options)), compact)),1,,%rCurrent signature: [u(get_sig_name, %q0)])]
&DASH_COMMAND #13=$-*: @swi/first [setq(0, get(%vm/mailbox_%#))]1 = strmatch(%0, -),,not(strmatch(type(%#), PLAYER)),{@pemit %# = u(not_player)},eq(strlen(%q0), 0),{@pemit %# = u(not_writing_mail)},{@wait %q0 = {&debug_mail %q0 = -%0; @swi/first [setq(4, get(%q0/mail-in-progress-body))]1 = strmatch(get(%q0/mail-in-progress), false),{@pemit %# = u(not_writing_mail); @no %q0},eq(words(escape(%0)), 0),{@pemit %# = Options:%r%r%b%b[ljust(-, 40)] ( show this help display )%r%b%b[ljust(-<text>, 40)] ( add text to the message )%r%b%b[ljust(+proof, 40)] ( proofread the message )%r%b%b[ljust(+send, 40)] ( send the message )%r%b%b[ljust(--, 40)] ( same as +send )%r%b%b[ljust(+toss, 40)] ( discard the message )%r%b%b[ljust(+include \[<letter number or keyword>\], 40)] ( include letter into text )%r%b%b[ljust(+cc <list of people or aliases>, 40)] ( set carbon copy list )%r%b%b[ljust(+bcc <list of people or aliases>, 40)] ( set blind carbon copy list )%r%r%b%b[ljust(+edit <mail part>=<old>/<new>, 40)] ( edit your message )%r%b%b%b%b(where mail part = to, cc, bcc, subject or text)%r%r%b%b[ljust(+set mail flag \[!\]<flag>, 40)] ( set or clear mail flag )%r%b%b%b%b(where flag = urgent, private, registered, or reply requested)%r%r%b%b[ljust(+sig %[<signature name>%],40)] ( select signature ); @no %q0},{&mail-in-progress-body %q0 = u(clean_text, switch(words(%q4), 0, %0, %q4[u(get_separator_option, %#)]%0)); @pemit %# = [setq(1, u(size_of_mail_in_progress, %q0))][u(text_added_notification)][switch(gt(%q1, 4000), 1, %b%bWarning, message is [sub(4000, %q1)] characters too long and will be truncated.,)]; @no %q0}}}
&STORE_LETTER #17 = &[setq(0, u(free_num, get(%0/out-list)))]out-%q0-time_sent %0 = time(); &[setq(3, get(%0/owner_dbref))]out-%q0-subject %0 = %1; &out-list %0 = [get(%0/out-list)] %q0; &out-list-current %0 = switch(words(get(%0/out-list)), 1, %q0, get(%0/out-list-current)); &out-%q0-to %0 = %2; &out-%q0-cc %0 = %4; &out-%q0-bcc %0 = %6; &out-%q0-bcc-expanded %0 = %7; &out-%q0-text %0 = %9[switch([setq(4, u(get_sig_text, %q3, u(get_sig_name, %0)))]strlen(%q4), 0,, %r%q4)]; &out-%q0-replyall_to %0 = setunion(%q3 %3 %5, ); &out-%q0-held %0 = [setq(8, setunion(iter(setunion(%3 %5 %7, ), ulocal(autoforward_test, ##)), ))]%q8; &out-%q0-dist %0 = iter(%q8, ##:); @dolist %q8 = {@swi/first [setq(1, get(%vm/mailbox_##))][setq(9, u(folder_to_store_into, %q1, get(%0/owner_dbref), %1, ##, %2))]1 = and(strmatch(type(##), PLAYER), eq(strlen(%q1), 0)),{@create [name(##)]'s Mailbox; @set [setq(2, con(me))]%q2 = quiet; @drain %q2; &debug_mail %q2 = store_letter; @tel %q2 = %vm; &mailbox_## %vm = %q2; @tr %vm/add_mailbox = %q2; &owner_dbref %q2 = ##; @startup %q2 = {@drain me; @no me}; @set %q2 = safe; &mail-in-progress %q2 = false; ¤t_folder %q2 = %q9; &folder-list %q2 = %q9; &in-list-%q9 %q2 = 0; ¤t_letter-%q9 %q2 = 0; &in-0-time_read %q2 = 0; &in-0-flags %q2 = %8; &in-0-note %q2 = ; &in-0-location %q2 = %0 %q0; @edit %0/out-%q0-dist = ##:,##:0; @pemit ## = switch(%1, Personal Note,, {u(delivery_notification, %q3, sign(match(%8, u)),sign(match(%8, p)),sign(match(%8, rr)),sign(match(%8, r)), secure(%q9))}); @no %q2}, strmatch(type(##), PLAYER), {&folder-list %q1 = setunion(%q9 [get(%q1/folder-list)], ); &in-list-%q9 %q1 = [setq(6, u(free_num, u(get_all_in_lists, %q1)))][setq(7, get(%q1/in-list-%q9))]squish(%q7 %q6); ¤t_letter-%q9 %q1 = switch(words(%q7), 0, %q6, get(%q1/current_letter-%q9)); &in-%q6-time_read %q1 = 0; &in-%q6-flags %q1 = %8; &in-%q6-note %q1 = ; &in-%q6-location %q1 = %0 %q0; @edit %0/out-%q0-dist = ##:,##:%q6; @pemit ## = switch(1, strmatch(%1, Personal Note),, hasattr(%q1, reject_msg),, {u(delivery_notification, %q3, sign(match(%8, u)),sign(match(%8, p)),sign(match(%8, rr)),sign(match(%8, r)), secure(%q9))}); @swi/first 1 = strmatch(%1, On Vacation),,strmatch(%1, Letter Rejected),,and(strmatch(%q9, null), hasattr(%q1, filter_reject)),{@tr me/remove_letter =%0, %q0, get(%q1/owner_dbref), %q1, %q6, %q9, discard;@tr me/store_letter =%q1,Letter Rejected,name(get(%0/owner_dbref)),get(%0/owner_dbref),,,,,,{Message with subject line "%1" has been rejected by [name(get(%0/owner_dbref))]'s mailbox.%r%r----- Reject Message -----%r%r[get(%q1/filter_reject)]}; @pemit ## = Discarded due to personal mail filter.},strmatch(%q9, null),{@tr me/remove_letter = %0, %q0, get(%q1/owner_dbref), %q1, %q6, %q9,discard; @pemit ## = Discarded due to personal mail filter. },hasattr(%q1, reject_msg), {@tr me/remove_letter = %0, %q0, get(%q1/owner_dbref), %q1, %q6, %q9,reject; @tr me/store_letter = %q1, Letter Rejected, name(get(%0/owner_dbref)), get(%0/owner_dbref), , , , , , {Message with subject line "%1" has been rejected by [name(get(%q1/owner_dbref))]'s mailbox.%r%r----- Reject Message -----%r%r[get(%q1/reject_msg)]}},hasattr(%q1, vacation), {@tr me/store_letter = %q1, On Vacation, name(get(%0/owner_dbref)), get(%0/owner_dbref), , , , , , {Message with subject line "%1" has been stored in [name(get(%q1/owner_dbref))]'s mailbox.%r%r----- Vacation Message -----%r%r[get(%q1/vacation)]}}}, {@pemit get(%0/owner_dbref) = Unable to deliver message.} }
&sig_cmd #13=$+sig*:@switch pos(%b,%0):[pos(/,%0)]=#-1:#-1,{@switch/first strmatch(type(%#),player):[setq(0,get(%vm/mailbox_%#))]%q0=0:*,{@pemit %#=u(not_player)},*:,{@pemit %#=You don't have a mailbox.},{@wait %q0={@switch strlen(get(%q0/SIG-CURRENT)):[strlen(get(%q0/SIG-LIST))]=0:*,{&sig-current %q0=default},*:0,{&sig-list %q0=default};@wait %q0={@pemit %#=[repeat(=,78)]%r%r[center(+Mail Signatures,78)]%r%rSignature list: [get(%q0/SIG-LIST)]%rCurrent signature: [setq(1,get(%q0/SIG-CURRENT))]%q1%rSignature Text:%r%r**%r[get(%#/MAIL_SIG[switch(%q1,default,,,,_%q1)])]%r**%r[repeat(=,78)];@no %q0};@no %q0}}}
&sig_select_cmd #13=$+sig *:@switch/first strmatch(type(%#),player):[setq(0,get(%vm/mailbox_%#))]%q0=0:*,{@pemit %#=u(not_player)},*:,{@pemit %#=You don't have a mailbox.},{@wait %q0={@switch strlen(get(%q0/SIG-CURRENT)):[strlen(get(%q0/SIG-LIST))]=0:*,{&sig-current %q0=default},*:0,{&SIG-LIST %q0=default};@wait %q0={@switch/first neq(words(%0,),1):[switch(matchall(get(%q0/SIG-LIST),%0*),,0,* *,-1,1)]=1:*,{@pemit %#=Invalid signature name.},*:0,{@pemit %#=You don't have a signature named '%0'.},*:-1,{@pemit %#=Ambiguous signature name. Please be more specific.},{&SIG-CURRENT [setq(1,extract(get(%q0/SIG-LIST),match(get(%q0/SIG-LIST),%0*),1))]%q0=%q1;@pemit %#=Signature '%q1' selected.[switch(get(%#/MAIL_SIG[switch(%q1,default,,,,_%q1)]),,%rWARNING: Your [ucstr(MAIL_SIG[switch(%q1,default,,,,_%q1)])] attribute is blank.)]};@no %q0};@no %q0}}
&sig_add_cmd #13=$+sig/add *:@switch/first strmatch(type(%#),player):[setq(0,get(%vm/mailbox_%#))]%q0=0:*,{@pemit %#=u(not_player)},*:,{@pemit %#=You don't have a mailbox.},{@wait %q0={@switch strlen(get(%q0/SIG-CURRENT)):[strlen(get(%q0/SIG-LIST))]=0:*,{&sig-current %q0=default},*:0,{&SIG-LIST %q0=default};@wait %q0={@switch/first neq(words(%0,),1):[eq(match(get(%q0/SIG-LIST),%0),0)]=1:*,{@pemit %#=Invalid signature name.},*:0,{@pemit %#=You already have a signature named '[lcstr(%0)]'.},{&SIG-CURRENT %q0=lcstr(%0);&SIG-LIST %q0=setunion(get(%q0/SIG-LIST),lcstr(%0));@pemit %#=Signature '[lcstr(%0)]' added and selected.[switch(strlen(u(get_sig_text,%#,%0)),0,%rWARNING: Your [ucstr(MAIL_SIG_%0)] attribute is blank.)]};@no %q0};@no %q0}}
&sig_del_cmd #13=$+sig/del *:@switch/first strmatch(type(%#),player):[setq(0,get(%vm/mailbox_%#))]%q0=0:*,{@pemit %#=u(not_player)},*:,{@pemit %#=You don't have a mailbox.},{@wait %q0={@switch strlen(get(%q0/SIG-CURRENT)):[strlen(get(%q0/SIG-LIST))]=0:*,{&sig-current %q0=default},*:0,{&SIG-LIST %q0=default};@wait %q0={@switch/first neq(words(%0,),1):[match(get(%q0/SIG-LIST),%0)]:[strmatch(%0,default)]=1:*:*,{@pemit %#=Invalid signature name.},*:0:*,{@pemit %#=You don't have a signature named '[lcstr(%0)]'.},*:*:1,{@pemit %#=You cannot remove the default signature.},{&SIG-LIST %q0=setdiff(get(%q0/SIG-LIST),lcstr(%0));@pemit %#=Signature '[lcstr(%0)]' removed.;@switch get(%q0/SIG-CURRENT)=%0,{&SIG-CURRENT %q0=default;@pemit %#=Signature 'default' selected.[switch(get(%#/MAIL_SIG),,%rWARNING: Your MAIL_SIG attribute is blank.)]}};@no %q0};@no %q0}}
&sig_view_cmd #13=$+sig/view *:@switch/first strmatch(type(%#),player):[setq(0,get(%vm/mailbox_%#))]%q0=0:*,{@pemit %#=u(not_player)},*:,{@pemit %#=You don't have a mailbox.},{@wait %q0={@switch strlen(get(%q0/SIG-CURRENT)):[strlen(get(%q0/SIG-LIST))]=0:*,{&sig-current %q0=default},*:0,{&sig-list %q0=default};@wait %q0={@switch/first neq(words(%0,),1):[match(get(%q0/SIG-LIST),%0)]=1:*,{@pemit %#=Invalid signature name.},*:0,{@pemit %#=You don't have a signature named '[lcstr(%0)]'.},{@pemit %#=Signature '[lcstr(%0)]' text:%r**%r[u(get_sig_text,%#,%0)]%r**};@no %q0};@no %q0}}
&help_mail #22=+mail is a global mail system.%b The help topics available are:%r%r%t[ljust(Mail Admin, 19)][ljust(Mail Aliases, 19)][ljust(Mail Credits, 19)]%r%t[ljust(Mail Deleting, 19)][ljust(Mail Editing, 19)][ljust(Mail Filters, 19)]%r%t[ljust(Mail Flags, 19)][ljust(Mail Folders, 19)][ljust(Mail Forwarding, 19)]%r%t[ljust(Mail Keywords, 19)][ljust(Mail Marking, 19)][ljust(Mail Notes, 19)]%r%t[ljust(Mail Options, 19)][ljust(Mail Reading, 19)][ljust(Mail Replying, 19)]%r%t[ljust(Mail Reviewing, 19)][ljust(Mail Saving, 19)][ljust(Mail Sending, 19)]%r%t[ljust(Mail Functions, 19)][ljust(Mail Signatures, 19)]Mail Changes%r%tMail Replace Subject
&help_mail_signatures #22=[mudname()] supports a multiple signature system, in addition to the BrandyMail single signature.%r%rEach player can have a set of signatures, identified by single-word names. The text for the signature is stored in the player's MAIL_SIG_<signature> attribute, UNLESS it is the default signature, which is stored in the player's MAIL_SIG attribute.%r%rA message is displayed when a player begins writing a +mail. A new 'Sig:' field is also shown in a +proof. Neither of these messages are shown if the player's signature is set to 'default' (ie. it acts normally for the normal signature) or if the player's FORMAT mail option is set to 'compact'.%r%rCommands:%r%r[ljust(+sig,20)]View a list of your signatures and the current one's text.%r[ljust(+sig <sig>,20)]Select <sig> as your signature. (Partial names allowed)%r[ljust(+sig/view <sig>,20)]View the signature text for signature <sig>.%r[ljust(+sig/add <name>,20)]Add a signature named <name>.%r[ljust(+sig/del <name>,20)]Delete signature <name>. Note that you cannot delete the%r[space(20)]default signature.%r%rSee also: mail options
&help_mail_options #22=\(Page 1 of 2\)%r%rUser configurable options:%r%r+set mail option delete=hard | soft%r+set mail option format=standard | compact %r+set mail option autoforward=<list of people and/or mail aliases>%r+set mail option separator=space | return %r+set mail option inbox=<folder name>%r+set mail option vacation=<text>%r+set mail option reject=<text>%r+set mail option filter reject=<text>%r+show mail options%r%rUsers that wish to have a .signature automatically included at the end of their +mail messages, should set whatever text they want into an attribute called MAIL_SIG on themselves. Keep in mind that whatever text is used in your MAIL_SIG will impact how much you can send in the normal body of aletter. %r%rExample: &MAIL_SIG me=--%%rObligatory cute .sig here%r%rSee also: mail options2, mail signatures
# Multiple Signatures for BrandyMail 14
#
# Version 1.1 (17/12/98)
# Coded by Greg Kempe (kempe@iafrica.com)
# BrandyMail coded by Brandy@CrystalMUSH
# Server: TinyMUSH 2.2.3, BrandyMail 14
#
# CHANGES IN 1.1:
# o Evaluation problem with %t, %b and function calls etc in signatures etc
# fixed
# o STORE_LETTER and GET_SIG_TEXT (on #10) updated
#
# HOWTO:
# o To apply the patches, change all occurrences of #17 to the dbref of your
# Parent Mail Object, all occurrences of #13 to the dbref of your Mail
# System object, and all occurrences of #22 to the dbref of your help
# object.
# Change all occurrences of #10 to the dbref of an object owned by a wizard
# and set inherit (used by the GET_SIG_TEXT function - see below)
#
# NB: If you have added some other patches that affect the attributes listed
# below, I strongly advise against just overwriting them with these
# versions. The modified sections should, instead, be copied across
# manually (they are clearly marked by comments.)
#
# DISCLAIMER: I am not liable for any damages to your DB caused by this code.
# It shouldn't, though, do anything funny, so don't worry too much.
# The patches are in no way official and aren't supported by
# Brandy.
# Please contact me with any oddities, so that I can update the
# patch code.
#
# DESCRIPTION:
#
# The code adds support for multiple signatures when sending +mail, as well as
# maintaining support for the already existing single-signature code.
# Signatures are easily selected and whenever a signature other than the
# default is selected, a message is shown in +proof and if a new message is
# begun. The signature text is help on unrestricted attributes on the player
# A help entry is included.
#
# Modified (or added) attributes and descriptions:
#
# &MAIL_COMMAND : shows a message about the current signature
# &PROOF_COMMAND : ditto - obeys FORMAT config option
# &FORWARD_MAIL2 : ditto
# &REPLY_COMMAND : ditto
# &REPLYALL_COMMAND : ditto
# &SIG_MSG : the message for above. Obeys FORMAT config option.
# - : added a line to the help displayed by '-'
# &STORE_LETTER : adds the required signature
# &GET_SIG_NAME : returns a player's current signature name
# &GET_SIG_TEXT : returns the (evaluated) text of a player's signature
# NB: above attribute MUST be set on a wiz-owned object
# set INHERIT, since none of the BrandyMail objects
# are set INHERIT but this function needs global perms.
#
# &HELP_MAIL : Mail Signatures added to index
# &HELP_MAIL_SIGNATURES
# : Text for multi-signature help
# &HELP_MAIL_OPTIONS : Mail Signatures added to 'See Also: '
#
# New commands (on #13):
# &SIG_CMD : +sig[s]
# &SIG_SELECT_CMD : +sig <sig name>
# &SIG_ADD_CMD : +sig/add <sig name>
# &SIG_DEL_CMD : +sig/del <sig name>
# &SIG_VIEW_CMD : +sig/view <sig name>
#
# New mailbox attributes:
# &SIG-CURRENT : name of current signature (blank or 'default' for default)
# &SIG-LIST : list of sig names (or blank for just the default sig)
#
# NOTE: If the two above attributes are blank, they are set when the user uses any
# of the +sig commands. ie. they do NOT have to be set manually upon
# installation of this patch.
#
# New attributes on player (non-restricted):
#
# &MAIL_SIG : default sig used (if SIG-CURRENT is blank or set to default)
# &MAIL_SIG_<sig> : text for other signatures
#
##############################################################################
#
# Let the code begin...
#
##############################################################################
&get_sig_name #17=switch(get(%1/SIG-CURRENT),,default,get(%1/SIG-CURRENT))
&get_sig_text #17=u(#10/get_sig_text,%0,%1)
&get_sig_text #10=objeval(%0,u(%0/MAIL_SIG[switch(%1,default,,_%1)]))
@set #10/get_sig_text=visual
&MAIL_COMMAND #13=$+mail *=*: @swi/first [setq(0, get(%vm/mailbox_%#))]1 = or(strmatch(escape(%0), *[*), strmatch(escape(%1), *[*)),{@pemit %# = u(nofunc)},not(strmatch(type(%#), PLAYER)),{@pemit %# = u(not_player)},eq(strlen(%q0), 0), {@swi/first [setq(6, get(%vm/global-mail-aliases))][setq(1, ulocal(identify_to_list, {%0}, %vm))][setq(2, u(get_aliases, {%0}, #0, %q6, ))][setq(3, setunion(%q1 [ulocal(expand_aliases, %q2, #0, %b, %q6, )], ))]1 = strmatch(%q1, *ABORT*),{@pemit %# = secure(after(before(%q1, ENDABORT), ABORT))},eq(words(%q3), 0),{@pemit %# = You must specify a destination for this piece of mail.},{@create %N's Mailbox; @set [setq(4, con(me))]%q4 = quiet; @drain %q4; &debug_mail %q4 = +mail %0=%1; @tel %q4 = %vm; &mailbox_%# %vm = %q4; @tr %vm/add_mailbox = %q4; &owner_dbref %q4 = %#; @startup %q4 = {@drain me; @no me}; @set %q4 = safe; ¤t_folder %q4 = ulocal(get_inbox, %#); &folder-list %q4 = get(%q4/current_folder); &mail-in-progress %q4 = true; &mail-in-progress-to %q4 = u(pretty_dist, %q2, #0, , %q6, %q1); &mail-in-progress-to-expanded %q4 = %q3; &mail-in-progress-subject %q4 = %1; @pemit %# = u(enter_msg); @no %q4}},{@wait %q0 = {&debug_mail %q0 = +mail %0=%1; @swi/first [setq(1, ulocal(identify_to_list, {%0}, %q0))][setq(7, get(%q0/alias-list))][setq(6, get(%vm/global-mail-aliases))][setq(2, u(get_aliases, {%0}, %q0, %q6, %q7))]1 = strmatch(get(%q0/mail-in-progress), true),{@pemit %# = You are already in the middle of sending a message. %bYou must complete that one before you begin another.; @no %q0},eq(strlen(%0), 0),{@pemit %# = You must specify a destination for this piece of mail.; @no %q0},strmatch(%q1, *ABORT*),{@pemit %# = secure(after(before(%q1, ENDABORT), ABORT)); @no %q0},{&mail-in-progress %q0 = true; &mail-in-progress-to %q0 = u(pretty_dist, %q2, %q0, %q7, %q6, %q1); &mail-in-progress-to-expanded %q0 = %q1 [ulocal(expand_aliases, %q2, %q0, %b, %q6, %q7)]; &mail-in-progress-subject %q0 = %1; @swi/first hasattr(%q0, mail-in-progress-to-expanded) = 0,{@pemit %# = You must specify a destination for this piece of mail.; &mail-in-progress %q0 = false; &mail-in-progress-to %q0 = ; &mail-in-progress-to-expanded %q0 = ; &mail-in-progress-subject %q0 = ; @no %q0},{@pemit %# = u(enter_msg)[u(sig_msg)]; @no %q0}}}}
&PROOF_COMMAND #13=$+proof: @swi/first [setq(0, get(%vm/mailbox_%#))]0 = strmatch(type(%#), PLAYER),{@pemit %# = u(not_player)},strlen(%q0),{@pemit %# = You are not currently writing a mail message.},{@wait %q0 = {&debug_mail %q0 = +proof; @pemit %# = switch(get(%q0/mail-in-progress),false, You are not currently writing a mail message.,{[setq(1, get(%q0/mail-in-progress-cc))][setq(2, get(%q0/mail-in-progress-bcc))][setq(3, get(%q0/mail-in-progress-flags))][setq(4, u(get_format_option, get(%#/mail_config_options)))][switch(%q4, standard, {[u(equal_line)]%r})]To:[space(7)][trim(get(%q0/mail-in-progress-to))][switch(words(%q1), 0,, %rCc:[space(7)][trim(%q1)])][switch(words(%q2), 0,, %rBcc:[space(6)][trim(%q2)])]%rSubject:%b%b[trim(get(%q0/mail-in-progress-subject))][switch(words(%q3), 0,, %rFlags:%b%b%b%b)][switch(match(%q3, u), 0,, [v(mail_flag_u)]%b%b)][switch(match(%q3, rr), 0,, [v(mail_flag_rr)]%b%b)][switch(match(%q3, r), 0,, [v(mail_flag_r)]%b%b)][switch(match(%q3, p), 0,, [v(mail_flag_p)]%b%b)][switch(or(strmatch(%q4, compact), strmatch(u(get_sig_name, %q0), default),),1,,%rSig:[space(5)] [u(get_sig_name, %q0)])][switch(%q4, standard, {%r[u(dash_line)]%r%r},%rText:[space(5)])][get_eval(%q0/mail-in-progress-body)][switch(%q4, standard, {%r%r[u(equal_line)]})]%r[u(finish_msg)]}); @swi and(v(spell_checker_available), hasflag(v(spell_checker), connect), strmatch(get(%q0/mail-in-progress), true)) = 1,{@pemit v(spell_checker) = StartSpelling %# 0 0 subject 0; @pemit v(spell_checker) = get(%q0/mail-in-progress-subject); @pemit v(spell_checker) = StopSpelling; @pemit v(spell_checker) = StartSpelling %# 0 0 text 0; @pemit v(spell_checker) = get(%q0/mail-in-progress-body); @pemit v(spell_checker) = StopSpelling}; @no %q0}}
&FORWARD_MAIL2 #13=$+forward *=*: @swi/first [setq(0, get(%vm/mailbox_%#))]1 = not(strmatch(type(%#), PLAYER)),{@pemit %# = u(not_player)},or(strmatch(escape(%0), *[*), strmatch(escape(%1), *[*)), {@pemit %# = u(nofunc)},eq(strlen(%q0), 0), {@pemit %# = u(nomail, ulocal(get_inbox))},{@wait %q0 = {&debug_mail %q0 = +forward %0=%1; @swi/first [setq(1, u(get_folder_in_list, %q0))][setq(2, ulocal(expand_single_letter_range, trim(%1), %q1, u(get_folder_current_letter, %q0)))][setq(3, ulocal(identify_to_list, {%0}, %q0))][setq(7, get(%vm/global-mail-aliases))][setq(8, get(%q0/alias-list))][setq(4, u(get_aliases, {%0}, %q0, %q7, %q8))][setq(5,setunion(%q3 [ulocal(expand_aliases, %q4, %q0, %b, %q7, %q8)], ))][setq(6,[u(pretty_dist, %q4, %q0, %q8, %q7, %q3)])]1 = eq(strlen(%0), 0), {@pemit %# = You must specify a destination to forward this pieceof mail to.;@no %q0},strmatch(get(%q0/mail-in-progress), true),{@pemit %# = You are already in the middle of sending a message. You must complete that one before you can forward another.; @no %q0},eq(words(%q1), 0), {@pemit %# = u(nomail, u(get_active_folder, %q0));@no %q0},strmatch(%q2, *ABORT*), {@pemit %# = after(before(%q2, ENDABORT), ABORT); @no %q0},eq(words(%q2), 0), {@pemit %# = u(no_match, +forward, ulocal(format_request, trim(%1)), u(get_active_folder, %q0)); @no %q0},strmatch(%q3, *ABORT*),{@pemit %# = secure(after(before(%q3, ENDABORT), ABORT));@no %q0},{&[u(which_current_letter, %q0)] %q0 = %q2;&mail-in-progress %q0 = true; &mail-in-progress-to %q0 = %q6; &mail-in-progress-to-expanded %q0 = %q5; &mail-in-progress-flags %q0 = setunion(get(%q0/mail-in-progress-flags) F, );&mail-in-progress-body %q0 = [setq(9, u(get_src_dbref, %q0, %q2))]Received from:%b%b[name(get(%q9/owner_dbref))]%r[u(%q9/out-[u(get_src_num, %q0, %q2)]-text)]%r%r---- Below this line are comments added by %N ----%r; &mail-in-progress-subject %q0 = [setq(9, get(%q9/out-[u(get_src_num, %q0, %q2)]-subject))]switch(mid(%q9, 0, 4), Fwd:, %q9, Fwd:%b%b%q9); @pemit %# = You may now enter text to send along with the message to forward.[u(sig_msg)]; @no %q0}}}
&REPLY_COMMAND #13=$+reply*: @swi/first [setq(0, get(%vm/mailbox_%#))]1 = strmatch(%0, all*),,not(strmatch(type(%#), PLAYER)),{@pemit %# = u(not_player)},strmatch(escape(%0), *[*), {@pemit %# = u(nofunc)},eq(strlen(%q0), 0), {@pemit %# = u(nomail, ulocal(get_inbox, %#))},{@wait %q0 = {&debug_mail %q0 = +reply%0; @swi/first [setq(1, u(get_folder_in_list, %q0))][setq(2, ulocal(expand_single_letter_range, trim(%0), %q1, u(get_folder_current_letter, %q0)))][setq(4, u(get_src_dbref, %q0, %q2))][setq(5, u(get_src_num, %q0, %q2))][setq(6, default(%q4/out-%q5-sender, get(%q4/owner_dbref)))]1 = strmatch(get(%q0/mail-in-progress), true),{@pemit %# = You are already in the middle of sending a message. You must complete that one before you reply to this one.; @no %q0},eq(words(%q1), 0), {@pemit %# = u(nomail, u(get_active_folder, %q0));@no %q0},strmatch(%q2, *ABORT*), {@pemit %# = after(before(%q2, ENDABORT), ABORT); @no %q0},eq(words(%q2), 0), {@pemit %# = u(no_match, +reply, ulocal(format_request, trim(%0)), u(get_active_folder, %q0)); @no %q0},not(strmatch(type(%q6), PLAYER)), {@pemit %# = Originator of letter [u(convert_nums, %q2, %q1)][ulocal(format_request, trim(%0))] in folder '[u(get_active_folder, %q0)]' is no longer a player.; @no %q0},{&[u(which_current_letter, %q0)] %q0 = %q2;&mail-in-progress %q0 = true; &mail-in-progress-to %q0 = name(%q6); &mail-in-progress-to-expanded %q0 = %q6; &mail-in-progress-subject %q0 = [setq(3, get(%q4/out-%q5-subject))][setq(7, get(%q0/in-%q2-subject))]switch(words(%q7), 0, switch(mid(%q3, 0, 3), Re:, %q3, Re:%b%b%q3),%q7); @pemit %# = u(enter_msg)[u(sig_msg)]; @no %q0}}}
&REPLYALL_COMMAND #13=$+replyall*: @swi/first [setq(0, get(%vm/mailbox_%#))]1 = not(strmatch(type(%#), PLAYER)),{@pemit %# = u(not_player)},strmatch(escape(%0), *[*), {@pemit %# = u(nofunc)},eq(strlen(%q0), 0), {@pemit %# = u(nomail, ulocal(get_inbox, %#))},{@wait %q0 = {&debug_mail %q0 = +replyall%0; @swi/first [setq(1, u(get_folder_in_list, %q0))][setq(2, ulocal(expand_single_letter_range, trim(%0), %q1, u(get_folder_current_letter, %q0)))][setq(4, u(get_src_dbref, %q0, %q2))][setq(5, u(get_src_num, %q0, %q2))]1 = strmatch(get(%q0/mail-in-progress), true),{@pemit %# = You are already in the middle of sending a message. You must complete that one before you reply to this one.; @no %q0},eq(words(%q1), 0),{@pemit %# = u(nomail, u(get_active_folder, %q0));@no %q0},strmatch(%q2, *ABORT*), {@pemit %# = after(before(%q2, ENDABORT), ABORT); @no %q0},eq(words(%q2), 0), {@pemit %# = u(no_match, +replyall, ulocal(format_request, trim(%0)), u(get_active_folder, %q0)); @no %q0},not(hasattr(%q4, out-%q5-replyall_to)), {@pemit %# = +replyall:%b%bUnable to perform this function on the specified letter[ulocal(format_request, trim(%0))] in folder '[u(get_active_folder, %q0)]'.;@no %q0},{&[u(which_current_letter, %q0)] %q0 = %q2;&mail-in-progress %q0 = true; &mail-in-progress-to %q0 = u(pretty_dist, get(%q4/out-%q5-replyall_to)); &mail-in-progress-to-expanded %q0 = get(%q4/out-%q5-replyall_to); &mail-in-progress-subject %q0 = [setq(3, get(%q4/out-%q5-subject))][setq(7, get(%q0/in-%q2-subject))]switch(words(%q7),0,switch(mid(%q3, 0, 3),Re:,%q3,Re:%b%b%q3),%q7);@pemit %# = u(enter_msg)[u(sig_msg)]; @no %q0}}}
&SIG_MSG #17=[switch(or(strmatch(u(get_sig_name, %q0), default), strmatch(u(get_format_option, get(%#/mail_config_options)), compact)),1,,%rCurrent signature: [u(get_sig_name, %q0)])]
&DASH_COMMAND #13=$-*: @swi/first [setq(0, get(%vm/mailbox_%#))]1 = strmatch(%0, -),,not(strmatch(type(%#), PLAYER)),{@pemit %# = u(not_player)},eq(strlen(%q0), 0),{@pemit %# = u(not_writing_mail)},{@wait %q0 = {&debug_mail %q0 = -%0; @swi/first [setq(4, get(%q0/mail-in-progress-body))]1 = strmatch(get(%q0/mail-in-progress), false),{@pemit %# = u(not_writing_mail); @no %q0},eq(words(escape(%0)), 0),{@pemit %# = Options:%r%r%b%b[ljust(-, 40)] ( show this help display )%r%b%b[ljust(-<text>, 40)] ( add text to the message )%r%b%b[ljust(+proof, 40)] ( proofread the message )%r%b%b[ljust(+send, 40)] ( send the message )%r%b%b[ljust(--, 40)] ( same as +send )%r%b%b[ljust(+toss, 40)] ( discard the message )%r%b%b[ljust(+include \[<letter number or keyword>\], 40)] ( include letter into text )%r%b%b[ljust(+cc <list of people or aliases>, 40)] ( set carbon copy list )%r%b%b[ljust(+bcc <list of people or aliases>, 40)] ( set blind carbon copy list )%r%r%b%b[ljust(+edit <mail part>=<old>/<new>, 40)] ( edit your message )%r%b%b%b%b(where mail part = to, cc, bcc, subject or text)%r%r%b%b[ljust(+set mail flag \[!\]<flag>, 40)] ( set or clear mail flag )%r%b%b%b%b(where flag = urgent, private, registered, or reply requested)%r%r%b%b[ljust(+sig %[<signature name>%],40)] ( select signature ); @no %q0},{&mail-in-progress-body %q0 = u(clean_text, switch(words(%q4), 0, %0, %q4[u(get_separator_option, %#)]%0)); @pemit %# = [setq(1, u(size_of_mail_in_progress, %q0))][u(text_added_notification)][switch(gt(%q1, 4000), 1, %b%bWarning, message is [sub(4000, %q1)] characters too long and will be truncated.,)]; @no %q0}}}
&STORE_LETTER #17 = &[setq(0, u(free_num, get(%0/out-list)))]out-%q0-time_sent %0 = time(); &[setq(3, get(%0/owner_dbref))]out-%q0-subject %0 = %1; &out-list %0 = [get(%0/out-list)] %q0; &out-list-current %0 = switch(words(get(%0/out-list)), 1, %q0, get(%0/out-list-current)); &out-%q0-to %0 = %2; &out-%q0-cc %0 = %4; &out-%q0-bcc %0 = %6; &out-%q0-bcc-expanded %0 = %7; &out-%q0-text %0 = %9[switch([setq(4, u(get_sig_text, %q3, u(get_sig_name, %0)))]strlen(%q4), 0,, %r%q4)]; &out-%q0-replyall_to %0 = setunion(%q3 %3 %5, ); &out-%q0-held %0 = [setq(8, setunion(iter(setunion(%3 %5 %7, ), ulocal(autoforward_test, ##)), ))]%q8; &out-%q0-dist %0 = iter(%q8, ##:); @dolist %q8 = {@swi/first [setq(1, get(%vm/mailbox_##))][setq(9, u(folder_to_store_into, %q1, get(%0/owner_dbref), %1, ##, %2))]1 = and(strmatch(type(##), PLAYER), eq(strlen(%q1), 0)),{@create [name(##)]'s Mailbox; @set [setq(2, con(me))]%q2 = quiet; @drain %q2; &debug_mail %q2 = store_letter; @tel %q2 = %vm; &mailbox_## %vm = %q2; @tr %vm/add_mailbox = %q2; &owner_dbref %q2 = ##; @startup %q2 = {@drain me; @no me}; @set %q2 = safe; &mail-in-progress %q2 = false; ¤t_folder %q2 = %q9; &folder-list %q2 = %q9; &in-list-%q9 %q2 = 0; ¤t_letter-%q9 %q2 = 0; &in-0-time_read %q2 = 0; &in-0-flags %q2 = %8; &in-0-note %q2 = ; &in-0-location %q2 = %0 %q0; @edit %0/out-%q0-dist = ##:,##:0; @pemit ## = switch(%1, Personal Note,, {u(delivery_notification, %q3, sign(match(%8, u)),sign(match(%8, p)),sign(match(%8, rr)),sign(match(%8, r)), secure(%q9))}); @no %q2}, strmatch(type(##), PLAYER), {&folder-list %q1 = setunion(%q9 [get(%q1/folder-list)], ); &in-list-%q9 %q1 = [setq(6, u(free_num, u(get_all_in_lists, %q1)))][setq(7, get(%q1/in-list-%q9))]squish(%q7 %q6); ¤t_letter-%q9 %q1 = switch(words(%q7), 0, %q6, get(%q1/current_letter-%q9)); &in-%q6-time_read %q1 = 0; &in-%q6-flags %q1 = %8; &in-%q6-note %q1 = ; &in-%q6-location %q1 = %0 %q0; @edit %0/out-%q0-dist = ##:,##:%q6; @pemit ## = switch(1, strmatch(%1, Personal Note),, hasattr(%q1, reject_msg),, {u(delivery_notification, %q3, sign(match(%8, u)),sign(match(%8, p)),sign(match(%8, rr)),sign(match(%8, r)), secure(%q9))}); @swi/first 1 = strmatch(%1, On Vacation),,strmatch(%1, Letter Rejected),,and(strmatch(%q9, null), hasattr(%q1, filter_reject)),{@tr me/remove_letter =%0, %q0, get(%q1/owner_dbref), %q1, %q6, %q9, discard;@tr me/store_letter =%q1,Letter Rejected,name(get(%0/owner_dbref)),get(%0/owner_dbref),,,,,,{Message with subject line "%1" has been rejected by [name(get(%0/owner_dbref))]'s mailbox.%r%r----- Reject Message -----%r%r[get(%q1/filter_reject)]}; @pemit ## = Discarded due to personal mail filter.},strmatch(%q9, null),{@tr me/remove_letter = %0, %q0, get(%q1/owner_dbref), %q1, %q6, %q9,discard; @pemit ## = Discarded due to personal mail filter. },hasattr(%q1, reject_msg), {@tr me/remove_letter = %0, %q0, get(%q1/owner_dbref), %q1, %q6, %q9,reject; @tr me/store_letter = %q1, Letter Rejected, name(get(%0/owner_dbref)), get(%0/owner_dbref), , , , , , {Message with subject line "%1" has been rejected by [name(get(%q1/owner_dbref))]'s mailbox.%r%r----- Reject Message -----%r%r[get(%q1/reject_msg)]}},hasattr(%q1, vacation), {@tr me/store_letter = %q1, On Vacation, name(get(%0/owner_dbref)), get(%0/owner_dbref), , , , , , {Message with subject line "%1" has been stored in [name(get(%q1/owner_dbref))]'s mailbox.%r%r----- Vacation Message -----%r%r[get(%q1/vacation)]}}}, {@pemit get(%0/owner_dbref) = Unable to deliver message.} }
&sig_cmd #13=$+sig*:@switch pos(%b,%0):[pos(/,%0)]=#-1:#-1,{@switch/first strmatch(type(%#),player):[setq(0,get(%vm/mailbox_%#))]%q0=0:*,{@pemit %#=u(not_player)},*:,{@pemit %#=You don't have a mailbox.},{@wait %q0={@switch strlen(get(%q0/SIG-CURRENT)):[strlen(get(%q0/SIG-LIST))]=0:*,{&sig-current %q0=default},*:0,{&sig-list %q0=default};@wait %q0={@pemit %#=[repeat(=,78)]%r%r[center(+Mail Signatures,78)]%r%rSignature list: [get(%q0/SIG-LIST)]%rCurrent signature: [setq(1,get(%q0/SIG-CURRENT))]%q1%rSignature Text:%r%r**%r[get(%#/MAIL_SIG[switch(%q1,default,,,,_%q1)])]%r**%r[repeat(=,78)];@no %q0};@no %q0}}}
&sig_select_cmd #13=$+sig *:@switch/first strmatch(type(%#),player):[setq(0,get(%vm/mailbox_%#))]%q0=0:*,{@pemit %#=u(not_player)},*:,{@pemit %#=You don't have a mailbox.},{@wait %q0={@switch strlen(get(%q0/SIG-CURRENT)):[strlen(get(%q0/SIG-LIST))]=0:*,{&sig-current %q0=default},*:0,{&SIG-LIST %q0=default};@wait %q0={@switch/first neq(words(%0,),1):[switch(matchall(get(%q0/SIG-LIST),%0*),,0,* *,-1,1)]=1:*,{@pemit %#=Invalid signature name.},*:0,{@pemit %#=You don't have a signature named '%0'.},*:-1,{@pemit %#=Ambiguous signature name. Please be more specific.},{&SIG-CURRENT [setq(1,extract(get(%q0/SIG-LIST),match(get(%q0/SIG-LIST),%0*),1))]%q0=%q1;@pemit %#=Signature '%q1' selected.[switch(get(%#/MAIL_SIG[switch(%q1,default,,,,_%q1)]),,%rWARNING: Your [ucstr(MAIL_SIG[switch(%q1,default,,,,_%q1)])] attribute is blank.)]};@no %q0};@no %q0}}
&sig_add_cmd #13=$+sig/add *:@switch/first strmatch(type(%#),player):[setq(0,get(%vm/mailbox_%#))]%q0=0:*,{@pemit %#=u(not_player)},*:,{@pemit %#=You don't have a mailbox.},{@wait %q0={@switch strlen(get(%q0/SIG-CURRENT)):[strlen(get(%q0/SIG-LIST))]=0:*,{&sig-current %q0=default},*:0,{&SIG-LIST %q0=default};@wait %q0={@switch/first neq(words(%0,),1):[eq(match(get(%q0/SIG-LIST),%0),0)]=1:*,{@pemit %#=Invalid signature name.},*:0,{@pemit %#=You already have a signature named '[lcstr(%0)]'.},{&SIG-CURRENT %q0=lcstr(%0);&SIG-LIST %q0=setunion(get(%q0/SIG-LIST),lcstr(%0));@pemit %#=Signature '[lcstr(%0)]' added and selected.[switch(strlen(u(get_sig_text,%#,%0)),0,%rWARNING: Your [ucstr(MAIL_SIG_%0)] attribute is blank.)]};@no %q0};@no %q0}}
&sig_del_cmd #13=$+sig/del *:@switch/first strmatch(type(%#),player):[setq(0,get(%vm/mailbox_%#))]%q0=0:*,{@pemit %#=u(not_player)},*:,{@pemit %#=You don't have a mailbox.},{@wait %q0={@switch strlen(get(%q0/SIG-CURRENT)):[strlen(get(%q0/SIG-LIST))]=0:*,{&sig-current %q0=default},*:0,{&SIG-LIST %q0=default};@wait %q0={@switch/first neq(words(%0,),1):[match(get(%q0/SIG-LIST),%0)]:[strmatch(%0,default)]=1:*:*,{@pemit %#=Invalid signature name.},*:0:*,{@pemit %#=You don't have a signature named '[lcstr(%0)]'.},*:*:1,{@pemit %#=You cannot remove the default signature.},{&SIG-LIST %q0=setdiff(get(%q0/SIG-LIST),lcstr(%0));@pemit %#=Signature '[lcstr(%0)]' removed.;@switch get(%q0/SIG-CURRENT)=%0,{&SIG-CURRENT %q0=default;@pemit %#=Signature 'default' selected.[switch(get(%#/MAIL_SIG),,%rWARNING: Your MAIL_SIG attribute is blank.)]}};@no %q0};@no %q0}}
&sig_view_cmd #13=$+sig/view *:@switch/first strmatch(type(%#),player):[setq(0,get(%vm/mailbox_%#))]%q0=0:*,{@pemit %#=u(not_player)},*:,{@pemit %#=You don't have a mailbox.},{@wait %q0={@switch strlen(get(%q0/SIG-CURRENT)):[strlen(get(%q0/SIG-LIST))]=0:*,{&sig-current %q0=default},*:0,{&sig-list %q0=default};@wait %q0={@switch/first neq(words(%0,),1):[match(get(%q0/SIG-LIST),%0)]=1:*,{@pemit %#=Invalid signature name.},*:0,{@pemit %#=You don't have a signature named '[lcstr(%0)]'.},{@pemit %#=Signature '[lcstr(%0)]' text:%r**%r[u(get_sig_text,%#,%0)]%r**};@no %q0};@no %q0}}
&help_mail #22=+mail is a global mail system.%b The help topics available are:%r%r%t[ljust(Mail Admin, 19)][ljust(Mail Aliases, 19)][ljust(Mail Credits, 19)]%r%t[ljust(Mail Deleting, 19)][ljust(Mail Editing, 19)][ljust(Mail Filters, 19)]%r%t[ljust(Mail Flags, 19)][ljust(Mail Folders, 19)][ljust(Mail Forwarding, 19)]%r%t[ljust(Mail Keywords, 19)][ljust(Mail Marking, 19)][ljust(Mail Notes, 19)]%r%t[ljust(Mail Options, 19)][ljust(Mail Reading, 19)][ljust(Mail Replying, 19)]%r%t[ljust(Mail Reviewing, 19)][ljust(Mail Saving, 19)][ljust(Mail Sending, 19)]%r%t[ljust(Mail Functions, 19)][ljust(Mail Signatures, 19)]Mail Changes%r%tMail Replace Subject
&help_mail_signatures #22=[mudname()] supports a multiple signature system, in addition to the BrandyMail single signature.%r%rEach player can have a set of signatures, identified by single-word names. The text for the signature is stored in the player's MAIL_SIG_<signature> attribute, UNLESS it is the default signature, which is stored in the player's MAIL_SIG attribute.%r%rA message is displayed when a player begins writing a +mail. A new 'Sig:' field is also shown in a +proof. Neither of these messages are shown if the player's signature is set to 'default' (ie. it acts normally for the normal signature) or if the player's FORMAT mail option is set to 'compact'.%r%rCommands:%r%r[ljust(+sig,20)]View a list of your signatures and the current one's text.%r[ljust(+sig <sig>,20)]Select <sig> as your signature. (Partial names allowed)%r[ljust(+sig/view <sig>,20)]View the signature text for signature <sig>.%r[ljust(+sig/add <name>,20)]Add a signature named <name>.%r[ljust(+sig/del <name>,20)]Delete signature <name>. Note that you cannot delete the%r[space(20)]default signature.%r%rSee also: mail options
&help_mail_options #22=\(Page 1 of 2\)%r%rUser configurable options:%r%r+set mail option delete=hard | soft%r+set mail option format=standard | compact %r+set mail option autoforward=<list of people and/or mail aliases>%r+set mail option separator=space | return %r+set mail option inbox=<folder name>%r+set mail option vacation=<text>%r+set mail option reject=<text>%r+set mail option filter reject=<text>%r+show mail options%r%rUsers that wish to have a .signature automatically included at the end of their +mail messages, should set whatever text they want into an attribute called MAIL_SIG on themselves. Keep in mind that whatever text is used in your MAIL_SIG will impact how much you can send in the normal body of aletter. %r%rExample: &MAIL_SIG me=--%%rObligatory cute .sig here%r%rSee also: mail options2, mail signatures