add subscribe / unsubscribe to the nsISubscribable interface and use them.

This commit is contained in:
sspitzer%netscape.com 2000-05-13 04:41:52 +00:00
Родитель 74f213b360
Коммит 4ca2b3d567
5 изменённых файлов: 52 добавлений и 4 удалений

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

@ -45,5 +45,7 @@ interface nsISubscribableServer : nsISupports {
void addToSubscribeDS(in string aName);
void setAsSubscribedInSubscribeDS(in string aName);
void updateSubscribedInSubscribeDS();
void subscribe(in string name);
void unsubscribe(in string name);
};

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

@ -320,15 +320,19 @@ function SubscribeOKCallback(serverURI, changeTable)
dump("in SubscribeOKCallback(" + serverURI +")\n");
dump("change table = " + changeTable + "\n");
var folder = GetMsgFolderFromUri(serverURI);
var server = folder.server;
var subscribableServer = server.QueryInterface(Components.interfaces.nsISubscribableServer);
for (var name in changeTable) {
dump(name + " = " + changeTable[name] + "\n");
if (changeTable[name] == true) {
dump("subscribe to " + name +"\n");
// should this be SubscribeFolder()?
NewFolder(name,serverURI);
dump("from js, subscribe to " + name +"\n");
subscribableServer.subscribe(name);
}
else if (changeTable[name] == false) {
dump("unsubscribe to " + name +"\n");
dump("from js, unsubscribe to " + name +"\n");
subscribableServer.unsubscribe(name);
}
else {
dump("no change to " + name + "\n");

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

@ -335,3 +335,17 @@ nsSubscribableServer::PopulateSubscribeDatasource(nsIMsgWindow *aMsgWindow)
NS_ASSERTION(PR_FALSE,"override this.");
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP
nsSubscribableServer::Subscribe(const char *aName)
{
NS_ASSERTION(PR_FALSE,"override this.");
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP
nsSubscribableServer::Unsubscribe(const char *aName)
{
NS_ASSERTION(PR_FALSE,"override this.");
return NS_ERROR_FAILURE;
}

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

@ -1985,3 +1985,17 @@ nsImapIncomingServer::GetSubscribeListener(nsISubscribeListener **aListener)
if (!mInner) return NS_ERROR_FAILURE;
return mInner->GetSubscribeListener(aListener);
}
NS_IMETHODIMP
nsImapIncomingServer::Subscribe(const char *aName)
{
printf("subscribe to folder: %s\n",aName);
return NS_OK;
}
NS_IMETHODIMP
nsImapIncomingServer::Unsubscribe(const char *aName)
{
printf("unsubscribe to folder: %s\n",aName);
return NS_OK;
}

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

@ -793,3 +793,17 @@ nsNntpIncomingServer::GetSubscribeListener(nsISubscribeListener **aListener)
if (!mInner) return NS_ERROR_FAILURE;
return mInner->GetSubscribeListener(aListener);
}
NS_IMETHODIMP
nsNntpIncomingServer::Subscribe(const char *aName)
{
printf("subscribe to news group: %s\n",aName);
return SubscribeToNewsgroup(aName);
}
NS_IMETHODIMP
nsNntpIncomingServer::Unsubscribe(const char *aName)
{
printf("unsubscribe to news group: %s\n",aName);
return NS_OK;
}