# # Patch name: mail_fwd_patch # Patch version: 1 # Author's name: Siris # Author's email: siris@forbidden-donut.anet-stl.com # Version of PennMUSH: 1.7.0 Patchlevel 11 # Date patch made: 12-21-97 # Author is willing to support (yes/no): No # Patch format: diff -c # # # This is a contributed PennMUSH patch. Its use is subject to the # same restrictions found in PennMUSH's hdrs/copyrite.h file. # # No warranty is given for this patch. It is not necessarily going # to work on your system, with any version of PennMUSH other than # the one above, etc. # # If the author given above was willing to support the patch, you # should write to the author if you have any questions or problems. Do # *NOT* send email messages to Javelin or any PennMUSH mailing list about # this patch! # # Below this line is the author's description of the patch, # followed by the patch itself. If the patch is in context diff # format, you'll probably apply it by typing: patch < patchfile # in your top-level MUSH directory, unless instructed otherwise # below. # # This patch adds a '(Fwd: Name)' string to @MAIL that was forwarded from # someone, 'Name' is the original sender of the message, it required # the addition of a EXTMAIL DB flag so it can be convert'd to/from normal # PennMUSH mail db's. # # This patch also adds some ANSI color to do_mail_read, if EXTENDED_ANSI is # defined. # Apply the patch by typing 'patch < mail_fwd_patch.170p11' from your # top-level MUSH directory. # Note, only @MAIL forwarded -after- you apply this patch, # #define MAIL_FWD_PATCH in dune.h or options.h, compile and # reboot will save the original sender. *** src/extmail.c Sun Dec 21 21:32:56 1997 --- ../Penn1.7.0/src/extmail.c Sun Dec 21 18:17:42 1997 *************** *** 78,84 **** #include "extmail.h" #include "parse.h" #include "confmagic.h" ! #define notify(p,m) notify_check(p,m,0) extern void desc_mail_set _((dbref player, struct mail * mp)); /* bsd.c */ --- 78,86 ---- #include "extmail.h" #include "parse.h" #include "confmagic.h" ! #ifdef MAIL_FWD_PATCH ! #include "ansi.h" ! #endif #define notify(p,m) notify_check(p,m,0) extern void desc_mail_set _((dbref player, struct mail * mp)); /* bsd.c */ *************** *** 103,112 **** static struct mail *mailfun_fetch _((dbref player, int nargs, char *arg1, char *arg2)); static void count_mail _((dbref player, int folder, int *rcount, int *ucount, int *ccount)); #ifdef MAIL_SUBJECTS static void send_mail _((dbref player, dbref target, unsigned char *subject, char *message, mail_flag flags, int silent)); #else static void send_mail _((dbref player, dbref target, char *message, mail_flag flags, int silent)); ! #endif void do_mail_nuke _((dbref player)); void do_mail_debug _((dbref player, char *action, char *victim)); void do_mail_stats _((dbref player, char *name, int full)); --- 105,128 ---- static struct mail *mailfun_fetch _((dbref player, int nargs, char *arg1, char *arg2)); static void count_mail _((dbref player, int folder, int *rcount, int *ucount, int *ccount)); #ifdef MAIL_SUBJECTS + #ifdef MAIL_FWD_PATCH + static void send_mail _((dbref player, dbref target, unsigned char *subject, char *message, mail_flag flags, int silent, dbref orig)); + #else /* MAIL_FWD_PATCH */ static void send_mail _((dbref player, dbref target, unsigned char *subject, char *message, mail_flag flags, int silent)); + + #endif /* MAIL_FWD_PATCH */ + + #else /* MAIL_SUBJECTS */ + + #ifdef MAIL_FWD_PATCH + static void send_mail _((dbref player, dbref target, char *message, mail_flag flags, int silent, dbref orig)); + #else + static void send_mail _((dbref player, dbref target, char *message, mail_flag flags, int silent)); ! #endif /* MAIL_FWD_PATCH */ ! #endif /* MAIL_SUBJECTS */ ! void do_mail_nuke _((dbref player)); void do_mail_debug _((dbref player, char *action, char *victim)); void do_mail_stats _((dbref player, char *name, int full)); *************** *** 437,442 **** --- 453,460 ---- if (mail_match(player, mp, ms, i[Folder(mp)])) { /* Read it */ j++; + #ifndef MAIL_FWD_PATCH + notify(player, DASH_LINE); if (Typeof(mp->from) == TYPE_PLAYER) sprintf(tbuf1, "%s", Name(mp->from)); *************** *** 457,462 **** --- 475,551 ---- strcpy(tbuf1, uncompress(mp->message)); notify(player, tbuf1); notify(player, DASH_LINE); + + + + #else /* MAIL_FWD_PATCH */ + + #ifdef EXTENDED_ANSI + notify(player, tprintf("%s%s%s", ANSI_BLUE, DASH_LINE, ANSI_NORMAL)); + #else + notify(player, DASH_LINE); + #endif + if (Typeof(mp->from) == TYPE_PLAYER) { + + if(GoodObject(mp->original_sender) && mp->original_sender != (dbref) 0) + #ifdef EXTENDED_ANSI + sprintf(tbuf1, "%s (Fwd: %s%s%s%s)", Name(mp->from), ANSI_HILITE, ANSI_CYAN, + Name(mp->original_sender), ANSI_NORMAL); + #else + sprintf(tbuf1, "%s (Fwd: %s)", Name(mp->from), Name(mp->original_sender)); + #endif + else + sprintf(tbuf1, "%s", Name(mp->from)); + } else + #ifdef EXTENDED_ANSI + sprintf(tbuf1, "%s (owner: %s%s%s)", Name(mp->from), ANSI_HILITE,Name(Owner(mp->from)), ANSI_NORMAL); + #else + sprintf(tbuf1, "%s (owner: %s)", Name(mp->from), Name(Owner(mp->from))); + #endif /* EXTENDED_ANSI */ + + #ifdef EXTENDED_ANSI + notify(player, tprintf("%sFrom:%s %-55s %s\n%sDate:%s %-25s %sFolder:%s %2d %sMessage:%s %d\n%sStatus:%s %s", + ANSI_CYAN, ANSI_NORMAL, tbuf1, + ((Typeof(mp->from) == TYPE_PLAYER) && Connected(mp->from) && + (!hidden(mp->from) || Hasprivs(player))) ? + " (Conn)" : " ", + ANSI_CYAN, ANSI_NORMAL, uncompress(mp->time), + ANSI_CYAN, ANSI_NORMAL, Folder(mp), + ANSI_CYAN, ANSI_NORMAL, i[Folder(mp)], + ANSI_CYAN, ANSI_NORMAL, + status_string(mp))); + #else /* EXTENDED_ANSI */ + notify(player, tprintf("From: %-55s %s\nDate: %-25s Folder: %2d Message: %d\nStatus: %s", + tbuf1, + ((Typeof(mp->from) == TYPE_PLAYER) && Connected(mp->from) && + (!hidden(mp->from) || Hasprivs(player))) ? + " (Conn)" : " ", + uncompress(mp->time), + Folder(mp), i[Folder(mp)], + status_string(mp))); + #endif /* EXTENDED_ANSI */ + + #ifdef MAIL_SUBJECTS + #ifdef EXTENDED_ANSI + + notify(player, tprintf("%sSubject:%s %s", ANSI_CYAN, ANSI_NORMAL, get_subject(mp))); + #else + notify(player, tprintf("Subject: %s", get_subject(mp))); + #endif /* EXTENDED_ANSI */ + #endif + + #ifdef EXTENDED_ANSI + notify(player, tprintf("%s%s%s", ANSI_BLUE, DASH_LINE, ANSI_NORMAL)); + strncpy(tbuf1, uncompress(mp->message), BUFFER_LEN); + notify(player, tbuf1); + notify(player, tprintf("%s%s%s%s", ANSI_HILITE, ANSI_BLUE, DASH_LINE, ANSI_NORMAL)); + #else + notify(player, DASH_LINE); + strncpy(tbuf1, uncompress(mp->message), BUFFER_LEN); + notify(player, tbuf1); + notify(player, DASH_LINE); + #endif /* EXTENDED_ANSI */ + #endif /* MAIL_FWD_PATCH */ if (Unread(mp)) mp->read |= M_READ; /* mark message as read */ } *************** *** 676,685 **** notify(player, "MAIL: You can't reply to nonexistant mail."); } else { #ifdef MAIL_SUBJECTS send_mail(player, temp->from, mp->subject, (char *) mp->message, M_FORWARD | M_REPLY, 1); ! #else send_mail(player, temp->from, (char *) mp->message, M_FORWARD | M_REPLY, 1); ! #endif num_recpts++; } } else { --- 765,784 ---- notify(player, "MAIL: You can't reply to nonexistant mail."); } else { #ifdef MAIL_SUBJECTS + + #ifdef MAIL_FWD_PATCH + send_mail(player, temp->from, mp->subject, (char *) mp->message, M_FORWARD | M_REPLY, 1, (dbref) -1); + #else /* MAIL_FWD_PATCH */ send_mail(player, temp->from, mp->subject, (char *) mp->message, M_FORWARD | M_REPLY, 1); ! #endif /* MAIL_FWD_PATCH */ ! #else /* MAIL_SUBJECTS */ ! #ifdef MAIL_FWD_PATCH ! send_mail(player, temp->from, (char *) mp->message, M_FORWARD | M_REPLY, 1, (dbref) -1); ! #else /* MAIL_FWD_PATCH */ send_mail(player, temp->from, (char *) mp->message, M_FORWARD | M_REPLY, 1); ! #endif /* MAIL_FWD_PATCH */ ! #endif /* MAIL_SUBJECTS */ ! num_recpts++; } } else { *************** *** 695,705 **** if ((target == NOTHING) || (Typeof(target) != TYPE_PLAYER)) { notify(player, "No such player."); } else { #ifdef MAIL_SUBJECTS send_mail(player, target, mp->subject, (char *) mp->message, M_FORWARD, 1); ! #else send_mail(player, target, (char *) mp->message, M_FORWARD, 1); ! #endif num_recpts++; } } --- 794,817 ---- if ((target == NOTHING) || (Typeof(target) != TYPE_PLAYER)) { notify(player, "No such player."); } else { + + #ifdef MAIL_SUBJECTS + #ifdef MAIL_FWD_PATCH + send_mail(player, target, mp->subject, (char *) mp->message, M_FORWARD, 1, mp->from); + #else /* MAIL_FWD_PATCH */ send_mail(player, target, mp->subject, (char *) mp->message, M_FORWARD, 1); ! #endif /* MAIL_FWD_PATCH */ ! ! #else /* MAIL_SUBJECTS */ ! ! #ifdef MAIL_FWD_PATCH ! send_mail(player, target, (char *) mp->message, M_FORWARD, 1, mp->from); ! #else /* MAIL_FWD_PATCH */ send_mail(player, target, (char *) mp->message, M_FORWARD, 1); ! #endif /* MAIL_FWD_PATCH */ ! ! #endif /* MAIL_SUBJECTS */ num_recpts++; } } *************** *** 794,806 **** } #ifdef MAIL_SUBJECTS if (subject_given) send_mail(player, temp->from, compress(sbuf), message, mail_flags, silent); else send_mail(player, temp->from, temp->subject, message, mail_flags | M_REPLY, silent); ! #else send_mail(player, temp->from, message, mail_flags, silent); ! #endif } else { /* send a new mail message */ if (!strcasecmp(head, "me")) --- 906,931 ---- } #ifdef MAIL_SUBJECTS if (subject_given) + #ifdef MAIL_FWD_PATCH + send_mail(player, temp->from, compress(sbuf), message, mail_flags, silent, (dbref) -1); + #else /* MAIL_FWD_PATCH */ send_mail(player, temp->from, compress(sbuf), message, mail_flags, silent); + #endif /* MAIL_FWD_PATCH */ else + #ifdef MAIL_FWD_PATCH + send_mail(player, temp->from, temp->subject, message, + mail_flags | M_REPLY, silent, (dbref) -1); + #else /* MAIL_FWD_PATCH */ send_mail(player, temp->from, temp->subject, message, mail_flags | M_REPLY, silent); ! #endif /* MAIL_FWD_PATCH */ ! #else /* MAIL_SUBJECTS */ ! #ifdef MAIL_FWD_PATCH ! send_mail(player, temp->from, message, mail_flags, silent, (dbref) -1); ! #else /* MAIL_FWD_PATCH */ send_mail(player, temp->from, message, mail_flags, silent); ! #endif /* MAIL_FWD_PATCH */ ! #endif /* MAIL_SUBJECTS */ } else { /* send a new mail message */ if (!strcasecmp(head, "me")) *************** *** 815,824 **** notify(player, "No such player."); else #ifdef MAIL_SUBJECTS send_mail(player, target, compress(sbuf), message, mail_flags, silent); ! #else send_mail(player, target, message, mail_flags, silent); ! #endif } /* Get the next recip */ *tail = spot; --- 940,957 ---- notify(player, "No such player."); else #ifdef MAIL_SUBJECTS + #ifdef MAIL_FWD_PATCH + send_mail(player, target, compress(sbuf), message, mail_flags, silent, (dbref)-1); + #else /* MAIL_FWD_PATCH */ send_mail(player, target, compress(sbuf), message, mail_flags, silent); ! #endif /* MAIL_FWD_PATCH */ ! #else /* MAIL_SUBJECTS */ ! #ifdef MAIL_FWD_PATCH ! send_mail(player, target, message, mail_flags, silent, (dbref)-1); ! #else /* MAIL_FWD_PATCH */ send_mail(player, target, message, mail_flags, silent); ! #endif /* MAIL_FWD_PATCH */ ! #endif /* MAIL_SUBJECTS */ } /* Get the next recip */ *tail = spot; *************** *** 903,914 **** #ifdef MAIL_SUBJECTS static void send_mail(player, target, subject, message, flags, silent) ! #else static void send_mail(player, target, message, flags, silent) ! #endif dbref player; dbref target; #ifdef MAIL_SUBJECTS --- 1036,1067 ---- #ifdef MAIL_SUBJECTS + #ifdef MAIL_FWD_PATCH + + static void + send_mail(player, target, subject, message, flags, silent, orig) + + #else /* MAIL_FWD_PATCH */ + static void send_mail(player, target, subject, message, flags, silent) ! ! #endif /* MAIL_FWD_PATCH */ ! ! #else /* MAIL_SUBJECTS */ ! ! #ifdef MAIL_FWD_PATCH ! ! static void ! send_mail(player, target, message, flags, silent, orig) ! ! #else /* MAIL_FWD_PATCH */ ! static void send_mail(player, target, message, flags, silent) ! #endif /* MAIL_FWD_PATCH */ ! ! #endif /* MAIL_SUBJECTS */ dbref player; dbref target; #ifdef MAIL_SUBJECTS *************** *** 917,922 **** --- 1070,1078 ---- char *message; mail_flag flags; int silent; + #ifdef MAIL_FWD_PATCH + dbref orig; + #endif { /* send a mail message */ *************** *** 974,979 **** --- 1130,1140 ---- newp->time = u_strdup(compress(tbuf1)); newp->read = flags & M_FMASK; /* Send to folder 0 */ + #ifdef MAIL_FWD_PATCH + newp->original_sender = orig; + #endif /* MAIL_FWD_PATCH */ + + /* Where do we insert it? After mp, wherever that is. * This can return NULL if there are no messages or * if we insert at the head of the list *************** *** 1577,1582 **** --- 1738,1747 ---- mail_flags += MDBF_SUBJECT; #endif + #ifdef MAIL_FWD_PATCH + mail_flags += MDBF_ORIGSENDER; + #endif + if (mail_flags) fprintf(fp, "+%d\n", mail_flags); *************** *** 1594,1599 **** --- 1759,1767 ---- #endif putstring(fp, uncompress(mp->message)); putref(fp, mp->read); + #ifdef MAIL_FWD_PATCH + putref(fp, mp->original_sender); + #endif count++; } *************** *** 1731,1736 **** --- 1899,1911 ---- } #endif mp->read = getref(fp); + if(mail_flags & MDBF_ORIGSENDER) + #ifdef MAIL_FWD_PATCH + mp->original_sender = getref(fp); + #else + (void)getref(fp); + #endif + mp->next = NULL; mp->prev = NULL; HEAD = mp; *************** *** 1757,1762 **** --- 1932,1943 ---- } #endif mp->read = getref(fp); + if(mail_flags & MDBF_ORIGSENDER) + #ifdef MAIL_FWD_PATCH + mp->original_sender = getref(fp); + #else + (void)getref(fp); + #endif /* We now to a sorted insertion, sorted by recipient db# */ if (mp->to >= TAIL->to) { *** hdrs/extmail.h Thu Oct 9 09:54:37 1997 --- ../Penn1.7.0/hdrs/extmail.h Sun Dec 21 18:00:38 1997 *************** *** 60,64 **** #define MDBF_SUBJECT 0x1 #define MDBF_ALIASES 0x2 ! #endif /* _EXTMAIL_H */ --- 60,64 ---- #define MDBF_SUBJECT 0x1 #define MDBF_ALIASES 0x2 ! #define MDBF_ORIGSENDER 0x4 #endif /* _EXTMAIL_H */ *** hdrs/dbdefs.h Tue Oct 21 12:52:18 1997 --- ../Penn1.7.0/hdrs/dbdefs.h Sun Dec 21 17:04:56 1997 *************** *** 50,55 **** --- 50,56 ---- #define Typeof(x) (db[(x)].flags & TYPE_MASK) + #define Name(x) (db[(x)].name) #define Flags(x) (db[(x)].flags) #define Toggles(x) (db[(x)].toggles) *************** *** 86,91 **** --- 87,96 ---- #define Parent(x) (db[(x)].parent) #define Powers(x) (db[(x)].powers) /* Note that this is a utility to determine the objects which may or may */ /* not be controlled, rather than a strict check for the INHERIT flag */ #define Owns(p,x) (db[(p)].owner == db[(x)].owner) *************** *** 296,301 **** --- 301,309 ---- unsigned char *time; /* compressed */ #ifdef MAIL_SUBJECTS unsigned char *subject; /* compressed */ + #endif + #ifdef MAIL_FWD_PATCH + dbref original_sender; /* For forwarded mail */ #endif int read; };