This commit is contained in:
putterman%netscape.com 1999-04-24 20:35:34 +00:00
Родитель 0695594f7a
Коммит 55286de9a6
5 изменённых файлов: 548 добавлений и 0 удалений

Просмотреть файл

@ -26,4 +26,5 @@ nsMsgIdentity.h
nsMsgIncomingServer.h
nsNewsSummarySpec.h
nsMsgUtils.h
nsMessage.h

Просмотреть файл

@ -36,6 +36,7 @@ EXPORTS = \
nsMsgIdentity.h \
nsMsgIncomingServer.h \
nsMsgUtils.h \
nsMessage.h \
$(NULL)
CPPSRCS = \
@ -49,6 +50,7 @@ CPPSRCS = \
nsMsgIdentity.cpp \
nsMsgIncomingServer.cpp \
nsMsgUtils.cpp \
nsMessage.cpp \
$(NULL)
EXTRA_DSO_LDOPTS = \

Просмотреть файл

@ -37,6 +37,7 @@ CPPSRCS= \
nsMsgIncomingServer.cpp \
nsNewsSummarySpec.cpp \
nsMsgUtils.cpp \
nsMessage.cpp \
$(NULL)
@ -52,6 +53,7 @@ CPP_OBJS= \
.\$(OBJDIR)\nsMsgIncomingServer.obj \
.\$(OBJDIR)\nsNewsSummarySpec.obj \
.\$(OBJDIR)\nsMsgUtils.obj \
.\$(OBJDIR)\nsMessage.obj \
$(NULL)
@ -66,6 +68,7 @@ EXPORTS= \
nsMsgIncomingServer.h \
nsNewsSummarySpec.h \
nsMsgUtils.h \
nsMessage.h \
$(NULL)
LINCS= \

Просмотреть файл

@ -0,0 +1,434 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1999 Netscape Communications Corporation. All Rights
* Reserved.
*/
#include "msgCore.h" // precompiled header...
#include "nsMessage.h"
nsMessage::nsMessage(void)
: nsRDFResource(), mFolder(nsnull),
mMsgHdr(nsnull)
{
}
nsMessage::~nsMessage(void)
{
NS_IF_RELEASE(mFolder);
NS_IF_RELEASE(mMsgHdr);
}
NS_IMPL_ISUPPORTS_INHERITED(nsMessage, nsRDFResource, nsIMessage)
NS_IMETHODIMP nsMessage::GetProperty(const char *propertyName, nsString &resultProperty)
{
if(mMsgHdr)
return mMsgHdr->GetProperty(propertyName, resultProperty);
else
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP nsMessage::SetProperty(const char *propertyName, nsString &propertyStr)
{
if(mMsgHdr)
return mMsgHdr->SetProperty(propertyName, propertyStr);
else
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP nsMessage::GetUint32Property(const char *propertyName, PRUint32 *pResult)
{
if(mMsgHdr)
return mMsgHdr->GetUint32Property(propertyName, pResult);
else
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP nsMessage::SetUint32Property(const char *propertyName, PRUint32 propertyVal)
{
if(mMsgHdr)
return mMsgHdr->SetUint32Property(propertyName, propertyVal);
else
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP nsMessage::GetNumReferences(PRUint16 *result)
{
if(mMsgHdr)
return mMsgHdr->GetNumReferences(result);
else
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP nsMessage::GetStringReference(PRInt32 refNum, nsString2 &resultReference)
{
if(mMsgHdr)
return mMsgHdr->GetStringReference(refNum, resultReference);
else
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP nsMessage::GetDate(time_t *result)
{
if(mMsgHdr)
return mMsgHdr->GetDate(result);
else
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP nsMessage::SetDate(time_t date)
{
if(mMsgHdr)
return mMsgHdr->SetDate(date);
else
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP nsMessage::SetMessageId(const char *messageId)
{
if(mMsgHdr)
return mMsgHdr->SetMessageId(messageId);
else
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP nsMessage::SetReferences(const char *references)
{
if(mMsgHdr)
return mMsgHdr->SetReferences(references);
else
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP nsMessage::SetCCList(const char *ccList)
{
if(mMsgHdr)
return mMsgHdr->SetCCList(ccList);
else
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP nsMessage::SetRecipients(const char *recipients, PRBool recipientsIsNewsgroup)
{
if(mMsgHdr)
return mMsgHdr->SetRecipients(recipients, recipientsIsNewsgroup);
else
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP nsMessage::SetRecipientsArray(const char *names, const char *addresses, PRUint32 numAddresses)
{
if(mMsgHdr)
return mMsgHdr->SetRecipientsArray(names, addresses, numAddresses);
else
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP nsMessage::SetCCListArray(const char *names, const char *addresses, PRUint32 numAddresses)
{
if(mMsgHdr)
return mMsgHdr->SetCCListArray(names, addresses, numAddresses);
else
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP nsMessage::SetAuthor(const char *author)
{
if(mMsgHdr)
return mMsgHdr->SetAuthor(author);
else
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP nsMessage::SetSubject(const char *subject)
{
if(mMsgHdr)
return mMsgHdr->SetSubject(subject);
else
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP nsMessage::SetStatusOffset(PRUint32 statusOffset)
{
if(mMsgHdr)
return mMsgHdr->SetStatusOffset(statusOffset);
else
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP nsMessage::GetAuthor(nsString &resultAuthor)
{
if(mMsgHdr)
return mMsgHdr->GetAuthor(resultAuthor);
else
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP nsMessage::GetSubject(nsString &resultSubject)
{
if(mMsgHdr)
return mMsgHdr->GetSubject(resultSubject);
else
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP nsMessage::GetRecipients(nsString &resultRecipients)
{
if(mMsgHdr)
return mMsgHdr->GetRecipients(resultRecipients);
else
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP nsMessage::GetCCList(nsString &ccList)
{
if(mMsgHdr)
return mMsgHdr->GetCCList(ccList);
else
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP nsMessage::GetMessageId(nsString &resultMessageId)
{
if(mMsgHdr)
return mMsgHdr->GetMessageId(resultMessageId);
else
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP nsMessage::GetMime2EncodedAuthor(nsString &resultAuthor)
{
if(mMsgHdr)
return mMsgHdr->GetMime2EncodedAuthor(resultAuthor);
else
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP nsMessage::GetMime2EncodedSubject(nsString &resultSubject)
{
if(mMsgHdr)
return mMsgHdr->GetMime2EncodedSubject(resultSubject);
else
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP nsMessage::GetMime2EncodedRecipients(nsString &resultRecipients)
{
if(mMsgHdr)
return mMsgHdr->GetMime2EncodedRecipients(resultRecipients);
else
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP nsMessage::GetAuthorCollationKey(nsString &resultAuthor)
{
if(mMsgHdr)
return mMsgHdr->GetAuthorCollationKey(resultAuthor);
else
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP nsMessage::GetSubjectCollationKey(nsString &resultSubject)
{
if(mMsgHdr)
return mMsgHdr->GetSubjectCollationKey(resultSubject);
else
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP nsMessage::GetRecipientsCollationKey(nsString &resultRecipients)
{
if(mMsgHdr)
return mMsgHdr->GetRecipientsCollationKey(resultRecipients);
else
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP nsMessage::GetFlags(PRUint32 *result)
{
if(mMsgHdr)
return mMsgHdr->GetFlags(result);
else
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP nsMessage::SetFlags(PRUint32 flags)
{
if(mMsgHdr)
return mMsgHdr->SetFlags(flags);
else
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP nsMessage::OrFlags(PRUint32 flags, PRUint32 *result)
{
if(mMsgHdr)
return mMsgHdr->OrFlags(flags, result);
else
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP nsMessage::AndFlags(PRUint32 flags, PRUint32 *result)
{
if(mMsgHdr)
return mMsgHdr->AndFlags(flags, result);
else
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP nsMessage::GetMessageKey(nsMsgKey *result)
{
if(mMsgHdr)
return mMsgHdr->GetMessageKey(result);
else
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP nsMessage::GetThreadId(nsMsgKey *result)
{
if(mMsgHdr)
return mMsgHdr->GetThreadId(result);
else
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP nsMessage::SetThreadId(nsMsgKey inKey)
{
if(mMsgHdr)
return mMsgHdr->SetThreadId(inKey);
else
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP nsMessage::SetMessageKey(nsMsgKey inKey)
{
if(mMsgHdr)
return mMsgHdr->SetMessageKey(inKey);
else
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP nsMessage::GetMessageSize(PRUint32 *result)
{
if(mMsgHdr)
return mMsgHdr->GetMessageSize(result);
else
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP nsMessage::SetMessageSize(PRUint32 messageSize)
{
if(mMsgHdr)
return mMsgHdr->SetMessageSize(messageSize);
else
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP nsMessage::SetLineCount(PRUint32 lineCount)
{
if(mMsgHdr)
return mMsgHdr->SetLineCount(lineCount);
else
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP nsMessage::SetPriority(nsMsgPriority priority)
{
if(mMsgHdr)
return mMsgHdr->SetPriority(priority);
else
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP nsMessage::SetPriority(const char *priority)
{
if(mMsgHdr)
return mMsgHdr->SetPriority(priority);
else
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP nsMessage::GetMessageOffset(PRUint32 *result)
{
if(mMsgHdr)
return mMsgHdr->GetMessageOffset(result);
else
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP nsMessage::GetStatusOffset(PRUint32 *result)
{
if(mMsgHdr)
return mMsgHdr->GetStatusOffset(result);
else
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP nsMessage::GetCharSet(nsString &result)
{
if(mMsgHdr)
return mMsgHdr->GetCharSet(result);
else
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP nsMessage::GetMsgFolder(nsIMsgFolder **folder)
{
if(!folder)
return NS_ERROR_NULL_POINTER;
*folder = mFolder;
if(mFolder)
NS_ADDREF(mFolder);
return NS_OK;
}
NS_IMETHODIMP nsMessage::SetMsgFolder(nsIMsgFolder *folder)
{
NS_IF_RELEASE(mFolder);
mFolder = folder;
if(mFolder)
NS_ADDREF(mFolder);
return NS_OK;
}
NS_IMETHODIMP nsMessage::SetMsgDBHdr(nsIMsgDBHdr *hdr)
{
NS_IF_RELEASE(mMsgHdr);
mMsgHdr = hdr;
if(mMsgHdr)
NS_ADDREF(mMsgHdr);
return NS_OK;
}
NS_IMETHODIMP nsMessage::GetMsgDBHdr(nsIMsgDBHdr **hdr)
{
*hdr = mMsgHdr;
if(mMsgHdr)
NS_ADDREF(mMsgHdr);
return NS_OK;
}

Просмотреть файл

@ -0,0 +1,108 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1999 Netscape Communications Corporation. All Rights
* Reserved.
*/
/********************************************************************************************************
Interface for representing Messenger folders.
*********************************************************************************************************/
#ifndef nsMessage_h__
#define nsMessage_h__
#include "msgCore.h"
#include "nsIMessage.h" /* include the interface we are going to support */
#include "nsRDFResource.h"
class nsMessage: public nsRDFResource, public nsIMessage
{
public:
nsMessage(void);
virtual ~nsMessage(void);
NS_DECL_ISUPPORTS_INHERITED
//nsIMessageHdr
NS_IMETHOD GetProperty(const char *propertyName, nsString &resultProperty);
NS_IMETHOD SetProperty(const char *propertyName, nsString &propertyStr);
NS_IMETHOD GetUint32Property(const char *propertyName, PRUint32 *pResult);
NS_IMETHOD SetUint32Property(const char *propertyName, PRUint32 propertyVal);
NS_IMETHOD GetNumReferences(PRUint16 *result);
NS_IMETHOD GetStringReference(PRInt32 refNum, nsString2 &resultReference);
NS_IMETHOD GetDate(time_t *result);
NS_IMETHOD SetDate(time_t date);
NS_IMETHOD SetMessageId(const char *messageId);
NS_IMETHOD SetReferences(const char *references);
NS_IMETHOD SetCCList(const char *ccList);
NS_IMETHOD SetRecipients(const char *recipients, PRBool recipientsIsNewsgroup);
NS_IMETHOD SetRecipientsArray(const char *names, const char *addresses, PRUint32 numAddresses);
NS_IMETHOD SetCCListArray(const char *names, const char *addresses, PRUint32 numAddresses);
NS_IMETHOD SetAuthor(const char *author);
NS_IMETHOD SetSubject(const char *subject);
NS_IMETHOD SetStatusOffset(PRUint32 statusOffset);
NS_IMETHOD GetAuthor(nsString &resultAuthor);
NS_IMETHOD GetSubject(nsString &resultSubject);
NS_IMETHOD GetRecipients(nsString &resultRecipients);
NS_IMETHOD GetCCList(nsString &ccList);
NS_IMETHOD GetMessageId(nsString &resultMessageId);
NS_IMETHOD GetMime2EncodedAuthor(nsString &resultAuthor);
NS_IMETHOD GetMime2EncodedSubject(nsString &resultSubject);
NS_IMETHOD GetMime2EncodedRecipients(nsString &resultRecipients);
NS_IMETHOD GetAuthorCollationKey(nsString &resultAuthor);
NS_IMETHOD GetSubjectCollationKey(nsString &resultSubject);
NS_IMETHOD GetRecipientsCollationKey(nsString &resultRecipients);
// flag handling routines
NS_IMETHOD GetFlags(PRUint32 *result);
NS_IMETHOD SetFlags(PRUint32 flags);
NS_IMETHOD OrFlags(PRUint32 flags, PRUint32 *result);
NS_IMETHOD AndFlags(PRUint32 flags, PRUint32 *result);
NS_IMETHOD GetMessageKey(nsMsgKey *result);
NS_IMETHOD GetThreadId(nsMsgKey *result);
NS_IMETHOD SetThreadId(nsMsgKey inKey);
NS_IMETHOD SetMessageKey(nsMsgKey inKey);
NS_IMETHOD GetMessageSize(PRUint32 *result);
NS_IMETHOD SetMessageSize(PRUint32 messageSize);
NS_IMETHOD SetLineCount(PRUint32 lineCount);
NS_IMETHOD SetPriority(nsMsgPriority priority);
NS_IMETHOD SetPriority(const char *priority);
NS_IMETHOD GetMessageOffset(PRUint32 *result);
NS_IMETHOD GetStatusOffset(PRUint32 *result);
NS_IMETHOD GetCharSet(nsString &result);
//nsIMessage
NS_IMETHOD GetMsgFolder(nsIMsgFolder **folder);
//other useful methods
NS_IMETHOD SetMsgFolder(nsIMsgFolder *folder);
NS_IMETHOD SetMsgDBHdr(nsIMsgDBHdr *hdr);
NS_IMETHOD GetMsgDBHdr(nsIMsgDBHdr **hdr);
protected:
nsIMsgFolder *mFolder;
nsIMsgDBHdr *mMsgHdr;
};
#endif //nsMessage_h__