зеркало из https://github.com/mozilla/pjs.git
add method to get charset for a message (though no one sets it currently)
This commit is contained in:
Родитель
710117681b
Коммит
db6f0557cd
|
@ -1,90 +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.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.
|
||||
*/
|
||||
|
||||
#ifndef nsIMessage_h__
|
||||
#define nsIMessage_h__
|
||||
|
||||
#include "MailNewsTypes.h"
|
||||
#include "nsString.h"
|
||||
|
||||
class nsString2;
|
||||
|
||||
#define NS_IMESSAGE_IID \
|
||||
{ /* 4e994f60-c317-11d2-8cc9-0060b0fc14a3 */ \
|
||||
0x4e994f60, \
|
||||
0xc317, \
|
||||
0x11d2, \
|
||||
{0x8c, 0xc9, 0x00, 0x60, 0xb0, 0xfc, 0x14, 0xa3} \
|
||||
}
|
||||
|
||||
class nsIMessage : public nsISupports {
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IMESSAGE_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, nsString2 &resultReference) = 0;
|
||||
NS_IMETHOD GetDate(time_t *result) = 0;
|
||||
NS_IMETHOD SetDate(time_t 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(nsString &resultMessageId) = 0;
|
||||
|
||||
NS_IMETHOD GetMime2EncodedAuthor(nsString &resultAuthor) = 0;
|
||||
NS_IMETHOD GetMime2EncodedSubject(nsString &resultSubject) = 0;
|
||||
NS_IMETHOD GetMime2EncodedRecipients(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;
|
||||
|
||||
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 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;
|
||||
};
|
||||
|
||||
#endif // nsIMessage_h__
|
|
@ -304,6 +304,7 @@ protected:
|
|||
mdb_token m_threadUnreadChildrenColumnToken;
|
||||
mdb_token m_messageThreadIdColumnToken;
|
||||
mdb_token m_numReferencesColumnToken;
|
||||
mdb_token m_messageCharSetColumnToken;
|
||||
nsIMsgHeaderParser *m_HeaderParser;
|
||||
};
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
#include "nsIMessage.h"
|
||||
#include "nsRDFResource.h"
|
||||
#include "nsString.h"
|
||||
#include "nsString2.h"
|
||||
#include "MailNewsTypes.h"
|
||||
#include "xp.h"
|
||||
#include "mdb.h"
|
||||
|
@ -84,7 +84,7 @@ public:
|
|||
NS_IMETHOD SetPriority(const char *priority);
|
||||
NS_IMETHOD GetMessageOffset(PRUint32 *result);
|
||||
NS_IMETHOD GetStatusOffset(PRUint32 *result);
|
||||
|
||||
NS_IMETHOD GetCharSet(nsString &result);
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// nsMsgHdr methods:
|
||||
nsMsgHdr(nsMsgDatabase *db, nsIMdbRow *dbRow);
|
||||
|
@ -115,7 +115,7 @@ protected:
|
|||
PRUint32 m_flags;
|
||||
PRUint16 m_numReferences; // x-ref header for threading
|
||||
PRInt16 m_csID; // cs id of message
|
||||
nsString m_charSet; // OK, charset of headers, since cs id's aren't supported.
|
||||
nsString2 m_charSet; // OK, charset of headers, since cs id's aren't supported.
|
||||
nsMsgPriority m_priority;
|
||||
|
||||
// nsMsgHdrs will have to know what db and row they belong to, since they are really
|
||||
|
|
|
@ -305,6 +305,7 @@ nsMsgDatabase::nsMsgDatabase()
|
|||
m_threadUnreadChildrenColumnToken(0),
|
||||
m_messageThreadIdColumnToken(0),
|
||||
m_numReferencesColumnToken(0),
|
||||
m_messageCharSetColumnToken(0),
|
||||
m_HeaderParser(nsnull)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
|
@ -724,6 +725,7 @@ const char *kThreadFlagsColumnName = "threadFlags";
|
|||
const char *kThreadIdColumnName = "threadId";
|
||||
const char *kThreadChildrenColumnName = "children";
|
||||
const char *kThreadUnreadChildrenColumnName = "unreadChildren";
|
||||
const char *kMessageCharSetColumnName = "msgCharSet";
|
||||
struct mdbOid gAllMsgHdrsTableOID;
|
||||
|
||||
// set up empty tables, dbFolderInfo, etc.
|
||||
|
@ -810,6 +812,7 @@ nsresult nsMsgDatabase::InitMDBInfo()
|
|||
GetStore()->StringToToken(GetEnv(), kThreadChildrenColumnName, &m_threadChildrenColumnToken);
|
||||
GetStore()->StringToToken(GetEnv(), kThreadUnreadChildrenColumnName, &m_threadUnreadChildrenColumnToken);
|
||||
GetStore()->StringToToken(GetEnv(), kNumReferencesColumnName, &m_numReferencesColumnToken);
|
||||
GetStore()->StringToToken(GetEnv(), kMessageCharSetColumnName, &m_messageCharSetColumnToken);
|
||||
err = GetStore()->StringToToken(GetEnv(), kMsgHdrsTableKind, &m_hdrTableKindToken);
|
||||
if (err == NS_OK)
|
||||
err = GetStore()->StringToToken(GetEnv(), kThreadTableKind, &m_threadTableKindToken);
|
||||
|
|
|
@ -502,6 +502,10 @@ NS_IMETHODIMP nsMsgHdr::GetRecipientsCollationKey(nsString &resultRecipients)
|
|||
return m_mdb->RowCellColumnToCollationKey(GetMDBRow(), m_mdb->m_recipientsColumnToken, resultRecipients);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgHdr::GetCharSet(nsString &result)
|
||||
{
|
||||
return m_mdb->RowCellColumnTonsString(GetMDBRow(), m_mdb->m_messageCharSetColumnToken, result);
|
||||
}
|
||||
|
||||
nsresult nsMsgHdr::SetStringColumn(const char *str, mdb_token token)
|
||||
{
|
||||
|
|
Загрузка…
Ссылка в новой задаче