From bf69b9fd4529e3797620e70347d3a5e98c764409 Mon Sep 17 00:00:00 2001 From: "scott%scott-macgregor.org" Date: Fri, 25 May 2007 17:34:59 +0000 Subject: [PATCH] Bug #379070 --> string cleanup for nsImapHostSessionList. Patch by Nick Kreeger sr=mscott --- mailnews/imap/src/nsIMAPHostSessionList.cpp | 46 ++++----------------- 1 file changed, 7 insertions(+), 39 deletions(-) diff --git a/mailnews/imap/src/nsIMAPHostSessionList.cpp b/mailnews/imap/src/nsIMAPHostSessionList.cpp index cda50ca9362..2bb35fb62e3 100644 --- a/mailnews/imap/src/nsIMAPHostSessionList.cpp +++ b/mailnews/imap/src/nsIMAPHostSessionList.cpp @@ -143,7 +143,7 @@ nsIMAPHostInfo *nsIMAPHostSessionList::FindHost(const char *serverKey) // ### should also check userName here, if NON NULL for (host = fHostInfoList; host; host = host->fNextHost) { - if (host->fServerKey.Equals(serverKey,nsCaseInsensitiveCStringComparator())) + if (host->fServerKey.Equals(serverKey, nsCaseInsensitiveCStringComparator())) return host; } return host; @@ -240,7 +240,6 @@ NS_IMETHODIMP nsIMAPHostSessionList::SetPasswordVerifiedOnline(const char *serve NS_IMETHODIMP nsIMAPHostSessionList::GetPasswordVerifiedOnline(const char *serverKey, PRBool &result) { - PR_EnterMonitor(gCachedHostInfoMonitor); nsIMAPHostInfo *host = FindHost(serverKey); if (host) @@ -274,8 +273,7 @@ NS_IMETHODIMP nsIMAPHostSessionList::SetOnlineDirForHost(const char *serverKey, return (host == NULL) ? NS_ERROR_ILLEGAL_VALUE : NS_OK; } -NS_IMETHODIMP nsIMAPHostSessionList::GetDeleteIsMoveToTrashForHost( - const char *serverKey, PRBool &result) +NS_IMETHODIMP nsIMAPHostSessionList::GetDeleteIsMoveToTrashForHost(const char *serverKey, PRBool &result) { PR_EnterMonitor(gCachedHostInfoMonitor); nsIMAPHostInfo *host = FindHost(serverKey); @@ -285,8 +283,7 @@ NS_IMETHODIMP nsIMAPHostSessionList::GetDeleteIsMoveToTrashForHost( return (host == NULL) ? NS_ERROR_ILLEGAL_VALUE : NS_OK; } -NS_IMETHODIMP nsIMAPHostSessionList::GetShowDeletedMessagesForHost( - const char *serverKey, PRBool &result) +NS_IMETHODIMP nsIMAPHostSessionList::GetShowDeletedMessagesForHost(const char *serverKey, PRBool &result) { PR_EnterMonitor(gCachedHostInfoMonitor); nsIMAPHostInfo *host = FindHost(serverKey); @@ -296,8 +293,7 @@ NS_IMETHODIMP nsIMAPHostSessionList::GetShowDeletedMessagesForHost( return (host == NULL) ? NS_ERROR_ILLEGAL_VALUE : NS_OK; } -NS_IMETHODIMP nsIMAPHostSessionList::SetDeleteIsMoveToTrashForHost( - const char *serverKey, PRBool isMoveToTrash) +NS_IMETHODIMP nsIMAPHostSessionList::SetDeleteIsMoveToTrashForHost(const char *serverKey, PRBool isMoveToTrash) { PR_EnterMonitor(gCachedHostInfoMonitor); nsIMAPHostInfo *host = FindHost(serverKey); @@ -307,8 +303,7 @@ NS_IMETHODIMP nsIMAPHostSessionList::SetDeleteIsMoveToTrashForHost( return (host == NULL) ? NS_ERROR_ILLEGAL_VALUE : NS_OK; } -NS_IMETHODIMP nsIMAPHostSessionList::SetShowDeletedMessagesForHost( - const char *serverKey, PRBool showDeletedMessages) +NS_IMETHODIMP nsIMAPHostSessionList::SetShowDeletedMessagesForHost(const char *serverKey, PRBool showDeletedMessages) { PR_EnterMonitor(gCachedHostInfoMonitor); nsIMAPHostInfo *host = FindHost(serverKey); @@ -318,8 +313,7 @@ NS_IMETHODIMP nsIMAPHostSessionList::SetShowDeletedMessagesForHost( return (host == NULL) ? NS_ERROR_ILLEGAL_VALUE : NS_OK; } -NS_IMETHODIMP nsIMAPHostSessionList::GetGotNamespacesForHost( - const char *serverKey, PRBool &result) +NS_IMETHODIMP nsIMAPHostSessionList::GetGotNamespacesForHost(const char *serverKey, PRBool &result) { PR_EnterMonitor(gCachedHostInfoMonitor); nsIMAPHostInfo *host = FindHost(serverKey); @@ -329,8 +323,7 @@ NS_IMETHODIMP nsIMAPHostSessionList::GetGotNamespacesForHost( return (host == NULL) ? NS_ERROR_ILLEGAL_VALUE : NS_OK; } -NS_IMETHODIMP nsIMAPHostSessionList::SetGotNamespacesForHost( - const char *serverKey, PRBool gotNamespaces) +NS_IMETHODIMP nsIMAPHostSessionList::SetGotNamespacesForHost(const char *serverKey, PRBool gotNamespaces) { PR_EnterMonitor(gCachedHostInfoMonitor); nsIMAPHostInfo *host = FindHost(serverKey); @@ -414,7 +407,6 @@ NS_IMETHODIMP nsIMAPHostSessionList::SetOnlineTrashFolderExistsForHost(const cha NS_IMETHODIMP nsIMAPHostSessionList::GetOnlineTrashFolderExistsForHost(const char *serverKey, PRBool &result) { - PR_EnterMonitor(gCachedHostInfoMonitor); nsIMAPHostInfo *host = FindHost(serverKey); if (host) @@ -428,9 +420,7 @@ NS_IMETHODIMP nsIMAPHostSessionList::AddNewNamespaceForHost(const char *serverKe PR_EnterMonitor(gCachedHostInfoMonitor); nsIMAPHostInfo *host = FindHost(serverKey); if (host) - { host->fNamespaceList->AddNewNamespace(ns); - } PR_ExitMonitor(gCachedHostInfoMonitor); return (host == NULL) ? NS_ERROR_ILLEGAL_VALUE : NS_OK; } @@ -473,9 +463,7 @@ NS_IMETHODIMP nsIMAPHostSessionList::GetNamespaceForMailboxForHost(const char *s PR_EnterMonitor(gCachedHostInfoMonitor); nsIMAPHostInfo *host = FindHost(serverKey); if (host) - { result = host->fNamespaceList->GetNamespaceForMailbox(mailbox_name); - } PR_ExitMonitor(gCachedHostInfoMonitor); return (host == NULL) ? NS_ERROR_ILLEGAL_VALUE : NS_OK; } @@ -486,9 +474,7 @@ NS_IMETHODIMP nsIMAPHostSessionList::ClearPrefsNamespacesForHost(const char *ser PR_EnterMonitor(gCachedHostInfoMonitor); nsIMAPHostInfo *host = FindHost(serverKey); if (host) - { host->fNamespaceList->ClearNamespaces(PR_TRUE, PR_FALSE, PR_TRUE); - } PR_ExitMonitor(gCachedHostInfoMonitor); return (host == NULL) ? NS_ERROR_ILLEGAL_VALUE : NS_OK; } @@ -499,9 +485,7 @@ NS_IMETHODIMP nsIMAPHostSessionList::ClearServerAdvertisedNamespacesForHost(cons PR_EnterMonitor(gCachedHostInfoMonitor); nsIMAPHostInfo *host = FindHost(serverKey); if (host) - { host->fNamespaceList->ClearNamespaces(PR_FALSE, PR_TRUE, PR_TRUE); - } PR_ExitMonitor(gCachedHostInfoMonitor); return (host == NULL) ? NS_ERROR_ILLEGAL_VALUE : NS_OK; } @@ -511,9 +495,7 @@ NS_IMETHODIMP nsIMAPHostSessionList::GetDefaultNamespaceOfTypeForHost(const char PR_EnterMonitor(gCachedHostInfoMonitor); nsIMAPHostInfo *host = FindHost(serverKey); if (host) - { result = host->fNamespaceList->GetDefaultNamespaceOfType(type); - } PR_ExitMonitor(gCachedHostInfoMonitor); return (host == NULL) ? NS_ERROR_ILLEGAL_VALUE : NS_OK; } @@ -545,9 +527,7 @@ NS_IMETHODIMP nsIMAPHostSessionList::GetNumberOfNamespacesForHost(const char *se PR_EnterMonitor(gCachedHostInfoMonitor); nsIMAPHostInfo *host = FindHost(serverKey); if (host) - { intResult = host->fNamespaceList->GetNumberOfNamespaces(); - } PR_ExitMonitor(gCachedHostInfoMonitor); NS_ASSERTION(intResult >= 0, "negative number of namespaces"); result = (PRUint32) intResult; @@ -559,9 +539,7 @@ NS_IMETHODIMP nsIMAPHostSessionList::GetNamespaceNumberForHost(const char *serve PR_EnterMonitor(gCachedHostInfoMonitor); nsIMAPHostInfo *host = FindHost(serverKey); if (host) - { result = host->fNamespaceList->GetNamespaceNumber(n); - } PR_ExitMonitor(gCachedHostInfoMonitor); return (host == NULL) ? NS_ERROR_ILLEGAL_VALUE : NS_OK; } @@ -618,9 +596,7 @@ NS_IMETHODIMP nsIMAPHostSessionList::CommitNamespacesForHost(nsIImapIncomingServ int32 numInNS = host->fNamespaceList->GetNumberOfNamespaces(type); if (numInNS == 0) - { SetNamespacesPrefForHost(aHost, type, ""); - } else if (numInNS >= 1) { char *pref = PR_smprintf(""); @@ -664,9 +640,7 @@ NS_IMETHODIMP nsIMAPHostSessionList::FlushUncommittedNamespacesForHost(const cha PR_EnterMonitor(gCachedHostInfoMonitor); nsIMAPHostInfo *host = FindHost(serverKey); if (host) - { host->fTempNamespaceList->ClearNamespaces(PR_TRUE, PR_TRUE, PR_TRUE); - } PR_ExitMonitor(gCachedHostInfoMonitor); return (host == NULL) ? NS_ERROR_ILLEGAL_VALUE : NS_OK; } @@ -688,9 +662,7 @@ NS_IMETHODIMP nsIMAPHostSessionList::GetOnlineInboxPathForHost(const char *serve } } else - { result.SetLength(0); - } PR_ExitMonitor(gCachedHostInfoMonitor); return (host == NULL) ? NS_ERROR_ILLEGAL_VALUE : NS_OK; } @@ -727,9 +699,7 @@ NS_IMETHODIMP nsIMAPHostSessionList::SetNamespaceHierarchyDelimiterFromMailboxFo { nsIMAPNamespace *ns = host->fNamespaceList->GetNamespaceForMailbox(boxName); if (ns && !ns->GetIsDelimiterFilledIn()) - { ns->SetDelimiter(delimiter, PR_TRUE); - } } PR_ExitMonitor(gCachedHostInfoMonitor); return (host) ? NS_OK : NS_ERROR_ILLEGAL_VALUE ; @@ -765,10 +735,8 @@ NS_IMETHODIMP nsIMAPHostSessionList::FindShellInCacheForHost(const char *serverK PR_EnterMonitor(gCachedHostInfoMonitor); nsIMAPHostInfo *host = FindHost(serverKey); if (host) - { if (host->fShellCache) *shell = host->fShellCache->FindShellForUID(uidString, mailboxName, modType); - } PR_ExitMonitor(gCachedHostInfoMonitor); return (host == NULL) ? NS_ERROR_ILLEGAL_VALUE : NS_OK; }