1999-04-25 00:35:34 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
*
|
1999-11-06 06:43:54 +03:00
|
|
|
* The contents of this file are subject to the Netscape Public
|
|
|
|
* License Version 1.1 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at http://www.mozilla.org/NPL/
|
1999-04-25 00:35:34 +04:00
|
|
|
*
|
1999-11-06 06:43:54 +03:00
|
|
|
* Software distributed under the License is distributed on an "AS
|
|
|
|
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
|
|
|
* implied. See the License for the specific language governing
|
|
|
|
* rights and limitations under the License.
|
1999-04-25 00:35:34 +04:00
|
|
|
*
|
1999-11-06 06:43:54 +03:00
|
|
|
* The Original Code is mozilla.org code.
|
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is Netscape
|
1999-04-25 00:35:34 +04:00
|
|
|
* Communications Corporation. Portions created by Netscape are
|
1999-11-06 06:43:54 +03:00
|
|
|
* Copyright (C) 1999 Netscape Communications Corporation. All
|
|
|
|
* Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s):
|
2000-02-06 06:18:27 +03:00
|
|
|
* Pierre Phaneuf <pp@ludusdesign.com>
|
1999-04-25 00:35:34 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "msgCore.h" // precompiled header...
|
|
|
|
#include "nsMessage.h"
|
1999-08-07 06:30:11 +04:00
|
|
|
#include "nsIMsgFolder.h"
|
1999-04-25 00:35:34 +04:00
|
|
|
|
2000-03-24 11:10:59 +03:00
|
|
|
// temp dependancy on RDF
|
|
|
|
#include "nsRDFCID.h"
|
|
|
|
#include "nsIRDFService.h"
|
|
|
|
|
|
|
|
static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
|
1999-10-07 00:32:25 +04:00
|
|
|
|
1999-04-25 00:35:34 +04:00
|
|
|
nsMessage::nsMessage(void)
|
2000-03-24 11:10:59 +03:00
|
|
|
: nsRDFResource(),
|
|
|
|
mFolder(nsnull),
|
|
|
|
mMsgKey(0),
|
|
|
|
mMsgKeyValid(PR_FALSE)
|
1999-04-25 00:35:34 +04:00
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
nsMessage::~nsMessage(void)
|
|
|
|
{
|
1999-05-05 02:34:35 +04:00
|
|
|
//Member variables are either nsCOMPtr's or ptrs we don't want to own.
|
1999-04-25 00:35:34 +04:00
|
|
|
}
|
|
|
|
|
1999-05-05 02:34:35 +04:00
|
|
|
NS_IMPL_ADDREF_INHERITED(nsMessage, nsRDFResource)
|
2000-05-15 03:16:25 +04:00
|
|
|
NS_IMPL_RELEASE_INHERITED(nsMessage, nsRDFResource)
|
|
|
|
NS_IMPL_QUERY_INTERFACE_INHERITED2(nsMessage,
|
|
|
|
nsRDFResource,
|
|
|
|
nsIMessage,
|
|
|
|
nsIDBMessage)
|
1999-04-25 00:35:34 +04:00
|
|
|
|
1999-09-22 00:03:37 +04:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsMessage::Init(const char* aURI)
|
|
|
|
{
|
|
|
|
|
|
|
|
return nsRDFResource::Init(aURI);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
1999-04-25 00:35:34 +04:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
1999-08-07 06:30:11 +04:00
|
|
|
NS_IMETHODIMP nsMessage::GetStringReference(PRInt32 refNum, nsCString &resultReference)
|
1999-04-25 00:35:34 +04:00
|
|
|
{
|
|
|
|
if(mMsgHdr)
|
|
|
|
return mMsgHdr->GetStringReference(refNum, resultReference);
|
|
|
|
else
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
1999-07-01 01:04:29 +04:00
|
|
|
NS_IMETHODIMP nsMessage::GetDate(PRTime *result)
|
1999-04-25 00:35:34 +04:00
|
|
|
{
|
|
|
|
if(mMsgHdr)
|
|
|
|
return mMsgHdr->GetDate(result);
|
|
|
|
else
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
1999-07-01 01:04:29 +04:00
|
|
|
NS_IMETHODIMP nsMessage::SetDate(PRTime date)
|
1999-04-25 00:35:34 +04:00
|
|
|
{
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2000-01-05 05:02:50 +03:00
|
|
|
NS_IMETHODIMP nsMessage::SetCcList(const char *ccList)
|
1999-04-25 00:35:34 +04:00
|
|
|
{
|
|
|
|
if(mMsgHdr)
|
2000-01-05 05:02:50 +03:00
|
|
|
return mMsgHdr->SetCcList(ccList);
|
1999-04-25 00:35:34 +04:00
|
|
|
else
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
2000-01-08 12:55:37 +03:00
|
|
|
NS_IMETHODIMP nsMessage::SetRecipients(const char *recipients)
|
1999-04-25 00:35:34 +04:00
|
|
|
{
|
|
|
|
if(mMsgHdr)
|
2000-01-08 12:55:37 +03:00
|
|
|
return mMsgHdr->SetRecipients(recipients);
|
|
|
|
else
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP nsMessage::SetRecipientsIsNewsgroup(PRBool aIsNewsgroup)
|
|
|
|
{
|
|
|
|
if(mMsgHdr)
|
|
|
|
return mMsgHdr->SetRecipientsIsNewsgroup(aIsNewsgroup);
|
1999-04-25 00:35:34 +04:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-01-08 12:55:37 +03:00
|
|
|
NS_IMETHODIMP nsMessage::GetAuthor(char* *resultAuthor)
|
1999-04-25 00:35:34 +04:00
|
|
|
{
|
|
|
|
if(mMsgHdr)
|
|
|
|
return mMsgHdr->GetAuthor(resultAuthor);
|
|
|
|
else
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
2000-01-08 12:55:37 +03:00
|
|
|
NS_IMETHODIMP nsMessage::GetSubject(char* *resultSubject)
|
1999-04-25 00:35:34 +04:00
|
|
|
{
|
|
|
|
if(mMsgHdr)
|
|
|
|
return mMsgHdr->GetSubject(resultSubject);
|
|
|
|
else
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
2000-01-08 12:55:37 +03:00
|
|
|
NS_IMETHODIMP nsMessage::GetRecipients(char* *resultRecipients)
|
1999-04-25 00:35:34 +04:00
|
|
|
{
|
|
|
|
if(mMsgHdr)
|
|
|
|
return mMsgHdr->GetRecipients(resultRecipients);
|
|
|
|
else
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
2000-01-08 12:55:37 +03:00
|
|
|
NS_IMETHODIMP nsMessage::GetRecipientsIsNewsgroup(PRBool* aIsNewsgroup)
|
|
|
|
{
|
|
|
|
if(mMsgHdr)
|
|
|
|
return mMsgHdr->GetRecipientsIsNewsgroup(aIsNewsgroup);
|
|
|
|
else
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
2000-01-05 05:02:50 +03:00
|
|
|
NS_IMETHODIMP nsMessage::GetCcList(char **ccList)
|
1999-04-25 00:35:34 +04:00
|
|
|
{
|
|
|
|
if(mMsgHdr)
|
2000-01-05 05:02:50 +03:00
|
|
|
return mMsgHdr->GetCcList(ccList);
|
1999-04-25 00:35:34 +04:00
|
|
|
else
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
2000-01-05 05:02:50 +03:00
|
|
|
NS_IMETHODIMP nsMessage::GetMessageId(char **resultMessageId)
|
1999-04-25 00:35:34 +04:00
|
|
|
{
|
|
|
|
if(mMsgHdr)
|
|
|
|
return mMsgHdr->GetMessageId(resultMessageId);
|
|
|
|
else
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-03-24 11:10:59 +03:00
|
|
|
NS_IMETHODIMP nsMessage::GetMime2DecodedAuthor(PRUnichar **resultAuthor)
|
1999-04-25 00:35:34 +04:00
|
|
|
{
|
|
|
|
if(mMsgHdr)
|
1999-07-29 04:42:25 +04:00
|
|
|
return mMsgHdr->GetMime2DecodedAuthor(resultAuthor);
|
1999-04-25 00:35:34 +04:00
|
|
|
else
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
2000-03-24 11:10:59 +03:00
|
|
|
NS_IMETHODIMP nsMessage::GetMime2DecodedSubject(PRUnichar* *resultSubject)
|
1999-04-25 00:35:34 +04:00
|
|
|
{
|
|
|
|
if(mMsgHdr)
|
1999-07-29 04:42:25 +04:00
|
|
|
return mMsgHdr->GetMime2DecodedSubject(resultSubject);
|
1999-04-25 00:35:34 +04:00
|
|
|
else
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
2000-03-24 11:10:59 +03:00
|
|
|
NS_IMETHODIMP nsMessage::GetMime2DecodedRecipients(PRUnichar* *resultRecipients)
|
1999-04-25 00:35:34 +04:00
|
|
|
{
|
|
|
|
if(mMsgHdr)
|
1999-07-29 04:42:25 +04:00
|
|
|
return mMsgHdr->GetMime2DecodedRecipients(resultRecipients);
|
1999-04-25 00:35:34 +04:00
|
|
|
else
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-03-24 11:10:59 +03:00
|
|
|
NS_IMETHODIMP nsMessage::GetAuthorCollationKey(PRUnichar* *resultAuthor)
|
1999-04-25 00:35:34 +04:00
|
|
|
{
|
|
|
|
if(mMsgHdr)
|
|
|
|
return mMsgHdr->GetAuthorCollationKey(resultAuthor);
|
|
|
|
else
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
2000-03-24 11:10:59 +03:00
|
|
|
NS_IMETHODIMP nsMessage::GetSubjectCollationKey(PRUnichar* *resultSubject)
|
1999-04-25 00:35:34 +04:00
|
|
|
{
|
|
|
|
if(mMsgHdr)
|
|
|
|
return mMsgHdr->GetSubjectCollationKey(resultSubject);
|
|
|
|
else
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
2000-03-24 11:10:59 +03:00
|
|
|
NS_IMETHODIMP nsMessage::GetRecipientsCollationKey(PRUnichar* *resultRecipients)
|
1999-04-25 00:35:34 +04:00
|
|
|
{
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
1999-05-14 04:45:06 +04:00
|
|
|
NS_IMETHODIMP nsMessage::MarkRead(PRBool bRead)
|
|
|
|
{
|
|
|
|
if(mMsgHdr)
|
|
|
|
return mMsgHdr->MarkRead(bRead);
|
|
|
|
else
|
|
|
|
return NS_ERROR_FAILURE;
|
1999-08-25 01:47:22 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP nsMessage::MarkFlagged(PRBool bFlagged)
|
|
|
|
{
|
|
|
|
if(mMsgHdr)
|
|
|
|
return mMsgHdr->MarkFlagged(bFlagged);
|
|
|
|
else
|
|
|
|
return NS_ERROR_FAILURE;
|
1999-05-14 04:45:06 +04:00
|
|
|
}
|
1999-04-25 00:35:34 +04:00
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
1999-05-08 21:02:19 +04:00
|
|
|
NS_IMETHODIMP nsMessage::GetLineCount(PRUint32 *result)
|
|
|
|
{
|
|
|
|
if(mMsgHdr)
|
|
|
|
return mMsgHdr->GetLineCount(result);
|
|
|
|
else
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
1999-04-25 00:35:34 +04:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2000-05-02 03:19:46 +04:00
|
|
|
NS_IMETHODIMP nsMessage::SetPriority(nsMsgPriorityValue priority)
|
1999-04-25 00:35:34 +04:00
|
|
|
{
|
|
|
|
if(mMsgHdr)
|
|
|
|
return mMsgHdr->SetPriority(priority);
|
|
|
|
else
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
2000-01-05 01:41:21 +03:00
|
|
|
NS_IMETHODIMP nsMessage::SetPriorityString(const char *priority)
|
1999-04-25 00:35:34 +04:00
|
|
|
{
|
|
|
|
if(mMsgHdr)
|
2000-01-05 01:41:21 +03:00
|
|
|
return mMsgHdr->SetPriorityString(priority);
|
1999-04-25 00:35:34 +04:00
|
|
|
else
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
2000-05-02 03:19:46 +04:00
|
|
|
NS_IMETHODIMP nsMessage::GetPriority(nsMsgPriorityValue *result)
|
1999-05-27 09:09:00 +04:00
|
|
|
{
|
|
|
|
if(mMsgHdr)
|
|
|
|
return mMsgHdr->GetPriority(result);
|
|
|
|
else
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
1999-04-25 00:35:34 +04:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2000-06-12 02:08:08 +04:00
|
|
|
NS_IMETHODIMP nsMessage::GetCharset(char **aCharset)
|
1999-04-25 00:35:34 +04:00
|
|
|
{
|
|
|
|
if(mMsgHdr)
|
2000-06-12 02:08:08 +04:00
|
|
|
return mMsgHdr->GetCharset(aCharset);
|
|
|
|
else
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP nsMessage::SetCharset(const char *aCharset)
|
|
|
|
{
|
|
|
|
if(mMsgHdr)
|
|
|
|
return mMsgHdr->SetCharset(aCharset);
|
1999-04-25 00:35:34 +04:00
|
|
|
else
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
1999-07-07 02:53:11 +04:00
|
|
|
NS_IMETHODIMP nsMessage::GetThreadParent(nsMsgKey *result)
|
|
|
|
{
|
|
|
|
if(mMsgHdr)
|
|
|
|
return mMsgHdr->GetThreadParent(result);
|
|
|
|
else
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP nsMessage::SetThreadParent(nsMsgKey inKey)
|
|
|
|
{
|
|
|
|
if(mMsgHdr)
|
|
|
|
return mMsgHdr->SetThreadParent(inKey);
|
|
|
|
else
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
1999-04-25 00:35:34 +04:00
|
|
|
|
2000-02-08 08:59:20 +03:00
|
|
|
NS_IMETHODIMP nsMessage::GetMsgFolder(nsIMsgFolder **aFolder)
|
1999-04-25 00:35:34 +04:00
|
|
|
{
|
2000-02-08 08:59:20 +03:00
|
|
|
NS_ENSURE_ARG_POINTER(aFolder);
|
|
|
|
|
|
|
|
nsresult rv;
|
|
|
|
nsCOMPtr<nsIMsgFolder> folder = do_QueryReferent(mFolder, &rv);
|
|
|
|
|
2000-03-24 11:10:59 +03:00
|
|
|
if (!folder) {
|
|
|
|
// quick hack to determine the msgfolder
|
|
|
|
nsCAutoString folderURI(mURI);
|
|
|
|
|
|
|
|
// get rid of _message from schema (what a hack)
|
|
|
|
PRInt32 messageStart = folderURI.Find("_message");
|
|
|
|
if (messageStart)
|
|
|
|
folderURI.Cut(messageStart, nsCRT::strlen("_message"));
|
|
|
|
|
|
|
|
// chop # off the end
|
|
|
|
PRInt32 folderEnd = folderURI.FindChar('#');
|
|
|
|
if (folderEnd>0)
|
|
|
|
folderURI.Truncate(folderEnd);
|
|
|
|
|
|
|
|
// now go through RDF
|
|
|
|
nsCOMPtr<nsIRDFService> rdfService =
|
|
|
|
do_GetService(kRDFServiceCID, &rv);
|
|
|
|
nsCOMPtr<nsIRDFResource> folderResource;
|
|
|
|
rv = rdfService->GetResource((const char*)folderURI,
|
|
|
|
getter_AddRefs(folderResource));
|
|
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
|
|
|
|
folder = do_QueryInterface(folderResource, &rv);
|
|
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
|
|
|
|
SetMsgFolder(folder);
|
|
|
|
}
|
|
|
|
|
|
|
|
*aFolder = folder;
|
|
|
|
NS_IF_ADDREF(*aFolder);
|
|
|
|
|
|
|
|
return NS_OK;
|
1999-04-25 00:35:34 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
NS_IMETHODIMP nsMessage::SetMsgFolder(nsIMsgFolder *folder)
|
|
|
|
{
|
2000-03-25 23:41:26 +03:00
|
|
|
mFolder = getter_AddRefs(NS_GetWeakReference(folder));
|
1999-04-25 00:35:34 +04:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
NS_IMETHODIMP nsMessage::SetMsgDBHdr(nsIMsgDBHdr *hdr)
|
|
|
|
{
|
1999-05-05 02:34:35 +04:00
|
|
|
mMsgHdr = dont_QueryInterface(hdr);
|
1999-04-25 00:35:34 +04:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP nsMessage::GetMsgDBHdr(nsIMsgDBHdr **hdr)
|
|
|
|
{
|
|
|
|
*hdr = mMsgHdr;
|
1999-05-05 02:34:35 +04:00
|
|
|
if(*hdr)
|
1999-04-27 02:02:48 +04:00
|
|
|
{
|
1999-05-05 02:34:35 +04:00
|
|
|
NS_ADDREF(*hdr);
|
1999-04-27 02:02:48 +04:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return NS_ERROR_NULL_POINTER;
|
1999-04-25 00:35:34 +04:00
|
|
|
}
|
|
|
|
|
2000-01-05 01:41:21 +03:00
|
|
|
NS_IMETHODIMP nsMessage::GetMsgKey(nsMsgKey *aMsgKey)
|
|
|
|
{
|
|
|
|
nsCAutoString uriStr(mURI);
|
2000-03-24 11:10:59 +03:00
|
|
|
if (mMsgKeyValid) {
|
|
|
|
*aMsgKey = mMsgKey;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2000-01-05 01:41:21 +03:00
|
|
|
|
|
|
|
PRInt32 keySeparator = uriStr.FindChar('#');
|
|
|
|
if(keySeparator != -1)
|
|
|
|
{
|
|
|
|
PRInt32 keyEndSeparator = uriStr.FindCharInSet("?&",
|
|
|
|
keySeparator);
|
|
|
|
nsCAutoString keyStr;
|
|
|
|
if (keyEndSeparator != -1)
|
|
|
|
uriStr.Mid(keyStr, keySeparator+1,
|
|
|
|
keyEndSeparator-(keySeparator+1));
|
|
|
|
else
|
|
|
|
uriStr.Right(keyStr, uriStr.Length() - (keySeparator + 1));
|
|
|
|
|
|
|
|
PRInt32 errorCode;
|
2000-03-24 11:10:59 +03:00
|
|
|
mMsgKey = keyStr.ToInteger(&errorCode);
|
|
|
|
|
|
|
|
if (NS_SUCCEEDED(errorCode))
|
|
|
|
mMsgKeyValid=PR_TRUE;
|
|
|
|
*aMsgKey = mMsgKey;
|
2000-01-05 01:41:21 +03:00
|
|
|
return (nsresult)errorCode;
|
|
|
|
}
|
|
|
|
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
2000-04-03 06:58:21 +04:00
|
|
|
|
|
|
|
NS_IMETHODIMP nsMessage::GetMessageType(PRUint32 *aMessageType)
|
|
|
|
{
|
|
|
|
// base classes need to define this
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|