зеркало из https://github.com/mozilla/pjs.git
break out UpdateFolder method from GetMessages
This commit is contained in:
Родитель
e0ccee51b2
Коммит
6a4ee199f9
|
@ -51,6 +51,8 @@ interface nsIMsgFolder : nsIFolder {
|
||||||
|
|
||||||
nsISimpleEnumerator GetMessages();
|
nsISimpleEnumerator GetMessages();
|
||||||
nsISimpleEnumerator GetThreads();
|
nsISimpleEnumerator GetThreads();
|
||||||
|
/* get new headers for db */
|
||||||
|
void UpdateFolder();
|
||||||
nsIMsgThread GetThreadForMessage(in nsIMessage message);
|
nsIMsgThread GetThreadForMessage(in nsIMessage message);
|
||||||
boolean HasMessage(in nsIMessage message);
|
boolean HasMessage(in nsIMessage message);
|
||||||
nsIEnumerator GetVisibleSubFolders();
|
nsIEnumerator GetVisibleSubFolders();
|
||||||
|
|
|
@ -276,6 +276,12 @@ nsMsgFolder::GetMessages(nsISimpleEnumerator* *result)
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
nsMsgFolder::UpdateFolder()
|
||||||
|
{
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsMsgFolder::GetThreads(nsISimpleEnumerator ** threadEnumerator)
|
nsMsgFolder::GetThreads(nsISimpleEnumerator ** threadEnumerator)
|
||||||
{
|
{
|
||||||
|
|
|
@ -92,6 +92,8 @@ public:
|
||||||
NS_IMETHOD ReplaceElement(nsISupports* element, nsISupports* newElement);
|
NS_IMETHOD ReplaceElement(nsISupports* element, nsISupports* newElement);
|
||||||
NS_IMETHOD GetVisibleSubFolders(nsIEnumerator* *result);
|
NS_IMETHOD GetVisibleSubFolders(nsIEnumerator* *result);
|
||||||
NS_IMETHOD GetMessages(nsISimpleEnumerator* *result);
|
NS_IMETHOD GetMessages(nsISimpleEnumerator* *result);
|
||||||
|
NS_IMETHOD UpdateFolder();
|
||||||
|
|
||||||
NS_IMETHOD GetThreads(nsISimpleEnumerator ** threadEnumerator);
|
NS_IMETHOD GetThreads(nsISimpleEnumerator ** threadEnumerator);
|
||||||
NS_IMETHOD GetThreadForMessage(nsIMessage *message, nsIMsgThread **thread);
|
NS_IMETHOD GetThreadForMessage(nsIMessage *message, nsIMsgThread **thread);
|
||||||
NS_IMETHOD HasMessage(nsIMessage *message, PRBool *hasMessage);
|
NS_IMETHOD HasMessage(nsIMessage *message, PRBool *hasMessage);
|
||||||
|
|
|
@ -79,6 +79,7 @@ ComposeBEGetStringByIDREAL(PRInt32 stringID)
|
||||||
nsIStringBundle* sBundle = nsnull;
|
nsIStringBundle* sBundle = nsnull;
|
||||||
res = sBundleService->CreateBundle(url, locale, &sBundle);
|
res = sBundleService->CreateBundle(url, locale, &sBundle);
|
||||||
#endif
|
#endif
|
||||||
|
NS_RELEASE(sBundle);
|
||||||
if (NS_FAILED(res))
|
if (NS_FAILED(res))
|
||||||
{
|
{
|
||||||
return PL_strdup("???"); // Don't I18N this string...failsafe return value
|
return PL_strdup("???"); // Don't I18N this string...failsafe return value
|
||||||
|
@ -92,6 +93,7 @@ ComposeBEGetStringByIDREAL(PRInt32 stringID)
|
||||||
#else
|
#else
|
||||||
res = sBundle->GetStringFromID(stringID, v);
|
res = sBundle->GetStringFromID(stringID, v);
|
||||||
#endif
|
#endif
|
||||||
|
NS_RELEASE(sBundle);
|
||||||
if (NS_FAILED(res))
|
if (NS_FAILED(res))
|
||||||
{
|
{
|
||||||
char buf[128];
|
char buf[128];
|
||||||
|
|
|
@ -143,6 +143,9 @@ NS_IMETHODIMP nsMsgDatabase::NotifyKeyDeletedAll(nsMsgKey keyDeleted, nsMsgKey p
|
||||||
NS_IMETHODIMP nsMsgDatabase::NotifyKeyAddedAll(nsMsgKey keyAdded, nsMsgKey parentKey, PRInt32 flags,
|
NS_IMETHODIMP nsMsgDatabase::NotifyKeyAddedAll(nsMsgKey keyAdded, nsMsgKey parentKey, PRInt32 flags,
|
||||||
nsIDBChangeListener *instigator)
|
nsIDBChangeListener *instigator)
|
||||||
{
|
{
|
||||||
|
#ifdef DEBUG_bienvenu1
|
||||||
|
printf("notifying add of %ld parent %ld\n", keyAdded, parentKey);
|
||||||
|
#endif
|
||||||
if (m_ChangeListeners == nsnull)
|
if (m_ChangeListeners == nsnull)
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
for (PRInt32 i = 0; i < m_ChangeListeners->Count(); i++)
|
for (PRInt32 i = 0; i < m_ChangeListeners->Count(); i++)
|
||||||
|
|
|
@ -411,12 +411,11 @@ nsresult nsImapMailFolder::GetDatabase()
|
||||||
return folderOpen;
|
return folderOpen;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP nsImapMailFolder::GetMessages(nsISimpleEnumerator* *result)
|
NS_IMETHODIMP
|
||||||
|
nsImapMailFolder::UpdateFolder()
|
||||||
{
|
{
|
||||||
nsresult rv = NS_ERROR_NULL_POINTER;
|
nsresult rv = NS_ERROR_NULL_POINTER;
|
||||||
PRBool selectFolder = PR_FALSE;
|
PRBool selectFolder = PR_FALSE;
|
||||||
if (result)
|
|
||||||
*result = nsnull;
|
|
||||||
|
|
||||||
NS_WITH_SERVICE(nsIImapService, imapService, kCImapService, &rv);
|
NS_WITH_SERVICE(nsIImapService, imapService, kCImapService, &rv);
|
||||||
|
|
||||||
|
@ -455,7 +454,15 @@ NS_IMETHODIMP nsImapMailFolder::GetMessages(nsISimpleEnumerator* *result)
|
||||||
rv = imapService->SelectFolder(eventQ, this, this, nsnull, nsnull);
|
rv = imapService->SelectFolder(eventQ, this, this, nsnull, nsnull);
|
||||||
m_urlRunning = PR_TRUE;
|
m_urlRunning = PR_TRUE;
|
||||||
}
|
}
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
NS_IMETHODIMP nsImapMailFolder::GetMessages(nsISimpleEnumerator* *result)
|
||||||
|
{
|
||||||
|
if (result)
|
||||||
|
*result = nsnull;
|
||||||
|
nsresult rv = UpdateFolder();
|
||||||
if(NS_SUCCEEDED(rv))
|
if(NS_SUCCEEDED(rv))
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsISimpleEnumerator> msgHdrEnumerator;
|
nsCOMPtr<nsISimpleEnumerator> msgHdrEnumerator;
|
||||||
|
@ -2904,7 +2911,6 @@ nsImapMailFolder::CreateDirectoryForFolder(nsFileSpec &path) //** dup
|
||||||
return rv;
|
return rv;
|
||||||
|
|
||||||
nsFileSpec tempPath(path.GetNativePathCString(), PR_TRUE); // create incoming directories.
|
nsFileSpec tempPath(path.GetNativePathCString(), PR_TRUE); // create incoming directories.
|
||||||
// need bienvenu to fix this for real - the intent of this line is a mystery to sfraser and I
|
|
||||||
|
|
||||||
//If that doesn't exist, then we have to create this directory
|
//If that doesn't exist, then we have to create this directory
|
||||||
if(!path.IsDirectory())
|
if(!path.IsDirectory())
|
||||||
|
|
|
@ -106,6 +106,7 @@ public:
|
||||||
NS_IMETHOD AddUnique(nsISupports* element);
|
NS_IMETHOD AddUnique(nsISupports* element);
|
||||||
NS_IMETHOD ReplaceElement(nsISupports* element, nsISupports* newElement);
|
NS_IMETHOD ReplaceElement(nsISupports* element, nsISupports* newElement);
|
||||||
NS_IMETHOD GetMessages(nsISimpleEnumerator* *result);
|
NS_IMETHOD GetMessages(nsISimpleEnumerator* *result);
|
||||||
|
NS_IMETHOD UpdateFolder();
|
||||||
|
|
||||||
NS_IMETHOD CreateSubfolder(const char *folderName);
|
NS_IMETHOD CreateSubfolder(const char *folderName);
|
||||||
|
|
||||||
|
|
|
@ -500,6 +500,12 @@ nsresult nsMsgLocalMailFolder::GetDatabase()
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
nsMsgLocalMailFolder::UpdateFolder()
|
||||||
|
{
|
||||||
|
return GetDatabase(); // this will cause a reparse, if needed.
|
||||||
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsMsgLocalMailFolder::GetMessages(nsISimpleEnumerator* *result)
|
nsMsgLocalMailFolder::GetMessages(nsISimpleEnumerator* *result)
|
||||||
{
|
{
|
||||||
|
|
|
@ -85,7 +85,7 @@ public:
|
||||||
NS_IMETHOD AddUnique(nsISupports* element);
|
NS_IMETHOD AddUnique(nsISupports* element);
|
||||||
NS_IMETHOD ReplaceElement(nsISupports* element, nsISupports* newElement);
|
NS_IMETHOD ReplaceElement(nsISupports* element, nsISupports* newElement);
|
||||||
NS_IMETHOD GetMessages(nsISimpleEnumerator* *result);
|
NS_IMETHOD GetMessages(nsISimpleEnumerator* *result);
|
||||||
|
NS_IMETHOD UpdateFolder();
|
||||||
|
|
||||||
NS_IMETHOD CreateSubfolder(const char *folderName);
|
NS_IMETHOD CreateSubfolder(const char *folderName);
|
||||||
|
|
||||||
|
|
|
@ -369,39 +369,22 @@ nsresult nsMsgNewsFolder::GetDatabase()
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
nsMsgNewsFolder::UpdateFolder()
|
||||||
|
{
|
||||||
|
return GetNewMessages();
|
||||||
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsMsgNewsFolder::GetMessages(nsISimpleEnumerator* *result)
|
nsMsgNewsFolder::GetMessages(nsISimpleEnumerator* *result)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_NEWS
|
#ifdef DEBUG_NEWS
|
||||||
printf("nsMsgNewsFolder::GetMessages(%s)\n",mURI);
|
printf("nsMsgNewsFolder::GetMessages(%s)\n",mURI);
|
||||||
#endif
|
#endif
|
||||||
// number_to_show is a tempory hack to allow newsgroups
|
|
||||||
// with thousands of message to work. the way it works is
|
|
||||||
// we return a cropped enumerator back to to the caller
|
|
||||||
// instead of the full one. This gets around the problem
|
|
||||||
// where tree layout (and probably other things) don't scale
|
|
||||||
|
|
||||||
PRInt32 number_to_show;
|
|
||||||
nsresult rv = NS_OK;
|
nsresult rv = NS_OK;
|
||||||
|
|
||||||
NS_WITH_SERVICE(nsIPref, prefs, kPrefServiceCID, &rv);
|
|
||||||
if (NS_SUCCEEDED(rv) && prefs) {
|
|
||||||
rv = prefs->GetIntPref(PREF_NEWS_MAX_HEADERS_TO_SHOW, &number_to_show);
|
|
||||||
if (NS_FAILED(rv)) {
|
|
||||||
// failed to get the pref...show them all the headers
|
|
||||||
number_to_show = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// failed to get pref service...show them all headers
|
|
||||||
number_to_show = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// if the user asks for a negative value, I'll just ignore them
|
|
||||||
if (number_to_show < 0) {
|
|
||||||
number_to_show = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
rv = GetDatabase();
|
rv = GetDatabase();
|
||||||
*result = nsnull;
|
*result = nsnull;
|
||||||
|
|
||||||
|
|
|
@ -54,6 +54,7 @@ public:
|
||||||
NS_IMETHOD AddUnique(nsISupports* element);
|
NS_IMETHOD AddUnique(nsISupports* element);
|
||||||
NS_IMETHOD ReplaceElement(nsISupports* element, nsISupports* newElement);
|
NS_IMETHOD ReplaceElement(nsISupports* element, nsISupports* newElement);
|
||||||
NS_IMETHOD GetMessages(nsISimpleEnumerator* *result);
|
NS_IMETHOD GetMessages(nsISimpleEnumerator* *result);
|
||||||
|
NS_IMETHOD UpdateFolder();
|
||||||
|
|
||||||
NS_IMETHOD CreateSubfolder(const char *folderName);
|
NS_IMETHOD CreateSubfolder(const char *folderName);
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче