зеркало из https://github.com/mozilla/pjs.git
More work on Biff.
This commit is contained in:
Родитель
e5fb22c0a7
Коммит
c1b900682f
|
@ -51,7 +51,9 @@ nsMsgFolder::nsMsgFolder(void)
|
|||
mNumUnreadMessages(-1),
|
||||
mNumTotalMessages(-1),
|
||||
mDepth(0),
|
||||
mPrefFlags(0)
|
||||
mPrefFlags(0),
|
||||
mBiffState(nsMsgBiffState_NoMail),
|
||||
mNumNewBiffMessages(0)
|
||||
{
|
||||
// NS_INIT_REFCNT(); done by superclass
|
||||
|
||||
|
@ -1242,6 +1244,81 @@ NS_IMETHODIMP nsMsgFolder::GetNewMessages()
|
|||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgFolder::GetBiffState(PRUint32 *aBiffState)
|
||||
{
|
||||
if(!aBiffState)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
*aBiffState = mBiffState;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgFolder::SetBiffState(PRUint32 aBiffState)
|
||||
{
|
||||
if(mBiffState != aBiffState)
|
||||
{
|
||||
PRUint32 oldBiffState = mBiffState;
|
||||
mBiffState = aBiffState;
|
||||
nsCOMPtr<nsISupports> supports;
|
||||
if(NS_SUCCEEDED(QueryInterface(kISupportsIID, getter_AddRefs(supports))))
|
||||
NotifyPropertyFlagChanged(supports, "BiffState", oldBiffState, mBiffState);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgFolder::GetNumNewMessages(PRInt32 *aNumNewMessages)
|
||||
{
|
||||
if(!aNumNewMessages)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
*aNumNewMessages = mNumNewBiffMessages;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgFolder::SetNumNewMessages(PRInt32 aNumNewMessages)
|
||||
{
|
||||
if(aNumNewMessages != mNumNewBiffMessages)
|
||||
{
|
||||
PRInt32 oldNumMessages = mNumNewBiffMessages;
|
||||
mNumNewBiffMessages = aNumNewMessages;
|
||||
|
||||
char *oldNumMessagesStr = PR_smprintf("%d", oldNumMessages);
|
||||
char *newNumMessagesStr = PR_smprintf("%d",aNumNewMessages);
|
||||
NotifyPropertyChanged("NumNewBiffMessages", oldNumMessagesStr, newNumMessagesStr);
|
||||
PR_smprintf_free(oldNumMessagesStr);
|
||||
PR_smprintf_free(newNumMessagesStr);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgFolder::GetNewMessagesNotificationDescription(PRUnichar * *aDescription)
|
||||
{
|
||||
nsresult rv;
|
||||
nsString description("");
|
||||
nsCOMPtr<nsIMsgIncomingServer> server;
|
||||
rv = GetServer(getter_AddRefs(server));
|
||||
if(NS_SUCCEEDED(rv))
|
||||
{
|
||||
char *serverName = nsnull;
|
||||
rv = server->GetPrettyName(&serverName);
|
||||
if(NS_SUCCEEDED(rv) && PL_strcmp(serverName, ""))
|
||||
description = serverName;
|
||||
else
|
||||
{
|
||||
if(serverName)
|
||||
PR_Free(serverName);
|
||||
rv = server->GetHostName(&serverName);
|
||||
if(NS_SUCCEEDED(rv))
|
||||
description = serverName;
|
||||
}
|
||||
if(serverName)
|
||||
PR_Free(serverName);
|
||||
|
||||
}
|
||||
*aDescription = description.ToNewUnicode();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsMsgFolder::NotifyPropertyChanged(char *property, char *oldValue, char* newValue)
|
||||
{
|
||||
nsCOMPtr<nsISupports> supports;
|
||||
|
|
|
@ -265,6 +265,14 @@ public:
|
|||
NS_IMETHOD GetCharset(PRUnichar * *aCharset) = 0;
|
||||
NS_IMETHOD SetCharset(PRUnichar * aCharset) = 0;
|
||||
|
||||
NS_IMETHOD GetBiffState(PRUint32 *aBiffState);
|
||||
NS_IMETHOD SetBiffState(PRUint32 aBiffState);
|
||||
|
||||
NS_IMETHOD GetNumNewMessages(PRInt32 *aNumNewMessages);
|
||||
NS_IMETHOD SetNumNewMessages(PRInt32 aNumNewMessages);
|
||||
|
||||
NS_IMETHOD GetNewMessagesNotificationDescription(PRUnichar * *adescription);
|
||||
|
||||
protected:
|
||||
nsresult NotifyPropertyChanged(char *property, char* oldValue, char* newValue);
|
||||
nsresult NotifyPropertyFlagChanged(nsISupports *item, char *property, PRUint32 oldValue,
|
||||
|
@ -306,6 +314,9 @@ protected:
|
|||
PRInt32 mNumPendingUnreadMessages;
|
||||
PRInt32 mNumPendingTotalMessages;
|
||||
|
||||
PRUint32 mBiffState;
|
||||
PRInt32 mNumNewBiffMessages;
|
||||
|
||||
PRBool mIsCachable;
|
||||
|
||||
};
|
||||
|
|
|
@ -85,7 +85,15 @@ nsMsgIncomingServer::GetRootFolder(nsIFolder * *aRootFolder)
|
|||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgIncomingServer::PerformBiff()
|
||||
{
|
||||
//This had to be implemented in the derived class, but in case someone doesn't implement it
|
||||
//just return not implemented.
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
char *
|
||||
nsMsgIncomingServer::getPrefName(const char *serverKey,
|
||||
const char *fullPrefName)
|
||||
|
|
|
@ -76,7 +76,8 @@ class NS_MSG_BASE nsMsgIncomingServer : public nsIMsgIncomingServer {
|
|||
NS_IMETHOD GetRootFolder(nsIFolder * *aRootFolder);
|
||||
NS_IMETHOD SetRootFolder(nsIFolder * aRootFolder);
|
||||
|
||||
|
||||
NS_IMETHOD PerformBiff();
|
||||
|
||||
private:
|
||||
nsIPref *m_prefs;
|
||||
char *m_serverKey;
|
||||
|
|
Загрузка…
Ссылка в новой задаче