зеркало из https://github.com/mozilla/pjs.git
make newly junk mail plugin classified junk mail not appear in the non-junk mail view 180203 r/sr/a=sspitzer
This commit is contained in:
Родитель
c04a8c2901
Коммит
84af051c8d
|
@ -2195,7 +2195,8 @@ nsMsgDBView::ApplyCommandToIndices(nsMsgViewCommandTypeValue command, nsMsgViewI
|
|||
// in the last callback.
|
||||
//
|
||||
if ( command == nsMsgViewCommandType::junk
|
||||
|| command == nsMsgViewCommandType::unjunk ) {
|
||||
|| command == nsMsgViewCommandType::unjunk )
|
||||
{
|
||||
|
||||
// get the folder from the first item (if it's the search view,
|
||||
// only one item can be touched at a time; if a regular folder view,
|
||||
|
@ -2610,6 +2611,13 @@ nsresult nsMsgDBView::SetJunkScoreByIndex(nsIJunkMailPlugin *aJunkPlugin,
|
|||
uri, oldUserClassification, aNewClassification, mMsgWindow, this);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// this routine is only reached if the user someone touched the UI
|
||||
// and told us the junk status of this message.
|
||||
// Set origin first so that listeners on the junkscore will
|
||||
// know the correct origin.
|
||||
rv = SetStringPropertyByIndex(aIndex, "junkscoreorigin", "user");
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "SetStringPropertyByIndex failed");
|
||||
|
||||
// set the junk score on the message itself
|
||||
//
|
||||
rv = SetStringPropertyByIndex(
|
||||
|
@ -2617,11 +2625,6 @@ nsresult nsMsgDBView::SetJunkScoreByIndex(nsIJunkMailPlugin *aJunkPlugin,
|
|||
aNewClassification == nsIJunkMailPlugin::JUNK ? "100" : "0");
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// this routine is only reached if the user someone touched the UI
|
||||
// and told us the junk status of this message.
|
||||
//
|
||||
rv = SetStringPropertyByIndex(aIndex, "junkscoreorigin", "user");
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "SetStringPropertyByIndex failed");
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
|
|
@ -106,6 +106,47 @@ nsresult nsMsgQuickSearchDBView::OnNewHeader(nsMsgKey newKey, nsMsgKey aParentKe
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgQuickSearchDBView::OnKeyChange(nsMsgKey aKeyChanged, PRUint32 aOldFlags,
|
||||
PRUint32 aNewFlags, nsIDBChangeListener *aInstigator)
|
||||
{
|
||||
nsresult rv = nsMsgDBView::OnKeyChange(aKeyChanged, aOldFlags, aNewFlags, aInstigator);
|
||||
// flags haven't really changed - check if the message is newly classified as junk
|
||||
if ((aOldFlags == aNewFlags) && (aOldFlags & MSG_FLAG_NEW))
|
||||
{
|
||||
nsCOMPtr <nsIMsgDBHdr> msgHdr;
|
||||
rv = m_db->GetMsgHdrForKey(aKeyChanged, getter_AddRefs(msgHdr));
|
||||
if (NS_SUCCEEDED(rv) && msgHdr != nsnull)
|
||||
{
|
||||
nsXPIDLCString junkScoreStr;
|
||||
(void) msgHdr->GetStringProperty("junkscore", getter_Copies(junkScoreStr));
|
||||
if (atoi(junkScoreStr.get()) > 50)
|
||||
{
|
||||
nsXPIDLCString originStr;
|
||||
(void) msgHdr->GetStringProperty("junkscoreorigin",
|
||||
getter_Copies(originStr));
|
||||
|
||||
// if this was classified by the plugin, see if we're supposed to
|
||||
// show junk mail
|
||||
if (originStr.get()[0] == 'p')
|
||||
{
|
||||
PRBool match=PR_FALSE;
|
||||
nsCOMPtr <nsIMsgSearchSession> searchSession = do_QueryReferent(m_searchSession);
|
||||
if (searchSession)
|
||||
searchSession->MatchHdr(msgHdr, m_db, &match);
|
||||
if (!match)
|
||||
{
|
||||
// remove hdr from view
|
||||
nsMsgViewIndex deletedIndex = m_keys.FindIndex(aKeyChanged);
|
||||
if (deletedIndex != nsMsgViewIndex_None)
|
||||
RemoveByIndex(deletedIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgQuickSearchDBView::GetSearchSession(nsIMsgSearchSession* *aSession)
|
||||
{
|
||||
|
|
Загрузка…
Ссылка в новой задаче