fixed bug 17100 - [FEATURE] enabled partial message download for pop3

This commit is contained in:
jefft%netscape.com 2000-04-25 01:48:00 +00:00
parent 71ffe0bc54
commit da50b52420
25 changed files with 372 additions and 34 deletions

View File

@ -494,6 +494,7 @@ nsScriptSecurityManager::CheckLoadURI(nsIURI *aFromURI, nsIURI *aURI,
{ "imap", DenyProtocol },
{ "mailbox", DenyProtocol },
{ "pop3", DenyProtocol },
{ "pop", AllowProtocol },
{ "news", AllowProtocol },
};

View File

@ -92,4 +92,5 @@ interface nsIMsgMessageUrl : nsISupports {
attribute nsIFileSpec messageFile;
attribute boolean AddDummyEnvelope;
attribute boolean canonicalLineEnding;
attribute string originalSpec;
};

View File

@ -153,6 +153,8 @@ NS_IMETHODIMP nsMsgMailNewsUrl::GetServer(nsIMsgIncomingServer ** aIncomingServe
rv = GetScheme(getter_Copies(scheme));
if (NS_SUCCEEDED(rv))
{
if (nsCRT::strcmp((const char *)scheme, "pop") == 0)
scheme = "pop3";
NS_WITH_SERVICE(nsIMsgAccountManager, accountManager,
NS_MSGACCOUNTMANAGER_PROGID, &rv);
if (NS_FAILED(rv)) return rv;

View File

@ -1066,6 +1066,18 @@ NS_IMETHODIMP nsImapUrl::IsUrlType(PRUint32 type, PRBool *isType)
}
NS_IMETHODIMP
nsImapUrl::GetOriginalSpec(char ** aSpec)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsImapUrl::SetOriginalSpec(const char *aSpec)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
char *nsImapUrl::ReplaceCharsInCopiedString(const char *stringToCopy, char oldChar, char newChar)
{
char oldCharString[2];

View File

@ -126,10 +126,10 @@
"component://netscape/messenger/popservice"
#define NS_POP3SERVICE_PROGID2 \
NS_NETWORK_PROTOCOL_PROGID_PREFIX "pop3"
NS_NETWORK_PROTOCOL_PROGID_PREFIX "pop"
#define NS_POP3PROTOCOLINFO_PROGID \
NS_MSGPROTOCOLINFO_PROGID_PREFIX "pop3"
NS_MSGPROTOCOLINFO_PROGID_PREFIX "pop"
#define NS_POP3SERVICE_CID \
{ /* 3BB459E3-D746-11d2-806A-006008128C4E */ \

View File

@ -35,9 +35,9 @@ typedef long nsMailboxParseState;
[scriptable, uuid(0CC23170-1459-11d3-8097-006008128C4E)]
interface nsIMsgParseMailMsgState : nsISupports {
attribute unsigned long envelopePos;
void SetMailDB(in nsIMsgDatabase aDatabase);
void Clear();
void SetEnvelopePos(in unsigned long aEnvelopePos);
void ParseAFolderLine(in string line, in unsigned long lineLength);
nsIMsgDBHdr GetNewMsgHdr();

View File

@ -59,5 +59,4 @@ interface nsIPop3Service : nsISupports {
nsIURI CheckForNewMail(in nsIMsgWindow aMsgWindow, in nsIUrlListener aUrlListener,
in nsIMsgFolder inbox,
in nsIPop3IncomingServer popServer);
};

View File

@ -31,6 +31,9 @@ interface nsIPop3Sink : nsISupports {
attribute boolean userAuthenticated;
attribute string mailAccountURL;
attribute boolean buildMessageUri;
attribute string messageUri;
attribute string baseMessageUri;
boolean BeginMailDelivery();
void EndMailDelivery();

View File

@ -26,6 +26,7 @@
[scriptable, uuid(73c043d0-b7e2-11d2-ab5c-00805f8ac968)]
interface nsIPop3URL : nsISupports {
attribute nsIPop3Sink pop3Sink;
attribute string messageUri;
void SetUsername(in string aUserName);
};

View File

@ -74,6 +74,7 @@
#include "nsIDocShell.h"
#include "nsIPrompt.h"
#include "nsIInterfaceRequestor.h"
#include "nsIPop3URL.h"
static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
@ -2570,3 +2571,78 @@ nsresult nsMsgLocalMailFolder::CreateBaseMessageURI(const char *aURI)
return rv;
}
NS_IMETHODIMP
nsMsgLocalMailFolder::OnStartRunningUrl(nsIURI * aUrl)
{
nsresult rv;
nsCOMPtr<nsIPop3URL> popurl = do_QueryInterface(aUrl, &rv);
if (NS_SUCCEEDED(rv))
{
nsXPIDLCString aSpec;
aUrl->GetSpec(getter_Copies(aSpec));
if (aSpec && PL_strstr((const char *) aSpec, "uidl="))
{
nsCOMPtr<nsIPop3Sink> popsink;
rv = popurl->GetPop3Sink(getter_AddRefs(popsink));
if (NS_SUCCEEDED(rv))
popsink->SetBaseMessageUri(mBaseMessageURI);
}
}
return nsMsgDBFolder::OnStartRunningUrl(aUrl);
}
NS_IMETHODIMP
nsMsgLocalMailFolder::OnStopRunningUrl(nsIURI * aUrl, nsresult aExitCode)
{
if (NS_SUCCEEDED(aExitCode))
{
nsXPIDLCString aSpec;
aUrl->GetSpec(getter_Copies(aSpec));
if (PL_strstr(aSpec, "uidl="))
{
nsresult rv;
nsCOMPtr<nsIPop3URL> popurl = do_QueryInterface(aUrl, &rv);
if (NS_SUCCEEDED(rv))
{
nsXPIDLCString messageuri;
rv = popurl->GetMessageUri(getter_Copies(messageuri));
if (NS_SUCCEEDED(rv))
{
NS_WITH_SERVICE(nsIRDFService, rdfService, kRDFServiceCID, &rv);
if(NS_SUCCEEDED(rv))
{
nsCOMPtr<nsIRDFResource> msgResource;
nsCOMPtr<nsIMessage> message;
rv = rdfService->GetResource(messageuri,
getter_AddRefs(msgResource));
if(NS_SUCCEEDED(rv))
rv = msgResource->QueryInterface(NS_GET_IID(nsIMessage),
getter_AddRefs(message));
if (NS_SUCCEEDED(rv))
{
nsCOMPtr <nsIMsgDBHdr> msgDBHdr;
nsCOMPtr<nsIDBMessage> dbMessage(do_QueryInterface(message,
&rv));
if(NS_SUCCEEDED(rv))
{
rv = dbMessage->GetMsgDBHdr(getter_AddRefs(msgDBHdr));
if(NS_SUCCEEDED(rv))
rv = mDatabase->DeleteHeader(msgDBHdr, nsnull, PR_TRUE,
PR_TRUE);
}
}
nsCOMPtr<nsIPop3Sink> pop3sink;
nsXPIDLCString newMessageUri;
rv = popurl->GetPop3Sink(getter_AddRefs(pop3sink));
if (NS_SUCCEEDED(rv))
pop3sink->GetMessageUri(getter_Copies(newMessageUri));
}
}
}
}
}
return nsMsgDBFolder::OnStopRunningUrl(aUrl, aExitCode);
}

View File

@ -88,6 +88,10 @@ public:
// nsICollection methods:
NS_IMETHOD Enumerate(nsIEnumerator* *result);
// nsIUrlListener methods
NS_IMETHOD OnStartRunningUrl(nsIURI * aUrl);
NS_IMETHOD OnStopRunningUrl(nsIURI * aUrl, nsresult aExitCode);
// nsIFolder methods:
NS_IMETHOD GetSubFolders(nsIEnumerator* *result);

View File

@ -36,10 +36,12 @@
#include "nsMsgLocalCID.h"
#include "nsMsgBaseCID.h"
#include "nsIDocShell.h"
#include "nsIPop3Service.h"
static NS_DEFINE_CID(kCMailboxUrl, NS_MAILBOXURL_CID);
static NS_DEFINE_CID(kCMailDB, NS_MAILDB_CID);
static NS_DEFINE_CID(kMsgMailSessionCID, NS_MSGMAILSESSION_CID);
static NS_DEFINE_CID(kCPop3ServiceCID, NS_POP3SERVICE_CID);
nsMailboxService::nsMailboxService()
{
@ -289,7 +291,9 @@ nsresult nsMailboxService::PrepareMessageUrl(const char * aSrcMsgMailboxURI, nsI
rv = url->RegisterListener(aUrlListener);
url->SetMsgWindow(msgWindow);
nsCOMPtr<nsIMsgMessageUrl> msgUrl = do_QueryInterface(url);
if (msgUrl)
msgUrl->SetOriginalSpec(aSrcMsgMailboxURI);
} // if we got a url
} // if we got a url
@ -320,18 +324,30 @@ NS_IMETHODIMP nsMailboxService::NewURI(const char *aSpec, nsIURI *aBaseURI, nsIU
{
nsCOMPtr<nsIMailboxUrl> aMsgUrl;
nsresult rv = NS_OK;
rv = nsComponentManager::CreateInstance(kCMailboxUrl,
nsnull,
NS_GET_IID(nsIMailboxUrl),
getter_AddRefs(aMsgUrl));
if (PL_strstr(aSpec, "?uidl=") || PL_strstr(aSpec, "&uidl="))
{
NS_WITH_SERVICE(nsIPop3Service, pop3Service, kCPop3ServiceCID, &rv);
if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsIProtocolHandler> handler = do_QueryInterface(pop3Service,
&rv);
if (NS_SUCCEEDED(rv))
rv = handler->NewURI(aSpec, aBaseURI, _retval);
}
else
{
rv = nsComponentManager::CreateInstance(kCMailboxUrl,
nsnull,
NS_GET_IID(nsIMailboxUrl),
getter_AddRefs(aMsgUrl));
if (NS_SUCCEEDED(rv))
{
nsCOMPtr<nsIURL> aUrl = do_QueryInterface(aMsgUrl);
aUrl->SetSpec((char *) aSpec);
aMsgUrl->SetMailboxAction(nsIMailboxUrl::ActionDisplayMessage);
aMsgUrl->QueryInterface(NS_GET_IID(nsIURI), (void **) _retval);
}
if (NS_SUCCEEDED(rv))
{
nsCOMPtr<nsIURL> aUrl = do_QueryInterface(aMsgUrl);
aUrl->SetSpec((char *) aSpec);
aMsgUrl->SetMailboxAction(nsIMailboxUrl::ActionDisplayMessage);
aMsgUrl->QueryInterface(NS_GET_IID(nsIURI), (void **) _retval);
}
}
return rv;
}

View File

@ -305,6 +305,21 @@ NS_IMETHODIMP nsMailboxUrl::GetMessageHeader(nsIMsgDBHdr ** aMsgHdr)
NS_IMPL_GETSET(nsMailboxUrl, AddDummyEnvelope, PRBool, m_addDummyEnvelope);
NS_IMPL_GETSET(nsMailboxUrl, CanonicalLineEnding, PRBool, m_canonicalLineEnding);
NS_IMETHODIMP
nsMailboxUrl::GetOriginalSpec(char **aSpec)
{
if (!aSpec || !m_originalSpec) return NS_ERROR_NULL_POINTER;
*aSpec = nsCRT::strdup(m_originalSpec);
return NS_OK;
}
NS_IMETHODIMP
nsMailboxUrl::SetOriginalSpec(const char *aSpec)
{
m_originalSpec = aSpec;
return NS_OK;
}
NS_IMETHODIMP nsMailboxUrl::SetMessageFile(nsIFileSpec * aFileSpec)
{
m_messageFileSpec = dont_QueryInterface(aFileSpec);
@ -429,4 +444,3 @@ char * extractAttributeValue(const char * searchString, const char * attributeNa
return attributeValue;
}

View File

@ -78,6 +78,9 @@ protected:
PRBool m_addDummyEnvelope;
PRBool m_canonicalLineEnding;
nsresult ParseSearchPart();
// truncated message support
nsXPIDLCString m_originalSpec;
};
#endif // nsMailboxUrl_h__

View File

@ -499,6 +499,15 @@ NS_IMETHODIMP nsParseMailMessageState::GetState(nsMailboxParseState *aState)
return NS_OK;
}
NS_IMETHODIMP
nsParseMailMessageState::GetEnvelopePos(PRUint32 *aEnvelopePos)
{
if (!aEnvelopePos)
return NS_ERROR_NULL_POINTER;
*aEnvelopePos = m_envelope_pos;
return NS_OK;
}
NS_IMETHODIMP nsParseMailMessageState::SetEnvelopePos(PRUint32 aEnvelopePos)
{
m_envelope_pos = aEnvelopePos;

View File

@ -677,7 +677,7 @@ nsresult nsPop3Protocol::LoadUrl(nsIURI* aURL, nsISupports * /* aConsumer */)
if (uidl)
{
uidl += 6;
uidl += 5;
m_pop3ConData->only_uidl = PL_strdup(uidl);
}

View File

@ -41,6 +41,9 @@
#include "nsIFileLocator.h"
#include "nsFileLocations.h"
#include "nsIRDFService.h"
#include "nsIRDFDataSource.h"
#include "nsRDFCID.h"
#define POP3_PORT 110 // The IANA port for Pop3
@ -51,6 +54,7 @@ static NS_DEFINE_CID(kPop3UrlCID, NS_POP3URL_CID);
static NS_DEFINE_CID(kMsgMailSessionCID, NS_MSGMAILSESSION_CID);
static NS_DEFINE_IID(kIFileLocatorIID, NS_IFILELOCATOR_IID);
static NS_DEFINE_CID(kFileLocatorCID, NS_FILELOCATOR_CID);
static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
nsPop3Service::nsPop3Service()
{
@ -263,18 +267,94 @@ NS_IMETHODIMP nsPop3Service::GetDefaultPort(PRInt32 *aDefaultPort)
NS_IMETHODIMP nsPop3Service::NewURI(const char *aSpec, nsIURI *aBaseURI, nsIURI **_retval)
{
// i just haven't implemented this yet...I will be though....
NS_NOTREACHED("nsPop3Service::NewURI");
return NS_ERROR_NOT_IMPLEMENTED;
nsresult rv = NS_ERROR_FAILURE;
if (!aSpec || !_retval) return rv;
nsCAutoString folderUri(aSpec);
nsCOMPtr<nsIRDFResource> resource;
PRInt32 offset = folderUri.Find("?");
if (offset)
folderUri.Truncate(offset);
NS_WITH_SERVICE(nsIRDFService, rdfService, kRDFServiceCID, &rv);
if (NS_FAILED(rv)) return rv;
rv = rdfService->GetResource(folderUri.GetBuffer(),
getter_AddRefs(resource));
if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsIMsgFolder> folder = do_QueryInterface(resource, &rv);
if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsIMsgIncomingServer> server;
rv = folder->GetServer(getter_AddRefs(server));
if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsIPop3IncomingServer> popServer = do_QueryInterface(server,&rv);
if (NS_FAILED(rv)) return rv;
nsXPIDLCString hostname;
nsXPIDLCString username;
server->GetHostName(getter_Copies(hostname));
server->GetUsername(getter_Copies(username));
nsCAutoString popSpec = "pop://";
popSpec += hostname;
popSpec += ":";
popSpec.AppendInt(POP3_PORT);
popSpec += "?";
const char *uidl = PL_strstr(aSpec, "uidl=");
if (!uidl) return NS_ERROR_FAILURE;
popSpec += uidl;
nsCOMPtr<nsIUrlListener> urlListener = do_QueryInterface(folder, &rv);
if (NS_FAILED(rv)) return rv;
rv = BuildPop3Url((char *)popSpec.GetBuffer(), folder, popServer,
urlListener, _retval, nsnull);
if (NS_SUCCEEDED(rv))
{
nsCOMPtr<nsIMsgMailNewsUrl> mailnewsurl =
do_QueryInterface(*_retval, &rv);
if (NS_SUCCEEDED(rv))
{
mailnewsurl->SetUsername((const char*) username);
}
nsCOMPtr<nsIPop3URL> popurl = do_QueryInterface(mailnewsurl, &rv);
if (NS_SUCCEEDED(rv))
{
nsCAutoString messageUri (aSpec);
messageUri.ReplaceSubstring("mailbox:", "mailbox_message:");
messageUri.ReplaceSubstring("?number=", "#");
offset = messageUri.Find("&");
if (offset)
messageUri.Truncate(offset);
popurl->SetMessageUri(messageUri.GetBuffer());
nsCOMPtr<nsIPop3Sink> pop3Sink;
rv = popurl->GetPop3Sink(getter_AddRefs(pop3Sink));
if (NS_SUCCEEDED(rv))
pop3Sink->SetBuildMessageUri(PR_TRUE);
}
}
return rv;
}
NS_IMETHODIMP nsPop3Service::NewChannel(nsIURI *aURI, nsIChannel **_retval)
{
// mscott - right now, I don't like the idea of returning channels to the caller. They just want us
// to run the url, they don't want a channel back...I'm going to be addressing this issue with
// the necko team in more detail later on.
NS_NOTREACHED("nsPop3Service::NewChannel");
return NS_ERROR_NOT_IMPLEMENTED;
nsresult rv = NS_OK;
nsPop3Protocol * protocol = new nsPop3Protocol(aURI);
if (protocol)
{
rv = protocol->Initialize(aURI);
if (NS_FAILED(rv))
{
delete protocol;
return rv;
}
nsXPIDLCString username;
nsCOMPtr<nsIMsgMailNewsUrl> url = do_QueryInterface(aURI, &rv);
if (NS_SUCCEEDED(rv) && url)
{
url->GetUsername(getter_Copies(username));
protocol->SetUsername((const char *)username);
}
rv = protocol->QueryInterface(NS_GET_IID(nsIChannel), (void **) _retval);
}
else
rv = NS_ERROR_NULL_POINTER;
return rv;
}
@ -359,3 +439,5 @@ nsPop3Service::GetDefaultCopiesAndFoldersPrefsToServer(PRBool *aDefaultCopiesAnd
*aDefaultCopiesAndFoldersPrefsToServer = PR_TRUE;
return NS_OK;
}

View File

@ -31,6 +31,7 @@
#include "nsParseMailbox.h"
#include "nsIFolder.h"
#include "nsIMsgIncomingServer.h"
#include "nsLocalUtils.h"
#include "nsMsgLocalFolderHdrs.h"
NS_IMPL_ISUPPORTS(nsPop3Sink, NS_GET_IID(nsIPop3Sink));
@ -50,7 +51,8 @@ nsPop3Sink::nsPop3Sink()
#endif
m_popServer = nsnull;
m_outFileStream = nsnull;
m_folder = nsnull;
m_folder = nsnull;
m_buildMessageUri = PR_FALSE;
}
nsPop3Sink::~nsPop3Sink()
@ -371,6 +373,13 @@ nsresult nsPop3Sink::WriteLineToMailbox(char *buffer)
nsresult
nsPop3Sink::IncorporateComplete(void* closure)
{
if (m_buildMessageUri && m_baseMessageUri)
{
PRUint32 msgKey = -1;
m_newMailParser->GetEnvelopePos(&msgKey);
m_messageUri.SetLength(0);
nsBuildLocalMessageURI(m_baseMessageUri, msgKey, m_messageUri);
}
WriteLineToMailbox(MSG_LINEBREAK);
// do not take out this printf as it is used by QA
@ -431,3 +440,55 @@ nsPop3Sink::SetBiffStateAndUpdateFE(PRUint32 aBiffState, PRInt32 numNewMessages)
}
return NS_OK;
}
NS_IMETHODIMP
nsPop3Sink::GetBuildMessageUri(PRBool *bVal)
{
if (!bVal)
return NS_ERROR_NULL_POINTER;
*bVal = m_buildMessageUri;
return NS_OK;
}
NS_IMETHODIMP
nsPop3Sink::SetBuildMessageUri(PRBool bVal)
{
m_buildMessageUri = bVal;
return NS_OK;
}
NS_IMETHODIMP
nsPop3Sink::GetMessageUri(char **messageUri)
{
if (!messageUri || m_messageUri.Length() <= 0)
return NS_ERROR_NULL_POINTER;
*messageUri = m_messageUri.ToNewCString();
return NS_OK;
}
NS_IMETHODIMP
nsPop3Sink::SetMessageUri(const char *messageUri)
{
if (!messageUri)
return NS_ERROR_NULL_POINTER;
m_messageUri = messageUri;
return NS_OK;
}
NS_IMETHODIMP
nsPop3Sink::GetBaseMessageUri(char **baseMessageUri)
{
if (!baseMessageUri || !m_baseMessageUri)
return NS_ERROR_NULL_POINTER;
*baseMessageUri = nsCRT::strdup((const char *) m_baseMessageUri);
return NS_OK;
}
NS_IMETHODIMP
nsPop3Sink::SetBaseMessageUri(const char *baseMessageUri)
{
if (!baseMessageUri)
return NS_ERROR_NULL_POINTER;
m_baseMessageUri = baseMessageUri;
return NS_OK;
}

View File

@ -32,6 +32,7 @@
#include "plstr.h"
#include "prenv.h"
#include "nsIMsgFolder.h"
#include "nsXPIDLString.h"
class nsParseNewMailState;
class nsIFolder;
@ -66,6 +67,9 @@ protected:
PRInt32 m_fileCounter;
#endif
nsIOFileStream* m_outFileStream;
PRBool m_buildMessageUri;
nsCString m_messageUri;
nsXPIDLCString m_baseMessageUri;
};
#endif

View File

@ -67,13 +67,33 @@ NS_IMETHODIMP nsPop3URL::SetUsername(const char *aUserName)
{
nsresult rv = NS_OK;
if (aUserName)
{
m_userName = aUserName;
nsMsgMailNewsUrl::SetUsername(aUserName);
}
else
rv = NS_ERROR_NULL_POINTER;
return rv;
}
NS_IMETHODIMP
nsPop3URL::GetMessageUri(char ** aMessageUri)
{
if(!aMessageUri || m_messageUri.Length() == 0)
return NS_ERROR_NULL_POINTER;
*aMessageUri = m_messageUri.ToNewCString();
return NS_OK;
}
NS_IMETHODIMP
nsPop3URL::SetMessageUri(const char *aMessageUri)
{
if (aMessageUri)
m_messageUri = aMessageUri;
return NS_OK;
}
nsresult nsPop3URL::ParseUrl(const nsString& aSpec)
{
// mscott - i don't believe I'm going to need this

View File

@ -43,6 +43,7 @@ protected:
virtual const char * GetUserName() { return m_userName.GetBuffer();}
nsCString m_userName;
nsCString m_messageUri;
/* Pop3 specific event sinks */
nsCOMPtr<nsIPop3Sink> m_pop3Sink;

View File

@ -802,6 +802,9 @@ mime_display_stream_complete (nsMIMESession *stream)
if (msd->url_name)
nsCRT::free(msd->url_name);
if (msd->orig_url_name)
nsCRT::free(msd->orig_url_name);
PR_FREEIF(msd);
}
@ -824,6 +827,8 @@ mime_display_stream_abort (nsMIMESession *stream, int status)
if (msd->options)
{
PR_FREEIF(msd->options->part_to_load);
PR_FREEIF(msd->options->default_charset);
PR_FREEIF(msd->options->override_charset);
PR_FREEIF(msd->options);
msd->options = 0;
}
@ -832,6 +837,12 @@ mime_display_stream_abort (nsMIMESession *stream, int status)
if (msd->headers)
MimeHeaders_free (msd->headers);
if (msd->url_name)
nsCRT::free(msd->url_name);
if (msd->orig_url_name)
nsCRT::free(msd->orig_url_name);
PR_FREEIF(msd);
}
@ -1209,7 +1220,9 @@ mime_bridge_create_display_stream(
PR_FREEIF(msd);
return NULL;
}
nsCOMPtr<nsIMsgMessageUrl> msgUrl = do_QueryInterface(uri);
if (msgUrl)
msgUrl->GetOriginalSpec(&msd->orig_url_name);
PR_FREEIF(urlString);
}
}

