make the subscribe i18n friendly when drilling down to find imap folders.

I need to use the folder path, not the folder name.  r=mscott
This commit is contained in:
sspitzer%netscape.com 2000-06-01 03:59:14 +00:00
parent 48fe888b7b
commit 97504bf2d6
7 changed files with 32 additions and 22 deletions

View File

@ -37,7 +37,7 @@ interface nsISubscribableServer : nsISupports {
void setIncomingServer(in nsIMsgIncomingServer server); void setIncomingServer(in nsIMsgIncomingServer server);
void setDelimiter(in char delimiter); void setDelimiter(in char delimiter);
void populateSubscribeDatasource(in nsIMsgWindow aMsgWindow, in boolean forceToServer); void populateSubscribeDatasource(in nsIMsgWindow aMsgWindow, in boolean forceToServer);
void populateSubscribeDatasourceWithName(in nsIMsgWindow aMsgWindow, in boolean forceToServer, in string name); void populateSubscribeDatasourceWithPath(in nsIMsgWindow aMsgWindow, in boolean forceToServer, in string path);
attribute nsISubscribeListener subscribeListener; attribute nsISubscribeListener subscribeListener;
void startPopulatingSubscribeDS(); void startPopulatingSubscribeDS();
void stopPopulatingSubscribeDS(); void stopPopulatingSubscribeDS();

View File

@ -328,13 +328,23 @@ function SubscribeOnClick(event)
var treeitem = event.target.parentNode.parentNode.parentNode; var treeitem = event.target.parentNode.parentNode.parentNode;
var open = treeitem.getAttribute('open'); var open = treeitem.getAttribute('open');
if(open == "true") { if(open == "true") {
var name = treeitem.getAttribute("name"); var uri = treeitem.getAttribute("id");
dump("do twisty for " + name +"\n");
// we need the path here, so if the uri is:
// imap://sspitzer@nsmail-1/foo/bar
// we want foo/bar
//
// why not use the "name" attribute?
// for i18n, we need the folder path, which is not the same
// the folder path (of the uri) will have UTF7
// the name has UTF8
var path = uri.substring(gServerURI.length + 1,uri.length);
dump("do twisty for " + path + "\n");
// Turn progress meter on. // Turn progress meter on.
gStatusBar.setAttribute("mode","undetermined"); gStatusBar.setAttribute("mode","undetermined");
gSubscribableServer.populateSubscribeDatasourceWithName(null /* eventually, a nsIMsgWindow */, true /* force to server */, name); gSubscribableServer.populateSubscribeDatasourceWithPath(null /* eventually, a nsIMsgWindow */, true /* force to server */, path);
} }
} }
else { else {

View File

@ -452,7 +452,7 @@ nsSubscribableServer::SubscribeCleanup()
} }
NS_IMETHODIMP NS_IMETHODIMP
nsSubscribableServer::PopulateSubscribeDatasourceWithName(nsIMsgWindow *aMsgWindow, PRBool aForceToServer, const char *name) nsSubscribableServer::PopulateSubscribeDatasourceWithPath(nsIMsgWindow *aMsgWindow, PRBool aForceToServer, const char *path)
{ {
NS_ASSERTION(PR_FALSE,"override this."); NS_ASSERTION(PR_FALSE,"override this.");
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;

View File

@ -140,13 +140,13 @@ interface nsIImapService : nsISupports
void discoverChildren(in nsIEventQueue aClientEventQueue, void discoverChildren(in nsIEventQueue aClientEventQueue,
in nsIMsgFolder aImapMailFolder, in nsIMsgFolder aImapMailFolder,
in nsIUrlListener aUrlListener, in nsIUrlListener aUrlListener,
in string name, in string folderPath,
out nsIURI aURL); out nsIURI aURL);
void discoverLevelChildren(in nsIEventQueue aClientEventQueue, void discoverLevelChildren(in nsIEventQueue aClientEventQueue,
in nsIMsgFolder aImapMailFolder, in nsIMsgFolder aImapMailFolder,
in nsIUrlListener aUrlListener, in nsIUrlListener aUrlListener,
in string name, in string folderPath,
in long aLevel, in long aLevel,
out nsIURI aURL); out nsIURI aURL);
@ -205,5 +205,5 @@ interface nsIImapService : nsISupports
in nsIUrlListener aUrlListener); in nsIUrlListener aUrlListener);
void buildSubscribeDatasource(in nsIImapIncomingServer aServer, in nsIMsgWindow aMsgWindow); void buildSubscribeDatasource(in nsIImapIncomingServer aServer, in nsIMsgWindow aMsgWindow);
void buildSubscribeDatasourceWithName(in nsIImapIncomingServer aServer, in nsIMsgWindow aMsgWindow, in string name); void buildSubscribeDatasourceWithPath(in nsIImapIncomingServer aServer, in nsIMsgWindow aMsgWindow, in string folderPath);
}; };

View File

@ -1839,11 +1839,11 @@ NS_IMETHODIMP nsImapIncomingServer::OnLogonRedirectionReply(const PRUnichar *pHo
} }
NS_IMETHODIMP NS_IMETHODIMP
nsImapIncomingServer::PopulateSubscribeDatasourceWithName(nsIMsgWindow *aMsgWindow, PRBool aForceToServer /*ignored*/, const char *name) nsImapIncomingServer::PopulateSubscribeDatasourceWithPath(nsIMsgWindow *aMsgWindow, PRBool aForceToServer /*ignored*/, const char *path)
{ {
nsresult rv; nsresult rv;
#ifdef DEBUG_sspitzer #ifdef DEBUG_sspitzer
printf("in PopulateSubscribeDatasourceWithName(%s)\n",name); printf("in PopulateSubscribeDatasourceWithPath(%s)\n",path);
#endif #endif
mDoingSubscribeDialog = PR_TRUE; mDoingSubscribeDialog = PR_TRUE;
@ -1855,7 +1855,7 @@ nsImapIncomingServer::PopulateSubscribeDatasourceWithName(nsIMsgWindow *aMsgWind
if (NS_FAILED(rv)) return rv; if (NS_FAILED(rv)) return rv;
if (!imapService) return NS_ERROR_FAILURE; if (!imapService) return NS_ERROR_FAILURE;
rv = imapService->BuildSubscribeDatasourceWithName(this, aMsgWindow, name); rv = imapService->BuildSubscribeDatasourceWithPath(this, aMsgWindow, path);
if (NS_FAILED(rv)) return rv; if (NS_FAILED(rv)) return rv;
return NS_OK; return NS_OK;

View File

@ -1503,7 +1503,7 @@ NS_IMETHODIMP
nsImapService::DiscoverChildren(nsIEventQueue* aClientEventQueue, nsImapService::DiscoverChildren(nsIEventQueue* aClientEventQueue,
nsIMsgFolder* aImapMailFolder, nsIMsgFolder* aImapMailFolder,
nsIUrlListener* aUrlListener, nsIUrlListener* aUrlListener,
const char *folderName, const char *folderPath,
nsIURI** aURL) nsIURI** aURL)
{ {
NS_ASSERTION (aImapMailFolder && aClientEventQueue, NS_ASSERTION (aImapMailFolder && aClientEventQueue,
@ -1524,13 +1524,13 @@ nsImapService::DiscoverChildren(nsIEventQueue* aClientEventQueue,
if (NS_SUCCEEDED(rv)) if (NS_SUCCEEDED(rv))
{ {
if (folderName && (nsCRT::strlen(folderName) > 0)) if (folderPath && (nsCRT::strlen(folderPath) > 0))
{ {
nsCOMPtr<nsIURI> uri = do_QueryInterface(aImapUrl); nsCOMPtr<nsIURI> uri = do_QueryInterface(aImapUrl);
urlSpec.Append("/discoverchildren>"); urlSpec.Append("/discoverchildren>");
urlSpec.AppendWithConversion(hierarchySeparator); urlSpec.AppendWithConversion(hierarchySeparator);
urlSpec.Append(folderName); urlSpec.Append(folderPath);
// mscott - this cast to a char * is okay...there's a bug in the XPIDL // mscott - this cast to a char * is okay...there's a bug in the XPIDL
// compiler that is preventing in string parameters from showing up as // compiler that is preventing in string parameters from showing up as
// const char *. hopefully they will fix it soon. // const char *. hopefully they will fix it soon.
@ -1553,7 +1553,7 @@ NS_IMETHODIMP
nsImapService::DiscoverLevelChildren(nsIEventQueue* aClientEventQueue, nsImapService::DiscoverLevelChildren(nsIEventQueue* aClientEventQueue,
nsIMsgFolder* aImapMailFolder, nsIMsgFolder* aImapMailFolder,
nsIUrlListener* aUrlListener, nsIUrlListener* aUrlListener,
const char *folderName, const char *folderPath,
PRInt32 level, PRInt32 level,
nsIURI** aURL) nsIURI** aURL)
{ {
@ -1574,13 +1574,13 @@ nsImapService::DiscoverLevelChildren(nsIEventQueue* aClientEventQueue,
if (NS_SUCCEEDED(rv)) if (NS_SUCCEEDED(rv))
{ {
if (folderName && (nsCRT::strlen(folderName) > 0)) if (folderPath && (nsCRT::strlen(folderPath) > 0))
{ {
nsCOMPtr<nsIURI> uri = do_QueryInterface(aImapUrl); nsCOMPtr<nsIURI> uri = do_QueryInterface(aImapUrl);
urlSpec.Append("/discoverlevelchildren>"); urlSpec.Append("/discoverlevelchildren>");
urlSpec.AppendInt(level); urlSpec.AppendInt(level);
urlSpec.AppendWithConversion(hierarchySeparator); // hierarchySeparator "/" urlSpec.AppendWithConversion(hierarchySeparator); // hierarchySeparator "/"
urlSpec.Append(folderName); urlSpec.Append(folderPath);
rv = uri->SetSpec((char *) urlSpec.GetBuffer()); rv = uri->SetSpec((char *) urlSpec.GetBuffer());
if (NS_SUCCEEDED(rv)) if (NS_SUCCEEDED(rv))
@ -2758,12 +2758,12 @@ nsImapService::GetDefaultCopiesAndFoldersPrefsToServer(PRBool *aDefaultCopiesAnd
} }
NS_IMETHODIMP NS_IMETHODIMP
nsImapService::BuildSubscribeDatasourceWithName(nsIImapIncomingServer *aServer, nsIMsgWindow *aMsgWindow, const char *folderName) nsImapService::BuildSubscribeDatasourceWithPath(nsIImapIncomingServer *aServer, nsIMsgWindow *aMsgWindow, const char *folderPath)
{ {
nsresult rv; nsresult rv;
#ifdef DEBUG_sspitzer #ifdef DEBUG_sspitzer
printf("BuildSubscribeDatasourceWithName(%s)\n",folderName); printf("BuildSubscribeDatasourceWithPath(%s)\n",folderPath);
#endif #endif
nsCOMPtr<nsIMsgIncomingServer> server = do_QueryInterface(aServer); nsCOMPtr<nsIMsgIncomingServer> server = do_QueryInterface(aServer);
if (!server) return NS_ERROR_FAILURE; if (!server) return NS_ERROR_FAILURE;
@ -2788,7 +2788,7 @@ nsImapService::BuildSubscribeDatasourceWithName(nsIImapIncomingServer *aServer,
rv = pEventQService->GetThreadEventQueue(NS_CURRENT_THREAD, getter_AddRefs(queue)); rv = pEventQService->GetThreadEventQueue(NS_CURRENT_THREAD, getter_AddRefs(queue));
if (NS_FAILED(rv)) return rv; if (NS_FAILED(rv)) return rv;
rv = DiscoverChildren(queue, rootMsgFolder, listener, folderName, nsnull); rv = DiscoverChildren(queue, rootMsgFolder, listener, folderPath, nsnull);
if (NS_FAILED(rv)) return rv; if (NS_FAILED(rv)) return rv;
return NS_OK; return NS_OK;

View File

@ -815,12 +815,12 @@ nsNntpIncomingServer::PopulateSubscribeDatasourceFromHostInfo(nsIMsgWindow *aMsg
} }
NS_IMETHODIMP NS_IMETHODIMP
nsNntpIncomingServer::PopulateSubscribeDatasourceWithName(nsIMsgWindow *aMsgWindow, PRBool aForceToServer, const char *name) nsNntpIncomingServer::PopulateSubscribeDatasourceWithPath(nsIMsgWindow *aMsgWindow, PRBool aForceToServer, const char *path)
{ {
nsresult rv; nsresult rv;
#ifdef DEBUG_sspitzer #ifdef DEBUG_sspitzer
printf("PopulateSubscribeDatasourceWithName(%s)\n",name); printf("PopulateSubscribeDatasourceWithPath(%s)\n",path);
#endif #endif
rv = StopPopulatingSubscribeDS(); rv = StopPopulatingSubscribeDS();