зеркало из https://github.com/mozilla/pjs.git
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:
Родитель
8200f0f780
Коммит
186a459557
|
@ -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,13 +36,16 @@ 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);
|
||||
dump("root subscribe tree at: "+ gServerURI +"\n");
|
||||
gSubscribeTree.setAttribute('ref',gServerURI);
|
||||
}
|
||||
catch (ex) {
|
||||
dump("failed to populate subscribe ds: " + ex + "\n");
|
||||
}
|
||||
}
|
||||
|
||||
function SubscribeOnLoad()
|
||||
|
|
|
@ -41,8 +41,8 @@ interface nsINntpService : nsISupports {
|
|||
nsIURI getNewNews (in nsINntpIncomingServer nntpServer, in string uri, in nsIUrlListener aUrlListener, in nsIMsgWindow aMsgWindow);
|
||||
|
||||
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,18 +57,24 @@ 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()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
|
||||
mNewsrcHasChanged = PR_FALSE;
|
||||
mGroupsEnumerator = nsnull;
|
||||
NS_NewISupportsArray(getter_AddRefs(m_connectionCache));
|
||||
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;
|
||||
|
|
Загрузка…
Ссылка в новой задаче