add old flags to key change notification, use PRUint32 exclusively

This commit is contained in:
bienvenu%netscape.com 1999-05-13 23:16:39 +00:00
parent 292011de1f
commit 6d0429b17c
4 changed files with 15 additions and 10 deletions

View File

@ -12,7 +12,7 @@ class nsIDBChangeListener : public nsISupports
public:
static const nsIID& IID(void) { static nsIID iid = NS_IDBCHANGELISTENER_IID; return iid; }
NS_IMETHOD OnKeyChange(nsMsgKey aKeyChanged, PRInt32 aFlags,
NS_IMETHOD OnKeyChange(nsMsgKey aKeyChanged, PRUint32 aOldFlags, PRUint32 aNewFlags,
nsIDBChangeListener * aInstigator) = 0;
NS_IMETHOD OnKeyDeleted(nsMsgKey aKeyChanged, PRInt32 aFlags,
nsIDBChangeListener * aInstigator) = 0;

View File

@ -60,7 +60,7 @@ public:
NS_IMETHOD AddListener(nsIDBChangeListener *listener) = 0;
NS_IMETHOD RemoveListener(nsIDBChangeListener *listener) = 0;
NS_IMETHOD NotifyKeyChangeAll(nsMsgKey keyChanged, PRInt32 flags,
NS_IMETHOD NotifyKeyChangeAll(nsMsgKey keyChanged, PRUint32 aOldFlags, PRUint32 aNewFlags,
nsIDBChangeListener *instigator) = 0;
NS_IMETHOD NotifyKeyAddedAll(nsMsgKey keyAdded, PRInt32 flags,
nsIDBChangeListener *instigator) = 0;

View File

@ -47,7 +47,7 @@ public:
NS_IMETHOD AddListener(nsIDBChangeListener *listener);
NS_IMETHOD RemoveListener(nsIDBChangeListener *listener);
NS_IMETHOD NotifyKeyChangeAll(nsMsgKey keyChanged, PRInt32 flags,
NS_IMETHOD NotifyKeyChangeAll(nsMsgKey keyChanged, PRUint32 aOldFlags, PRUint32 aNewFlags,
nsIDBChangeListener *instigator);
NS_IMETHOD NotifyKeyAddedAll(nsMsgKey keyAdded, PRInt32 flags,
nsIDBChangeListener *instigator);
@ -263,7 +263,7 @@ protected:
#endif
// Flag handling routines
virtual nsresult SetKeyFlag(nsMsgKey key, PRBool set, PRInt32 flag,
virtual nsresult SetKeyFlag(nsMsgKey key, PRBool set, PRUint32 flag,
nsIDBChangeListener *instigator = NULL);
virtual PRBool SetHdrFlag(nsIMsgDBHdr *, PRBool bSet, MsgFlags flag);
virtual PRUint32 GetStatusFlags(nsIMsgDBHdr *msgHdr);

View File

@ -115,7 +115,7 @@ NS_IMETHODIMP nsMsgDatabase::RemoveListener(nsIDBChangeListener *listener)
}
// change announcer methods - just broadcast to all listeners.
NS_IMETHODIMP nsMsgDatabase::NotifyKeyChangeAll(nsMsgKey keyChanged, PRInt32 flags,
NS_IMETHODIMP nsMsgDatabase::NotifyKeyChangeAll(nsMsgKey keyChanged, PRUint32 oldFlags, PRUint32 newFlags,
nsIDBChangeListener *instigator)
{
if (m_ChangeListeners == nsnull)
@ -125,7 +125,7 @@ NS_IMETHODIMP nsMsgDatabase::NotifyKeyChangeAll(nsMsgKey keyChanged, PRInt32 fla
nsIDBChangeListener *changeListener =
(nsIDBChangeListener *) m_ChangeListeners->ElementAt(i);
nsresult rv = changeListener->OnKeyChange(keyChanged, flags, instigator);
nsresult rv = changeListener->OnKeyChange(keyChanged, oldFlags, newFlags, instigator);
if (NS_FAILED(rv))
return rv;
}
@ -1077,7 +1077,9 @@ NS_IMETHODIMP nsMsgDatabase::MarkHdrReadInDB(nsIMsgDBHdr *msgHdr, PRBool bRead,
nsIDBChangeListener *instigator)
{
nsMsgKey key;
PRUint32 oldFlags;
(void)msgHdr->GetMessageKey(&key);
msgHdr->GetFlags(&oldFlags);
SetHdrFlag(msgHdr, bRead, MSG_FLAG_READ);
if (m_newSet)
m_newSet->Remove(key);
@ -1091,7 +1093,7 @@ NS_IMETHODIMP nsMsgDatabase::MarkHdrReadInDB(nsIMsgDBHdr *msgHdr, PRBool bRead,
PRUint32 flags;
(void)msgHdr->GetFlags(&flags);
return NotifyKeyChangeAll(key, flags, instigator);
return NotifyKeyChangeAll(key, oldFlags, flags, instigator);
}
NS_IMETHODIMP nsMsgDatabase::MarkRead(nsMsgKey key, PRBool bRead,
@ -1212,7 +1214,7 @@ nsresult nsMsgDatabase::IsMDNSent(nsMsgKey key, PRBool *pSent)
}
nsresult nsMsgDatabase::SetKeyFlag(nsMsgKey key, PRBool set, PRInt32 flag,
nsresult nsMsgDatabase::SetKeyFlag(nsMsgKey key, PRBool set, PRUint32 flag,
nsIDBChangeListener *instigator)
{
nsresult rv;
@ -1222,11 +1224,14 @@ nsresult nsMsgDatabase::SetKeyFlag(nsMsgKey key, PRBool set, PRInt32 flag,
if (NS_FAILED(rv) || !msgHdr)
return NS_MSG_MESSAGE_NOT_FOUND; // XXX return rv?
PRUint32 oldFlags;
msgHdr->GetFlags(&oldFlags);
SetHdrFlag(msgHdr, set, flag);
PRUint32 flags;
(void)msgHdr->GetFlags(&flags);
NotifyKeyChangeAll(key, flags, instigator);
NotifyKeyChangeAll(key, oldFlags, flags, instigator);
NS_RELEASE(msgHdr);
return rv;
@ -1398,7 +1403,7 @@ NS_IMETHODIMP nsMsgDatabase::ClearNewList(PRBool notify /* = FALSE */)
(void)msgHdr->GetMessageKey(&key);
PRUint32 flags;
(void)msgHdr->GetFlags(&flags);
NotifyKeyChangeAll(key, flags, NULL);
NotifyKeyChangeAll(key, flags | MSG_FLAG_NEW, flags, NULL);
NS_RELEASE(msgHdr);
}
}