зеркало из https://github.com/mozilla/gecko-dev.git
add subscribe / unsubscribe to the nsISubscribable interface and use them.
This commit is contained in:
Родитель
74f213b360
Коммит
4ca2b3d567
|
@ -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;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче