mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-11 04:15:43 +00:00
first pass at fix for #7808, XPIDLizing nsIMsgHdr - for now just make an exact duplicate of the C++ interface, except in XPIDL
r=putterman
This commit is contained in:
parent
5b028e92f2
commit
24f15fcdf7
@ -21,7 +21,6 @@
|
||||
#
|
||||
|
||||
msgCore.h
|
||||
nsIMsgHdr.h
|
||||
nsMsgFolderFlags.h
|
||||
nsMsgHeaderMasks.h
|
||||
nsMsgLocalFolderHdrs.h
|
||||
|
@ -35,8 +35,4 @@ nsIUrlListenerManager.idl
|
||||
nsIMsgProtocolInfo.idl
|
||||
nsIMsgRDFDataSource.idl
|
||||
nsIIncomingServerListener.idl
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
nsIMsgHdr.idl
|
||||
|
@ -30,7 +30,6 @@ MODULE = msgbase
|
||||
|
||||
EXPORTS = \
|
||||
msgCore.h \
|
||||
nsIMsgHdr.h \
|
||||
nsMsgFolderFlags.h \
|
||||
nsMsgHeaderMasks.h \
|
||||
nsMsgMessageFlags.h \
|
||||
@ -71,6 +70,7 @@ XPIDLSRCS = \
|
||||
nsIMsgProtocolInfo.idl \
|
||||
nsIMsgRDFDataSource.idl \
|
||||
nsIIncomingServerListener.idl \
|
||||
nsIMsgHdr.idl \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
@ -55,6 +55,7 @@ XPIDLSRCS = \
|
||||
.\nsIMsgProtocolInfo.idl \
|
||||
.\nsIMsgRDFDataSource.idl \
|
||||
.\nsIIncomingServerListener.idl \
|
||||
.\nsIMsgHdr.idl \
|
||||
$(NULL)
|
||||
|
||||
################################################################################
|
||||
@ -67,7 +68,6 @@ EXPORTS = \
|
||||
nsMsgLocalFolderHdrs.h \
|
||||
nsMsgMessageFlags.h \
|
||||
nsMsgMD5.h \
|
||||
nsIMsgHdr.h \
|
||||
$(NULL)
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
|
@ -26,6 +26,7 @@ interface nsIMsgFolder;
|
||||
[scriptable, uuid(5B926BB4-F839-11d2-8A5F-0060B0FC04D2)]
|
||||
interface nsIMessage : nsIMsgHdr {
|
||||
|
||||
readonly attribute nsMsgKey msgKey;
|
||||
nsIMsgFolder GetMsgFolder();
|
||||
void SetMsgFolder(in nsIMsgFolder folder);
|
||||
};
|
||||
|
@ -1,117 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* 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/
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1999 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsIMsgHdr_h__
|
||||
#define nsIMsgHdr_h__
|
||||
|
||||
#include "MailNewsTypes.h"
|
||||
#include "nsString.h"
|
||||
|
||||
class nsCString;
|
||||
|
||||
#define NS_IMSGHDR_IID \
|
||||
{ /* 4e994f60-c317-11d2-8cc9-0060b0fc14a3 */ \
|
||||
0x4e994f60, \
|
||||
0xc317, \
|
||||
0x11d2, \
|
||||
{0x8c, 0xc9, 0x00, 0x60, 0xb0, 0xfc, 0x14, 0xa3} \
|
||||
}
|
||||
|
||||
class nsIMsgHdr : public nsISupports {
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IMSGHDR_IID; return iid; }
|
||||
|
||||
NS_IMETHOD GetProperty(const char *propertyName, nsString &resultProperty) = 0;
|
||||
NS_IMETHOD SetProperty(const char *propertyName, nsString &propertyStr) = 0;
|
||||
NS_IMETHOD GetUint32Property(const char *propertyName, PRUint32 *pResult) = 0;
|
||||
NS_IMETHOD SetUint32Property(const char *propertyName, PRUint32 propertyVal) = 0;
|
||||
NS_IMETHOD GetNumReferences(PRUint16 *result) = 0;
|
||||
NS_IMETHOD GetStringReference(PRInt32 refNum, nsCString &resultReference) = 0;
|
||||
NS_IMETHOD GetDate(PRTime *result) = 0;
|
||||
NS_IMETHOD SetDate(PRTime date) = 0;
|
||||
NS_IMETHOD SetMessageId(const char *messageId) = 0;
|
||||
NS_IMETHOD SetReferences(const char *references) = 0;
|
||||
NS_IMETHOD SetCCList(const char *ccList) = 0;
|
||||
NS_IMETHOD SetRecipients(const char *recipients, PRBool recipientsIsNewsgroup) = 0;
|
||||
NS_IMETHOD SetRecipientsArray(const char *names, const char *addresses, PRUint32 numAddresses) = 0;
|
||||
NS_IMETHOD SetCCListArray(const char *names, const char *addresses, PRUint32 numAddresses) = 0;
|
||||
NS_IMETHOD SetAuthor(const char *author) = 0;
|
||||
NS_IMETHOD SetSubject(const char *subject) = 0;
|
||||
NS_IMETHOD SetStatusOffset(PRUint32 statusOffset) = 0;
|
||||
|
||||
NS_IMETHOD GetAuthor(nsString *resultAuthor) = 0;
|
||||
NS_IMETHOD GetSubject(nsString *resultSubject) = 0;
|
||||
NS_IMETHOD GetRecipients(nsString *resultRecipients) = 0;
|
||||
NS_IMETHOD GetCCList(nsString *ccList) = 0;
|
||||
NS_IMETHOD GetMessageId(nsCString *resultMessageId) = 0;
|
||||
|
||||
NS_IMETHOD GetMime2DecodedAuthor(nsString *resultAuthor) = 0;
|
||||
NS_IMETHOD GetMime2DecodedSubject(nsString *resultSubject) = 0;
|
||||
NS_IMETHOD GetMime2DecodedRecipients(nsString *resultRecipients) = 0;
|
||||
|
||||
NS_IMETHOD GetAuthorCollationKey(nsString *resultAuthor) = 0;
|
||||
NS_IMETHOD GetSubjectCollationKey(nsString *resultSubject) = 0;
|
||||
NS_IMETHOD GetRecipientsCollationKey(nsString *resultRecipients) = 0;
|
||||
|
||||
// flag handling routines
|
||||
NS_IMETHOD GetFlags(PRUint32 *result) = 0;
|
||||
NS_IMETHOD SetFlags(PRUint32 flags) = 0;
|
||||
NS_IMETHOD OrFlags(PRUint32 flags, PRUint32 *result) = 0;
|
||||
NS_IMETHOD AndFlags(PRUint32 flags, PRUint32 *result) = 0;
|
||||
|
||||
// Mark message routines
|
||||
NS_IMETHOD MarkRead(PRBool bRead) = 0;
|
||||
NS_IMETHOD MarkFlagged(PRBool bFlagged) = 0;
|
||||
|
||||
NS_IMETHOD GetMessageKey(nsMsgKey *result) = 0;
|
||||
NS_IMETHOD GetThreadId(nsMsgKey *result) = 0;
|
||||
NS_IMETHOD SetThreadId(nsMsgKey inKey) = 0;
|
||||
NS_IMETHOD SetMessageKey(nsMsgKey inKey) = 0;
|
||||
NS_IMETHOD GetMessageSize(PRUint32 *result) = 0;
|
||||
NS_IMETHOD SetMessageSize(PRUint32 messageSize) = 0;
|
||||
NS_IMETHOD GetLineCount(PRUint32 *result) = 0;
|
||||
NS_IMETHOD SetLineCount(PRUint32 lineCount) = 0;
|
||||
NS_IMETHOD SetPriority(nsMsgPriority priority) = 0;
|
||||
NS_IMETHOD SetPriority(const char *priority) = 0;
|
||||
NS_IMETHOD GetMessageOffset(PRUint32 *result) = 0;
|
||||
NS_IMETHOD GetStatusOffset(PRUint32 *result) = 0;
|
||||
NS_IMETHOD GetCharSet(nsString *result) = 0;
|
||||
NS_IMETHOD GetPriority(nsMsgPriority *msgPriority) = 0;
|
||||
NS_IMETHOD GetThreadParent(nsMsgKey *result) = 0;
|
||||
NS_IMETHOD SetThreadParent(nsMsgKey inKey) = 0;
|
||||
|
||||
};
|
||||
|
||||
#define NS_IDBMSGHDR_IID \
|
||||
{ /* B5212A60-F93F-11d2-951C-006097222B83 */ \
|
||||
0xb5212a60, \
|
||||
0xf93f, \
|
||||
0x11d2, \
|
||||
{0x95, 0x1c, 0x0, 0x60, 0x97, 0x22, 0x2b, 0x83} \
|
||||
}
|
||||
|
||||
class nsIMsgDBHdr : public nsIMsgHdr
|
||||
{
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IDBMSGHDR_IID; return iid; }
|
||||
};
|
||||
#endif // nsIMsgHdr_h__
|
@ -22,83 +22,91 @@
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
/******************************************************************************
|
||||
%{C++
|
||||
#include "MailNewsTypes.h"
|
||||
%}
|
||||
|
||||
just stub the interfaces for now
|
||||
|
||||
interface nsIMsgHdr : nsISupports
|
||||
{
|
||||
};
|
||||
|
||||
interface nsIMsgDBHdr : nsIMsgHdr
|
||||
{
|
||||
};
|
||||
|
||||
this is commented out because it doesn't match nsIMessage.h, and I don't
|
||||
want anyone to try to use it yet.
|
||||
|
||||
the problem is nsIMessage.h has interfaces that pass references to nsStrings.
|
||||
|
||||
but, you can't do that in idl.
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "MailNewsTypes2.idl"
|
||||
|
||||
[ptr] native nsString(nsString);
|
||||
[ptr] native nsCString(nsCString);
|
||||
[ref] native nsStringRef(nsString);
|
||||
[ref] native nsCStringRef(nsCString);
|
||||
|
||||
native nsMsgPriority(nsMsgPriority);
|
||||
|
||||
[scriptable, uuid(4e994f60-c317-11d2-8cc9-0060b0fc14a3)]
|
||||
interface nsIMsgHdr : nsISupports
|
||||
{
|
||||
nsString GetProperty(in string propertyName);
|
||||
void SetProperty(in string propertyName, in nsString propertyStr);
|
||||
[noscript] void GetProperty(in string propertyName, in nsStringRef propertyValue);
|
||||
[noscript] void SetProperty(in string propertyName, in nsStringRef propertyStr);
|
||||
|
||||
unsigned long GetUint32Property(in string propertyName);
|
||||
void SetUint32Property(in string propertyName, in unsigned long propertyVal);
|
||||
unsigned long GetUint32Property(in string propertyName);
|
||||
void SetUint32Property(in string propertyName,
|
||||
in unsigned long propertyVal);
|
||||
|
||||
attribute unsigned short numReferences;
|
||||
nsCString GetStringReference(in long refNum);
|
||||
readonly attribute unsigned short numReferences;
|
||||
[noscript] void GetStringReference(in long refNum, in nsCStringRef ref);
|
||||
|
||||
attribute long long date;
|
||||
attribute string messageId;
|
||||
attribute string references;
|
||||
attribute string CCList;
|
||||
attribute string recipients;
|
||||
attribute boolean recipientsIsNewsgroup;
|
||||
attribute string author;
|
||||
attribute PRTime date;
|
||||
|
||||
/* XXX make this an attribute */
|
||||
void SetMessageId(in string messageId);
|
||||
[noscript] void GetMessageId(in nsCString messageId);
|
||||
|
||||
void SetRecipientsArray(in string names,
|
||||
in string addresses,
|
||||
in unsigned long numaddresses);
|
||||
/* XXX make this an attribute */
|
||||
void SetReferences(in string references);
|
||||
void SetCCList(in string ccList);
|
||||
void SetRecipients(in string recipients, in boolean recipientsIsNewsgroup);
|
||||
void SetRecipientsArray(in string names, in string addresses, in unsigned long numAddresses);
|
||||
void SetCCListArray(in string names, in string addresses, in unsigned long numAddresses);
|
||||
void SetAuthor(in string author);
|
||||
void SetSubject(in string subject);
|
||||
void SetStatusOffset(in unsigned long statusOffset);
|
||||
|
||||
void SetCCListArray(in string names,
|
||||
in string addresses,
|
||||
in unsigned long numAddresses);
|
||||
[noscript] void GetAuthor(in nsString resultAuthor);
|
||||
[noscript] void GetSubject(in nsString resultSubject);
|
||||
[noscript] void GetRecipients(in nsString resultRecipients);
|
||||
[noscript] void GetCCList(in nsString ccList);
|
||||
|
||||
readonly attribute string mime2EncodedAuthor;
|
||||
readonly attribute string mime2EncodedSubject;
|
||||
readonly attribute string mime2EncodedRecipients;
|
||||
[noscript] void GetMime2DecodedAuthor(in nsString resultAuthor);
|
||||
[noscript] void GetMime2DecodedSubject(in nsString resultSubject);
|
||||
[noscript] void GetMime2DecodedRecipients(in nsString resultRecipients);
|
||||
|
||||
readonly attribute string authorCollationKey;
|
||||
readonly attribute string subjectCollationKey;
|
||||
readonly attribute string recipientsCollationKey;
|
||||
[noscript] void GetAuthorCollationKey(in nsString resultAuthor);
|
||||
[noscript] void GetSubjectCollationKey(in nsString resultSubject);
|
||||
[noscript] void GetRecipientsCollationKey(in nsString resultRecipients);
|
||||
|
||||
attribute string messageKey;
|
||||
attribute nsMsgKey threadID;
|
||||
attribute unsigned long messageSize;
|
||||
attribute unsigned long lineCount;
|
||||
attribute nsMsgPriority priority;
|
||||
readonly attribute unsigned long messageOffset;
|
||||
readonly attribute unsigned long statusOffset;
|
||||
readonly attribute string charSet;
|
||||
// flag handling routines
|
||||
void GetFlags(out unsigned long result);
|
||||
void SetFlags(in unsigned long flags);
|
||||
void OrFlags(in unsigned long flags, out unsigned long result);
|
||||
void AndFlags(in unsigned long flags, out unsigned long result);
|
||||
|
||||
void MarkRead(in boolean markRead);
|
||||
void MarkFlagged(in boolean markFlagged);
|
||||
// Mark message routines
|
||||
void MarkRead(in boolean bRead);
|
||||
void MarkFlagged(in boolean bFlagged);
|
||||
|
||||
void GetMessageKey(out nsMsgKey result);
|
||||
void GetThreadId(out nsMsgKey result);
|
||||
void SetThreadId(in nsMsgKey inKey);
|
||||
void SetMessageKey(in nsMsgKey inKey);
|
||||
void GetMessageSize(out unsigned long result);
|
||||
void SetMessageSize(in unsigned long messageSize);
|
||||
void GetLineCount(out unsigned long result);
|
||||
void SetLineCount(in unsigned long lineCount);
|
||||
[noscript] void SetPriority(in nsMsgPriority priority);
|
||||
void SetPriorityString(in string priority);
|
||||
void GetMessageOffset(out unsigned long result);
|
||||
void GetStatusOffset(out unsigned long result);
|
||||
[noscript] void GetCharSet(in nsString result);
|
||||
[noscript] void GetPriority(out nsMsgPriority msgPriority);
|
||||
void GetThreadParent(out nsMsgKey result);
|
||||
void SetThreadParent(in nsMsgKey inKey);
|
||||
|
||||
};
|
||||
|
||||
[scriptable, uuid(B5212A60-F93F-11d2-951C-006097222B83)]
|
||||
interface nsIMsgDBHdr : nsIMsgHdr
|
||||
{
|
||||
|
||||
|
@ -412,10 +412,10 @@ NS_IMETHODIMP nsMessage::SetPriority(nsMsgPriority priority)
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMessage::SetPriority(const char *priority)
|
||||
NS_IMETHODIMP nsMessage::SetPriorityString(const char *priority)
|
||||
{
|
||||
if(mMsgHdr)
|
||||
return mMsgHdr->SetPriority(priority);
|
||||
return mMsgHdr->SetPriorityString(priority);
|
||||
else
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
@ -511,3 +511,26 @@ NS_IMETHODIMP nsMessage::GetMsgDBHdr(nsIMsgDBHdr **hdr)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMessage::GetMsgKey(nsMsgKey *aMsgKey)
|
||||
{
|
||||
nsCAutoString uriStr(mURI);
|
||||
|
||||
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;
|
||||
*aMsgKey = keyStr.ToInteger(&errorCode);
|
||||
return (nsresult)errorCode;
|
||||
}
|
||||
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
@ -99,7 +99,7 @@ public:
|
||||
NS_IMETHOD GetLineCount(PRUint32 *result);
|
||||
NS_IMETHOD SetLineCount(PRUint32 lineCount);
|
||||
NS_IMETHOD SetPriority(nsMsgPriority priority);
|
||||
NS_IMETHOD SetPriority(const char *priority);
|
||||
NS_IMETHOD SetPriorityString(const char *priority);
|
||||
NS_IMETHOD GetMessageOffset(PRUint32 *result);
|
||||
NS_IMETHOD GetStatusOffset(PRUint32 *result);
|
||||
NS_IMETHOD GetCharSet(nsString *result);
|
||||
|
@ -37,11 +37,14 @@
|
||||
#include "nsIMsgIncomingServer.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIURL.h"
|
||||
#include "nsWeakReference.h"
|
||||
|
||||
/*
|
||||
* MsgFolder
|
||||
*/
|
||||
|
||||
class NS_MSG_BASE nsMsgFolder : public nsRDFResource,
|
||||
public nsSupportsWeakReference,
|
||||
public nsIMsgFolder
|
||||
{
|
||||
public:
|
||||
|
@ -89,7 +89,7 @@ public:
|
||||
NS_IMETHOD GetLineCount(PRUint32 *result);
|
||||
NS_IMETHOD SetLineCount(PRUint32 lineCount);
|
||||
NS_IMETHOD SetPriority(nsMsgPriority priority);
|
||||
NS_IMETHOD SetPriority(const char *priority);
|
||||
NS_IMETHOD SetPriorityString(const char *priority);
|
||||
NS_IMETHOD GetMessageOffset(PRUint32 *result);
|
||||
NS_IMETHOD GetStatusOffset(PRUint32 *result);
|
||||
NS_IMETHOD GetCharSet(nsString *result);
|
||||
|
@ -514,7 +514,7 @@ NS_IMETHODIMP nsMsgHdr::GetLineCount(PRUint32 *result)
|
||||
return res;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgHdr::SetPriority(const char *priority)
|
||||
NS_IMETHODIMP nsMsgHdr::SetPriorityString(const char *priority)
|
||||
{
|
||||
nsMsgPriority priorityVal = nsMsgPriorityNormal;
|
||||
|
||||
|
@ -1272,7 +1272,7 @@ int nsParseMailMessageState::FinalizeHeaders()
|
||||
m_newMsgHdr->SetDate(nsTime(resultTime));
|
||||
}
|
||||
if (priority)
|
||||
m_newMsgHdr->SetPriority(priority->value);
|
||||
m_newMsgHdr->SetPriorityString(priority->value);
|
||||
else if (priorityFlags == nsMsgPriorityNotSet)
|
||||
m_newMsgHdr->SetPriority(nsMsgPriorityNone);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user