зеркало из https://github.com/mozilla/pjs.git
add i18n interfaces for mime2 encoding and collation keys - shouldn't be called yet
This commit is contained in:
Родитель
217d824947
Коммит
6b9f1334cb
|
@ -65,7 +65,10 @@ public:
|
|||
NS_IMETHOD SetImapUidValidity(PRInt32 uidValidity) ;
|
||||
NS_IMETHOD GetImapTotalPendingMessages(PRInt32 *result) ;
|
||||
NS_IMETHOD GetImapUnreadPendingMessages(PRInt32 *result) ;
|
||||
NS_IMETHOD GetCSID(PRInt16 *result) ;
|
||||
NS_IMETHOD GetCharacterSet(nsString &result) ;
|
||||
NS_IMETHOD SetCharacterSet(nsString &charSet) ;
|
||||
NS_IMETHOD GetLocale(nsString &result) ;
|
||||
NS_IMETHOD SetLocale(nsString &locale) ;
|
||||
|
||||
NS_IMETHOD SetVersion(PRUint32 version) ;
|
||||
NS_IMETHOD GetVersion(PRUint32 *result);
|
||||
|
@ -104,7 +107,6 @@ public:
|
|||
void SetSortInfo(nsMsgSortType, nsMsgSortOrder);
|
||||
void GetSortInfo(nsMsgSortType *, nsMsgSortOrder *);
|
||||
PRBool TestFlag(PRInt32 flags);
|
||||
void SetCSID(PRInt16 csid) ;
|
||||
PRInt16 GetIMAPHierarchySeparator() ;
|
||||
void SetIMAPHierarchySeparator(PRInt16 hierarchySeparator) ;
|
||||
void ChangeImapTotalPendingMessages(PRInt32 delta);
|
||||
|
|
|
@ -51,7 +51,10 @@ public:
|
|||
NS_IMETHOD SetImapUidValidity(PRInt32 uidValidity) = 0;
|
||||
NS_IMETHOD GetImapTotalPendingMessages(PRInt32 *result) = 0;
|
||||
NS_IMETHOD GetImapUnreadPendingMessages(PRInt32 *result) = 0;
|
||||
NS_IMETHOD GetCSID(PRInt16 *result) = 0;
|
||||
NS_IMETHOD GetCharacterSet(nsString &result) = 0;
|
||||
NS_IMETHOD SetCharacterSet(nsString &result) = 0;
|
||||
NS_IMETHOD GetLocale(nsString &result) = 0;
|
||||
NS_IMETHOD SetLocale(nsString &locale) = 0;
|
||||
|
||||
NS_IMETHOD SetVersion(PRUint32 version) = 0;
|
||||
NS_IMETHOD GetVersion(PRUint32 *result) = 0;
|
||||
|
|
|
@ -57,6 +57,14 @@ public:
|
|||
NS_IMETHOD GetRecipients(nsString &resultRecipients) = 0;
|
||||
NS_IMETHOD GetCCList(nsString &ccList) =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;
|
||||
|
|
|
@ -73,6 +73,7 @@ public:
|
|||
// a new header, fill in its properties, and then call AddNewHdrToDB.
|
||||
// AddNewHdrToDB will send notifications to any listeners.
|
||||
NS_IMETHOD CreateNewHdr(nsMsgKey key, nsIMessage **newHdr);
|
||||
// NS_IMETHOD CopyHdrFromExistingHdr(nsMsgKey key, nsIMessage *existingHdr, nsIMessage **newHdr);
|
||||
NS_IMETHOD AddNewHdrToDB(nsIMessage *newHdr, PRBool notify);
|
||||
// extract info from an nsIMessage into a nsMsgHdrStruct
|
||||
NS_IMETHOD GetMsgHdrStructFromnsMsgHdr(nsIMessage *msgHdr,
|
||||
|
@ -179,6 +180,8 @@ public:
|
|||
nsresult RowCellColumnTonsString(nsIMdbRow *row, mdb_token columnToken, nsString &resultStr);
|
||||
nsresult RowCellColumnToUInt32(nsIMdbRow *row, mdb_token columnToken, PRUint32 *uint32Result);
|
||||
nsresult RowCellColumnToUInt32(nsIMdbRow *row, mdb_token columnToken, PRUint32 &uint32Result);
|
||||
nsresult RowCellColumnToMime2EncodedString(nsIMdbRow *row, mdb_token columnToken, nsString &resultStr);
|
||||
nsresult RowCellColumnToCollationKey(nsIMdbRow *row, mdb_token columnToken, nsString &resultStr);
|
||||
|
||||
// helper functions to copy an nsString to a yarn, int32 to yarn, and vice versa.
|
||||
static struct mdbYarn *nsStringToYarn(struct mdbYarn *yarn, nsString *str);
|
||||
|
|
|
@ -58,6 +58,15 @@ public:
|
|||
NS_IMETHOD GetAuthor(nsString &resultAuthor);
|
||||
NS_IMETHOD GetSubject(nsString &resultSubject);
|
||||
NS_IMETHOD GetRecipients(nsString &resultRecipients);
|
||||
|
||||
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);
|
||||
|
||||
NS_IMETHOD GetCCList(nsString &ccList);
|
||||
// flag handling routines
|
||||
NS_IMETHOD GetFlags(PRUint32 *result);
|
||||
|
|
|
@ -32,6 +32,7 @@ CPPSRCS = \
|
|||
nsMsgDatabase.cpp\
|
||||
nsDBFolderInfo.cpp\
|
||||
nsMsgHdr.cpp\
|
||||
nsNewsDatabase.cpp\
|
||||
nsMailDatabase.cpp\
|
||||
$(NULL)
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ include <$(DEPTH)\config\config.mak>
|
|||
|
||||
LIBRARY_NAME=msgdb
|
||||
MODULE= mailnews
|
||||
REQUIRES=rdf
|
||||
REQUIRES=rdf mime
|
||||
|
||||
DEFINES=-D_IMPL_NS_HTML -DWIN32_LEAN_AND_MEAN
|
||||
|
||||
|
@ -46,7 +46,8 @@ EXPORTS= \
|
|||
$(NULL)
|
||||
|
||||
|
||||
LINCS=-I$(PUBLIC)\xpcom -I$(PUBLIC)\mailnews -I$(PUBLIC)\raptor -I$(PUBLIC)\rdf -I$(PUBLIC)\rdfutil
|
||||
LINCS=-I$(PUBLIC)\xpcom -I$(PUBLIC)\mailnews -I$(PUBLIC)\raptor -I$(PUBLIC)\rdf -I$(PUBLIC)\rdfutil -I$(PUBLIC)\mime -I$(PUBLIC)\locale
|
||||
|
||||
|
||||
LCFLAGS = \
|
||||
$(LCFLAGS) \
|
||||
|
|
|
@ -42,6 +42,8 @@ static const char * kMailboxNameColumnName = "mailboxName";
|
|||
static const char * kKnownArtsSetColumnName = "knownArts";
|
||||
static const char * kExpiredMarkColumnName = "expiredMark";
|
||||
static const char * kVersionColumnName = "version";
|
||||
static const char * kCharacterSetColumnName = "charSet";
|
||||
static const char * kLocaleColumnName = "locale";
|
||||
|
||||
// we need this because of an egcs 1.0 (and possibly gcc) compiler bug
|
||||
// that doesn't allow you to call ::nsISupports::GetIID() inside of a class
|
||||
|
@ -495,18 +497,30 @@ PRBool nsDBFolderInfo::TestFlag(PRInt32 flags)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDBFolderInfo::GetCSID(PRInt16 *result)
|
||||
nsDBFolderInfo::GetCharacterSet(nsString &result)
|
||||
{
|
||||
if (!result) return NS_ERROR_NULL_POINTER;
|
||||
*result = m_csid;
|
||||
GetProperty(kCharacterSetColumnName, result);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void nsDBFolderInfo::SetCSID(PRInt16 csid)
|
||||
NS_IMETHODIMP nsDBFolderInfo::SetCharacterSet(nsString &charSet)
|
||||
{
|
||||
m_csid = csid;
|
||||
return SetProperty(kCharacterSetColumnName, charSet);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDBFolderInfo::GetLocale(nsString &result)
|
||||
{
|
||||
GetProperty(kLocaleColumnName, result);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDBFolderInfo::SetLocale(nsString &locale)
|
||||
{
|
||||
return SetProperty(kLocaleColumnName, locale);
|
||||
}
|
||||
|
||||
|
||||
PRInt16 nsDBFolderInfo::GetIMAPHierarchySeparator()
|
||||
{
|
||||
return m_IMAPHierarchySeparator;
|
||||
|
|
|
@ -27,7 +27,25 @@
|
|||
#include "nsRDFCID.h"
|
||||
#include "nsIRDFResource.h"
|
||||
|
||||
#include "nsIMimeHeaderConverter.h"
|
||||
//#include "nsMimeHeaderConverter.h"
|
||||
|
||||
#include "nsILocale.h"
|
||||
#include "nsLocaleCID.h"
|
||||
#include "nsILocaleFactory.h"
|
||||
#include "nsICollation.h"
|
||||
#include "nsCollationCID.h"
|
||||
|
||||
static NS_DEFINE_CID(kCMimeHeaderConverterCID, NS_MIME_HEADER_CONVERTER_CID);
|
||||
|
||||
static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
|
||||
static NS_DEFINE_CID(kLocaleFactoryCID, NS_LOCALEFACTORY_CID);
|
||||
static NS_DEFINE_IID(kILocaleFactoryIID, NS_ILOCALEFACTORY_IID);
|
||||
static NS_DEFINE_CID(kLocaleCID, NS_LOCALE_CID);
|
||||
static NS_DEFINE_IID(kILocaleIID, NS_ILOCALE_IID);
|
||||
static NS_DEFINE_CID(kCollationFactoryCID, NS_COLLATIONFACTORY_CID);
|
||||
static NS_DEFINE_IID(kICollationIID, NS_ICOLLATION_IID);
|
||||
static NS_DEFINE_IID(kICollationFactoryIID, NS_ICOLLATIONFACTORY_IID);
|
||||
|
||||
#ifdef WE_HAVE_MDBINTERFACES
|
||||
static NS_DEFINE_CID(kIMBBCID, NS_IMBB_IID);
|
||||
|
@ -1668,6 +1686,74 @@ nsresult nsMsgDatabase::RowCellColumnTonsString(nsIMdbRow *hdrRow, mdb_token col
|
|||
return err;
|
||||
}
|
||||
|
||||
nsresult nsMsgDatabase::RowCellColumnToMime2EncodedString(nsIMdbRow *row, mdb_token columnToken, nsString &resultStr)
|
||||
{
|
||||
nsresult err;
|
||||
nsString nakedString;
|
||||
err = RowCellColumnTonsString(row, columnToken, nakedString);
|
||||
if (NS_SUCCEEDED(err))
|
||||
{
|
||||
|
||||
// apply mime decode
|
||||
nsIMimeHeaderConverter *converter;
|
||||
err = nsComponentManager::CreateInstance(kCMimeHeaderConverterCID, nsnull,
|
||||
nsIMimeHeaderConverter::GetIID(), (void **)&converter);
|
||||
|
||||
if (NS_SUCCEEDED(err) && nsnull != converter)
|
||||
{
|
||||
nsString charset;
|
||||
nsString decodedStr;
|
||||
err = converter->DecodeMimePartIIStr(nakedString, charset, resultStr);
|
||||
NS_RELEASE(converter);
|
||||
}
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
||||
nsresult nsMsgDatabase::RowCellColumnToCollationKey(nsIMdbRow *row, mdb_token columnToken, nsString &resultStr)
|
||||
{
|
||||
nsString nakedString;
|
||||
nsresult err;
|
||||
|
||||
err = RowCellColumnTonsString(row, columnToken, nakedString);
|
||||
if (NS_SUCCEEDED(err))
|
||||
{
|
||||
nsILocaleFactory* localeFactory;
|
||||
nsILocale* locale;
|
||||
nsString localeName;
|
||||
|
||||
// get a locale factory
|
||||
err = nsComponentManager::FindFactory(kLocaleFactoryCID, (nsIFactory**)&localeFactory);
|
||||
|
||||
// do this for a new db if no UI to be provided for locale selection
|
||||
err = localeFactory->GetApplicationLocale(&locale);
|
||||
|
||||
// or generate a locale from a stored locale name ("en_US", "fr_FR")
|
||||
err = localeFactory->NewLocale(&localeName, &locale);
|
||||
|
||||
// and locale name can be taken as below, category should be one of the following
|
||||
// probably NSILOCALE_COLLATE is appropriate
|
||||
nsString catagory = "NSILOCALE_COLLATE";
|
||||
err = locale->GetCatagory(&catagory, &localeName);
|
||||
|
||||
nsICollationFactory *f;
|
||||
|
||||
err = nsComponentManager::CreateInstance(kCollationFactoryCID, NULL,
|
||||
kICollationFactoryIID, (void**) &f);
|
||||
|
||||
nsICollation *inst;
|
||||
|
||||
// get a collation interface instance
|
||||
err = f->CreateCollation(locale, &inst);
|
||||
|
||||
if (NS_SUCCEEDED(err) && inst)
|
||||
{
|
||||
err = inst->CreateSortKey( kCollationCaseSensitive, nakedString, resultStr) ;
|
||||
}
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
||||
nsresult nsMsgDatabase::RowCellColumnToUInt32(nsIMdbRow *hdrRow, mdb_token columnToken, PRUint32 &uint32Result)
|
||||
{
|
||||
return RowCellColumnToUInt32(hdrRow, columnToken, &uint32Result);
|
||||
|
|
|
@ -391,6 +391,37 @@ NS_IMETHODIMP nsMsgHdr::GetCCList(nsString &resultCCList)
|
|||
return m_mdb->RowCellColumnTonsString(GetMDBRow(), m_mdb->m_ccListColumnToken, resultCCList);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgHdr::GetMime2EncodedAuthor(nsString &resultAuthor)
|
||||
{
|
||||
return m_mdb->RowCellColumnToMime2EncodedString(GetMDBRow(), m_mdb->m_senderColumnToken, resultAuthor);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgHdr::GetMime2EncodedSubject(nsString &resultSubject)
|
||||
{
|
||||
return m_mdb->RowCellColumnToMime2EncodedString(GetMDBRow(), m_mdb->m_subjectColumnToken, resultSubject);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgHdr::GetMime2EncodedRecipients(nsString &resultRecipients)
|
||||
{
|
||||
return m_mdb->RowCellColumnToMime2EncodedString(GetMDBRow(), m_mdb->m_recipientsColumnToken, resultRecipients);
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP nsMsgHdr::GetAuthorCollationKey(nsString &resultAuthor)
|
||||
{
|
||||
return m_mdb->RowCellColumnToCollationKey(GetMDBRow(), m_mdb->m_senderColumnToken, resultAuthor);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgHdr::GetSubjectCollationKey(nsString &resultSubject)
|
||||
{
|
||||
return m_mdb->RowCellColumnToCollationKey(GetMDBRow(), m_mdb->m_subjectColumnToken, resultSubject);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgHdr::GetRecipientsCollationKey(nsString &resultRecipients)
|
||||
{
|
||||
return m_mdb->RowCellColumnToCollationKey(GetMDBRow(), m_mdb->m_recipientsColumnToken, resultRecipients);
|
||||
}
|
||||
|
||||
|
||||
nsresult nsMsgHdr::SetStringColumn(const char *str, mdb_token token)
|
||||
{
|
||||
|
|
Загрузка…
Ссылка в новой задаче