зеркало из https://github.com/mozilla/pjs.git
Родитель
64478dedad
Коммит
01863be811
|
@ -20,6 +20,7 @@
|
|||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Håkan Waara <hwaara@chello.se>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
|
@ -38,50 +39,8 @@
|
|||
#include "msgCore.h"
|
||||
#include "nntpCore.h"
|
||||
#include "nsNewsUtils.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "prsystem.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsIMsgAccountManager.h"
|
||||
#include "nsIMsgIncomingServer.h"
|
||||
#include "nsINntpIncomingServer.h"
|
||||
#include "nsMsgBaseCID.h"
|
||||
#include "nsMsgUtils.h"
|
||||
#include "nsIRDFService.h"
|
||||
#include "nsIRDFResource.h"
|
||||
#include "nsRDFCID.h"
|
||||
#include "nsIMsgNewsFolder.h"
|
||||
#include "nsIFileSpec.h"
|
||||
|
||||
static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
|
||||
|
||||
static nsresult
|
||||
nsGetNewsServer(const char* username, const char *hostname,
|
||||
nsIMsgIncomingServer** aResult)
|
||||
{
|
||||
#ifdef DEBUG_NEWS
|
||||
printf("nsGetNewsServer(%s,%s,??)\n",username,hostname);
|
||||
#endif
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
// retrieve the AccountManager
|
||||
nsCOMPtr<nsIMsgAccountManager> accountManager =
|
||||
do_GetService(NS_MSGACCOUNTMANAGER_CONTRACTID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// find the news host
|
||||
nsCOMPtr<nsIMsgIncomingServer> server;
|
||||
rv = accountManager->FindServer(username,
|
||||
hostname,
|
||||
"nntp",
|
||||
getter_AddRefs(server));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
*aResult = server;
|
||||
NS_ADDREF(*aResult);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
/* parses NewsMessageURI */
|
||||
nsresult
|
||||
|
@ -114,27 +73,6 @@ nsParseNewsMessageURI(const char* uri, nsCString& folderURI, PRUint32 *key)
|
|||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsresult nsGetNewsGroupFromUri(const char *uri, nsIMsgNewsFolder **aFolder)
|
||||
{
|
||||
NS_ENSURE_ARG(aFolder);
|
||||
NS_ENSURE_ARG(uri);
|
||||
nsresult rv;
|
||||
|
||||
nsCOMPtr<nsIRDFService> rdf(do_GetService(kRDFServiceCID, &rv));
|
||||
if (NS_FAILED(rv)) return(rv);
|
||||
|
||||
nsCOMPtr<nsIRDFResource> resource;
|
||||
rv = rdf->GetResource(uri, getter_AddRefs(resource));
|
||||
if (NS_FAILED(rv)) return(rv);
|
||||
|
||||
rv = resource->QueryInterface(NS_GET_IID(nsIMsgNewsFolder), (void **) aFolder);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "uri is not for a news folder!");
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
if (!*aFolder) return NS_ERROR_FAILURE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsCreateNewsBaseMessageURI(const char *baseURI, char **baseMessageURI)
|
||||
{
|
||||
if(!baseMessageURI)
|
||||
|
|
|
@ -39,7 +39,6 @@
|
|||
#define NS_NEWSUTILS_H
|
||||
|
||||
#include "nsString.h"
|
||||
#include "nsIMsgIncomingServer.h"
|
||||
|
||||
class nsIMsgNewsFolder;
|
||||
|
||||
|
@ -55,7 +54,5 @@ nsParseNewsMessageURI(const char* uri, nsCString& messageUriWithoutKey, PRUint32
|
|||
extern nsresult
|
||||
nsCreateNewsBaseMessageURI(const char *baseURI, char **baseMessageURI);
|
||||
|
||||
extern nsresult nsGetNewsGroupFromUri(const char *uri, nsIMsgNewsFolder **aFolder);
|
||||
|
||||
#endif //NS_NEWSUTILS_H
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче