зеркало из https://github.com/mozilla/pjs.git
fixed bug 39262 folder pane doesn't show [un]subscribe changes to imap folders; r=bienvenu, sspitzer
This commit is contained in:
Родитель
4ea8da2e4c
Коммит
4f1d1b600c
|
@ -333,7 +333,8 @@ function SubscribeOKCallback(serverURI, changeTable)
|
|||
|
||||
var folder = GetMsgFolderFromUri(serverURI);
|
||||
var server = folder.server;
|
||||
var subscribableServer = server.QueryInterface(Components.interfaces.nsISubscribableServer);
|
||||
var subscribableServer =
|
||||
server.QueryInterface(Components.interfaces.nsISubscribableServer);
|
||||
|
||||
for (var name in changeTable) {
|
||||
//dump(name + " = " + changeTable[name] + "\n");
|
||||
|
@ -349,6 +350,15 @@ function SubscribeOKCallback(serverURI, changeTable)
|
|||
//dump("no change to " + name + "\n");
|
||||
}
|
||||
}
|
||||
try {
|
||||
var imapServer =
|
||||
server.QueryInterface(Components.interfaces.nsIImapIncomingServer);
|
||||
if (imapServer)
|
||||
imapServer.reDiscoverAllFolders();
|
||||
}
|
||||
catch (ex) {
|
||||
//dump("*** not an imap server\n");
|
||||
}
|
||||
}
|
||||
|
||||
function SaveAsFile(message)
|
||||
|
|
|
@ -72,6 +72,6 @@ interface nsIImapIncomingServer : nsISupports {
|
|||
void PseudoInterruptMsgLoad(in nsIImapUrl aImapUrl, out boolean interrupted);
|
||||
void ResetConnection(in string folderName);
|
||||
void CreatePRUnicharStringFromUTF7(in string aSourceString, out wstring aUnicodeStr);
|
||||
|
||||
void reDiscoverAllFolders();
|
||||
attribute boolean doingLsub;
|
||||
};
|
||||
|
|
|
@ -657,7 +657,7 @@ nsImapIncomingServer::PerformExpand(nsIMsgWindow *aMsgWindow)
|
|||
|
||||
rv = pEventQService->GetThreadEventQueue(NS_CURRENT_THREAD, getter_AddRefs(queue));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = imapService->DiscoverAllFolders(queue, rootMsgFolder, nsnull, nsnull);
|
||||
rv = imapService->DiscoverAllFolders(queue, rootMsgFolder, this, nsnull);
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
@ -1439,6 +1439,44 @@ NS_IMETHODIMP nsImapIncomingServer::GetImapStringByID(PRInt32 aMsgId, PRUnichar
|
|||
return res;
|
||||
}
|
||||
|
||||
nsresult nsImapIncomingServer::ResetFoldersToUnverified(nsIFolder *parentFolder)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
if (!parentFolder) {
|
||||
nsCOMPtr<nsIFolder> rootFolder;
|
||||
rv = GetRootFolder(getter_AddRefs(rootFolder));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
return ResetFoldersToUnverified(rootFolder);
|
||||
}
|
||||
else {
|
||||
nsCOMPtr<nsIEnumerator> subFolders;
|
||||
nsCOMPtr<nsIMsgImapMailFolder> imapFolder =
|
||||
do_QueryInterface(parentFolder, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = imapFolder->SetVerifiedAsOnlineFolder(PR_FALSE);
|
||||
rv = parentFolder->GetSubFolders(getter_AddRefs(subFolders));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
nsAdapterEnumerator *simpleEnumerator = new
|
||||
nsAdapterEnumerator(subFolders);
|
||||
if (!simpleEnumerator) return NS_ERROR_OUT_OF_MEMORY;
|
||||
PRBool moreFolders = PR_FALSE;
|
||||
while (NS_SUCCEEDED(simpleEnumerator->HasMoreElements(&moreFolders))
|
||||
&& moreFolders) {
|
||||
nsCOMPtr<nsISupports> child;
|
||||
rv = simpleEnumerator->GetNext(getter_AddRefs(child));
|
||||
if (NS_SUCCEEDED(rv) && child) {
|
||||
nsCOMPtr<nsIFolder> childFolder = do_QueryInterface(child,
|
||||
&rv);
|
||||
if (NS_SUCCEEDED(rv) && childFolder) {
|
||||
rv = ResetFoldersToUnverified(childFolder);
|
||||
if (NS_FAILED(rv)) break;
|
||||
}
|
||||
}
|
||||
}
|
||||
delete simpleEnumerator;
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsresult nsImapIncomingServer::GetUnverifiedFolders(nsISupportsArray *aFoldersArray, PRInt32 *aNumUnverifiedFolders)
|
||||
{
|
||||
|
@ -1935,15 +1973,27 @@ nsImapIncomingServer::OnStartRunningUrl(nsIURI *url)
|
|||
NS_IMETHODIMP
|
||||
nsImapIncomingServer::OnStopRunningUrl(nsIURI *url, nsresult exitCode)
|
||||
{
|
||||
nsresult rv;
|
||||
nsresult rv = exitCode;
|
||||
|
||||
nsCOMPtr<nsIImapUrl> imapUrl = do_QueryInterface(url);
|
||||
if (imapUrl) {
|
||||
nsImapAction imapAction = nsIImapUrl::nsImapTest;
|
||||
imapUrl->GetImapAction(&imapAction);
|
||||
switch (imapAction) {
|
||||
case nsIImapUrl::nsImapDiscoverAllAndSubscribedBoxesUrl:
|
||||
case nsIImapUrl::nsImapDiscoverChildrenUrl:
|
||||
rv = UpdateSubscribedInSubscribeDS();
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
mDoingSubscribeDialog = PR_FALSE;
|
||||
|
||||
rv = StopPopulatingSubscribeDS();
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
break;
|
||||
case nsIImapUrl::nsImapDiscoverAllBoxesUrl:
|
||||
DiscoveryDone();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -2154,3 +2204,11 @@ nsImapIncomingServer::GetDoingLsub(PRBool *doingLsub)
|
|||
*doingLsub = mDoingLsub;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsImapIncomingServer::ReDiscoverAllFolders()
|
||||
{
|
||||
nsresult rv = ResetFoldersToUnverified(nsnull);
|
||||
rv = PerformExpand(nsnull);
|
||||
return rv;
|
||||
}
|
||||
|
|
|
@ -64,6 +64,7 @@ public:
|
|||
|
||||
protected:
|
||||
nsresult GetFolder(const char* name, nsIMsgFolder** pFolder);
|
||||
nsresult ResetFoldersToUnverified(nsIFolder *parentFolder);
|
||||
nsresult GetUnverifiedSubFolders(nsIFolder *parentFolder, nsISupportsArray *aFoldersArray, PRInt32 *aNumUnverifiedFolders);
|
||||
nsresult GetUnverifiedFolders(nsISupportsArray *aFolderArray, PRInt32 *aNumUnverifiedFolders);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче