Brandy Mailer 1.4 Bug Fixes


Copy and paste the below code into a compatible MUSH or MUX.

MUSHCode for Brandy Mailer 1.4 Bug Fixes

# Misc Patches for BrandyMail 14
# Version 1 (9/7/98)
# Patches coded by Greg Kempe (
# BrandyMail coded by Brandy@CrystalMUSH
# Server: TinyMUSH 2.2.3, BrandyMail 14
# o To apply the patches, change all occurrences of #17 to the dbref of your
# Parent Mail Object and all occurrences of #13 to the dbref of your Mail
# System object.
# 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.)
# The FORMAT_REQUEST patch assumes that you have my HELDBY keyword patch
# added. If you don't, there is no need to remove the HELDBY section as
# it will make no difference to the operation of the mail system.
# If you do have my HELDBY keyword added, there is no need to install the
# FORMAT_REQUEST patch as the HELDBY patch already fixed the bug.
# 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.
# The code fixes a bunch of bugs in the BrandyMail code. Brandy has released
# newer versions of BrandyMail 14 that include /some/ (but not all) of the
# patches. Unfortunately she hasn't included patchlevel indicators with them
# so you can either check if you have the patch or not or just pop it in :)
# Modified attributes:
# Bug information:
# &NO_MATCH : no longer returns "... in folder '<folder>'" if
# <folder> is a blank string
# +add filter : checks to see that the filter doesn't already exist
# +add personal alias
# : doesn't add the alias if a global alias with the same
# name already exists (&ADD_PERSONAL_ALIAS)
# : clearing of null folder bug fixed
# +set mail option format
# : 'already set' message fixed (&SET_MAIL_OPTION_FORMAT)
# &FORMAT_REQUEST : fixed 'to:' keyword matching (+review)

