eudora-mac/pop.c

1 line
95 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 "pop.h" #include "myssl.h" #define FILE_NUM 30 /* Copyright (c) 1990-1992 by the University of Illinois Board of Trustees */ /* 5/29/97 cwong NOTE: You should use the following macros when accessing POPD resources in the settings file: GetResourceMainThread_ ZapSettingsResourceMainThread AddMyResourceMainThread_ They access the main thread's Settings file (not the background thread's copy.) */ /************************************************************************ * functions for dealing with a pop 2 server ************************************************************************/ #ifdef KERBEROS #include <krb.h> #endif #pragma segment POP #define CMD_BUFFER 514 #define PSIZE (UseCTB ? 256 : 4096) #define errNotFound -2 #define MatchPOPD(old,oldSpot,hash) \ ((hash) && (*(old))[oldSpot].uidHash==(hash)) #define POP_TERM(buffer,size) ((size)==2 && (buffer)[0]=='.' && (buffer)[1]=='\015') /************************************************************************ * private routines ************************************************************************/ void POPDelDup(POPDHandle popDH); OSErr POPPreFetch(TransStream stream,POPDHandle popDH,short message,Boolean *capabilities); int POPGetReplyLo(TransStream stream,short cmd, UPtr buffer, long *size,AccuPtr resAcc); #define POPGetReply(stream,cmd,buffer,size) POPGetReplyLo(stream,cmd,buffer,size,nil) void RelatedNote(FSSpecPtr spec,HeaderDHandle hdh,PStr theMessage); int POPByeBye(TransStream stream); int POPCmdLo(TransStream stream, short cmd, UPtr args, AccuPtr argsAcc); #define POPCmd(stream,cmd,args) POPCmdLo(stream,cmd,args,nil) int POPGetMessage(TransStream,long messageNumber,short *gotSome,POPDHandle popDH,Boolean *capabilities); int DupHeader(short refN,UPtr buff,long bSize,long offset,long headerSize); int SaveAndSplit(TransStream stream,short refN,long estSize,HeaderDHandle *hdhp,Boolean isIMAP); Boolean StackLowErr = false; Boolean PopConnected; int FirstUnread(TransStream stream,int count); Boolean HasBeenRead(TransStream stream,short msgNum,short count); void StampPartNumber(MSumPtr sum,short part,short count); UPtr ExtractStamp(UPtr stamp,UPtr banner); short POPLast(TransStream,short *lastRead); POPLineType ReadPlainBody(TransStream stream,short refN,char *buf,long bSize,long estSize); short SplitMessage(short refN, long hStart, long hEnd, long msgEnd); void DisposePOPD(POPDHandle