Changed uses of MsgErr to nsresult. Moved CR LF macros to base/src/nsCRT.h.

This commit is contained in:
warren%netscape.com 1999-02-09 04:20:46 +00:00
parent b6be0cc3db
commit 6025c5369c
12 changed files with 71 additions and 69 deletions

View File

@ -29,19 +29,6 @@
/* Carriage return and linefeeds */
#define CR '\015'
#define LF '\012'
#define VTAB '\013'
#define FF '\014'
#define TAB '\011'
#define CRLF "\015\012" /* A CR LF equivalent string */
/* Right now, plstr.h does not implement strok yet, so we'll go through the string library for this.... */
/* We need to fix this! strtok is not thread-safe on most platforms.
* we need a better solution for this */
#include <string.h>
#define XP_STRTOK strtok
/* see mozilla/xpcom/public/nsError.h for details */
#define NS_ERROR_MODULE_MAILNEWS 16

View File

@ -8,17 +8,6 @@
#include "nsISupportsArray.h" /* interface nsISupportsArray */
#include "nsIMsg.h"
enum FolderType {
FOLDER_MAIL,
FOLDER_IMAPMAIL,
FOLDER_NEWSGROUP,
FOLDER_CONTAINERONLY,
FOLDER_CATEGORYCONTAINER,
FOLDER_IMAPSERVERCONTAINER,
FOLDER_UNKNOWN
};
/* starting interface nsIMsgFolder */
/* {85e39ff0-b248-11d2-b7ef-00805f05ffa5} */
@ -34,9 +23,6 @@ class nsIMsgFolder : public nsISupports {
return iid;
}
/* <IDL> */
NS_IMETHOD GetType(FolderType *aType) = 0;
/* <IDL> */
NS_IMETHOD GetPrettyName(char * *aPrettyName) = 0;
@ -234,6 +220,7 @@ class nsIMsgFolder : public nsISupports {
NS_IMETHOD GetExpansionArray(const nsISupportsArray *expansionArray) = 0;
};
////////////////////////////////////////////////////////////////////////////////
/* starting interface nsIMsgMailFolder */
/* {27D2DE40-BAF1-11d2-9578-00805F8AC615} */
@ -254,4 +241,29 @@ class nsIMsgLocalMailFolder : public nsISupports {
NS_IMETHOD SetPathName(char * aPathName) = 0;
};
////////////////////////////////////////////////////////////////////////////////
/* {83ebf570-bfc6-11d2-8177-006008119d7a} */
#define NS_IMSGIMAPMAILFOLDER_IID_STR "83ebf570-bfc6-11d2-8177-006008119d7a"
#define NS_IMSGIMAPMAILFOLDER_IID \
{ /* 83ebf570-bfc6-11d2-8177-006008119d7a */ \
0x83ebf570, \
0xbfc6, \
0x11d2, \
{0x81, 0x77, 0x00, 0x60, 0x08, 0x11, 0x9d, 0x7a} \
}
class nsIMsgImapMailFolder : public nsISupports {
public:
static const nsIID& IID() {
static nsIID iid = NS_IMSGIMAPMAILFOLDER_IID;
return iid;
}
/* <IDL> */
NS_IMETHOD GetPathName(char * *aPathName) = 0;
NS_IMETHOD SetPathName(char * aPathName) = 0;
};
#endif /* __gen_nsIMsgFolder_h__ */

View File

@ -19,6 +19,7 @@
#include "nsISupportsArray.idl"
#include "nsIMsg.idl"
/* XXX replaced by QueryInterface for nsIMsgFolder subtypes:
enum FolderType {
FOLDER_MAIL,
FOLDER_IMAPMAIL,
@ -27,12 +28,12 @@ enum FolderType {
FOLDER_CATEGORYCONTAINER,
FOLDER_IMAPSERVERCONTAINER,
FOLDER_UNKNOWN
};
};
*/
[uuid(85e39ff0-b248-11d2-b7ef-00805f05ffa5)]
interface nsIMsgFolder : nsISupports {
readonly attribute FolderType type;
readonly attribute string prettyName;
readonly attribute string name;
void SetName(in string name);
@ -129,10 +130,17 @@ interface nsIMsgFolder : nsISupports {
};
////////////////////////////////////////////////////////////////////////////////
[uuid(27D2DE40-BAF1-11d2-9578-00805F8AC615)]
interface nsIMsgMailFolder : nsISupports {
interface nsIMsgLocalMailFolder : nsISupports {
attribute string pathName;
};
////////////////////////////////////////////////////////////////////////////////
interface nsIMsgImapMailFolder : nsISupports {
};

View File

@ -134,17 +134,18 @@ NS_IMETHODIMP nsMsgFolder::SetMaster(MSG_Master *master)
#endif
#ifdef DOES_FOLDEROPERATIONS
NS_IMETHODIMP nsMsgFolder::StartAsyncCopyMessagesInto(MSG_FolderInfo *dstFolder,
MSG_Pane* sourcePane,
nsMsgDatabase *sourceDB,
nsMsgKeyArray *srcArray,
int32 srcCount,
MWContext *currentContext,
MSG_UrlQueue *urlQueue,
PRBool deleteAfterCopy,
MessageKey nextKey = MSG_MESSAGEKEYNONE)
NS_IMETHODIMP
nsMsgFolder::StartAsyncCopyMessagesInto(MSG_FolderInfo *dstFolder,
MSG_Pane* sourcePane,
nsMsgDatabase *sourceDB,
nsMsgKeyArray *srcArray,
int32 srcCount,
MWContext *currentContext,
MSG_UrlQueue *urlQueue,
PRBool deleteAfterCopy,
MessageKey nextKey = MSG_MESSAGEKEYNONE)
{
// General note: If either the source or destination folder is an IMAP folder then we add the copy info struct
// General note: If either the source or destination folder is an IMAP folder then we add the copy info struct
// to the end of the current context's chain of copy info structs then fire off an IMAP URL.
// However, local folders don't work this way! We must add the copy info struct to the URL queue where it will be fired
// at its leisure.
@ -172,7 +173,7 @@ NS_IMETHODIMP nsMsgFolder::StartAsyncCopyMessagesInto(MSG_FolderInfo *dstFolder,
copyInfo->moveState.imap_connection = 0;
copyInfo->moveState.haveUploadedMessageSize = FALSE;
MsgERR openErr = eSUCCESS;
nsresult openErr = NS_OK;
PRBool wasCreated;
if (dstFolder->GetType() == FOLDER_MAIL)
openErr = MailDB::Open (dstFolder->GetMailFolderInfo()->GetPathname(), FALSE, &copyInfo->moveState.destDB, FALSE);
@ -181,7 +182,7 @@ NS_IMETHODIMP nsMsgFolder::StartAsyncCopyMessagesInto(MSG_FolderInfo *dstFolder,
sourcePane->GetMaster(), &wasCreated);
if (!dstFolder->GetMailFolderInfo() || (openErr != eSUCCESS))
if (!dstFolder->GetMailFolderInfo() || (openErr != NS_OK))
copyInfo->moveState.destDB = NULL;
// let the front end know that we are starting a long update
@ -204,8 +205,8 @@ NS_IMETHODIMP nsMsgFolder::StartAsyncCopyMessagesInto(MSG_FolderInfo *dstFolder,
// shebang is handled as one IMAP url. Previously the copy
// happened with a mailbox url and IMAP url running together
// in the same context. This worked on mac only.
MsgERR copyErr = BeginCopyingMessages(dstFolder, sourceDB, srcArray,urlQueue,srcCount,copyInfo);
if (0 != copyErr)
nsresult copyErr = BeginCopyingMessages(dstFolder, sourceDB, srcArray,urlQueue,srcCount,copyInfo);
if (NS_OK != copyErr)
{
CleanupCopyMessagesInto(&currentContext->msgCopyInfo);

View File

@ -228,7 +228,7 @@ public:
NS_IMETHOD DisplayRecipients(PRBool *displayRecipients);
#ifdef HAVE_SEMAPHORE
MsgERR AcquireSemaphore(void *semHolder);
nsresult AcquireSemaphore(void *semHolder);
void ReleaseSemaphore(void *semHolder);
PRBool TestSemaphore(void *semHolder);
PRBool IsLocked() { return m_semaphoreHolder != NULL; }
@ -243,8 +243,8 @@ public:
#endif
#ifdef HAVE_CACHE
virtual MsgERR WriteToCache(XP_File);
virtual MsgERR ReadFromCache(char *);
virtual nsresult WriteToCache(XP_File);
virtual nsresult ReadFromCache(char *);
virtual PRBool IsCachable();
void SkipCacheTokens(char **ppBuf, int numTokens);
#endif

View File

@ -36,7 +36,7 @@ public:
NS_DECL_ISUPPORTS
#ifdef HAVE_DB
virtual MsgERR BeginCopyingMessages(MSG_FolderInfo *dstFolder,
virtual nsresult BeginCopyingMessages(MSG_FolderInfo *dstFolder,
MessageDB *sourceDB,
IDArray *srcArray,
MSG_UrlQueue *urlQueue,

View File

@ -71,7 +71,7 @@ NS_IMETHODIMP nsMsgLocalMailFolder::BuildFolderURL(char **url)
NS_IMETHODIMP nsMsgLocalMailFolder::CreateSubfolder(const char *leafNameFromUser, nsIMsgFolder **outFolder, PRUint32 *outPos)
{
#ifdef HAVE_PORT
MsgERR status = 0;
nsresult status = NS_OK;
*ppOutFolder = NULL;
*pOutPos = 0;
XP_StatStruct stat;
@ -187,7 +187,7 @@ NS_IMETHODIMP nsMsgLocalMailFolder::Delete ()
#ifdef HAVE_PORT
nsMsgDatabase *db;
// remove the summary file
MsgERR status = CloseDatabase (m_pathName, &db);
nsresult status = CloseDatabase (m_pathName, &db);
if (0 == status)
{
if (db != NULL)
@ -220,7 +220,7 @@ NS_IMETHODIMP nsMsgLocalMailFolder::Rename (const char *newName)
{
#ifdef HAVE_PORT
// change the leaf name (stored separately)
MsgERR status = MSG_FolderInfo::Rename (newUserLeafName);
nsresult status = MSG_FolderInfo::Rename (newUserLeafName);
if (status == 0)
{
char *baseDir = XP_STRDUP(m_pathName);
@ -300,7 +300,7 @@ NS_IMETHODIMP nsMsgLocalMailFolder::Rename (const char *newName)
NS_IMETHODIMP nsMsgLocalMailFolder::Adopt(const nsIMsgFolder *srcFolder, PRUint32 *outPos)
{
#ifdef HAVE_PORT
MsgERR err = eSUCCESS;
nsresult err = NS_OK;
XP_ASSERT (srcFolder->GetType() == GetType()); // we can only adopt the same type of folder
MSG_FolderInfoMail *mailFolder = (MSG_FolderInfoMail*) srcFolder;
@ -325,7 +325,7 @@ NS_IMETHODIMP nsMsgLocalMailFolder::Adopt(const nsIMsgFolder *srcFolder, PRUint3
else
err = MK_COULD_NOT_CREATE_DIRECTORY;
}
if (eSUCCESS == err)
if (NS_OK == err)
{
m_flags |= MSG_FOLDER_FLAG_DIRECTORY;
m_flags |= MSG_FOLDER_FLAG_ELIDED;
@ -336,7 +336,7 @@ NS_IMETHODIMP nsMsgLocalMailFolder::Adopt(const nsIMsgFolder *srcFolder, PRUint3
err = mailFolder->PropagateAdopt (m_pathName, m_depth);
// Add the folder to our tree in the right sorted position
if (eSUCCESS == err)
if (NS_OK == err)
{
XP_ASSERT(m_subFolders->FindIndex(0, srcFolder) == -1);
*pOutPos = m_subFolders->Add (srcFolder);

View File

@ -33,13 +33,10 @@ public:
nsMsgLocalMailFolder(const char* uri);
~nsMsgLocalMailFolder();
NS_IMETHOD QueryInterface(REFNSIID aIID,
void** aInstancePtr);
NS_IMETHOD_(nsrefcnt) AddRef(void);
NS_IMETHOD_(nsrefcnt) Release(void);
NS_DECL_ISUPPORTS
#ifdef HAVE_DB
virtual MsgERR BeginCopyingMessages (MSG_FolderInfo *dstFolder,
virtual nsresult BeginCopyingMessages(MSG_FolderInfo *dstFolder,
MessageDB *sourceDB,
IDArray *srcArray,
MSG_UrlQueue *urlQueue,

View File

@ -81,8 +81,6 @@ const int MK_MSG_OUTBOX_L10N_NAME_OLD = 0;
#define FE_Alert(a, b) /*NYI*/
#define MsgERR PRInt32
/* The three ways to deliver a message.
*/
typedef enum

View File

@ -257,10 +257,9 @@ nsresult nsSmtpUrl::ParseMessageToPost(char * searchPart)
if (rest)
{
rest = XP_STRTOK (rest, "&");
while (rest && *rest)
char *token = nsCRT::strtok(rest, "&", &rest);
while (token && *token)
{
char *token = rest;
char *value = 0;
char *eq = PL_strchr(token, '=');
if (eq)
@ -367,7 +366,7 @@ nsresult nsSmtpUrl::ParseMessageToPost(char * searchPart)
if (eq)
*eq = '='; /* put it back */
rest = XP_STRTOK (0, "&");
token = nsCRT::strtok(rest, "&", &rest);
} // while we still have part of the url to parse...
} // if rest && *rest
@ -978,4 +977,4 @@ nsresult nsSmtpUrl::ToString(PRUnichar* *aString) const
////////////////////////////////////////////////////////////////////////////////////
// End of functions which should be made obsolete after modifying nsIURL
////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////

View File

@ -26,7 +26,7 @@ class nsNewsDatabase : public nsMsgDatabase
public:
nsNewsDatabase();
virtual ~nsNewsDatabase();
virtual MsgERR MessageDBOpenUsingURL(const char * groupURL);
virtual nsresult MessageDBOpenUsingURL(const char * groupURL);
char *GetGroupURL() { return m_groupURL; }
static nsresult Open(const char * groupURL, MSG_Master *master,
nsNewsDatabase** pMessageDB);

View File

@ -307,7 +307,7 @@ nsNNTPNewsgroupList::GetRangeOfArtsToDownload(
#ifdef HAVE_NEWSDB
if (!m_newsDB)
{
if ((err = NewsGroupDB::Open(m_url, m_master, &m_newsDB)) != eSUCCESS)
if ((err = NewsGroupDB::Open(m_url, m_master, &m_newsDB)) != NS_OK)
{
if (status) *status = ConvertMsgErrToMKErr(err);
return NS_ERROR_NOT_INITIALIZED;