зеркало из https://github.com/mozilla/gecko-dev.git
more work to get subscribe dialog to work with imap servers.
thanks to jefft@netscape.com for the imap help.
This commit is contained in:
Родитель
19d5868936
Коммит
e26ba25b81
|
@ -77,6 +77,7 @@ NS_INTERFACE_MAP_BEGIN(nsImapIncomingServer)
|
|||
NS_INTERFACE_MAP_ENTRY(nsIImapIncomingServer)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIMsgLogonRedirectionRequester)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISubscribableServer)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIUrlListener)
|
||||
NS_INTERFACE_MAP_END_INHERITING(nsMsgIncomingServer)
|
||||
|
||||
nsImapIncomingServer::nsImapIncomingServer()
|
||||
|
@ -88,6 +89,7 @@ nsImapIncomingServer::nsImapIncomingServer()
|
|||
m_capability = kCapabilityUndefined;
|
||||
m_waitingForConnectionInfo = PR_FALSE;
|
||||
m_redirectedLogonRetries = 0;
|
||||
mDoingSubscribeDialog = PR_FALSE;
|
||||
}
|
||||
|
||||
nsImapIncomingServer::~nsImapIncomingServer()
|
||||
|
@ -678,6 +680,7 @@ NS_IMETHODIMP nsImapIncomingServer::PossibleImapMailbox(const char *folderPath,
|
|||
PRBool explicitlyVerify = PR_FALSE;
|
||||
|
||||
if (!folderPath || !*folderPath) return NS_ERROR_NULL_POINTER;
|
||||
|
||||
nsCAutoString dupFolderPath = folderPath;
|
||||
if (dupFolderPath.Last() == '/')
|
||||
{
|
||||
|
@ -712,6 +715,7 @@ NS_IMETHODIMP nsImapIncomingServer::PossibleImapMailbox(const char *folderPath,
|
|||
folderName.Cut(0, leafPos + 1); // get rid of the parent name
|
||||
}
|
||||
|
||||
|
||||
nsCOMPtr<nsIFolder> rootFolder;
|
||||
rv = GetRootFolder(getter_AddRefs(rootFolder));
|
||||
|
||||
|
@ -740,6 +744,11 @@ NS_IMETHODIMP nsImapIncomingServer::PossibleImapMailbox(const char *folderPath,
|
|||
uri.Append('/');
|
||||
uri.Append(dupFolderPath);
|
||||
|
||||
if (mDoingSubscribeDialog) {
|
||||
rv = AddFolderToSubscribeDialog((const char *)parentUri, (const char *)uri,(const char *)folderName);
|
||||
return rv;
|
||||
}
|
||||
|
||||
a_nsIFolder->GetChildWithURI(uri, PR_TRUE, getter_AddRefs(child));
|
||||
|
||||
if (child)
|
||||
|
@ -1817,6 +1826,7 @@ nsImapIncomingServer::PopulateSubscribeDatasource(nsIMsgWindow *aMsgWindow)
|
|||
#ifdef DEBUG_sspitzer
|
||||
printf("in PopulateSubscribeDatasource()\n");
|
||||
#endif
|
||||
mDoingSubscribeDialog = PR_TRUE;
|
||||
|
||||
nsCOMPtr<nsIImapService> imapService = do_GetService(kImapServiceCID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
@ -1846,3 +1856,36 @@ nsImapIncomingServer::GetSubscribeListener(nsISubscribeListener **aListener)
|
|||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsImapIncomingServer::OnStartRunningUrl(nsIURI *url)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsImapIncomingServer::OnStopRunningUrl(nsIURI *url, nsresult exitCode)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
mDoingSubscribeDialog = PR_FALSE;
|
||||
|
||||
nsCOMPtr<nsISubscribeListener> listener;
|
||||
rv = GetSubscribeListener(getter_AddRefs(listener));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
if (!listener) return NS_ERROR_FAILURE;
|
||||
|
||||
printf("set all the subscribed folders as subscribed\n");
|
||||
|
||||
rv = listener->OnStopPopulating();
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsImapIncomingServer::AddFolderToSubscribeDialog(const char *parentUri, const char *uri,const char *folderName)
|
||||
{
|
||||
printf("AddFolderToSubscribeDialog(%s,%s,%s)\n",parentUri,uri,folderName);
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -31,13 +31,15 @@
|
|||
#include "nsIStringBundle.h"
|
||||
#include "nsIMsgLogonRedirector.h"
|
||||
#include "nsISubscribableServer.h"
|
||||
#include "nsIUrlListener.h"
|
||||
|
||||
/* get some implementation from nsMsgIncomingServer */
|
||||
class nsImapIncomingServer : public nsMsgIncomingServer,
|
||||
public nsIImapIncomingServer,
|
||||
public nsIImapServerSink,
|
||||
public nsIMsgLogonRedirectionRequester,
|
||||
public nsISubscribableServer
|
||||
public nsISubscribableServer,
|
||||
public nsIUrlListener
|
||||
|
||||
{
|
||||
public:
|
||||
|
@ -54,6 +56,7 @@ public:
|
|||
NS_DECL_NSIIMAPSERVERSINK
|
||||
NS_DECL_NSIMSGLOGONREDIRECTIONREQUESTER
|
||||
NS_DECL_NSISUBSCRIBABLESERVER
|
||||
NS_DECL_NSIURLLISTENER
|
||||
|
||||
NS_IMETHOD PerformBiff();
|
||||
NS_IMETHOD CloseCachedConnections();
|
||||
|
@ -85,7 +88,11 @@ private:
|
|||
PRBool m_waitingForConnectionInfo;
|
||||
PRInt32 m_redirectedLogonRetries;
|
||||
nsCOMPtr<nsIMsgLogonRedirector> m_logonRedirector;
|
||||
nsCOMPtr <nsISubscribeListener> mSubscribeListener;
|
||||
|
||||
// subscribe dialog stuff
|
||||
nsCOMPtr <nsISubscribeListener> mSubscribeListener;
|
||||
PRBool mDoingSubscribeDialog;
|
||||
nsresult AddFolderToSubscribeDialog(const char *parentUri, const char *uri,const char *folderName);
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -2144,7 +2144,6 @@ nsresult nsImapProtocol::BeginMessageDownLoad(
|
|||
{
|
||||
// create a pipe to pump the message into...the output will go to whoever
|
||||
// is consuming the message display
|
||||
nsresult rv;
|
||||
rv = NS_NewPipe(getter_AddRefs(m_channelInputStream), getter_AddRefs(m_channelOutputStream));
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "NS_NewPipe failed!");
|
||||
}
|
||||
|
@ -5256,6 +5255,11 @@ void nsImapProtocol::FindMailboxesIfNecessary()
|
|||
//PR_ExitMonitor(fFindingMailboxesMonitor);
|
||||
}
|
||||
|
||||
void nsImapProtocol::DiscoverAllAndSubscribedBoxes()
|
||||
{
|
||||
printf("jefft fix DiscoverAllAndSubscribedBoxes() to be like 4.x\n");
|
||||
DiscoverMailboxList();
|
||||
}
|
||||
|
||||
// DiscoverMailboxList() is used to actually do the discovery of folders
|
||||
// for a host. This is used both when we initially start up (and re-sync)
|
||||
|
@ -5826,11 +5830,7 @@ void nsImapProtocol::ProcessAuthenticatedStateURL()
|
|||
DiscoverMailboxList();
|
||||
break;
|
||||
case nsIImapUrl::nsImapDiscoverAllAndSubscribedBoxesUrl:
|
||||
NS_ASSERTION (GetSubscribingNow(),
|
||||
"Oops ... should not get here");
|
||||
#if NOT_YET
|
||||
DiscoverAllAndSubscribedBoxes();
|
||||
#endif
|
||||
break;
|
||||
case nsIImapUrl::nsImapCreateFolder:
|
||||
sourceMailbox = OnCreateServerSourceFolderPathString();
|
||||
|
@ -6770,7 +6770,6 @@ nsImapMockChannel::GetNotificationCallbacks(nsIInterfaceRequestor* *aNotificatio
|
|||
NS_IMETHODIMP
|
||||
nsImapMockChannel::SetNotificationCallbacks(nsIInterfaceRequestor* aNotificationCallbacks)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
mCallbacks = aNotificationCallbacks;
|
||||
|
||||
// Verify that the event sink is http
|
||||
|
|
|
@ -483,6 +483,7 @@ private:
|
|||
char * CreatePossibleTrashName(const char *prefix);
|
||||
PRBool FolderNeedsACLInitialized(const char *folderName);
|
||||
void DiscoverMailboxList();
|
||||
void DiscoverAllAndSubscribedBoxes();
|
||||
void MailboxDiscoveryFinished();
|
||||
void NthLevelChildList(const char *onlineMailboxPrefix, PRInt32 depth);
|
||||
void Lsub(const char *mailboxPattern, PRBool addDirectoryIfNecessary);
|
||||
|
|
|
@ -2754,20 +2754,31 @@ nsImapService::GetDefaultCopiesAndFoldersPrefsToServer(PRBool *aDefaultCopiesAnd
|
|||
NS_IMETHODIMP
|
||||
nsImapService::BuildSubscribeDatasource(nsIImapIncomingServer *aServer, nsIMsgWindow *aMsgWindow)
|
||||
{
|
||||
NS_ASSERTION(PR_FALSE,"imap subscribe doesn't work yet.");
|
||||
nsresult rv;
|
||||
|
||||
nsCOMPtr<nsISubscribeListener> listener;
|
||||
nsCOMPtr<nsISubscribableServer> server = do_QueryInterface(aServer,&rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
nsCOMPtr<nsIMsgIncomingServer> server = do_QueryInterface(aServer);
|
||||
if (!server) return NS_ERROR_FAILURE;
|
||||
|
||||
rv = server->GetSubscribeListener(getter_AddRefs(listener));
|
||||
nsCOMPtr<nsIFolder> rootFolder;
|
||||
rv = server->GetRootFolder(getter_AddRefs(rootFolder));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsIMsgFolder> rootMsgFolder = do_QueryInterface(rootFolder);
|
||||
if (!rootMsgFolder) return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIUrlListener> listener = do_QueryInterface(aServer);
|
||||
if (!listener) return NS_ERROR_FAILURE;
|
||||
|
||||
rv = listener->OnStopPopulating();
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsIEventQueue> queue;
|
||||
// get the Event Queue for this thread...
|
||||
NS_WITH_SERVICE(nsIEventQueueService, pEventQService, kEventQueueServiceCID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = pEventQService->GetThreadEventQueue(NS_CURRENT_THREAD, getter_AddRefs(queue));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = DiscoverAllAndSubscribedFolders(queue, rootMsgFolder, listener, nsnull);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче