зеркало из https://github.com/mozilla/pjs.git
get downloading of imap attachments working, r=alecf 32767
This commit is contained in:
Родитель
79885a762f
Коммит
90210ce245
|
@ -513,35 +513,6 @@ void nsAddrDatabase::UnixToNative(char*& ioPath)
|
|||
ioPath = result;
|
||||
}
|
||||
}
|
||||
|
||||
void nsAddrDatabase::NativeToUnix(char*& ioPath)
|
||||
// This just does string manipulation. It doesn't check reality, or canonify, or
|
||||
// anything
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
size_t len = PL_strlen(ioPath);
|
||||
char* result = new char[len + 2]; // ... but allow for the initial colon in a partial name
|
||||
if (result)
|
||||
{
|
||||
char* dst = result;
|
||||
const char* src = ioPath;
|
||||
if (*src == ':') // * partial path, and not just a leaf name
|
||||
src++;
|
||||
else if (PL_strchr(src, ':')) // * full path
|
||||
*dst++ = '/';
|
||||
PL_strcpy(dst, src);
|
||||
|
||||
while ( *dst != 0)
|
||||
{
|
||||
if (*dst == ':')
|
||||
*dst++ = '/';
|
||||
else
|
||||
*dst++;
|
||||
}
|
||||
PR_Free(ioPath);
|
||||
ioPath = result;
|
||||
}
|
||||
}
|
||||
#endif /* XP_MAC */
|
||||
|
||||
/* caller need to delete *aDbPath */
|
||||
|
|
|
@ -247,9 +247,6 @@ protected:
|
|||
#if defined(XP_PC) || defined(XP_MAC) // this should go away when we can provide our own file stream to MDB/Mork
|
||||
static void UnixToNative(char*& ioPath);
|
||||
#endif
|
||||
#if defined(XP_MAC)
|
||||
static void NativeToUnix(char*& ioPath);
|
||||
#endif
|
||||
|
||||
|
||||
void YarnToUInt32(struct mdbYarn *yarn, PRUint32 *pResult);
|
||||
|
|
|
@ -77,6 +77,18 @@ interface nsIMsgMessageService : nsISupports {
|
|||
in nsIUrlListener aUrlListener,
|
||||
out nsIURI aURL);
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
// OpenAttachment: When you want an attachment downloaded
|
||||
// aURL is a url representing the attachment.
|
||||
// aDisplayConsumer is (for now) a nsIWebshell which we'll use to load
|
||||
// the message into.
|
||||
///////////////////////////////////////////////////////////////////
|
||||
|
||||
void OpenAttachment(in nsIURI aURI, in string aMessageUri, in nsISupports aDisplayConsumer,
|
||||
in nsIMsgWindow aMsgWindow,
|
||||
in nsIUrlListener aUrlListener,
|
||||
out nsIURI aURL);
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
// SaveMessageToDisk: When you want to spool a message out to a file
|
||||
// on disk. This is an asynch operation of course. You must pass in a
|
||||
|
|
|
@ -494,6 +494,8 @@ nsMessenger::OpenAttachment(const char * url, const char * displayName,
|
|||
char * unescapedDisplayName = nsnull;
|
||||
nsCOMPtr<nsIURI> aURL;
|
||||
nsAutoString tempStr;
|
||||
PRBool canFetchMimeParts = PR_FALSE;
|
||||
nsCAutoString fullMessageUri = messageUri;
|
||||
|
||||
NS_WITH_SERVICE(nsIStreamConverterService,
|
||||
streamConverterService,
|
||||
|
@ -554,6 +556,8 @@ nsMessenger::OpenAttachment(const char * url, const char * displayName,
|
|||
NS_ADDREF(aListener);
|
||||
|
||||
urlString = unescapedUrl;
|
||||
|
||||
urlString.ReplaceSubstring("/;section", "?section");
|
||||
urlCString = urlString.ToNewCString();
|
||||
|
||||
rv = CreateStartupUrl(urlCString, getter_AddRefs(aURL));
|
||||
|
@ -561,35 +565,58 @@ nsMessenger::OpenAttachment(const char * url, const char * displayName,
|
|||
|
||||
if (NS_FAILED(rv)) goto done;
|
||||
|
||||
aListener->m_channel = null_nsCOMPtr();
|
||||
rv = NS_NewInputStreamChannel(aURL,
|
||||
nsnull, // contentType
|
||||
-1, // contentLength
|
||||
nsnull, // inputStream
|
||||
nsnull, // loadGroup
|
||||
nsnull, // notificationCallbacks
|
||||
nsIChannel::LOAD_NORMAL,
|
||||
nsnull, // originalURI
|
||||
0, 0,
|
||||
getter_AddRefs(aListener->m_channel));
|
||||
if (NS_FAILED(rv)) goto done;
|
||||
|
||||
from = MESSAGE_RFC822;
|
||||
to = "text/xul";
|
||||
|
||||
channelSupport = do_QueryInterface(aListener->m_channel);
|
||||
|
||||
rv = streamConverterService->AsyncConvertData(
|
||||
from.GetUnicode(), to.GetUnicode(), aListener,
|
||||
channelSupport, getter_AddRefs(convertedListener));
|
||||
if (NS_FAILED(rv)) goto done;
|
||||
|
||||
rv = GetMessageServiceFromURI(messageUri, &messageService);
|
||||
if (NS_FAILED(rv)) goto done;
|
||||
|
||||
rv = messageService->DisplayMessage(messageUri,
|
||||
convertedListener,mMsgWindow,
|
||||
nsnull, nsnull);
|
||||
messageService->GetCanFetchMimeParts(&canFetchMimeParts);
|
||||
|
||||
if (canFetchMimeParts)
|
||||
{
|
||||
PRInt32 sectionPos = urlString.Find("?section");
|
||||
nsString mimePart;
|
||||
|
||||
urlString.Right(mimePart, urlString.Length() - sectionPos);
|
||||
fullMessageUri.Append(mimePart);
|
||||
|
||||
// nsCOMPtr <nsIStreamListener> streamListener = do_QueryInterface((nsIStreamListener *) aListener);
|
||||
// nsCOMPtr <nsISupports> supportsListener = streamListener;
|
||||
messageUri = fullMessageUri.GetBuffer();
|
||||
// rv = messageService->DisplayMessage(fullMessageUri.GetBuffer(),
|
||||
// supportsListener, mMsgWindow,
|
||||
// nsnull, nsnull);
|
||||
|
||||
}
|
||||
{
|
||||
aListener->m_channel = null_nsCOMPtr();
|
||||
rv = NS_NewInputStreamChannel(aURL,
|
||||
nsnull, // contentType
|
||||
-1, // contentLength
|
||||
nsnull, // inputStream
|
||||
nsnull, // loadGroup
|
||||
nsnull, // notificationCallbacks
|
||||
nsIChannel::LOAD_NORMAL,
|
||||
nsnull, // originalURI
|
||||
0, 0,
|
||||
getter_AddRefs(aListener->m_channel));
|
||||
if (NS_FAILED(rv)) goto done;
|
||||
|
||||
from = MESSAGE_RFC822;
|
||||
to = "text/xul";
|
||||
|
||||
channelSupport = do_QueryInterface(aListener->m_channel);
|
||||
|
||||
rv = streamConverterService->AsyncConvertData(
|
||||
from.GetUnicode(), to.GetUnicode(), aListener,
|
||||
channelSupport, getter_AddRefs(convertedListener));
|
||||
if (NS_FAILED(rv)) goto done;
|
||||
|
||||
if (canFetchMimeParts)
|
||||
rv = messageService->OpenAttachment(aURL, messageUri, convertedListener, mMsgWindow, nsnull,nsnull);
|
||||
else
|
||||
rv = messageService->DisplayMessage(messageUri,
|
||||
convertedListener,mMsgWindow,
|
||||
nsnull, nsnull);
|
||||
}
|
||||
|
||||
done:
|
||||
if (messageService)
|
||||
|
|
|
@ -24,8 +24,8 @@
|
|||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
static NS_DEFINE_IID(kITransactionIID, NS_ITRANSACTION_IID);
|
||||
|
||||
NS_IMPL_ADDREF(nsMsgTxn)
|
||||
NS_IMPL_RELEASE(nsMsgTxn)
|
||||
NS_IMPL_THREADSAFE_ADDREF(nsMsgTxn)
|
||||
NS_IMPL_THREADSAFE_RELEASE(nsMsgTxn)
|
||||
|
||||
// note that aEditor is not refcounted
|
||||
nsMsgTxn::nsMsgTxn()
|
||||
|
|
|
@ -281,9 +281,6 @@ protected:
|
|||
#if defined(XP_PC) || defined(XP_MAC) // this should go away when we can provide our own file stream to MDB/Mork
|
||||
static void UnixToNative(char*& ioPath);
|
||||
#endif
|
||||
#if defined(XP_MAC)
|
||||
static void NativeToUnix(char*& ioPath);
|
||||
#endif
|
||||
|
||||
// Flag handling routines
|
||||
virtual nsresult SetKeyFlag(nsMsgKey key, PRBool set, PRUint32 flag,
|
||||
|
|
|
@ -672,34 +672,6 @@ void nsMsgDatabase::UnixToNative(char*& ioPath)
|
|||
}
|
||||
}
|
||||
|
||||
void nsMsgDatabase::NativeToUnix(char*& ioPath)
|
||||
// This just does string manipulation. It doesn't check reality, or canonify, or
|
||||
// anything
|
||||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
size_t len = strlen(ioPath);
|
||||
char* result = new char[len + 2]; // ... but allow for the initial colon in a partial name
|
||||
if (result)
|
||||
{
|
||||
char* dst = result;
|
||||
const char* src = ioPath;
|
||||
if (*src == ':') // * partial path, and not just a leaf name
|
||||
src++;
|
||||
else if (strchr(src, ':')) // * full path
|
||||
*dst++ = '/';
|
||||
strcpy(dst, src);
|
||||
|
||||
while ( *dst != 0)
|
||||
{
|
||||
if (*dst == ':')
|
||||
*dst++ = '/';
|
||||
else
|
||||
*dst++;
|
||||
}
|
||||
PR_Free(ioPath);
|
||||
ioPath = result;
|
||||
}
|
||||
}
|
||||
#endif /* XP_MAC */
|
||||
|
||||
NS_IMETHODIMP nsMsgDatabase::Open(nsIFileSpec *folderName, PRBool create, PRBool upgrading, nsIMsgDatabase** pMessageDB)
|
||||
|
|
|
@ -64,7 +64,7 @@ nsresult nsImapMessage::GetFolderFromURI(nsIMsgFolder **folder)
|
|||
resource->GetValue( getter_Copies(uri) );
|
||||
nsCAutoString messageFolderURIStr;
|
||||
nsMsgKey key;
|
||||
nsParseImapMessageURI(uri, messageFolderURIStr, &key);
|
||||
nsParseImapMessageURI(uri, messageFolderURIStr, &key, nsnull);
|
||||
nsCAutoString folderOnly, folderURIStr;
|
||||
|
||||
if (messageFolderURIStr.Find(kImapRootURI) != ((PRInt32)-1))
|
||||
|
|
|
@ -1681,7 +1681,7 @@ void nsImapProtocol::ProcessSelectedStateURL()
|
|||
IMAP_CONTENT_MODIFIED_VIEW_AS_LINKS;
|
||||
|
||||
nsIMAPBodyShell *foundShell = nsnull;
|
||||
res = m_hostSessionList->FindShellInCacheForHost(GetImapHostName(),
|
||||
res = m_hostSessionList->FindShellInCacheForHost(GetImapServerKey(),
|
||||
GetServerStateParser().GetSelectedMailboxName(), messageIdString, modType, &foundShell);
|
||||
if (!foundShell)
|
||||
{
|
||||
|
@ -1747,7 +1747,7 @@ void nsImapProtocol::ProcessSelectedStateURL()
|
|||
SetContentModified(modType); // This will be looked at by the cache
|
||||
if (bMessageIdsAreUids)
|
||||
{
|
||||
res = m_hostSessionList->FindShellInCacheForHost(GetImapHostName(),
|
||||
res = m_hostSessionList->FindShellInCacheForHost(GetImapServerKey(),
|
||||
GetServerStateParser().GetSelectedMailboxName(), messageIdString, modType, &foundShell);
|
||||
if (foundShell)
|
||||
{
|
||||
|
|
|
@ -296,6 +296,42 @@ NS_IMETHODIMP nsImapService::GetCanFetchMimeParts(PRBool *canFetchMimeParts)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
/* void OpenAttachment (in nsIURI aURI, in nsISupports aDisplayConsumer, in nsIMsgWindow aMsgWindow, in nsIUrlListener aUrlListener, out nsIURI aURL); */
|
||||
NS_IMETHODIMP nsImapService::OpenAttachment(nsIURI *aURI, const char *aMessageURI, nsISupports *aDisplayConsumer, nsIMsgWindow *aMsgWindow, nsIUrlListener *aUrlListener, nsIURI **aURL)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
nsCOMPtr<nsIMsgFolder> folder;
|
||||
nsXPIDLCString msgKey;
|
||||
nsXPIDLCString mimePart;
|
||||
nsCAutoString folderURI;
|
||||
nsMsgKey key;
|
||||
|
||||
rv = DecomposeImapURI(aMessageURI, getter_AddRefs(folder), getter_Copies(msgKey));
|
||||
rv = nsParseImapMessageURI(aMessageURI, folderURI, &key, getter_Copies(mimePart));
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
nsCOMPtr<nsIImapMessageSink> imapMessageSink(do_QueryInterface(folder, &rv));
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
nsCOMPtr<nsIImapUrl> imapUrl = do_QueryInterface(aURI);
|
||||
nsCAutoString urlSpec;
|
||||
PRUnichar hierarchySeparator = GetHierarchyDelimiter(folder);
|
||||
nsCOMPtr<nsIMsgMailNewsUrl> msgurl (do_QueryInterface(aURI));
|
||||
|
||||
msgurl->SetMsgWindow(aMsgWindow);
|
||||
msgurl->RegisterListener(aUrlListener);
|
||||
|
||||
if (mimePart)
|
||||
{
|
||||
return FetchMimePart(imapUrl, nsIImapUrl::nsImapMsgFetch, folder, imapMessageSink,
|
||||
aURL, aDisplayConsumer, msgKey, mimePart);
|
||||
}
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP nsImapService::DisplayMessage(const char* aMessageURI,
|
||||
nsISupports * aDisplayConsumer,
|
||||
nsIMsgWindow * aMsgWindow,
|
||||
|
@ -305,8 +341,12 @@ NS_IMETHODIMP nsImapService::DisplayMessage(const char* aMessageURI,
|
|||
nsresult rv = NS_OK;
|
||||
nsCOMPtr<nsIMsgFolder> folder;
|
||||
nsXPIDLCString msgKey;
|
||||
nsXPIDLCString mimePart;
|
||||
nsCAutoString folderURI;
|
||||
nsMsgKey key;
|
||||
|
||||
rv = DecomposeImapURI(aMessageURI, getter_AddRefs(folder), getter_Copies(msgKey));
|
||||
rv = nsParseImapMessageURI(aMessageURI, folderURI, &key, getter_Copies(mimePart));
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
nsCOMPtr<nsIImapMessageSink> imapMessageSink(do_QueryInterface(folder, &rv));
|
||||
|
@ -318,6 +358,12 @@ NS_IMETHODIMP nsImapService::DisplayMessage(const char* aMessageURI,
|
|||
rv = CreateStartOfImapUrl(getter_AddRefs(imapUrl), folder, aUrlListener, urlSpec, hierarchySeparator);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
if (mimePart)
|
||||
{
|
||||
return FetchMimePart(imapUrl, nsIImapUrl::nsImapMsgFetch, folder, imapMessageSink,
|
||||
aURL, aDisplayConsumer, msgKey, mimePart);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIMsgMailNewsUrl> msgurl (do_QueryInterface(imapUrl));
|
||||
|
||||
PRUint32 messageSize;
|
||||
|
@ -349,6 +395,125 @@ NS_IMETHODIMP nsImapService::DisplayMessage(const char* aMessageURI,
|
|||
return rv;
|
||||
}
|
||||
|
||||
|
||||
nsresult nsImapService::FetchMimePart(nsIImapUrl * aImapUrl,
|
||||
nsImapAction aImapAction,
|
||||
nsIMsgFolder * aImapMailFolder,
|
||||
nsIImapMessageSink * aImapMessage,
|
||||
nsIURI ** aURL,
|
||||
nsISupports * aDisplayConsumer,
|
||||
const char *messageIdentifierList,
|
||||
const char *mimePart)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
// create a protocol instance to handle the request.
|
||||
// NOTE: once we start working with multiple connections, this step will be much more complicated...but for now
|
||||
// just create a connection and process the request.
|
||||
NS_ASSERTION (aImapUrl && aImapMailFolder && aImapMessage,"Oops ... null pointer");
|
||||
if (!aImapUrl || !aImapMailFolder || !aImapMessage)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
nsCAutoString urlSpec;
|
||||
rv = SetImapUrlSink(aImapMailFolder, aImapUrl);
|
||||
|
||||
rv = aImapUrl->SetImapMessageSink(aImapMessage);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
nsXPIDLCString currentSpec;
|
||||
nsCOMPtr<nsIURI> url = do_QueryInterface(aImapUrl);
|
||||
url->GetSpec(getter_Copies(currentSpec));
|
||||
urlSpec.Assign(currentSpec);
|
||||
|
||||
PRUnichar hierarchySeparator = GetHierarchyDelimiter(aImapMailFolder);
|
||||
|
||||
urlSpec.Append("fetch>");
|
||||
urlSpec.Append(uidString);
|
||||
urlSpec.Append(">");
|
||||
urlSpec.Append(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.
|
||||
//
|
||||
if (mPrintingOperation)
|
||||
urlSpec.Append("?header=print");
|
||||
|
||||
// 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
|
||||
// const char *. hopefully they will fix it soon.
|
||||
rv = url->SetSpec((char *) urlSpec.GetBuffer());
|
||||
|
||||
rv = aImapUrl->SetImapAction(aImapAction /* nsIImapUrl::nsImapMsgFetch */);
|
||||
if (aImapMailFolder && aDisplayConsumer)
|
||||
{
|
||||
nsCOMPtr<nsIMsgIncomingServer> aMsgIncomingServer;
|
||||
rv = aImapMailFolder->GetServer(getter_AddRefs(aMsgIncomingServer));
|
||||
if (NS_SUCCEEDED(rv) && aMsgIncomingServer)
|
||||
{
|
||||
PRBool interrupted;
|
||||
nsCOMPtr<nsIImapIncomingServer>
|
||||
aImapServer(do_QueryInterface(aMsgIncomingServer, &rv));
|
||||
if (NS_SUCCEEDED(rv) && aImapServer)
|
||||
aImapServer->PseudoInterruptMsgLoad(aImapUrl, &interrupted);
|
||||
}
|
||||
}
|
||||
// if the display consumer is a webshell, then we should run the url in the webshell.
|
||||
// otherwise, it should be a stream listener....so open a channel using AsyncRead
|
||||
// and the provided stream listener....
|
||||
|
||||
nsCOMPtr<nsIWebShell> webShell = do_QueryInterface(aDisplayConsumer, &rv);
|
||||
if (NS_SUCCEEDED(rv) && webShell)
|
||||
rv = webShell->LoadURI(url, "view", nsnull, PR_TRUE);
|
||||
else
|
||||
{
|
||||
nsCOMPtr<nsIStreamListener> aStreamListener = do_QueryInterface(aDisplayConsumer, &rv);
|
||||
if (NS_SUCCEEDED(rv) && aStreamListener)
|
||||
{
|
||||
nsCOMPtr<nsIChannel> aChannel;
|
||||
nsCOMPtr<nsILoadGroup> aLoadGroup;
|
||||
nsCOMPtr<nsIMsgMailNewsUrl> mailnewsUrl = do_QueryInterface(aImapUrl, &rv);
|
||||
if (NS_SUCCEEDED(rv) && mailnewsUrl)
|
||||
mailnewsUrl->GetLoadGroup(getter_AddRefs(aLoadGroup));
|
||||
|
||||
rv = NewChannel(nsnull, url, aLoadGroup, nsnull, nsIChannel::LOAD_NORMAL,
|
||||
nsnull, 0, 0, getter_AddRefs(aChannel));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsISupports> aCtxt = do_QueryInterface(url);
|
||||
// now try to open the channel passing in our display consumer as the listener
|
||||
rv = aChannel->AsyncRead(0, -1, aCtxt, aStreamListener);
|
||||
}
|
||||
else // do what we used to do before
|
||||
{
|
||||
// I'd like to get rid of this code as I believe that we always get a webshell
|
||||
// or stream listener passed into us in this method but i'm not sure yet...
|
||||
// I'm going to use an assert for now to figure out if this is ever getting called
|
||||
#ifdef DEBUG_mscott
|
||||
NS_ASSERTION(0, "oops...someone still is reaching this part of the code");
|
||||
#endif
|
||||
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 = GetImapConnectionAndLoadUrl(queue, aImapUrl, aDisplayConsumer, aURL);
|
||||
}
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
//
|
||||
// rhp: Right now, this is the same as simple DisplayMessage, but it will change
|
||||
// to support print rendering.
|
||||
|
@ -476,7 +641,7 @@ nsresult nsImapService::DecomposeImapURI(const char * aMessageURI, nsIMsgFolder
|
|||
|
||||
nsCAutoString folderURI;
|
||||
nsMsgKey msgKey;
|
||||
rv = nsParseImapMessageURI(aMessageURI, folderURI, &msgKey);
|
||||
rv = nsParseImapMessageURI(aMessageURI, folderURI, &msgKey, nsnull);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
nsCOMPtr<nsIRDFResource> res;
|
||||
|
|
|
@ -81,6 +81,15 @@ protected:
|
|||
nsresult ResetImapConnection(nsIImapUrl* aImapUrl, const char *folderName);
|
||||
nsresult SetImapUrlSink(nsIMsgFolder* aMsgFolder,
|
||||
nsIImapUrl* aImapUrl);
|
||||
nsresult FetchMimePart(nsIImapUrl * aImapUrl,
|
||||
nsImapAction aImapAction,
|
||||
nsIMsgFolder * aImapMailFolder,
|
||||
nsIImapMessageSink * aImapMessage,
|
||||
nsIURI ** aURL,
|
||||
nsISupports * aDisplayConsumer,
|
||||
const char *messageIdentifierList,
|
||||
const char *mimePart);
|
||||
|
||||
nsresult DiddleFlags(nsIEventQueue * aClientEventQueue,
|
||||
nsIMsgFolder * aImapMailFolder,
|
||||
nsIUrlListener * aUrlListener,
|
||||
|
|
|
@ -307,14 +307,13 @@ NS_IMETHODIMP nsImapUrl::CreateListOfMessageIdsString(char ** aResult)
|
|||
NS_IMETHODIMP nsImapUrl::GetImapPartToFetch(char **result)
|
||||
{
|
||||
// here's the old code:
|
||||
#if 0
|
||||
char *wherepart = NULL, *rv = NULL;
|
||||
char *wherepart = NULL;
|
||||
if (m_listOfMessageIds && (wherepart = PL_strstr(m_listOfMessageIds, "/;section=")) != NULL)
|
||||
{
|
||||
wherepart += 10; // nsCRT::strlen("/;section=")
|
||||
if (wherepart)
|
||||
{
|
||||
char *wherelibmimepart = XP_STRSTR(wherepart, "&part=");
|
||||
char *wherelibmimepart = PL_strstr(wherepart, "&part=");
|
||||
int len = PL_strlen(m_listOfMessageIds), numCharsToCopy = 0;
|
||||
if (wherelibmimepart)
|
||||
numCharsToCopy = (wherelibmimepart - wherepart);
|
||||
|
@ -322,15 +321,15 @@ NS_IMETHODIMP nsImapUrl::GetImapPartToFetch(char **result)
|
|||
numCharsToCopy = PL_strlen(m_listOfMessageIds) - (wherepart - m_listOfMessageIds);
|
||||
if (numCharsToCopy)
|
||||
{
|
||||
rv = (char *) PR_Malloc(sizeof(char) * (numCharsToCopy + 1));
|
||||
if (rv)
|
||||
*result = (char *) PR_Malloc(sizeof(char) * (numCharsToCopy + 1));
|
||||
if (*result)
|
||||
{
|
||||
XP_STRNCPY_SAFE(rv, wherepart, numCharsToCopy + 1); // appends a \0
|
||||
PL_strncpy(*result, wherepart, numCharsToCopy + 1); // appends a \0
|
||||
(*result)[numCharsToCopy] = '\0';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // 0
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -178,7 +178,7 @@ nsImapURI2FullName(const char* rootURI, const char* hostname, char* uriStr,
|
|||
}
|
||||
|
||||
/* parses ImapMessageURI */
|
||||
nsresult nsParseImapMessageURI(const char* uri, nsCString& folderURI, PRUint32 *key)
|
||||
nsresult nsParseImapMessageURI(const char* uri, nsCString& folderURI, PRUint32 *key, char **part)
|
||||
{
|
||||
if(!key)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
@ -201,9 +201,19 @@ nsresult nsParseImapMessageURI(const char* uri, nsCString& folderURI, PRUint32 *
|
|||
PRInt32 errorCode;
|
||||
*key = keyStr.ToInteger(&errorCode);
|
||||
|
||||
return errorCode;
|
||||
if (part && keyEndSeparator != -1)
|
||||
{
|
||||
PRInt32 partPos = uriStr.Find("part=", PR_FALSE, keyEndSeparator);
|
||||
if (partPos != -1)
|
||||
{
|
||||
nsCString partSubStr;
|
||||
uriStr.Right(partSubStr, uriStr.Length() - keyEndSeparator);
|
||||
*part = partSubStr.ToNewCString();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
return NS_ERROR_FAILURE;
|
||||
return NS_OK;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ nsImapURI2FullName(const char* rootURI, const char* hostname, char* uriStr,
|
|||
char **name);
|
||||
|
||||
extern nsresult
|
||||
nsParseImapMessageURI(const char* uri, nsCString& folderURI, PRUint32 *key);
|
||||
nsParseImapMessageURI(const char* uri, nsCString& folderURI, PRUint32 *key, char **part);
|
||||
|
||||
extern nsresult
|
||||
nsBuildImapMessageURI(const char *baseURI, PRUint32 key, nsCString& uri);
|
||||
|
|
|
@ -256,14 +256,13 @@ NS_IMETHODIMP nsMsgLocalMailFolder::AddSubfolder(nsAutoString *name,
|
|||
|
||||
if(NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCAutoString uri;
|
||||
nsAutoString uri;
|
||||
uri.Append(mURI);
|
||||
uri.Append('/');
|
||||
|
||||
uri.Append(*name);
|
||||
|
||||
nsCOMPtr<nsIRDFResource> res;
|
||||
rv = rdf->GetResource(uri, getter_AddRefs(res));
|
||||
rv = rdf->GetUnicodeResource(uri.GetUnicode(), getter_AddRefs(res));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
|
|
|
@ -154,6 +154,13 @@ nsresult nsMailboxService::DisplayMessage(const char* aMessageURI,
|
|||
return FetchMessage(aMessageURI, aDisplayConsumer, aMsgWindow,aUrlListener, nsIMailboxUrl::ActionDisplayMessage, aURL);
|
||||
}
|
||||
|
||||
/* void OpenAttachment (in nsIURI aURI, in nsISupports aDisplayConsumer, in nsIMsgWindow aMsgWindow, in nsIUrlListener aUrlListener, out nsIURI aURL); */
|
||||
NS_IMETHODIMP nsMailboxService::OpenAttachment(nsIURI *aURI, const char *aMessageURI, nsISupports *aDisplayConsumer, nsIMsgWindow *aMsgWindow, nsIUrlListener *aUrlListener, nsIURI **aURL)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMailboxService::SaveMessageToDisk(const char *aMessageURI,
|
||||
nsIFileSpec *aFile,
|
||||
|
|
|
@ -247,7 +247,7 @@ nsMimeHtmlDisplayEmitter::StartAttachment(const char *name, const char *contentT
|
|||
}
|
||||
|
||||
if (NS_SUCCEEDED(rv))
|
||||
headerSink->HandleAttachment(escapedUrl, unicodeHeaderValue, uriString, aNotDownloaded);
|
||||
headerSink->HandleAttachment(url /* was escapedUrl */, unicodeHeaderValue, uriString, aNotDownloaded);
|
||||
nsCRT::free(escapedUrl);
|
||||
mSkipAttachment = PR_TRUE;
|
||||
}
|
||||
|
|
|
@ -205,6 +205,13 @@ nsresult nsNntpService::DisplayMessage(const char* aMessageURI, nsISupports * aD
|
|||
return rv;
|
||||
}
|
||||
|
||||
/* void OpenAttachment (in nsIURI aURI, in nsISupports aDisplayConsumer, in nsIMsgWindow aMsgWindow, in nsIUrlListener aUrlListener, out nsIURI aURL); */
|
||||
NS_IMETHODIMP nsNntpService::OpenAttachment(nsIURI *aURI, const char *aMessageURI, nsISupports *aDisplayConsumer, nsIMsgWindow *aMsgWindow, nsIUrlListener *aUrlListener, nsIURI **aURL)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
|
||||
/* readonly attribute canFetchMimeParts; */
|
||||
NS_IMETHODIMP nsNntpService::GetCanFetchMimeParts(PRBool *canFetchMimeParts)
|
||||
{
|
||||
|
|
Загрузка…
Ссылка в новой задаче