diff --git a/mailnews/base/search/public/nsIMsgFilter.idl b/mailnews/base/search/public/nsIMsgFilter.idl index 9c455ac5a1e..8467cbd96f0 100644 --- a/mailnews/base/search/public/nsIMsgFilter.idl +++ b/mailnews/base/search/public/nsIMsgFilter.idl @@ -100,7 +100,5 @@ interface nsIMsgFilter : nsISupports { // [array, size_is(headerSize)] in string headers, in unsigned long headerSize, out boolean result); - void logRuleHit(in nsIMsgDBHdr header); - - + void logRuleHit(in nsIMsgDBHdr aHeader); }; diff --git a/mailnews/base/search/public/nsIMsgFilterHitNotify.idl b/mailnews/base/search/public/nsIMsgFilterHitNotify.idl index b84997f3d72..a4b698516f0 100644 --- a/mailnews/base/search/public/nsIMsgFilterHitNotify.idl +++ b/mailnews/base/search/public/nsIMsgFilterHitNotify.idl @@ -54,7 +54,6 @@ interface nsIMsgWindow; [scriptable, uuid(c9f15174-1f3f-11d3-a51b-0060b0fc04b7)] interface nsIMsgFilterHitNotify : nsISupports { - boolean applyFilterHit(in nsIMsgFilter filter, in nsIMsgWindow msgWindow); }; diff --git a/mailnews/base/search/public/nsIMsgFilterList.idl b/mailnews/base/search/public/nsIMsgFilterList.idl index 968074838f3..70a50e366b9 100644 --- a/mailnews/base/search/public/nsIMsgFilterList.idl +++ b/mailnews/base/search/public/nsIMsgFilterList.idl @@ -125,6 +125,7 @@ interface nsIMsgFilterList : nsISupports { readonly attribute string logURL; void clearLog(); void ensureLogFile(); + void flushLogIfNecessary(); }; diff --git a/mailnews/base/search/src/nsMsgFilter.cpp b/mailnews/base/search/src/nsMsgFilter.cpp index 5aad2f3dd7c..83ef7ace35a 100644 --- a/mailnews/base/search/src/nsMsgFilter.cpp +++ b/mailnews/base/search/src/nsMsgFilter.cpp @@ -268,7 +268,7 @@ nsMsgFilter::GetActionTargetFolderUri(char** aResult) #define LOG_ENTRY_END_TAG "\n" #define LOG_ENTRY_END_TAG_LEN (strlen(LOG_ENTRY_END_TAG)) -NS_IMETHODIMP nsMsgFilter::LogRuleHit(nsIMsgDBHdr *msgHdr) +NS_IMETHODIMP nsMsgFilter::LogRuleHit(nsIMsgDBHdr *aMsgHdr) { nsCOMPtr logStream; nsresult rv = m_filterList->GetLogStream(getter_AddRefs(logStream)); @@ -285,17 +285,19 @@ NS_IMETHODIMP nsMsgFilter::LogRuleHit(nsIMsgDBHdr *msgHdr) GetFilterName(getter_Copies(filterName)); GetAction(&actionType); - rv = msgHdr->GetDate(&date); + rv = aMsgHdr->GetDate(&date); PRExplodedTime exploded; PR_ExplodeTime(date, PR_LocalTimeParameters, &exploded); PR_FormatTimeUSEnglish(dateStr, 100, "%m/%d/%Y %I:%M %p", &exploded); - msgHdr->GetAuthor(getter_Copies(author)); - msgHdr->GetSubject(getter_Copies(subject)); + aMsgHdr->GetAuthor(getter_Copies(author)); + aMsgHdr->GetSubject(getter_Copies(subject)); nsCString buffer; - buffer.SetCapacity(512); - + // this is big enough to hold a log entry. + // do this so we avoid growing and copying as we append to the log. + buffer.SetCapacity(512); + buffer = "Applied filter \""; buffer += NS_ConvertUCS2toUTF8(filterName).get(); buffer += "\" to message from "; @@ -318,7 +320,7 @@ NS_IMETHODIMP nsMsgFilter::LogRuleHit(nsIMsgDBHdr *msgHdr) buffer += "\n"; if (actionType == nsMsgFilterAction::MoveToFolder) { nsXPIDLCString msgId; - msgHdr->GetMessageId(getter_Copies(msgId)); + aMsgHdr->GetMessageId(getter_Copies(msgId)); buffer += (const char *) actionFolderUri; buffer += " id = "; buffer += (const char*)msgId; @@ -331,6 +333,9 @@ NS_IMETHODIMP nsMsgFilter::LogRuleHit(nsIMsgDBHdr *msgHdr) NS_ENSURE_SUCCESS(rv,rv); NS_ASSERTION(writeCount == LOG_ENTRY_START_TAG_LEN, "failed to write out start log tag"); + // html escape the log for security reasons. + // we don't want some to send us a message with a subject with + // html tags, especially