changes for subscribe. it needs to be general, not just for news, since imap

will use the subscribe dialog as well.

also, some minor changes, the humble beginnings of the hostinfo.dat support.
This commit is contained in:
sspitzer%netscape.com 2000-04-23 01:19:51 +00:00
Родитель 8200f0f780
Коммит 186a459557
7 изменённых файлов: 48 добавлений и 18 удалений

Просмотреть файл

@ -76,6 +76,7 @@ XPIDLSRCS = \
nsIMsgStringService.idl \
nsIMsgViewNavigationService.idl \
nsIMsgPrintEngine.idl \
nsISubscribableServer.idl \
$(NULL)
include $(topsrcdir)/config/rules.mk

Просмотреть файл

@ -61,6 +61,7 @@ XPIDLSRCS = \
.\nsIMsgStringService.idl \
.\nsIMsgViewNavigationService.idl \
.\nsIMsgPrintEngine.idl \
.\nsISubscribableServer.idl \
$(NULL)
################################################################################

Просмотреть файл

@ -36,14 +36,17 @@ function SetUpTree()
var folder = GetMsgFolderFromUri(gServerURI);
var server = folder.server;
/* todo: this should be server.buildSubscribeDatasource() which does the right thing with its server. for imap */
var nntpService = Components.classes['component://netscape/messenger/nntpservice'].getService(Components.interfaces.nsINntpService);
nntpService = nntpService.QueryInterface(Components.interfaces.nsINntpService);
nntpService.buildSubscribeDatasource(server);
try {
subscribableServer = server.QueryInterface(Components.interfaces.nsISubscribableServer);
subscribableServer.populateSubscribeDatasource(null /* eventual, a nsIMsgWindow */);
dump("root subscribe tree at: "+ gServerURI +"\n");
gSubscribeTree.setAttribute('ref',gServerURI);
}
catch (ex) {
dump("failed to populate subscribe ds: " + ex + "\n");
}
}
function SubscribeOnLoad()
{

Просмотреть файл

@ -42,7 +42,7 @@ 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);
void buildSubscribeDatasource(in nsINntpIncomingServer nntpServer, in nsIMsgWindow aMsgWindow);
void updateCounts(in nsINntpIncomingServer nntpServer, in nsIMsgWindow aMsgWindow);
};

Просмотреть файл

@ -36,6 +36,7 @@
#include "nsRDFCID.h"
#include "nsMsgNewsCID.h"
#include "nsNNTPProtocol.h"
#include "nsISubscribableServer.h"
#define NEW_NEWS_DIR_NAME "News"
#define PREF_MAIL_NEWSRC_ROOT "mail.newsrc_root"
@ -56,10 +57,14 @@ static NS_DEFINE_CID(kFileLocatorCID, NS_FILELOCATOR_CID);
static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
static NS_DEFINE_CID(kNntpServiceCID, NS_NNTPSERVICE_CID);
NS_IMPL_ISUPPORTS_INHERITED2(nsNntpIncomingServer,
nsMsgIncomingServer,
nsINntpIncomingServer,
nsIUrlListener);
NS_IMPL_ADDREF_INHERITED(nsNntpIncomingServer, nsMsgIncomingServer)
NS_IMPL_RELEASE_INHERITED(nsNntpIncomingServer, nsMsgIncomingServer)
NS_INTERFACE_MAP_BEGIN(nsNntpIncomingServer)
NS_INTERFACE_MAP_ENTRY(nsINntpIncomingServer)
NS_INTERFACE_MAP_ENTRY(nsIUrlListener)
NS_INTERFACE_MAP_ENTRY(nsISubscribableServer)
NS_INTERFACE_MAP_END_INHERITING(nsMsgIncomingServer)
nsNntpIncomingServer::nsNntpIncomingServer()
{
@ -68,6 +73,8 @@ nsNntpIncomingServer::nsNntpIncomingServer()
mNewsrcHasChanged = PR_FALSE;
mGroupsEnumerator = nsnull;
NS_NewISupportsArray(getter_AddRefs(m_connectionCache));
mHostInfoLoaded = PR_FALSE;
mHostInfoHasChanged = PR_FALSE;
}
@ -828,3 +835,17 @@ nsNntpIncomingServer::SubscribeToNewsgroup(const char *name)
return NS_OK;
}
NS_IMETHODIMP
nsNntpIncomingServer::PopulateSubscribeDatasource(nsIMsgWindow *aMsgWindow)
{
nsresult rv;
printf("in PopulateSubscribeDatasource()\n");
nsCOMPtr<nsINntpService> nntpService = do_GetService(kNntpServiceCID, &rv);
if (NS_FAILED(rv)) return rv;
if (!nntpService) return NS_ERROR_FAILURE;
rv = nntpService->BuildSubscribeDatasource(this, aMsgWindow);
if (NS_FAILED(rv)) return rv;
return NS_OK;
}

Просмотреть файл

@ -37,6 +37,7 @@
#include "nsEnumeratorUtils.h"
#include "nsIMsgWindow.h"
#include "nsISubscribableServer.h"
class nsINntpUrl;
class nsIMsgMailNewsUrl;
@ -44,13 +45,15 @@ class nsIMsgMailNewsUrl;
/* get some implementation from nsMsgIncomingServer */
class nsNntpIncomingServer : public nsMsgIncomingServer,
public nsINntpIncomingServer,
public nsIUrlListener
public nsIUrlListener,
public nsISubscribableServer
{
public:
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSINNTPINCOMINGSERVER
NS_DECL_NSIURLLISTENER
NS_DECL_NSISUBSCRIBABLESERVER
nsNntpIncomingServer();
virtual ~nsNntpIncomingServer();
@ -70,6 +73,8 @@ private:
nsresult SetNewsgroupAsSubscribed(const char *aName);
PRBool mNewsrcHasChanged;
nsAdapterEnumerator *mGroupsEnumerator;
PRBool mHostInfoLoaded;
PRBool mHostInfoHasChanged;
};
#endif

Просмотреть файл

@ -1291,7 +1291,7 @@ nsNntpService::UpdateCounts(nsINntpIncomingServer *aNntpServer, nsIMsgWindow *aM
}
NS_IMETHODIMP
nsNntpService::BuildSubscribeDatasource(nsINntpIncomingServer *aNntpServer)
nsNntpService::BuildSubscribeDatasource(nsINntpIncomingServer *aNntpServer, nsIMsgWindow *aMsgWindow)
{
nsresult rv;
#ifdef DEBUG_NEWS
@ -1318,8 +1318,7 @@ nsNntpService::BuildSubscribeDatasource(nsINntpIncomingServer *aNntpServer)
if (NS_FAILED(rv)) return rv;
// now run the url to add the rest of the groups
// TODO: pass in the nsIMsgWindow for progress.
rv = RunNewsUrl(uri, nsnull /* nsIMsgWindow */, nsnull);
rv = RunNewsUrl(uri, aMsgWindow, nsnull);
if (NS_FAILED(rv)) return rv;
return NS_OK;