зеркало из https://github.com/mozilla/pjs.git
add i18n routines
This commit is contained in:
Родитель
5adb94a8f4
Коммит
b4a60b1403
|
@ -26,3 +26,5 @@ nsMsgHdr.h
|
|||
nsIDBChangeListener.h
|
||||
nsIDBFolderInfo.h
|
||||
nsIMessage.h
|
||||
nsIMsgThread.h
|
||||
nsMsgThread.h
|
||||
|
|
|
@ -33,6 +33,8 @@ EXPORTS= \
|
|||
nsIDBChangeListener.h \
|
||||
nsIDBFolderInfo.h \
|
||||
nsIMessage.h \
|
||||
nsIMsgThread.h \
|
||||
nsMsgThread.h \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/config.mk
|
||||
|
|
|
@ -33,6 +33,8 @@ EXPORTS = \
|
|||
nsIDBChangeListener.h \
|
||||
nsIDBFolderInfo.h \
|
||||
nsIMessage.h \
|
||||
nsIMsgThread.h \
|
||||
nsMsgThread.h \
|
||||
$(NULL)
|
||||
|
||||
MODULE=mailnews
|
||||
|
|
|
@ -94,6 +94,7 @@ public:
|
|||
NS_IMETHOD GetMsgHdrStructFromnsMsgHdr(nsIMessage *msgHdr,
|
||||
nsMsgHdrStruct *hdrStruct) = 0;
|
||||
|
||||
NS_IMETHOD CopyHdrFromExistingHdr(nsMsgKey key, nsIMessage *existingHdr, nsIMessage **newHdr) = 0;
|
||||
#if HAVE_INT_ENUMERATORS
|
||||
NS_IMETHOD EnumerateKeys(nsIEnumerator* *outputKeys) = 0;
|
||||
#else
|
||||
|
|
|
@ -79,6 +79,9 @@ protected:
|
|||
MsgFlags flag, nsIOFileStream **ppFileStream);
|
||||
virtual void SetReparse(PRBool reparse);
|
||||
|
||||
protected:
|
||||
virtual PRBool ThreadBySubjectWithoutRe() ;
|
||||
|
||||
MSG_Master *m_master;
|
||||
PRBool m_reparse;
|
||||
nsFileSpec m_folderName;
|
||||
|
|
|
@ -73,7 +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 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,
|
||||
|
@ -211,6 +211,11 @@ protected:
|
|||
|
||||
nsresult CreateMsgHdr(nsIMdbRow* hdrRow, nsFileSpec& path, nsMsgKey key, nsIMessage* *result,
|
||||
PRBool createKeyFromHeader = PR_FALSE);
|
||||
// prefs stuff - in future, we might want to cache the prefs interface
|
||||
nsresult GetBoolPref(const char *prefName, PRBool *result);
|
||||
virtual PRBool ThreadBySubjectWithoutRe() ;
|
||||
|
||||
// open db cache
|
||||
static void AddToCache(nsMsgDatabase* pMessageDB)
|
||||
{GetDBCache()->AppendElement(pMessageDB);}
|
||||
static void RemoveFromCache(nsMsgDatabase* pMessageDB);
|
||||
|
@ -220,6 +225,8 @@ protected:
|
|||
#ifdef XP_PC // this should go away when we can provide our own file stream to MDB/Mork
|
||||
static void UnixToNative(char*& ioPath);
|
||||
#endif
|
||||
|
||||
// Flag handling routines
|
||||
virtual nsresult SetKeyFlag(nsMsgKey key, PRBool set, PRInt32 flag,
|
||||
nsIDBChangeListener *instigator = NULL);
|
||||
virtual PRBool SetHdrFlag(nsIMessage *, PRBool bSet, MsgFlags flag);
|
||||
|
|
|
@ -79,6 +79,7 @@ public:
|
|||
// caller needs to free
|
||||
static char *GetGroupNameFromURL(const char *url);
|
||||
protected:
|
||||
virtual PRBool ThreadBySubjectWithoutRe() ;
|
||||
|
||||
char* m_groupURL;
|
||||
// MSG_FilterList* m_filterList;
|
||||
|
|
|
@ -34,6 +34,7 @@ CPPSRCS = \
|
|||
nsMsgHdr.cpp\
|
||||
nsNewsDatabase.cpp\
|
||||
nsMailDatabase.cpp\
|
||||
nsMsgThread.cpp\
|
||||
$(NULL)
|
||||
|
||||
EXTRA_DSO_LDOPTS = \
|
||||
|
|
|
@ -31,7 +31,7 @@ CPPSRCS= nsMsgDatabase.cpp\
|
|||
nsMailDatabase.cpp\
|
||||
nsNewsDatabase.cpp\
|
||||
nsMsgHdr.cpp\
|
||||
mdbstubs.cpp \
|
||||
nsMsgThread.cpp\
|
||||
$(NULL)
|
||||
|
||||
CPP_OBJS= .\$(OBJDIR)\nsMsgDatabase.obj \
|
||||
|
@ -39,6 +39,7 @@ CPP_OBJS= .\$(OBJDIR)\nsMsgDatabase.obj \
|
|||
.\$(OBJDIR)\nsMailDatabase.obj\
|
||||
.\$(OBJDIR)\nsNewsDatabase.obj\
|
||||
.\$(OBJDIR)\nsMsgHdr.obj\
|
||||
.\$(OBJDIR)\nsMsgThread.obj\
|
||||
$(NULL)
|
||||
|
||||
|
||||
|
@ -46,7 +47,15 @@ EXPORTS= \
|
|||
$(NULL)
|
||||
|
||||
|
||||
LINCS=-I$(PUBLIC)\xpcom -I$(PUBLIC)\mailnews -I$(PUBLIC)\raptor -I$(PUBLIC)\rdf -I$(PUBLIC)\rdfutil -I$(PUBLIC)\mime -I$(PUBLIC)\locale
|
||||
LINCS=-I$(PUBLIC)\xpcom \
|
||||
-I$(PUBLIC)\mailnews \
|
||||
-I$(PUBLIC)\raptor \
|
||||
-I$(PUBLIC)\rdf \
|
||||
-I$(PUBLIC)\rdfutil \
|
||||
-I$(PUBLIC)\mime \
|
||||
-I$(PUBLIC)\locale \
|
||||
-I$(PUBLIC)\pref \
|
||||
-I$(PUBLIC)\js
|
||||
|
||||
|
||||
LCFLAGS = \
|
||||
|
|
|
@ -489,6 +489,24 @@ void nsMailDatabase::SetReparse(PRBool reparse)
|
|||
}
|
||||
|
||||
|
||||
static PRBool gGotThreadingPrefs = FALSE;
|
||||
static PRBool gThreadWithoutRe = FALSE;
|
||||
|
||||
|
||||
// should we thread messages with common subjects that don't start with Re: together?
|
||||
// I imagine we might have separate preferences for mail and news, so this is a virtual method.
|
||||
PRBool nsMailDatabase::ThreadBySubjectWithoutRe()
|
||||
{
|
||||
if (!gGotThreadingPrefs)
|
||||
{
|
||||
GetBoolPref("mail.thread_without_re", &gThreadWithoutRe);
|
||||
gGotThreadingPrefs = TRUE;
|
||||
}
|
||||
|
||||
return gThreadWithoutRe;
|
||||
}
|
||||
|
||||
|
||||
#ifdef DEBUG // strictly for testing purposes
|
||||
nsresult nsMailDatabase::PrePopulate()
|
||||
{
|
||||
|
|
|
@ -35,6 +35,10 @@
|
|||
#include "nsILocaleFactory.h"
|
||||
#include "nsICollation.h"
|
||||
#include "nsCollationCID.h"
|
||||
#include "nsIPref.h"
|
||||
|
||||
static NS_DEFINE_IID(kIPrefIID, NS_IPREF_IID);
|
||||
static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
|
||||
|
||||
static NS_DEFINE_CID(kCMimeHeaderConverterCID, NS_MIME_HEADER_CONVERTER_CID);
|
||||
|
||||
|
@ -304,7 +308,7 @@ void nsMsgDatabase::DumpCache()
|
|||
nsMsgDatabase::nsMsgDatabase()
|
||||
: m_dbFolderInfo(nsnull), m_mdbEnv(nsnull), m_mdbStore(nsnull),
|
||||
m_mdbAllMsgHeadersTable(nsnull), m_dbName(""), m_newSet(nsnull),
|
||||
mRefCnt(0), m_mdbTokensInitialized(PR_FALSE), m_ChangeListeners(nsnull),
|
||||
m_mdbTokensInitialized(PR_FALSE), m_ChangeListeners(nsnull),
|
||||
m_hdrRowScopeToken(0),
|
||||
m_hdrTableKindToken(0),
|
||||
m_subjectColumnToken(0),
|
||||
|
@ -320,6 +324,7 @@ nsMsgDatabase::nsMsgDatabase()
|
|||
m_numLinesColumnToken(0),
|
||||
m_ccListColumnToken(0)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
nsMsgDatabase::~nsMsgDatabase()
|
||||
|
@ -1644,6 +1649,8 @@ NS_IMETHODIMP nsMsgDatabase::CreateNewHdrAndAddToDB(PRBool *newThread, nsMsgHdrS
|
|||
if (NS_FAILED(err)) return err;
|
||||
|
||||
err = CreateMsgHdr(hdrRow, m_dbName, hdrStruct->m_messageKey, pnewHdr);
|
||||
if (NS_SUCCEEDED(err))
|
||||
err = AddNewHdrToDB(*pnewHdr, notify);
|
||||
return err;
|
||||
}
|
||||
|
||||
|
@ -1668,6 +1675,48 @@ NS_IMETHODIMP nsMsgDatabase::GetMsgHdrStructFromnsMsgHdr(nsIMessage *msg, nsMsgH
|
|||
return err;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgDatabase::CopyHdrFromExistingHdr(nsMsgKey key, nsIMessage *existingHdr, nsIMessage **newHdr)
|
||||
{
|
||||
nsresult err = NS_OK;
|
||||
|
||||
if (existingHdr)
|
||||
{
|
||||
nsMsgHdr* sourceMsgHdr = NS_STATIC_CAST(nsMsgHdr*, existingHdr); // closed system, cast ok
|
||||
nsMsgHdr *destMsgHdr = nsnull;
|
||||
#ifdef MDB_DOES_CELL_CURSORS_OR_COPY_ROW
|
||||
CreateNewHdr(key, &destMsgHdr);
|
||||
nsIMdbRow sourceRow = sourceMsgHdr->GetMDBRow() ;
|
||||
{
|
||||
nsIMdbRowCellCursor* cellCursor = nsnull;
|
||||
mdb_err res = sourceRow->GetRowCellCursor(GetEnv(), -1, &cellCursor) ; // acquire new cursor instance
|
||||
if (res == 0 && cellCursor)
|
||||
{
|
||||
do
|
||||
{
|
||||
nsIMdbCell ioCell;
|
||||
mdb_column outColumn;
|
||||
mdb_pos outPos;
|
||||
|
||||
res = cellCursor->NextCell(GetEnv(), &ioCell, &outColumn, &outPos);
|
||||
|
||||
}
|
||||
while (outPos >= 0 && res == 0);
|
||||
}
|
||||
}
|
||||
#else
|
||||
nsMsgHdrStruct hdrStruct;
|
||||
err = GetMsgHdrStructFromnsMsgHdr(existingHdr, &hdrStruct);
|
||||
if (NS_SUCCEEDED(err))
|
||||
{
|
||||
PRBool newThread;
|
||||
hdrStruct.m_messageKey = key;
|
||||
err = CreateNewHdrAndAddToDB(&newThread, &hdrStruct, newHdr, PR_FALSE);
|
||||
}
|
||||
#endif // MDB_DOES_CELL_CURSORS_OR_COPY_ROW
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
||||
nsresult nsMsgDatabase::RowCellColumnTonsString(nsIMdbRow *hdrRow, mdb_token columnToken, nsString &resultStr)
|
||||
{
|
||||
nsresult err = NS_OK;
|
||||
|
@ -1836,6 +1885,31 @@ nsresult nsMsgDatabase::SetSummaryValid(PRBool valid /* = PR_TRUE */)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
// protected routines
|
||||
|
||||
// should we thread messages with common subjects that don't start with Re: together?
|
||||
// I imagine we might have separate preferences for mail and news, so this is a virtual method.
|
||||
PRBool nsMsgDatabase::ThreadBySubjectWithoutRe()
|
||||
{
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
nsresult nsMsgDatabase::GetBoolPref(const char *prefName, PRBool *result)
|
||||
{
|
||||
PRBool prefValue = PR_FALSE;
|
||||
nsIPref* prefs = nsnull;
|
||||
nsresult rv;
|
||||
rv = nsServiceManager::GetService(kPrefCID, kIPrefIID, (nsISupports**)&prefs);
|
||||
if (prefs && NS_SUCCEEDED(rv))
|
||||
{
|
||||
// prefs->Startup("prefs.js");
|
||||
|
||||
rv = prefs->GetBoolPref(prefName, result);
|
||||
nsServiceManager::ReleaseService(kPrefCID, prefs);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
nsresult nsMsgDatabase::DumpContents()
|
||||
{
|
||||
|
|
|
@ -49,6 +49,8 @@ void nsMsgHdr::Init()
|
|||
m_csID = 0;
|
||||
m_flags = 0;
|
||||
m_mdbRow = NULL;
|
||||
m_numReferences = 0;
|
||||
m_threadId = nsMsgKey_None;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -161,3 +161,10 @@ nsresult nsNewsDatabase::GetPurgeArticleInfo(MSG_PurgeInfo *purgeInfo);
|
|||
// caller needs to free
|
||||
/* static */ char *nsNewsDatabase::GetGroupNameFromURL(const char *url);
|
||||
|
||||
|
||||
// should we thread messages with common subjects that don't start with Re: together?
|
||||
// I imagine we might have separate preferences for mail and news, so this is a virtual method.
|
||||
PRBool nsNewsDatabase::ThreadBySubjectWithoutRe()
|
||||
{
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче