fix 46233 saving imap attachments causes message to get downloaded again, sr=sspitzer

This commit is contained in:
bienvenu%nventure.com 2004-01-18 17:42:57 +00:00
Родитель 000a88f025
Коммит f64f67a002
1 изменённых файлов: 25 добавлений и 23 удалений

Просмотреть файл

@ -409,11 +409,25 @@ NS_IMETHODIMP nsImapService::OpenAttachment(const char *aContentType,
rv = CreateStartOfImapUrl(uri.get(), getter_AddRefs(imapUrl), folder, aUrlListener, urlSpec, hierarchySeparator);
if (NS_FAILED(rv))
return rv;
urlSpec.Append("/fetch>UID>");
urlSpec.Append(char(hierarchySeparator));
nsXPIDLCString folderName;
GetFolderName(folder, getter_Copies(folderName));
urlSpec.Append((const char *) folderName);
urlSpec.Append(">");
urlSpec.Append(msgKey.get());
urlSpec.Append(uriMimePart.get());
if (uriMimePart)
{
nsCOMPtr<nsIMsgMailNewsUrl> mailUrl (do_QueryInterface(imapUrl));
if (mailUrl)
{
mailUrl->SetSpec(urlSpec);
mailUrl->SetFileName(nsDependentCString(aFileName));
}
rv = FetchMimePart(imapUrl, nsIImapUrl::nsImapOpenMimePart, folder, imapMessageSink,
nsnull, aDisplayConsumer, msgKey, uriMimePart);
}
@ -606,18 +620,6 @@ nsresult nsImapService::FetchMimePart(nsIImapUrl * aImapUrl,
nsCOMPtr<nsIURI> url = do_QueryInterface(aImapUrl);
url->GetSpec(urlSpec);
PRUnichar hierarchySeparator = GetHierarchyDelimiter(aImapMailFolder);
urlSpec.Append("fetch>UID>");
urlSpec.Append(char(hierarchySeparator));
nsXPIDLCString folderName;
GetFolderName(aImapMailFolder, getter_Copies(folderName));
urlSpec.Append((const char *) folderName);
urlSpec.Append(">");
urlSpec.Append(messageIdentifierList);
urlSpec.Append(mimePart);
// rhp: If we are displaying this message for the purpose of printing, we
// need to append the header=print option.
//
@ -1196,7 +1198,8 @@ nsImapService::CreateStartOfImapUrl(const char * aImapURI, nsIImapUrl ** imapUrl
PRInt32 port = IMAP_PORT;
nsCOMPtr<nsIMsgIncomingServer> server;
rv = aImapMailFolder->GetServer(getter_AddRefs(server));
if (NS_SUCCEEDED(rv)) {
if (NS_SUCCEEDED(rv))
{
server->GetPort(&port);
if (port == -1 || port == 0) port = IMAP_PORT;
}
@ -1204,8 +1207,7 @@ nsImapService::CreateStartOfImapUrl(const char * aImapURI, nsIImapUrl ** imapUrl
// now we need to create an imap url to load into the connection. The url
// needs to represent a select folder action.
rv = nsComponentManager::CreateInstance(kImapUrlCID, nsnull,
NS_GET_IID(nsIImapUrl), (void **)
imapUrl);
NS_GET_IID(nsIImapUrl), (void **) imapUrl);
if (NS_SUCCEEDED(rv) && *imapUrl)
{
nsCOMPtr<nsIMsgMailNewsUrl> mailnewsUrl = do_QueryInterface(*imapUrl, &rv);