From 88616b2c9bc81cfbf246c078b4ffa72a2079a3ca Mon Sep 17 00:00:00 2001 From: "bienvenu%netscape.com" Date: Wed, 16 Jan 2002 03:19:22 +0000 Subject: [PATCH] use GetRootMsgFolder 119579 r/sr = sspitzer --- mailnews/news/src/nsNntpIncomingServer.cpp | 34 ++++++---------------- 1 file changed, 9 insertions(+), 25 deletions(-) diff --git a/mailnews/news/src/nsNntpIncomingServer.cpp b/mailnews/news/src/nsNntpIncomingServer.cpp index fa53f154703c..cfe32b6eabbd 100644 --- a/mailnews/news/src/nsNntpIncomingServer.cpp +++ b/mailnews/news/src/nsNntpIncomingServer.cpp @@ -775,12 +775,8 @@ nsNntpIncomingServer::SubscribeToNewsgroup(const char *name) if (!name) return NS_ERROR_NULL_POINTER; if (!nsCRT::strlen(name)) return NS_ERROR_FAILURE; - nsCOMPtr folder; - rv = GetRootFolder(getter_AddRefs(folder)); - if (NS_FAILED(rv)) return rv; - if (!folder) return NS_ERROR_FAILURE; - - nsCOMPtr msgfolder = do_QueryInterface(folder, &rv); + nsCOMPtr msgfolder; + rv = GetRootMsgFolder(getter_AddRefs(msgfolder)); if (NS_FAILED(rv)) return rv; if (!msgfolder) return NS_ERROR_FAILURE; @@ -1199,15 +1195,8 @@ nsNntpIncomingServer::Unsubscribe(const PRUnichar *aUnicharName) { nsresult rv; - nsCOMPtr rootFolder; - rv = GetRootFolder(getter_AddRefs(rootFolder)); - if (NS_FAILED(rv)) - return rv; - - if (!rootFolder) - return NS_ERROR_FAILURE; - - nsCOMPtr serverFolder = do_QueryInterface(rootFolder, &rv); + nsCOMPtr serverFolder; + rv = GetRootMsgFolder(getter_AddRefs(serverFolder)); if (NS_FAILED(rv)) return rv; @@ -1542,13 +1531,10 @@ nsNntpIncomingServer::FindGroup(const char *name, nsIMsgNewsFolder **result) NS_ENSURE_ARG_POINTER(result); nsresult rv; - nsCOMPtr rootFolder; - rv = GetRootFolder(getter_AddRefs(rootFolder)); + nsCOMPtr serverFolder; + rv = GetRootMsgFolder(getter_AddRefs(serverFolder)); NS_ENSURE_SUCCESS(rv,rv); - if (!rootFolder) return NS_ERROR_FAILURE; - nsCOMPtr serverFolder = do_QueryInterface(rootFolder, &rv); - NS_ENSURE_SUCCESS(rv,rv); if (!serverFolder) return NS_ERROR_FAILURE; nsCOMPtr subFolder; @@ -2012,15 +1998,13 @@ nsNntpIncomingServer::OnUserOrHostNameChanged(const char *oldName, const char *n // 3.Unsubscribe and then subscribe the existing groups to clean up the article numbers // in the rc file (this is because the old and new servers may maintain different // numbers for the same articles if both servers handle the same groups). - nsCOMPtr rootFolder; nsCOMPtr subFolders; - rv = GetRootFolder(getter_AddRefs(rootFolder)); - NS_ENSURE_SUCCESS(rv,rv); - nsCOMPtr serverFolder = do_QueryInterface(rootFolder, &rv); + nsCOMPtr serverFolder; + rv = GetRootMsgFolder(getter_AddRefs(serverFolder)); NS_ENSURE_SUCCESS(rv,rv); - rv = rootFolder->GetSubFolders(getter_AddRefs(subFolders)); + rv = serverFolder->GetSubFolders(getter_AddRefs(subFolders)); NS_ENSURE_SUCCESS(rv,rv); nsStringArray groupList;