eudora-mac/imapmailboxes.c

1 line
127 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. */ /* Copyright (c) 1998 by QUALCOMM Incorporated */ #define FILE_NUM 113 /********************************************************************** * imapmailboxes.c * * This file contains the functions necessary to keep track of the * remote IMAP mailboxes. Everything defined here is designed to work * in the main thread only. **********************************************************************/ #include "imapmailboxes.h" #pragma segment IMAP #define IMAP_TYPE 'IMAP' #define BOX_INFO_TYPE 'imap' #define BOX_NAME_TYPE 'inam' #define BOX_FLAGS_TYPE 'ifag' #define IMAP_ID 128 // mailbox error codes enum { IMAPParamErr=1, IMAPTreeInUse }; MailboxNodeHandle GetIMAPMailboxLevel(IMAPStreamPtr imapStream, const char *ref, Boolean includeInbox, Boolean progress); OSErr UpdateLocalCacheMailboxes(MailboxNodeHandle *tree, FSSpecPtr inSpec, Boolean progress); Boolean CreateIMAPCacheMailbox(FSSpecPtr spec, Boolean folder); OSErr CleanIMAPFolder(void); OSErr CleanCacheFolder(FSSpecPtr folderToClean, MailboxNodeHandle treeToClean); OSErr ReadIMAPMailboxInfo(FSSpecPtr spec, MailboxNodeHandle node); OSErr RebuildIMAPMailboxTree(FSSpecPtr dir, PersHandle pers, MailboxNodeHandle *tree, Boolean *bHasQueuedCommands); MailboxNodeHandle RebuildPersIMAPMailboxTree(PersHandle pers); Boolean StrCmpNotIncludingEndingDelimiter(UPtr str1, UPtr str2, char delimiter); void LocateNodeByVDInAllPersTrees(short vRef, long dirId, MailboxNodeHandle *node, PersHandle *pers); MailboxNodeHandle LocateNodeByVD(MailboxNodeHandle tree, short vRef, long dirId); MailboxNodeHandle LocateParentNode(MailboxNodeHandle tree, MailboxNodeHandle child); MailboxNodeHandle LocateParentNodeInChildren(MailboxNodeHandle tree, MailboxNodeHandle child); OSErr BuildIMAPMailboxName(MailboxNodeHandle parent, FSSpecPtr newSpec, Boolean folder, CStr *newMailboxName); Boolean DeleteIMAPMailboxNode(IMAPStreamPtr imapStream, MailboxNodeHandle node); Boolean FetchDelimiter(IMAPStreamPtr imapStream, MailboxNodeHandle node); void TransferLocalTreeInfo(MailboxNodeHandle oldTree, MailboxNodeHandle newTree); char *NewIMAPMailboxName(MailboxNodeHandle node, UPtr name, char *newName); MailboxNodeHandle LocateSpecialMailbox(MailboxNodeHandle tree, long mboxAtt); Boolean ChooseSpecialMailbox(PersHandle pers, short msg, FSSpecPtr specialSpec); OSErr EnsureIMAPCacheFolders(FSSpecPtr attach, FSSpecPtr imapStubSpec); void AttachOpenTocsToIMAPMailboxTrees(vo