&NO_MATCH #17 = %0:%b%bNo letter matches the specified criteria%1[switch(%2,,,%bin folder '%2'.)]
&ADD_FILTER #13=$+add filter *=* folder*=*: @swi/first [setq(0, get(%vm/mailbox_%#))][setq(1, edit(lcstr(trim(%3)), %b, $))][setq(4, switch(trim(%0),s*, subject,a*, author,error))]1 = strmatch(%3, *reject*=*),,or(strmatch(escape(%0), *[*), strmatch(escape(%1), *[*), strmatch(escape(%3), *[*)), {@pemit %# = u(nofunc)},not(strmatch(type(%#), PLAYER)),{@pemit %# = u(not_player)},strmatch(%q4, error),{@pemit %# = You must specify the type of filter: author, subject or to.%b (syntax:%b +add filter author|subject|to=<name, text or alias> folder=<folder name>)},eq(words(%1), 0),{@pemit %# = You must specify [switch(%q4, author, A player name to filter on, Some text to filter based on subject line)].%b (syntax:%b +add filter author|subject=<name or text> folder=<folder name>)}, and(strmatch(%q4, author), not(strmatch(type(*%1), PLAYER))),{@pemit %# = Name specified to filter based on author is not an existing player.}, eq(words(%3), 0),{@pemit %# = You must specify a name for the folder.},gt(strlen([setq(2, [setq(3, %3)]filter(check_for_bad_chars, v(bad_chars)))]%q2), 0),{@pemit %# = Invalid character(s) %q2 detected in folder name.},gt(strlen(%3), 16),{@pemit %# = Folder name specified is too long (maximum of 16 characters).},[setq(5, [switch(%q4,author, [num(*%1)],%1)])]neq(match(get(%q0/%q4_filter), %q5|%q1, ~), 0),{@pemit %# = That filter already exists.},eq(strlen(%q0), 0),{@create %N's Mailbox; @set [setq(2, con(me))]%q2 = quiet; @drain %q2; &debug_mail %q2 = +add filter %0=%1 folder%2=%3; @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; &%q4_filter %q2 = %q5|%q1; &current_folder %q2 = ulocal(get_inbox, %#); @pemit %# = Filter added.; @no %q2},{@wait %q0 = {&debug_mail %q0 = +add filter %0=%1 folder%2=%3; &%q4_filter %q0 = trim([get(%q0/%q4_filter)]~%q5|%q1,,~); @pemit %# = Filter added.; @no %q0}}
&ADD_PERSONAL_ALIAS #13=$+add personal alias *=*: @swi/first [setq(0, get(%vm/mailbox_%#))][setq(5, get(%q0/alias-list))]1 = or(strmatch(escape(%0), *[*), strmatch(escape(%1), *[*)),{@pemit %# = u(nofunc)},strmatch(type(*[trim(%0)]), PLAYER),{@pemit %# = I'm sorry, but the alias you specified is the name of%ba player.},not(strmatch(type(%#), PLAYER)), {@pemit %# = u(not_player)}, eq(strlen(%0), 0),{@pemit %# = You must specify a name for the alias.},gt(words(%0), 1),{@pemit %# = The alias must be a single word.},gt(strlen(%0), 25), {@pemit %# = Sorry, personal alias names are restricted to a maximum of 25 characters.},gt(strlen([setq(2,[setq(3, %0)]filter(check_for_bad_chars, v(bad_chars)))]%q2), 0),{@pemit %# = Invalid character(s) %q2 detected in alias name.},neq(match(get(%vm/global-mail-aliases), %q3), 0),{@pemit %# = A global mail alias with that name already exists.},eq(strlen(%1), 0),{@pemit %# = You need to specify a list of people to associate with the alias.},eq(strlen(%q0), 0),{@swi/first [setq(1, [ulocal(identify_to_list, {%1}, %vm)] [u(get_aliases, {%1}, #0, get(%vm/global-mail-aliases), )])]%q1 = *ABORT*,{@pemit %# = secure(after(before(%q1, ENDABORT), ABORT))},{@create %N's Mailbox; @set [setq(2, con(me))]%q2 = quiet; @drain %q2; &debug_mail %q2 = +add personal alias %0=%1; @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; &current_folder %q2 = ulocal(get_inbox, %#); &folder-list %q2 = get(%q2/current_folder); &alias-list %q2 = [setq(3, lcstr(trim(%0)))]%q3; &alias-%q3 %q2 = %q1; @pemit %# = '%q3' has been added as a personal mail alias.;@no %q2}},{@wait %q0 = {&debug_mail %q0 = +add personal alias %0=%1; @swi/first [setq(1,[ulocal(identify_to_list, {%1}, %q0)] [u(get_aliases, {%1}, %q0, get(%vm/global-mail-aliases), %q5)])][setq(3, lcstr(trim(%0)))]1 = gt(match(%q5, %q3), 0),{@pemit %# = You already have a personal alias with this name. If you really mean to totally overwrite it, you should do a +remove personal alias %q3, followed by a +add personal alias%b%q3=<list of people>.; @no %q0},strmatch(%q1, *ABORT*),{@pemit %# = secure(after(before(%q1, ENDABORT), ABORT)); @no %q0},{&alias-list %q0 = %q5 %q3; &alias-%q3 %q0 = %q1; @pemit %# = '%q3' has been added as a personal mail alias.; @no %q0}}}
&DISPLAY_MAIL_ADMIN #17 = &folder-list %1 = squish(remove(get(%1/folder-list), null)); @pemit %0 = [setq(0, u(get_format_option, get(%0/mail_config_options)))][setq(1, get(%1/owner_dbref))][setq(2, get(%1/mail-in-progress))][switch(%q0, standard, {[u(equal_line)]%rDetailed status for [name(%q1)]'s mailbox:%r[u(dash_line)]%r})][rjust(Mailbox dbref:, 20)]%b%b%1[switch(strlen(%q2), 0,{%r-- WARNING -- This does not seem to be a valid mailbox.})]%r[rjust(Mail-in-progress:, 20)]%b%b%q2%r[rjust(Received:, 20)]%b%b[words(u(get_all_in_lists, %1))]%r[rjust(Sent:, 20)]%b%b[words(get(%1/out-list))]%r[rjust(Personal aliases:, 20)]%b%b[words(get(%1/alias-list))] [switch(hasattr(%1, alias-list), 0,,([u(list_names, trim(get(%1/alias-list)))]))]%r[rjust(Filters:, 20)]%b%b[ulocal(get_filter_count, %q1)]%r[rjust(Folders:, 20)]%b%b[words(get(%1/folder-list))] [switch(hasattr(%1, folder-list), 0,,{([u(secure_names, trim(get(%1/folder-list)))])})]%r[rjust(Autoforward:, 20)]%b%b[ulocal(get_autoforward_option, %q1)]%r[rjust(Message Timeout:, 20)]%b%b[ulocal(get_timeout_option, %q1)]%r[rjust(Semaphore:, 20)]%b%b[get(%1/semaphore)]%r[rjust(Current Letter:, 20)]%b%b[get(%1/[u(which_current_letter, %1)])]%r[rjust(Current Folder:, 20)]%b%b[secure(get(%1/current_folder))]%r[rjust(Inbox:, 20)]%b%b[secure(ulocal(get_inbox, %q1))]%r[rjust(Vacation:, 20)]%b%b[u(%1/vacation)]%r[rjust(Reject:, 20)]%b%b[u(%1/reject_msg)]%r[rjust(Filter reject:, 20)]%b%b[u(%1/filter_reject)][switch(%q0, standard, {%r[u(equal_line)]})];
&SET_MAIL_OPTION_FORMAT #6=$+set mail option format*=*: @swi/first [setq(0, get(%#/mail_config_options))]trim(%1) = s*,{@pemit %# = switch(member(%q0, standard), 0, Your 'format' mail option is now set to 'standard'., Your 'format' mail option is already set to 'standard'.); &mail_config_options %# = setunion(squish(remove(%q0, compact) standard), )},c*,{@pemit %# = switch(member(%q0, compact), 0, Your 'format' mail option is now set to 'compact'., Your 'format' mail option is already set to 'compact'.); &mail_config_options %# = setunion(squish(remove(%q0, standard) compact), )},{@pemit %# = The value specified for the mail option 'format', must be either 'standard' or 'compact'.}
&FORMAT_REQUEST #17=switch([setq(1, after(%0, :))]%0+[strlen(%0)], *+0,{%b( current )},a*:*,{%b( author: %q1 )},s*, {[switch(%0,*:*, {%b( subject: %q1 )}, {%b( saved )})]},t*:*,{[switch(%0,te*, {%b( text: %q1 )}, {%b( to: %q1 )})]},h*:*,{%b( heldby: %q1) },a*, {%b( all )},f*, {%b( first )},p*, {%b( previous )},m*, {%b( marked )},c*, {%b( current )},u*, {%b( unread )},d*, {%b( deleted )},l*, {%b( last )},n*, {%b( next )},)