зеркало из https://github.com/mozilla/pjs.git
move the string parsing into the imap server code, since right now, it is only
needed for imap. r=mscott.
This commit is contained in:
Родитель
14a825e586
Коммит
0054860e90
|
@ -37,7 +37,7 @@ interface nsISubscribableServer : nsISupports {
|
|||
void setIncomingServer(in nsIMsgIncomingServer server);
|
||||
void setDelimiter(in char delimiter);
|
||||
void populateSubscribeDatasource(in nsIMsgWindow aMsgWindow, in boolean forceToServer);
|
||||
void populateSubscribeDatasourceWithPath(in nsIMsgWindow aMsgWindow, in boolean forceToServer, in string path);
|
||||
void populateSubscribeDatasourceWithUri(in nsIMsgWindow aMsgWindow, in boolean forceToServer, in string uri);
|
||||
attribute nsISubscribeListener subscribeListener;
|
||||
void startPopulatingSubscribeDS();
|
||||
void stopPopulatingSubscribeDS();
|
||||
|
|
|
@ -330,21 +330,12 @@ function SubscribeOnClick(event)
|
|||
if(open == "true") {
|
||||
var uri = treeitem.getAttribute("id");
|
||||
|
||||
// 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");
|
||||
dump("do twisty for " + uri + "\n");
|
||||
|
||||
// Turn progress meter on.
|
||||
gStatusBar.setAttribute("mode","undetermined");
|
||||
|
||||
gSubscribableServer.populateSubscribeDatasourceWithPath(null /* eventually, a nsIMsgWindow */, true /* force to server */, path);
|
||||
gSubscribableServer.populateSubscribeDatasourceWithUri(null /* eventually, a nsIMsgWindow */, true /* force to server */, uri);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -452,7 +452,7 @@ nsSubscribableServer::SubscribeCleanup()
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSubscribableServer::PopulateSubscribeDatasourceWithPath(nsIMsgWindow *aMsgWindow, PRBool aForceToServer, const char *path)
|
||||
nsSubscribableServer::PopulateSubscribeDatasourceWithUri(nsIMsgWindow *aMsgWindow, PRBool aForceToServer, const char *uri)
|
||||
{
|
||||
NS_ASSERTION(PR_FALSE,"override this.");
|
||||
return NS_ERROR_FAILURE;
|
||||
|
|
|
@ -1839,11 +1839,11 @@ NS_IMETHODIMP nsImapIncomingServer::OnLogonRedirectionReply(const PRUnichar *pHo
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsImapIncomingServer::PopulateSubscribeDatasourceWithPath(nsIMsgWindow *aMsgWindow, PRBool aForceToServer /*ignored*/, const char *path)
|
||||
nsImapIncomingServer::PopulateSubscribeDatasourceWithUri(nsIMsgWindow *aMsgWindow, PRBool aForceToServer /*ignored*/, const char *uri)
|
||||
{
|
||||
nsresult rv;
|
||||
#ifdef DEBUG_sspitzer
|
||||
printf("in PopulateSubscribeDatasourceWithPath(%s)\n",path);
|
||||
printf("in PopulateSubscribeDatasourceWithUri(%s)\n",uri);
|
||||
#endif
|
||||
mDoingSubscribeDialog = PR_TRUE;
|
||||
|
||||
|
@ -1855,6 +1855,19 @@ nsImapIncomingServer::PopulateSubscribeDatasourceWithPath(nsIMsgWindow *aMsgWind
|
|||
if (NS_FAILED(rv)) return rv;
|
||||
if (!imapService) return NS_ERROR_FAILURE;
|
||||
|
||||
nsXPIDLCString serverUri;
|
||||
rv = GetServerURI(getter_Copies(serverUri));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
/*
|
||||
if uri = imap://user@host/foo/bar, the serverUri is imap://user@host
|
||||
to get path from uri, skip over imap://user@host + 1 (for the /)
|
||||
*/
|
||||
const char *path = uri + nsCRT::strlen((const char *)serverUri) + 1;
|
||||
#ifdef DEBUG_seth
|
||||
printf("path = %s\n",path);
|
||||
#endif
|
||||
|
||||
rv = imapService->BuildSubscribeDatasourceWithPath(this, aMsgWindow, path);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
|
|
|
@ -679,8 +679,8 @@ writeGroupToHostInfo(nsCString &aElement, void *aData)
|
|||
nsIOFileStream *stream;
|
||||
stream = (nsIOFileStream *)aData;
|
||||
|
||||
// ",,x,y,z" is a temporary hack
|
||||
*stream << (const char *)aElement << ",,x,y,z" << MSG_LINEBREAK;
|
||||
// ",,1,0,0" is a temporary hack
|
||||
*stream << (const char *)aElement << ",,1,0,0" << MSG_LINEBREAK;
|
||||
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
@ -815,12 +815,12 @@ nsNntpIncomingServer::PopulateSubscribeDatasourceFromHostInfo(nsIMsgWindow *aMsg
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNntpIncomingServer::PopulateSubscribeDatasourceWithPath(nsIMsgWindow *aMsgWindow, PRBool aForceToServer, const char *path)
|
||||
nsNntpIncomingServer::PopulateSubscribeDatasourceWithUri(nsIMsgWindow *aMsgWindow, PRBool aForceToServer, const char *uri)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
#ifdef DEBUG_sspitzer
|
||||
printf("PopulateSubscribeDatasourceWithPath(%s)\n",path);
|
||||
printf("PopulateSubscribeDatasourceWithUri(%s)\n",uri);
|
||||
#endif
|
||||
|
||||
rv = StopPopulatingSubscribeDS();
|
||||
|
|
Загрузка…
Ссылка в новой задаче