View File

@ -106,6 +106,7 @@ struct mime_stream_data { /* This struct is the state we pass around
amongst the various stream functions
used by MIME_MessageConverter(). */
char *url_name;
char *orig_url_name; /* original url name */
nsIChannel *channel;
nsMimeOutputType format_out;
void *pluginObj2; /* The new XP-COM stream converter object */

View File

@ -35,6 +35,7 @@
#include "nsMimeTypes.h"
#include "nsMsgMessageFlags.h"
#include "nsEscape.h"
#include "nsString.h"
#define MIME_SUPERCLASS mimeContainerClass
MimeDefClass(MimeMessage, MimeMessageClass, mimeMessageClass,
@ -511,7 +512,7 @@ MimeMessage_parse_eof (MimeObject *obj, PRBool abort_p)
if (msd)
{
char *html = obj->options->generate_footer_html_fn
(msd->url_name, obj->options->html_closure, msg->hdrs);
(msd->orig_url_name, obj->options->html_closure, msg->hdrs);
if (html)
{
int lstatus = MimeObject_write(obj, html,
@ -751,15 +752,16 @@ static char *
MimeMessage_partial_message_html(const char *data, void *closure,
MimeHeaders *headers)
{
#if defined(DEBUG_jefft)
printf ("** generate partial message html...\n");
#endif
nsCAutoString orig_url = data;
char *partialMsgHtml = nsnull;
char *uidl = MimeHeaders_get(headers, HEADER_X_UIDL, PR_FALSE, PR_FALSE);
char *msgId = MimeHeaders_get(headers, HEADER_MESSAGE_ID, PR_FALSE,
PR_FALSE);
char *msgIdPtr = PL_strstr(msgId, "<");
orig_url.ReplaceSubstring("mailbox_message", "mailbox");
orig_url.ReplaceSubstring("#", "?number=");
if (msgIdPtr)
msgIdPtr++;
else
@ -772,7 +774,8 @@ MimeMessage_partial_message_html(const char *data, void *closure,
char *fmt1 = MimeGetStringByID(1037);
char *fmt2 = MimeGetStringByID(1038);
char *fmt3 = MimeGetStringByID(1039);
char *msgUrl = PR_smprintf("%s&id=%s&uidl=%s", data, escapedMsgId, uidl);
char *msgUrl = PR_smprintf("%s&messageid=%s&uidl=%s",
orig_url.GetBuffer(), escapedMsgId, uidl);
partialMsgHtml = PR_smprintf("%s%s%s%s", fmt1,fmt2, msgUrl, fmt3);
PR_FREEIF(uidl);
PR_FREEIF(msgId);

View File

@ -423,3 +423,15 @@ NS_IMETHODIMP nsNntpUrl::IsUrlType(PRUint32 type, PRBool *isType)
}
NS_IMETHODIMP
nsNntpUrl::GetOriginalSpec(char **aSpec)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsNntpUrl::SetOriginalSpec(const char *aSpec)
{
return NS_ERROR_NOT_IMPLEMENTED;
}