eudora-mac/makefilter.c

1 line
46 KiB
C
Raw Permalink Normal View History

2018-05-23 09:59:15 +00:00
/* Copyright (c) 2017, Computer History Museum All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted (subject to the limitations in the disclaimer below) provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of Computer History Museum nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "MakeFilter.h" #define FILE_NUM 101 /* Copyright (c) 1996 by QUALCOMM Incorporated */ #pragma segment Makefilter // Real Name Queue Structure - to maintain a list of entire addresses. typedef struct RNQ RealNameQ, *RealNameQPtr, **RealNameQHandle; struct RNQ { RealNameQHandle next; Str255 realName; }; // RecPopup structure. Makes it easier to maintain the list and popup in parallel typedef struct RecPopup { MenuHandle menu; RealNameQHandle listOfNames; } RecPopup, *RecPopupPtr; #define Toggle(b) {if (!b) b = true; else b = false;} #define IGNORE_RECIPIENTS (RealNameQHandle)(-1) OSErr DoMakeFilterDialog(Boolean *create, Boolean *details, MakeFilterRecPtr mfRecPtr, RecPopupPtr popupInfo); OSErr SetUpFilterFromComp(MyWindowPtr win, MakeFilterRecPtr mfRecPtr, RecPopupPtr popupInfo); OSErr SetUpFilterFromMbox(MyWindowPtr win, MakeFilterRecPtr mfRecPtr, RecPopupPtr popupInfo); OSErr SetUpFilterFromMess(MyWindowPtr win, MakeFilterRecPtr mfRecPtr, RecPopupPtr popupInfo); OSErr GatherAddresses(MessHandle messH, HeaderEnum header, Handle *dest, Boolean wantComments); OSErr CreateTheFilter(MakeFilterRecPtr mfRecPtr, Boolean details); void SetProperDefaultFolder(MakeFilterRecPtr mfRecPtr, Boolean warnUser); OSErr FileSpecByName(FSSpecPtr spec,PStr name); OSErr FileSpecByNameInMenu(MenuHandle mh,FSSpecPtr spec,PStr name); short FindFileByNameIn1Menu(MenuHandle mh, PStr name); UPtr SuggestAMailboxName(MakeFilterRecPtr mfRecPtr, RecPopupPtr popupInfo); short AnyRPopup(DialogPtr dlog,short top,short left,MenuHandle mh); OSErr ANDAddressesToListOfNames(RecPopupPtr popupInfo, UHandle addresses); void FlushRNQ(RecPopupPtr popupInfo); OSErr BuildAnyRPopupMenu(RecPopupPtr popupInfo); void ChangeMenuForFolderSelect(short menu); void TweakSubMenuForFolderSelect(short menu); void SetDefaultLocation(DialogPtr dlog, Str255 defaultText); /********************************************************************** * DoMakeFilter - do Make Filter. **********************************************************************/ void DoMakeFilter(MyWindowPtr win) { WindowPtr winWP = GetMyWindowWindowPtr (win); OSErr err = noErr; Boolean create, details; MakeFilterRec mfRec; RecPopup anyRPopupMenuInfo; #ifdef IMAP // make sure the message is downloaded before doing the make filter ... if (GetWindowKind(winWP)==MESS_WIN) { MessHandle messH; // we're doing a make filter with a message window fr