eudora-mac/multi.c

1 line
15 KiB
C
Raw 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 "multi.h" #define FILE_NUM 147 OSErr MultiReferences(TOCHandle tocH,MessHandle messH); OSErr MultiBody(TOCHandle tocH,MessHandle messH); short BoxFindVectorMID(uShort **vector,TOCHandle tocH,uLong value); DecBVCompare(msgIdHash) void ReplyCCOFilter(ConConOutDescPtr thisODP,ConConMessElmPtr thisMEP,MessHandle messH,ConConElmH cceh,StackHandle stack,PETEHandle pte,void *userData); /********************************************************************** * DoReplyMultiple - reply to multiple messages, making a single reply **********************************************************************/ OSErr DoReplyMultiple(TOCHandle tocH, short modifiers) { MyWindowPtr newWin; WindowPtr newWinWP; MessHandle newMessH; short sumNum; Boolean all, self, quote; HeadSpec hs; Handle text; Accumulator addrAcc; Str255 scratch; OSErr err = noErr; Boolean cacheReplyTo = HasFeature (featureNicknameWatching) && !PrefIsSet (PREF_NICK_CACHE) && !PrefIsSet (PREF_NICK_CACHE_NOT_ADD_REPLY_TO); Zero(addrAcc); // // Set the proper personality PushPers(MultiPers(tocH)); // // Figure out what kind of reply ReplyDefaults(modifiers,&all,&self,&quote); //////////////////////// // Make the new window if (newWin=DoComposeNew(0)) { newMessH = Win2MessH(newWin); newWinWP = GetMyWindowWindowPtr(newWin); //////////////////////// // IMAP; sigh for (sumNum=0;sumNum<(*tocH)->count;sumNum++) if ((*tocH)->sums[sumNum].selected && !EnsureMsgDownloaded(tocH,sumNum,false)) { CloseMyWindow(newWin); goto done; } //////////////////////// // Copy the addresses from each selected message for (sumNum=0;sumNum<(*tocH)->count && !err;sumNum++) if ((*tocH)->sums[sumNum].selected) { // grab the message text CacheMessage(tocH,sumNum); if (text=(*tocH)->sums[sumNum].cache) { HNoPurge(text); // put all our addresses in the address accumulator, so that // we ignore them, if the user is so inclined if (!self) AddSelfAddrHashes(&addrAcc); // grab the "from" header for reply if (HandleHeadFindReply(text,&hs)) HandleHeadCopyAddrs(text,&hs,newMessH,TO_HEAD,&addrAcc,cacheReplyTo); // how about the other recipients? if (all) { if (HandleHeadFindStr(text,HeaderName(TO_HEAD),&hs)) HandleHeadCopyAddrs(text,&hs,newMessH,PrefIsSet(PREF_CC_REPLY)?CC_HEAD:TO_HEAD,&addrAcc,false);