зеркало из https://github.com/mozilla/gecko-dev.git
removing the nsISubscribeDialog* interfaces, they aren't being used.
change for the new subscribe dialog, which isn't turned on yet. r=bienvenu, a=leaf.
This commit is contained in:
Родитель
6fd7f42463
Коммит
da78ce03ea
|
@ -73,6 +73,7 @@
|
|||
#include "nsMsgViewNavigationService.h"
|
||||
|
||||
#include "nsMsgServiceProvider.h"
|
||||
#include "nsSubscribeDataSource.h"
|
||||
|
||||
#include "nsMsgPrintEngine.h"
|
||||
|
||||
|
@ -134,6 +135,9 @@ static NS_DEFINE_CID(kMsgViewNavigationServiceCID, NS_MSGVIEWNAVIGATIONSERVICE_C
|
|||
//MsgServiceProviderService
|
||||
static NS_DEFINE_CID(kMsgServiceProviderServiceCID, NS_MSGSERVICEPROVIDERSERVICE_CID);
|
||||
|
||||
//SubscribeDataSource
|
||||
static NS_DEFINE_CID(kSubscribeDataSourceCID, NS_SUBSCRIBEDATASOURCE_CID);
|
||||
|
||||
// Print Engine
|
||||
static NS_DEFINE_CID(kMsgPrintEngineCID, NS_MSG_PRINTENGINE_CID);
|
||||
|
||||
|
@ -161,6 +165,7 @@ NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsMessageView,Init)
|
|||
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsMsgWindow,Init)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsMsgViewNavigationService,Init)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsMsgServiceProviderService, Init);
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsSubscribeDataSource, Init);
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsMsgPrintEngine, Init)
|
||||
// Module implementation for the sample library
|
||||
class nsMsgBaseModule : public nsIModule
|
||||
|
@ -202,6 +207,7 @@ protected:
|
|||
nsCOMPtr<nsIGenericFactory> mMsgWindowFactory;
|
||||
nsCOMPtr<nsIGenericFactory> mMsgViewNavigationServiceFactory;
|
||||
nsCOMPtr<nsIGenericFactory> mMsgServiceProviderServiceFactory;
|
||||
nsCOMPtr<nsIGenericFactory> mSubscribeDataSourceFactory;
|
||||
nsCOMPtr<nsIGenericFactory> mMsgPrintEngineFactory;
|
||||
};
|
||||
|
||||
|
@ -254,6 +260,7 @@ void nsMsgBaseModule::Shutdown()
|
|||
mMsgWindowFactory = null_nsCOMPtr();
|
||||
mMsgViewNavigationServiceFactory = null_nsCOMPtr();
|
||||
mMsgServiceProviderServiceFactory = null_nsCOMPtr();
|
||||
mSubscribeDataSourceFactory = null_nsCOMPtr();
|
||||
}
|
||||
|
||||
// Create a factory object for creating instances of aClass.
|
||||
|
@ -415,6 +422,12 @@ NS_IMETHODIMP nsMsgBaseModule::GetClassObject(nsIComponentManager *aCompMgr,
|
|||
rv = NS_NewGenericFactory(getter_AddRefs(mMsgServiceProviderServiceFactory), &nsMsgServiceProviderServiceConstructor);
|
||||
fact = mMsgServiceProviderServiceFactory;
|
||||
}
|
||||
else if (aClass.Equals(kSubscribeDataSourceCID))
|
||||
{
|
||||
if (!mSubscribeDataSourceFactory)
|
||||
rv = NS_NewGenericFactory(getter_AddRefs(mSubscribeDataSourceFactory), &nsSubscribeDataSourceConstructor);
|
||||
fact = mSubscribeDataSourceFactory;
|
||||
}
|
||||
else if (aClass.Equals(kMsgPrintEngineCID))
|
||||
{
|
||||
if (!mMsgPrintEngineFactory)
|
||||
|
@ -488,7 +501,9 @@ static Components gComponents[] = {
|
|||
{ "Mail/News Print Engine", &kMsgPrintEngineCID,
|
||||
NS_MSGPRINTENGINE_PROGID},
|
||||
{ "Mail/News Service Provider Service", &kMsgServiceProviderServiceCID,
|
||||
NS_MSGSERVICEPROVIDERSERVICE_PROGID}
|
||||
NS_MSGSERVICEPROVIDERSERVICE_PROGID},
|
||||
{ "Mail/News Subscribe Data Source", &kSubscribeDataSourceCID,
|
||||
NS_SUBSCRIBEDATASOURCE_PROGID}
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -75,8 +75,6 @@ XPIDLSRCS = \
|
|||
nsIMsgStringService.idl \
|
||||
nsIMsgViewNavigationService.idl \
|
||||
nsIMsgPrintEngine.idl \
|
||||
nsISubscribeDialogListener.idl \
|
||||
nsISubscribeDialogMaster.idl \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
|
|
@ -60,8 +60,6 @@ XPIDLSRCS = \
|
|||
.\nsIMsgStringService.idl \
|
||||
.\nsIMsgViewNavigationService.idl \
|
||||
.\nsIMsgPrintEngine.idl \
|
||||
.\nsISubscribeDialogListener.idl \
|
||||
.\nsISubscribeDialogMaster.idl \
|
||||
$(NULL)
|
||||
|
||||
################################################################################
|
||||
|
|
|
@ -1,30 +0,0 @@
|
|||
/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Seth Spitzer <sspitzer@netscape.com>
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
[scriptable, uuid(5022d2b6-1dd2-11b2-917b-e88201dcfc0d)]
|
||||
interface nsISubscribeDialogListener: nsISupports {
|
||||
void AddItem(in wstring name, in boolean subscribed, in long count);
|
||||
};
|
||||
|
|
@ -1,31 +0,0 @@
|
|||
/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Seth Spitzer <sspitzer@netscape.com>
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
interface nsISubscribeDialogListener;
|
||||
|
||||
[scriptable, uuid(75d31250-1dd2-11b2-906c-e1de3ecf633f)]
|
||||
interface nsISubscribeDialogMaster: nsISupports {
|
||||
void populateSubscribeDialog(in nsISubscribeDialogListener listener);
|
||||
};
|
|
@ -46,4 +46,8 @@ interface nsINntpIncomingServer : nsISupports {
|
|||
void writeNewsrcFile();
|
||||
|
||||
attribute boolean newsrcHasChanged;
|
||||
|
||||
/* used when populating the subscribe dialog */
|
||||
void addNewNewsgroup(in string name, in string state, in string count);
|
||||
void addSubscribedNewsgroups();
|
||||
};
|
||||
|
|
|
@ -42,5 +42,6 @@ interface nsINntpService : nsISupports {
|
|||
|
||||
nsIURI cancelMessages (in string hostname, in string newsgroupname, in nsISupportsArray messages, in nsISupports aConsumer, in nsIUrlListener aUrlListener, in nsIMsgWindow aMsgWindow);
|
||||
|
||||
void buildSubscribeDatasource(in nsINntpIncomingServer nntpServer);
|
||||
};
|
||||
|
||||
|
|
|
@ -678,13 +678,16 @@ nsresult nsNNTPProtocol::LoadUrl(nsIURI * aURL, nsISupports * aConsumer)
|
|||
NS_WITH_SERVICE(nsIMsgAccountManager, accountManager, NS_MSGACCOUNTMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) goto FAIL;
|
||||
|
||||
// find the news host
|
||||
// find the incoming server
|
||||
nsCOMPtr<nsIMsgIncomingServer> server;
|
||||
rv = accountManager->FindServer(m_userName,
|
||||
m_hostName,
|
||||
"nntp",
|
||||
getter_AddRefs(server));
|
||||
if (NS_FAILED(rv)) goto FAIL;
|
||||
if (NS_FAILED(rv) || !server) goto FAIL;
|
||||
|
||||
m_nntpServer = do_QueryInterface(server, &rv);
|
||||
if (NS_FAILED(rv) || !m_nntpServer) goto FAIL;
|
||||
|
||||
PRBool isSecure = PR_FALSE;
|
||||
rv = server->GetIsSecure(&isSecure);
|
||||
|
@ -800,17 +803,19 @@ nsresult nsNNTPProtocol::LoadUrl(nsIURI * aURL, nsISupports * aConsumer)
|
|||
news://HOST/GROUP
|
||||
*/
|
||||
|
||||
nsXPIDLCString newsgroupURI;
|
||||
rv = aURL->GetSpec(getter_Copies(newsgroupURI));
|
||||
if (NS_FAILED(rv)) return(rv);
|
||||
|
||||
rv = InitializeNewsFolderFromUri((const char *)newsgroupURI);
|
||||
if (NS_FAILED(rv)) return(rv);
|
||||
|
||||
if (PL_strchr (group, '*'))
|
||||
if (PL_strchr (group, '*')) {
|
||||
m_typeWanted = LIST_WANTED;
|
||||
else
|
||||
}
|
||||
else {
|
||||
nsXPIDLCString newsgroupURI;
|
||||
rv = aURL->GetSpec(getter_Copies(newsgroupURI));
|
||||
if (NS_FAILED(rv)) return(rv);
|
||||
|
||||
rv = InitializeNewsFolderFromUri((const char *)newsgroupURI);
|
||||
if (NS_FAILED(rv)) return(rv);
|
||||
|
||||
m_typeWanted = GROUP_WANTED;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2824,6 +2829,8 @@ PRInt32 nsNNTPProtocol::BeginReadNewsList()
|
|||
PRInt32 status = 0;
|
||||
#ifdef UNREADY_CODE
|
||||
NET_Progress(ce->window_id, XP_GetString(XP_PROGRESS_RECEIVE_NEWSGROUP));
|
||||
#else
|
||||
printf("progress, receiving list of newsgroups...\n");
|
||||
#endif
|
||||
|
||||
return(status);
|
||||
|
@ -2835,6 +2842,7 @@ PRInt32 nsNNTPProtocol::BeginReadNewsList()
|
|||
|
||||
PRInt32 nsNNTPProtocol::ReadNewsList(nsIInputStream * inputStream, PRUint32 length)
|
||||
{
|
||||
nsresult rv;
|
||||
char * line;
|
||||
char * description;
|
||||
int i=0;
|
||||
|
@ -2895,10 +2903,21 @@ PRInt32 nsNNTPProtocol::ReadNewsList(nsIInputStream * inputStream, PRUint32 leng
|
|||
|
||||
line[i] = 0; /* terminate group name */
|
||||
|
||||
/* store all the group names
|
||||
*/
|
||||
/* store all the group names */
|
||||
#if 0
|
||||
m_newsHost->AddNewNewsgroup(line, 0, 0, "", PR_FALSE);
|
||||
#else
|
||||
NS_ASSERTION(m_nntpServer, "no nntp incoming server");
|
||||
if (m_nntpServer) {
|
||||
rv = m_nntpServer->AddNewNewsgroup(line, "false", "0");
|
||||
}
|
||||
else {
|
||||
rv = NS_ERROR_FAILURE;
|
||||
}
|
||||
#endif
|
||||
PR_FREEIF(line);
|
||||
|
||||
if (NS_FAILED(rv)) status = -1;
|
||||
return(status);
|
||||
}
|
||||
|
||||
|
|
|
@ -30,7 +30,11 @@
|
|||
#include "nsIFolder.h"
|
||||
#include "nsIFileSpec.h"
|
||||
#include "nsFileStream.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsINntpService.h"
|
||||
|
||||
#include "nsIRDFService.h"
|
||||
#include "nsRDFCID.h"
|
||||
|
||||
#ifdef DEBUG_seth
|
||||
#define DO_HASHING_OF_HOSTNAME 1
|
||||
|
@ -50,20 +54,13 @@
|
|||
#endif /* XP_UNIX || XP_BEOS */
|
||||
|
||||
static NS_DEFINE_CID(kPrefServiceCID, NS_PREF_CID);
|
||||
static NS_DEFINE_IID(kIFileLocatorIID, NS_IFILELOCATOR_IID);
|
||||
static NS_DEFINE_CID(kFileLocatorCID, NS_FILELOCATOR_CID);
|
||||
static NS_DEFINE_IID(kIFileLocatorIID, NS_IFILELOCATOR_IID);
|
||||
static NS_DEFINE_CID(kFileLocatorCID, NS_FILELOCATOR_CID);
|
||||
static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
|
||||
|
||||
#ifdef HAVE_REAL_SUBSCRIBE
|
||||
NS_IMPL_ISUPPORTS_INHERITED2(nsNntpIncomingServer,
|
||||
nsMsgIncomingServer,
|
||||
nsINntpIncomingServer,
|
||||
nsISubscribeDialogMaster);
|
||||
#else
|
||||
NS_IMPL_ISUPPORTS_INHERITED(nsNntpIncomingServer,
|
||||
nsMsgIncomingServer,
|
||||
nsINntpIncomingServer);
|
||||
#endif
|
||||
|
||||
|
||||
nsNntpIncomingServer::nsNntpIncomingServer()
|
||||
{
|
||||
|
@ -72,9 +69,13 @@ nsNntpIncomingServer::nsNntpIncomingServer()
|
|||
mNewsrcHasChanged = PR_FALSE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
nsNntpIncomingServer::~nsNntpIncomingServer()
|
||||
{
|
||||
CloseCachedConnections();
|
||||
nsresult rv;
|
||||
rv = CloseCachedConnections();
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "CloseCachedConnections failed");
|
||||
}
|
||||
|
||||
NS_IMPL_SERVERPREF_BOOL(nsNntpIncomingServer, NotifyOn, "notify.on");
|
||||
|
@ -304,23 +305,124 @@ nsNntpIncomingServer::CloseCachedConnections()
|
|||
return WriteNewsrcFile();
|
||||
}
|
||||
|
||||
#ifdef HAVE_REAL_SUBSCRIBE
|
||||
NS_IMETHODIMP
|
||||
nsNntpIncomingServer::PopulateSubscribeDialog(nsISubscribeDialogListener *listener)
|
||||
nsNntpIncomingServer::AddSubscribedNewsgroups()
|
||||
{
|
||||
nsresult rv;
|
||||
PRInt32 i;
|
||||
if (!listener) return NS_ERROR_FAILURE;
|
||||
nsCOMPtr<nsIEnumerator> subFolders;
|
||||
nsCOMPtr<nsIFolder> rootFolder;
|
||||
nsCOMPtr<nsIFolder> currFolder;
|
||||
|
||||
rv = GetRootFolder(getter_AddRefs(rootFolder));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsAutoString name;
|
||||
rv = rootFolder->GetSubFolders(getter_AddRefs(subFolders));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsAdapterEnumerator *simpleEnumerator = new nsAdapterEnumerator(subFolders);
|
||||
if (simpleEnumerator == nsnull) return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
PRBool moreFolders;
|
||||
|
||||
while (NS_SUCCEEDED(simpleEnumerator->HasMoreElements(&moreFolders)) && moreFolders) {
|
||||
nsCOMPtr<nsISupports> child;
|
||||
rv = simpleEnumerator->GetNext(getter_AddRefs(child));
|
||||
if (NS_SUCCEEDED(rv) && child) {
|
||||
currFolder = do_QueryInterface(child, &rv);
|
||||
if (NS_SUCCEEDED(rv) && currFolder) {
|
||||
nsXPIDLString name;
|
||||
rv = currFolder->GetName(getter_Copies(name));
|
||||
if (NS_SUCCEEDED(rv) && name) {
|
||||
nsCAutoString asciiName(name);
|
||||
rv = AddNewNewsgroup((const char *)asciiName,"true","0");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
delete simpleEnumerator;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNntpIncomingServer::AddNewNewsgroup(const char *aName, const char *aState, const char *aCount)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
NS_ASSERTION(aName,"attempting to add newsgroup with no name");
|
||||
if (!aName) return NS_ERROR_FAILURE;
|
||||
|
||||
#ifdef DEBUG_sspitzer
|
||||
printf("AddNewNewsgroup(%s)\n",aName);
|
||||
#endif
|
||||
nsXPIDLCString hostname;
|
||||
|
||||
rv = GetHostName(getter_Copies(hostname));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCAutoString serverUri;
|
||||
nsCAutoString groupUri;
|
||||
|
||||
serverUri = "news://";
|
||||
serverUri += (const char *)hostname;
|
||||
|
||||
groupUri = serverUri;
|
||||
groupUri += "/";
|
||||
groupUri += aName;
|
||||
|
||||
nsCOMPtr <nsIRDFService> rdfService = do_GetService(kRDFServiceCID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
if (!rdfService) return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIRDFResource> newsgroupResource;
|
||||
rv = rdfService->GetResource((const char *) groupUri, getter_AddRefs(newsgroupResource));
|
||||
|
||||
nsCOMPtr<nsIRDFLiteral> nameLiteral;
|
||||
nsAutoString nameString(aName);
|
||||
rv = rdfService->GetLiteral(nameString.GetUnicode(), getter_AddRefs(nameLiteral));
|
||||
if(NS_FAILED(rv)) return rv;
|
||||
nsCOMPtr<nsIRDFResource> kNC_Name;
|
||||
rv = rdfService->GetResource("http://home.netscape.com/NC-rdf#Name", getter_AddRefs(kNC_Name));
|
||||
if(NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsIRDFLiteral> subscribedLiteral;
|
||||
nsAutoString subscribedString(aState);
|
||||
rv = rdfService->GetLiteral(subscribedString.GetUnicode(), getter_AddRefs(subscribedLiteral));
|
||||
if(NS_FAILED(rv)) return rv;
|
||||
nsCOMPtr<nsIRDFResource> kNC_Subscribed;
|
||||
rv = rdfService->GetResource("http://home.netscape.com/NC-rdf#Subscribed", getter_AddRefs(kNC_Subscribed));
|
||||
if(NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsIRDFLiteral> countLiteral;
|
||||
nsAutoString countString(aCount);
|
||||
rv = rdfService->GetLiteral(countString.GetUnicode(), getter_AddRefs(countLiteral));
|
||||
if(NS_FAILED(rv)) return rv;
|
||||
nsCOMPtr<nsIRDFResource> kNC_Count;
|
||||
rv = rdfService->GetResource("http://home.netscape.com/NC-rdf#Count", getter_AddRefs(kNC_Count));
|
||||
if(NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsIRDFDataSource> ds;
|
||||
rv = rdfService->GetDataSource("rdf:subscribe",getter_AddRefs(ds));
|
||||
if(NS_FAILED(rv)) return rv;
|
||||
if (!ds) return NS_ERROR_FAILURE;
|
||||
|
||||
rv = ds->Assert(newsgroupResource, kNC_Name, nameLiteral, PR_TRUE);
|
||||
if(NS_FAILED(rv)) return rv;
|
||||
rv = ds->Assert(newsgroupResource, kNC_Subscribed, subscribedLiteral, PR_TRUE);
|
||||
if(NS_FAILED(rv)) return rv;
|
||||
rv = ds->Assert(newsgroupResource, kNC_Count, countLiteral, PR_TRUE);
|
||||
if(NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsIRDFResource> kNC_Child;
|
||||
rv = rdfService->GetResource("http://home.netscape.com/NC-rdf#child", getter_AddRefs(kNC_Child));
|
||||
if(NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsIRDFResource> kServer;
|
||||
rv = rdfService->GetResource((const char *)serverUri, getter_AddRefs(kServer));
|
||||
if(NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = ds->Assert(kServer, kNC_Child, newsgroupResource, PR_TRUE);
|
||||
if(NS_FAILED(rv)) return rv;
|
||||
|
||||
// simple test code for now.
|
||||
for (i=0;i<1000;i++) {
|
||||
name = "";
|
||||
name.Append(i);
|
||||
rv = listener->AddItem(name.GetUnicode(),PR_FALSE,i+2);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -34,37 +34,21 @@
|
|||
#include "plstr.h"
|
||||
#include "prprf.h"
|
||||
|
||||
#if defined(XP_WIN)
|
||||
#define HAVE_REAL_SUBSCRIBE 1
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_REAL_SUBSCRIBE
|
||||
#include "nsISubscribeDialogMaster.h"
|
||||
#include "nsISubscribeDialogListener.h"
|
||||
#endif
|
||||
|
||||
/* get some implementation from nsMsgIncomingServer */
|
||||
#ifdef HAVE_REAL_SUBSCRIBE
|
||||
class nsNntpIncomingServer : public nsMsgIncomingServer,
|
||||
public nsINntpIncomingServer,
|
||||
public nsISubscribeDialogMaster
|
||||
#else
|
||||
class nsNntpIncomingServer : public nsMsgIncomingServer,
|
||||
public nsINntpIncomingServer
|
||||
#endif
|
||||
|
||||
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSINNTPINCOMINGSERVER
|
||||
#ifdef HAVE_REAL_SUBSCRIBE
|
||||
NS_DECL_NSISUBSCRIBEDIALOGMASTER
|
||||
#endif
|
||||
|
||||
nsNntpIncomingServer();
|
||||
virtual ~nsNntpIncomingServer();
|
||||
|
||||
NS_IMETHOD GetLocalStoreType(char * *type);
|
||||
NS_IMETHOD CloseCachedConnections();
|
||||
|
||||
|
||||
private:
|
||||
PRBool mNewsrcHasChanged;
|
||||
|
|
|
@ -68,7 +68,6 @@ static NS_DEFINE_CID(kCNetSupportDialogCID, NS_NETSUPPORTDIALOG_CID);
|
|||
static NS_DEFINE_CID(kCPrefServiceCID, NS_PREF_CID);
|
||||
static NS_DEFINE_CID(kFileLocatorCID, NS_FILELOCATOR_CID);
|
||||
static NS_DEFINE_CID(kMsgAccountManagerCID, NS_MSGACCOUNTMANAGER_CID);
|
||||
|
||||
static NS_DEFINE_IID(kIFileLocatorIID, NS_IFILELOCATOR_IID);
|
||||
|
||||
nsNntpService::nsNntpService()
|
||||
|
@ -79,7 +78,7 @@ nsNntpService::nsNntpService()
|
|||
|
||||
nsNntpService::~nsNntpService()
|
||||
{
|
||||
// do nothing
|
||||
// do nothing
|
||||
}
|
||||
|
||||
NS_IMPL_THREADSAFE_ADDREF(nsNntpService);
|
||||
|
@ -90,7 +89,7 @@ NS_IMPL_QUERY_INTERFACE5(nsNntpService,
|
|||
nsIMsgMessageService,
|
||||
nsIProtocolHandler,
|
||||
nsIMsgProtocolInfo,
|
||||
nsICmdLineHandler)
|
||||
nsICmdLineHandler)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
// nsIMsgMessageService support
|
||||
|
@ -138,7 +137,7 @@ nsNntpService::SaveMessageToDisk(const char *aMessageURI,
|
|||
msgUrl->SetCanonicalLineEnding(canonicalLineEnding);
|
||||
}
|
||||
|
||||
RunNewsUrl(myuri, nsnull, nsnull);
|
||||
rv = RunNewsUrl(myuri, nsnull, nsnull);
|
||||
}
|
||||
|
||||
if (aURL)
|
||||
|
@ -811,7 +810,7 @@ nsresult nsNntpService::ConstructNntpUrl(const char * urlString, const char * ne
|
|||
|
||||
nsCOMPtr <nsIMsgMailNewsUrl> mailnewsurl = do_QueryInterface(nntpUrl);
|
||||
// don't worry this cast is really okay...there'a bug in XPIDL compiler that is preventing
|
||||
// a "cont char *" in paramemter for uri SetSpec...
|
||||
// a "const char *" in paramemter for uri SetSpec...
|
||||
mailnewsurl->SetSpec((char *) urlString);
|
||||
|
||||
if (newsgroupName != "") {
|
||||
|
@ -863,9 +862,7 @@ nsNntpService::RunNewsUrl(nsIURI * aUri, nsIMsgWindow *aMsgWindow, nsISupports *
|
|||
|
||||
NS_IMETHODIMP nsNntpService::GetNewNews(nsINntpIncomingServer *nntpServer, const char *uri, nsIUrlListener * aUrlListener, nsIMsgWindow *aMsgWindow, nsIURI **_retval)
|
||||
{
|
||||
if (!uri) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
if (!uri) return NS_ERROR_NULL_POINTER;
|
||||
|
||||
#ifdef DEBUG_NEWS
|
||||
printf("nsNntpService::GetNewNews(%s)\n", uri);
|
||||
|
@ -1168,4 +1165,40 @@ nsresult nsNntpService::DisplayMessageForPrinting(const char* aMessageURI, nsISu
|
|||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNntpService::BuildSubscribeDatasource(nsINntpIncomingServer *aNntpServer)
|
||||
{
|
||||
nsresult rv;
|
||||
#ifdef DEBUG_sspitzer
|
||||
printf("in BuildSubscribeDatasource()\n");
|
||||
#endif
|
||||
if (!aNntpServer) return NS_ERROR_NULL_POINTER;
|
||||
|
||||
nsCOMPtr<nsIURI> aUrl;
|
||||
nsCAutoString uriStr;
|
||||
uriStr = "news://";
|
||||
nsCOMPtr <nsIMsgIncomingServer> server = do_QueryInterface(aNntpServer);
|
||||
if (!server) return NS_ERROR_FAILURE;
|
||||
|
||||
nsXPIDLCString hostname;
|
||||
rv = server->GetHostName(getter_Copies(hostname));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
uriStr += (const char *)hostname;
|
||||
uriStr += "/*";
|
||||
|
||||
rv = ConstructNntpUrl((const char *)uriStr, "", nsMsgKey_None, nsnull, getter_AddRefs(aUrl));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// first add the newsgroups we are subscribed to.
|
||||
rv = aNntpServer->AddSubscribedNewsgroups();
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// now add the rest
|
||||
rv = RunNewsUrl(aUrl, nsnull, nsnull);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
CMDLINEHANDLER_IMPL(nsNntpService,"-news","general.startup.news","chrome://messenger/content/","Start with news.",NS_NEWSSTARTUPHANDLER_PROGID,"News Cmd Line Handler", PR_FALSE,"", PR_TRUE)
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include "nsIMsgWindow.h"
|
||||
#include "nsINntpUrl.h"
|
||||
#include "nsICmdLineHandler.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
class nsIURI;
|
||||
class nsIUrlListener;
|
||||
|
|
Загрузка…
Ссылка в новой задаче