зеркало из https://github.com/mozilla/pjs.git
remove hard coded tabs and some trailing white space.
white space change only.
This commit is contained in:
Родитель
3d3842538b
Коммит
5feadfec3c
|
@ -53,7 +53,7 @@ interface nsIMailboxService : nsISupports {
|
|||
* the url you are given back. Remember to release aURL when you are done
|
||||
* with it. Pass nsnull in for aURL if you don't care about the returned URL.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* Pass in a file path for the mailbox you wish to parse. You also need to
|
||||
* pass in a mailbox parser (the consumer). The url listener can be null
|
||||
|
|
|
@ -49,46 +49,46 @@ typedef long nsMailboxAction;
|
|||
[scriptable, uuid(2ac72280-90f4-4d80-8af1-5e7a1997e2a8)]
|
||||
interface nsIMailboxUrl : nsISupports {
|
||||
|
||||
// Mailbox urls which parse a mailbox folder require a consumer of the
|
||||
// Mailbox urls which parse a mailbox folder require a consumer of the
|
||||
// stream which will represent the mailbox. This consumer is the mailbox
|
||||
// parser. As data from the mailbox folder is read in, the data will be
|
||||
// written to a stream and the consumer will be notified through
|
||||
// nsIStreamListenter::OnDataAvailable that the stream has data
|
||||
// available...
|
||||
// mscott: I wonder if the caller should be allowed to create and set
|
||||
// available...
|
||||
// mscott: I wonder if the caller should be allowed to create and set
|
||||
// the stream they want the data written to as well? Hmm....
|
||||
|
||||
|
||||
attribute nsIStreamListener mailboxParser;
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// Copy/Move mailbox urls require a mailbox copy handler which actually
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// Copy/Move mailbox urls require a mailbox copy handler which actually
|
||||
// performs the copy.
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
attribute nsIStreamListener mailboxCopyHandler;
|
||||
|
||||
// Some mailbox urls include a message key for the message in question.
|
||||
readonly attribute nsMsgKey messageKey;
|
||||
|
||||
|
||||
// this is to support multiple msg move/copy in one url
|
||||
void setMoveCopyMsgKeys(out nsMsgKey keysToFlag, in long numKeys);
|
||||
void getMoveCopyMsgHdrForIndex(in unsigned long msgIndex, out nsIMsgDBHdr msgHdr);
|
||||
readonly attribute unsigned long numMoveCopyMsgs;
|
||||
attribute unsigned long curMoveCopyMsgIndex;
|
||||
// mailbox urls to fetch a mail message can specify the size of
|
||||
// mailbox urls to fetch a mail message can specify the size of
|
||||
// the message...
|
||||
// this saves us the trouble of having to open up the msg db and ask
|
||||
// this saves us the trouble of having to open up the msg db and ask
|
||||
// ourselves...
|
||||
attribute unsigned long messageSize;
|
||||
|
||||
|
||||
attribute nsMailboxAction mailboxAction;
|
||||
|
||||
/* these are nsMailboxActions */
|
||||
const long ActionParseMailbox = 0;
|
||||
const long ActionParseMailbox = 0;
|
||||
const long ActionFetchMessage = 1;
|
||||
const long ActionCopyMessage = 2;
|
||||
const long ActionMoveMessage = 3;
|
||||
const long ActionSaveMessageToDisk = 4;
|
||||
const long ActionAppendMessageToDisk = 5;
|
||||
const long ActionFetchPart = 6;
|
||||
const long ActionMoveMessage = 3;
|
||||
const long ActionSaveMessageToDisk = 4;
|
||||
const long ActionAppendMessageToDisk = 5;
|
||||
const long ActionFetchPart = 6;
|
||||
};
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ interface nsIMsgParseMailMsgState : nsISupports {
|
|||
|
||||
long GetAllHeaders(out string headers);
|
||||
readonly attribute string headers;
|
||||
attribute nsMailboxParseState state;
|
||||
attribute nsMailboxParseState state;
|
||||
/* these are nsMailboxParseState */
|
||||
const long ParseEnvelopeState=0;
|
||||
const long ParseHeadersState=1;
|
||||
|
|
|
@ -44,13 +44,13 @@ interface nsIMsgWindow;
|
|||
interface nsINewsBlogFeedDownloader : nsISupports
|
||||
{
|
||||
void downloadFeed(in string aUrl, in nsIMsgFolder aFolder,
|
||||
in boolean aQuickMode, in wstring aTitle,
|
||||
in nsIUrlListener aUrlListener, in nsIMsgWindow aMsgWindow);
|
||||
in boolean aQuickMode, in wstring aTitle,
|
||||
in nsIUrlListener aUrlListener, in nsIMsgWindow aMsgWindow);
|
||||
|
||||
/* A convient method to subscribe to feeds without going through the subscribe UI
|
||||
used by drag and drop */
|
||||
void subscribeToFeed(in string aUrl, in nsIMsgFolder aFolder, in nsIMsgWindow aMsgWindow);
|
||||
|
||||
|
||||
/* called when the RSS Incoming Server detects a change to an RSS folder. For instance, the user just
|
||||
deleted an RSS folder and we need to update the subscriptions data source. Or the user renamed an RSS folder...
|
||||
*/
|
||||
|
|
|
@ -40,5 +40,5 @@
|
|||
|
||||
[scriptable, uuid(14714890-1dd2-11b2-87de-d265839520d6)]
|
||||
interface nsINoneService : nsISupports {
|
||||
/* nothing yet, but soon. */
|
||||
/* nothing yet, but soon. */
|
||||
};
|
||||
|
|
|
@ -67,12 +67,12 @@ interface nsIPop3Service : nsISupports {
|
|||
* we'll eventually pass in an identity to this call so you can get
|
||||
* mail on different pop3 accounts....
|
||||
*/
|
||||
|
||||
|
||||
nsIURI GetNewMail(in nsIMsgWindow aMsgWindow, in nsIUrlListener aUrlListener,
|
||||
in nsIMsgFolder aInbox,
|
||||
in nsIMsgFolder aInbox,
|
||||
in nsIPop3IncomingServer popServer);
|
||||
|
||||
nsIURI CheckForNewMail(in nsIMsgWindow aMsgWindow, in nsIUrlListener aUrlListener,
|
||||
in nsIMsgFolder inbox,
|
||||
in nsIMsgFolder inbox,
|
||||
in nsIPop3IncomingServer popServer);
|
||||
};
|
||||
|
|
|
@ -53,7 +53,7 @@
|
|||
NS_RDF_RESOURCE_FACTORY_CONTRACTID_PREFIX "mailbox"
|
||||
#define NS_LOCALMAILFOLDERRESOURCE_CID \
|
||||
{ /* e490d22c-cd67-11d2-8cca-0060b0fc14a3 */ \
|
||||
0xe490d22c, \
|
||||
0xe490d22c, \
|
||||
0xcd67, \
|
||||
0x11d2, \
|
||||
{0x8c, 0xca, 0x00, 0x60, 0xb0, 0xfc, 0x14, 0xa3} \
|
||||
|
@ -65,9 +65,9 @@
|
|||
#define NS_POP3INCOMINGSERVER_CONTRACTID \
|
||||
NS_MSGINCOMINGSERVER_CONTRACTID_PREFIX NS_POP3INCOMINGSERVER_TYPE
|
||||
|
||||
#define NS_POP3INCOMINGSERVER_CID \
|
||||
{ /* D2876E51-E62C-11d2-B7FC-00805F05FFA5 */ \
|
||||
0xd2876e51, 0xe62c, 0x11d2, \
|
||||
#define NS_POP3INCOMINGSERVER_CID \
|
||||
{ /* D2876E51-E62C-11d2-B7FC-00805F05FFA5 */ \
|
||||
0xd2876e51, 0xe62c, 0x11d2, \
|
||||
{0xb7, 0xfc, 0x0, 0x80, 0x5f, 0x5, 0xff, 0xa5 }}
|
||||
|
||||
#ifdef HAVE_MOVEMAIL
|
||||
|
@ -77,9 +77,9 @@
|
|||
#define NS_MOVEMAILINCOMINGSERVER_CONTRACTID \
|
||||
NS_MSGINCOMINGSERVER_CONTRACTID_PREFIX "movemail"
|
||||
|
||||
#define NS_MOVEMAILINCOMINGSERVER_CID \
|
||||
{ /* efbb77e4-1dd2-11b2-bbcf-961563396fec */ \
|
||||
0xefbb77e4, 0x1dd2, 0x11b2, \
|
||||
#define NS_MOVEMAILINCOMINGSERVER_CID \
|
||||
{ /* efbb77e4-1dd2-11b2-bbcf-961563396fec */ \
|
||||
0xefbb77e4, 0x1dd2, 0x11b2, \
|
||||
{0xbb, 0xcf, 0x96, 0x15, 0x63, 0x39, 0x6f, 0xec }}
|
||||
|
||||
#endif /* HAVE_MOVEMAIL */
|
||||
|
@ -90,15 +90,15 @@
|
|||
#define NS_NOINCOMINGSERVER_CONTRACTID \
|
||||
NS_MSGINCOMINGSERVER_CONTRACTID_PREFIX "none"
|
||||
|
||||
#define NS_NOINCOMINGSERVER_CID \
|
||||
{ /* {ca5ffe7e-5f47-11d3-9a51-004005263078} */ \
|
||||
0xca5ffe7e, 0x5f47, 0x11d3, \
|
||||
#define NS_NOINCOMINGSERVER_CID \
|
||||
{ /* {ca5ffe7e-5f47-11d3-9a51-004005263078} */ \
|
||||
0xca5ffe7e, 0x5f47, 0x11d3, \
|
||||
{0x9a, 0x51, 0x00, 0x40, 0x05, 0x26, 0x30, 0x78}}
|
||||
|
||||
|
||||
//
|
||||
// nsMsgMailboxService
|
||||
#define NS_MAILBOXSERVICE_CONTRACTID1 \
|
||||
#define NS_MAILBOXSERVICE_CONTRACTID1 \
|
||||
"@mozilla.org/messenger/mailboxservice;1"
|
||||
|
||||
#define NS_MAILBOXSERVICE_CONTRACTID2 \
|
||||
|
@ -119,7 +119,7 @@
|
|||
//
|
||||
// nsMailboxUrl
|
||||
//
|
||||
#define NS_MAILBOXURL_CONTRACTID \
|
||||
#define NS_MAILBOXURL_CONTRACTID \
|
||||
"@mozilla.org/messenger/mailboxurl;1"
|
||||
|
||||
/* 46EFCB10-CB6D-11d2-8065-006008128C4E */
|
||||
|
@ -153,9 +153,9 @@
|
|||
#define NS_POP3PROTOCOLINFO_CONTRACTID \
|
||||
NS_MSGPROTOCOLINFO_CONTRACTID_PREFIX NS_POP3INCOMINGSERVER_TYPE
|
||||
|
||||
#define NS_POP3SERVICE_CID \
|
||||
{ /* 3BB459E3-D746-11d2-806A-006008128C4E */ \
|
||||
0x3bb459e3, 0xd746, 0x11d2, \
|
||||
#define NS_POP3SERVICE_CID \
|
||||
{ /* 3BB459E3-D746-11d2-806A-006008128C4E */ \
|
||||
0x3bb459e3, 0xd746, 0x11d2, \
|
||||
{ 0x80, 0x6a, 0x0, 0x60, 0x8, 0x12, 0x8c, 0x4e }}
|
||||
|
||||
//
|
||||
|
@ -168,9 +168,9 @@
|
|||
#define NS_NONEPROTOCOLINFO_CONTRACTID \
|
||||
NS_MSGPROTOCOLINFO_CONTRACTID_PREFIX "none"
|
||||
|
||||
#define NS_NONESERVICE_CID \
|
||||
{ /* 75b63b46-1dd2-11b2-9873-bb375e1550fa */ \
|
||||
0x75b63b46, 0x1dd2, 0x11b2, \
|
||||
#define NS_NONESERVICE_CID \
|
||||
{ /* 75b63b46-1dd2-11b2-9873-bb375e1550fa */ \
|
||||
0x75b63b46, 0x1dd2, 0x11b2, \
|
||||
{ 0x98, 0x73, 0xbb, 0x37, 0x5e, 0x15, 0x50, 0xfa }}
|
||||
|
||||
#ifdef HAVE_MOVEMAIL
|
||||
|
@ -184,9 +184,9 @@
|
|||
#define NS_MOVEMAILPROTOCOLINFO_CONTRACTID \
|
||||
NS_MSGPROTOCOLINFO_CONTRACTID_PREFIX "movemail"
|
||||
|
||||
#define NS_MOVEMAILSERVICE_CID \
|
||||
{ /* 0e4db62e-1dd2-11b2-a5e4-f128fe4f1b69 */ \
|
||||
0x0e4db62e, 0x1dd2, 0x11b2, \
|
||||
#define NS_MOVEMAILSERVICE_CID \
|
||||
{ /* 0e4db62e-1dd2-11b2-a5e4-f128fe4f1b69 */ \
|
||||
0x0e4db62e, 0x1dd2, 0x11b2, \
|
||||
{ 0xa5, 0xe4, 0xf1, 0x28, 0xfe, 0x4f, 0x1b, 0x69 }}
|
||||
#endif /* HAVE_MOVEMAIL */
|
||||
|
||||
|
@ -219,17 +219,17 @@
|
|||
#define NS_RSSPROTOCOLINFO_CONTRACTID \
|
||||
NS_MSGPROTOCOLINFO_CONTRACTID_PREFIX "rss"
|
||||
|
||||
#define NS_RSSSERVICE_CID \
|
||||
{ /* 44aef4ce-475b-42e3-bc42-7730d5ce7365 */ \
|
||||
0x44aef4ce, 0x475b, 0x42e3, \
|
||||
#define NS_RSSSERVICE_CID \
|
||||
{ /* 44aef4ce-475b-42e3-bc42-7730d5ce7365 */ \
|
||||
0x44aef4ce, 0x475b, 0x42e3, \
|
||||
{ 0xbc, 0x42, 0x77, 0x30, 0xd5, 0xce, 0x73, 0x65 }}
|
||||
|
||||
#define NS_RSSINCOMINGSERVER_CONTRACTID \
|
||||
NS_MSGINCOMINGSERVER_CONTRACTID_PREFIX "rss"
|
||||
|
||||
#define NS_RSSINCOMINGSERVER_CID \
|
||||
{ /* 3a874285-5520-41a0-bcda-a3dee3dbf4f3 */ \
|
||||
0x3a874285, 0x5520, 0x41a0, \
|
||||
#define NS_RSSINCOMINGSERVER_CID \
|
||||
{ /* 3a874285-5520-41a0-bcda-a3dee3dbf4f3 */ \
|
||||
0x3a874285, 0x5520, 0x41a0, \
|
||||
{0xbc, 0xda, 0xa3, 0xde, 0xe3, 0xdb, 0xf4, 0xf3 }}
|
||||
|
||||
#endif // nsMsgLocalCID_h__
|
||||
|
|
|
@ -49,8 +49,8 @@
|
|||
|
||||
#define NS_LOCALMOVECOPYMSGTXN_IID \
|
||||
{ /* 874363b4-242e-11d3-afad-001083002da8 */ \
|
||||
0x874363b4, 0x242e, 0x11d3, \
|
||||
{ 0xaf, 0xad, 0x00, 0x10, 0x83, 0x00, 0x2d, 0xa8 } }
|
||||
0x874363b4, 0x242e, 0x11d3, \
|
||||
{ 0xaf, 0xad, 0x00, 0x10, 0x83, 0x00, 0x2d, 0xa8 } }
|
||||
|
||||
class nsLocalUndoFolderListener;
|
||||
|
||||
|
@ -70,20 +70,20 @@ public:
|
|||
|
||||
// helper
|
||||
nsresult AddSrcKey(nsMsgKey aKey);
|
||||
nsresult AddSrcStatusOffset(PRUint32 statusOffset);
|
||||
nsresult AddSrcStatusOffset(PRUint32 statusOffset);
|
||||
nsresult AddDstKey(nsMsgKey aKey);
|
||||
nsresult AddDstMsgSize(PRUint32 msgSize);
|
||||
nsresult SetSrcFolder(nsIMsgFolder* srcFolder);
|
||||
nsresult GetSrcIsImap(PRBool *isImap);
|
||||
nsresult SetDstFolder(nsIMsgFolder* dstFolder);
|
||||
nsresult Init(nsIMsgFolder* srcFolder,
|
||||
nsIMsgFolder* dstFolder,
|
||||
PRBool isMove);
|
||||
nsresult UndoImapDeleteFlag(nsIMsgFolder* aFolder,
|
||||
nsIMsgFolder* dstFolder,
|
||||
PRBool isMove);
|
||||
nsresult UndoImapDeleteFlag(nsIMsgFolder* aFolder,
|
||||
nsMsgKeyArray& aKeyArray,
|
||||
PRBool deleteFlag);
|
||||
nsresult UndoTransactionInternal();
|
||||
|
||||
|
||||
private:
|
||||
nsWeakPtr m_srcFolder;
|
||||
nsMsgKeyArray m_srcKeyArray; // used when src is local or imap
|
||||
|
@ -107,7 +107,7 @@ public:
|
|||
|
||||
nsLocalUndoFolderListener(nsLocalMoveCopyMsgTxn *aTxn, nsIMsgFolder *aFolder);
|
||||
virtual ~nsLocalUndoFolderListener();
|
||||
|
||||
|
||||
private:
|
||||
nsLocalMoveCopyMsgTxn *mTxn;
|
||||
nsIMsgFolder *mFolder;
|
||||
|
|
|
@ -44,33 +44,33 @@
|
|||
#include "nsIChannel.h"
|
||||
#include "nsIOutputStream.h"
|
||||
#include "nsIMailboxUrl.h"
|
||||
// State Flags (Note, I use the word state in terms of storing
|
||||
// State Flags (Note, I use the word state in terms of storing
|
||||
// state information about the connection (authentication, have we sent
|
||||
// commands, etc. I do not intend it to refer to protocol state)
|
||||
|
||||
#define MAILBOX_PAUSE_FOR_READ 0x00000001 /* should we pause for the next read */
|
||||
#define MAILBOX_PAUSE_FOR_READ 0x00000001 /* should we pause for the next read */
|
||||
#define MAILBOX_MSG_PARSE_FIRST_LINE 0x00000002 /* have we read in the first line of the msg */
|
||||
|
||||
/* states of the machine
|
||||
*/
|
||||
typedef enum _MailboxStatesEnum {
|
||||
MAILBOX_READ_FOLDER,
|
||||
MAILBOX_FINISH_OPEN_FOLDER,
|
||||
MAILBOX_OPEN_MESSAGE,
|
||||
MAILBOX_OPEN_STREAM,
|
||||
MAILBOX_READ_MESSAGE,
|
||||
MAILBOX_COMPRESS_FOLDER,
|
||||
MAILBOX_FINISH_COMPRESS_FOLDER,
|
||||
MAILBOX_BACKGROUND,
|
||||
MAILBOX_NULL,
|
||||
MAILBOX_NULL2,
|
||||
MAILBOX_DELIVER_QUEUED,
|
||||
MAILBOX_FINISH_DELIVER_QUEUED,
|
||||
MAILBOX_DONE,
|
||||
MAILBOX_ERROR_DONE,
|
||||
MAILBOX_FREE,
|
||||
MAILBOX_COPY_MESSAGES,
|
||||
MAILBOX_FINISH_COPY_MESSAGES
|
||||
MAILBOX_READ_FOLDER,
|
||||
MAILBOX_FINISH_OPEN_FOLDER,
|
||||
MAILBOX_OPEN_MESSAGE,
|
||||
MAILBOX_OPEN_STREAM,
|
||||
MAILBOX_READ_MESSAGE,
|
||||
MAILBOX_COMPRESS_FOLDER,
|
||||
MAILBOX_FINISH_COMPRESS_FOLDER,
|
||||
MAILBOX_BACKGROUND,
|
||||
MAILBOX_NULL,
|
||||
MAILBOX_NULL2,
|
||||
MAILBOX_DELIVER_QUEUED,
|
||||
MAILBOX_FINISH_DELIVER_QUEUED,
|
||||
MAILBOX_DONE,
|
||||
MAILBOX_ERROR_DONE,
|
||||
MAILBOX_FREE,
|
||||
MAILBOX_COPY_MESSAGES,
|
||||
MAILBOX_FINISH_COPY_MESSAGES
|
||||
} MailboxStatesEnum;
|
||||
|
||||
class nsMsgLineStreamBuffer;
|
||||
|
@ -78,76 +78,76 @@ class nsMsgLineStreamBuffer;
|
|||
class nsMailboxProtocol : public nsMsgProtocol
|
||||
{
|
||||
public:
|
||||
// Creating a protocol instance requires the URL which needs to be run AND it requires
|
||||
// a transport layer.
|
||||
nsMailboxProtocol(nsIURI * aURL);
|
||||
virtual ~nsMailboxProtocol();
|
||||
// Creating a protocol instance requires the URL which needs to be run AND it requires
|
||||
// a transport layer.
|
||||
nsMailboxProtocol(nsIURI * aURL);
|
||||
virtual ~nsMailboxProtocol();
|
||||
|
||||
// initialization function given a new url and transport layer
|
||||
nsresult Initialize(nsIURI * aURL);
|
||||
nsresult Initialize(nsIURI * aURL);
|
||||
|
||||
// the consumer of the url might be something like an nsIDocShell....
|
||||
virtual nsresult LoadUrl(nsIURI * aURL, nsISupports * aConsumer);
|
||||
// the consumer of the url might be something like an nsIDocShell....
|
||||
virtual nsresult LoadUrl(nsIURI * aURL, nsISupports * aConsumer);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
// we suppport the nsIStreamListener interface
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
// we suppport the nsIStreamListener interface
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
NS_IMETHOD OnStartRequest(nsIRequest *request, nsISupports *ctxt);
|
||||
NS_IMETHOD OnStopRequest(nsIRequest *request, nsISupports *ctxt, nsresult aStatus);
|
||||
NS_IMETHOD OnStartRequest(nsIRequest *request, nsISupports *ctxt);
|
||||
NS_IMETHOD OnStopRequest(nsIRequest *request, nsISupports *ctxt, nsresult aStatus);
|
||||
NS_IMETHOD GetContentLength(PRInt32 * aContentLength);
|
||||
|
||||
private:
|
||||
nsCOMPtr<nsIMailboxUrl> m_runningUrl; // the nsIMailboxURL that is currently running
|
||||
nsMailboxAction m_mailboxAction; // current mailbox action associated with this connnection...
|
||||
PRInt32 m_originalContentLength; /* the content length at the time of calling graph progress */
|
||||
nsCOMPtr<nsIMailboxUrl> m_runningUrl; // the nsIMailboxURL that is currently running
|
||||
nsMailboxAction m_mailboxAction; // current mailbox action associated with this connnection...
|
||||
PRInt32 m_originalContentLength; /* the content length at the time of calling graph progress */
|
||||
|
||||
// Event sink handles
|
||||
nsCOMPtr<nsIStreamListener> m_mailboxParser;
|
||||
// Event sink handles
|
||||
nsCOMPtr<nsIStreamListener> m_mailboxParser;
|
||||
|
||||
// Local state for the current operation
|
||||
nsMsgLineStreamBuffer * m_lineStreamBuffer; // used to efficiently extract lines from the incoming data stream
|
||||
// Local state for the current operation
|
||||
nsMsgLineStreamBuffer * m_lineStreamBuffer; // used to efficiently extract lines from the incoming data stream
|
||||
|
||||
// Generic state information -- What state are we in? What state do we want to go to
|
||||
// after the next response? What was the last response code? etc.
|
||||
MailboxStatesEnum m_nextState;
|
||||
// Generic state information -- What state are we in? What state do we want to go to
|
||||
// after the next response? What was the last response code? etc.
|
||||
MailboxStatesEnum m_nextState;
|
||||
MailboxStatesEnum m_initialState;
|
||||
|
||||
|
||||
PRInt32 mCurrentProgress;
|
||||
PRUint32 m_messageID;
|
||||
PRUint32 m_messageID;
|
||||
|
||||
// can we just use the base class m_tempMsgFile?
|
||||
nsCOMPtr<nsIFile> m_tempMessageFile;
|
||||
nsCOMPtr<nsIFile> m_tempMessageFile;
|
||||
nsCOMPtr<nsIOutputStream> m_msgFileOutputStream;
|
||||
|
||||
// this is used to hold the source mailbox file open when move/copying
|
||||
// multiple messages.
|
||||
nsCOMPtr<nsIInputStream> m_multipleMsgMoveCopyStream;
|
||||
|
||||
virtual nsresult ProcessProtocolState(nsIURI * url, nsIInputStream * inputStream,
|
||||
PRUint32 sourceOffset, PRUint32 length);
|
||||
virtual nsresult CloseSocket();
|
||||
virtual nsresult ProcessProtocolState(nsIURI * url, nsIInputStream * inputStream,
|
||||
PRUint32 sourceOffset, PRUint32 length);
|
||||
virtual nsresult CloseSocket();
|
||||
|
||||
PRInt32 SetupMessageExtraction();
|
||||
PRInt32 SetupMessageExtraction();
|
||||
nsresult OpenMultipleMsgTransport(PRUint32 offset, PRInt32 size);
|
||||
nsresult OpenFileSocketForReuse(nsIURI * aURL, PRUint32 aStartPosition, PRInt32 aReadCount);
|
||||
PRBool RunningMultipleMsgUrl();
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Protocol Methods --> This protocol is state driven so each protocol method is
|
||||
// designed to re-act to the current "state". I've attempted to
|
||||
// group them together based on functionality.
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Protocol Methods --> This protocol is state driven so each protocol method is
|
||||
// designed to re-act to the current "state". I've attempted to
|
||||
// group them together based on functionality.
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// When parsing a mailbox folder in chunks, this protocol state reads in the current chunk
|
||||
// and forwards it to the mailbox parser.
|
||||
PRInt32 ReadFolderResponse(nsIInputStream * inputStream, PRUint32 sourceOffset, PRUint32 length);
|
||||
PRInt32 ReadMessageResponse(nsIInputStream * inputStream, PRUint32 sourceOffset, PRUint32 length);
|
||||
PRInt32 DoneReadingMessage();
|
||||
// When parsing a mailbox folder in chunks, this protocol state reads in the current chunk
|
||||
// and forwards it to the mailbox parser.
|
||||
PRInt32 ReadFolderResponse(nsIInputStream * inputStream, PRUint32 sourceOffset, PRUint32 length);
|
||||
PRInt32 ReadMessageResponse(nsIInputStream * inputStream, PRUint32 sourceOffset, PRUint32 length);
|
||||
PRInt32 DoneReadingMessage();
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
// End of Protocol Methods
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
// End of Protocol Methods
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
};
|
||||
|
||||
#endif // nsMailboxProtocol_h___
|
||||
|
|
|
@ -74,8 +74,8 @@ nsMailboxService::~nsMailboxService()
|
|||
|
||||
NS_IMPL_ISUPPORTS4(nsMailboxService, nsIMailboxService, nsIMsgMessageService, nsIProtocolHandler, nsIMsgMessageFetchPartService)
|
||||
|
||||
nsresult nsMailboxService::ParseMailbox(nsIMsgWindow *aMsgWindow, nsILocalFile *aMailboxPath, nsIStreamListener *aMailboxParser,
|
||||
nsIUrlListener * aUrlListener, nsIURI ** aURL)
|
||||
nsresult nsMailboxService::ParseMailbox(nsIMsgWindow *aMsgWindow, nsILocalFile *aMailboxPath, nsIStreamListener *aMailboxParser,
|
||||
nsIUrlListener * aUrlListener, nsIURI ** aURL)
|
||||
{
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIMailboxUrl> mailboxurl = do_CreateInstance(kCMailboxUrl, &rv);
|
||||
|
@ -84,7 +84,7 @@ nsresult nsMailboxService::ParseMailbox(nsIMsgWindow *aMsgWindow, nsILocalFile *
|
|||
nsCOMPtr<nsIMsgMailNewsUrl> url = do_QueryInterface(mailboxurl);
|
||||
// okay now generate the url string
|
||||
nsCString mailboxPath;
|
||||
|
||||
|
||||
aMailboxPath->GetNativePath(mailboxPath);
|
||||
nsCAutoString buf;
|
||||
NS_EscapeURL(mailboxPath.get(),-1,
|
||||
|
@ -98,17 +98,17 @@ nsresult nsMailboxService::ParseMailbox(nsIMsgWindow *aMsgWindow, nsILocalFile *
|
|||
mailboxurl->SetMailboxParser(aMailboxParser);
|
||||
if (aUrlListener)
|
||||
url->RegisterListener(aUrlListener);
|
||||
|
||||
|
||||
rv = RunMailboxUrl(url, nsnull);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
||||
if (aURL)
|
||||
{
|
||||
*aURL = url;
|
||||
NS_IF_ADDREF(*aURL);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
@ -161,7 +161,7 @@ nsresult nsMailboxService::CopyMessages(nsMsgKeyArray *msgKeys,
|
|||
msgUrl->SetMsgWindow(aMsgWindow);
|
||||
|
||||
mailboxUrl->SetMoveCopyMsgKeys(msgKeys->GetArray(), msgKeys->GetSize());
|
||||
rv = RunMailboxUrl(url, aMailboxCopyHandler);
|
||||
rv = RunMailboxUrl(url, aMailboxCopyHandler);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -172,7 +172,7 @@ nsresult nsMailboxService::CopyMessages(nsMsgKeyArray *msgKeys,
|
|||
}
|
||||
|
||||
nsresult nsMailboxService::FetchMessage(const char* aMessageURI,
|
||||
nsISupports * aDisplayConsumer,
|
||||
nsISupports * aDisplayConsumer,
|
||||
nsIMsgWindow * aMsgWindow,
|
||||
nsIUrlListener * aUrlListener,
|
||||
const char * aFileName, /* only used by open attachment... */
|
||||
|
@ -182,9 +182,9 @@ nsresult nsMailboxService::FetchMessage(const char* aMessageURI,
|
|||
{
|
||||
nsresult rv = NS_OK;
|
||||
nsCOMPtr<nsIMailboxUrl> mailboxurl;
|
||||
|
||||
|
||||
nsMailboxAction actionToUse = mailboxAction;
|
||||
|
||||
|
||||
nsCOMPtr <nsIURI> url;
|
||||
|
||||
nsCAutoString uriString(aMessageURI);
|
||||
|
@ -241,7 +241,7 @@ nsresult nsMailboxService::FetchMessage(const char* aMessageURI,
|
|||
}
|
||||
else
|
||||
rv = PrepareMessageUrl(aMessageURI, aUrlListener, actionToUse , getter_AddRefs(mailboxurl), aMsgWindow);
|
||||
|
||||
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
url = do_QueryInterface(mailboxurl);
|
||||
|
@ -253,7 +253,7 @@ nsresult nsMailboxService::FetchMessage(const char* aMessageURI,
|
|||
msgUrl->SetFileName(nsDependentCString(aFileName));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// instead of running the mailbox url like we used to, let's try to run the url in the docshell...
|
||||
nsCOMPtr<nsIDocShell> docShell(do_QueryInterface(aDisplayConsumer, &rv));
|
||||
// if we were given a docShell, run the url in the docshell..otherwise just run it normally.
|
||||
|
@ -271,11 +271,11 @@ nsresult nsMailboxService::FetchMessage(const char* aMessageURI,
|
|||
rv = docShell->LoadURI(url, loadInfo, nsIWebNavigation::LOAD_FLAGS_NONE, PR_FALSE);
|
||||
}
|
||||
else
|
||||
rv = RunMailboxUrl(url, aDisplayConsumer);
|
||||
|
||||
rv = RunMailboxUrl(url, aDisplayConsumer);
|
||||
|
||||
if (aURL && mailboxurl)
|
||||
mailboxurl->QueryInterface(NS_GET_IID(nsIURI), (void **) aURL);
|
||||
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
@ -283,12 +283,12 @@ NS_IMETHODIMP nsMailboxService::FetchMimePart(nsIURI *aURI, const char *aMessage
|
|||
{
|
||||
nsCOMPtr<nsIMsgMailNewsUrl> msgUrl (do_QueryInterface(aURI));
|
||||
msgUrl->SetMsgWindow(aMsgWindow);
|
||||
|
||||
|
||||
// set up the url listener
|
||||
if (aUrlListener)
|
||||
msgUrl->RegisterListener(aUrlListener);
|
||||
|
||||
return RunMailboxUrl(msgUrl, aDisplayConsumer);
|
||||
|
||||
return RunMailboxUrl(msgUrl, aDisplayConsumer);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMailboxService::DisplayMessage(const char* aMessageURI,
|
||||
|
@ -304,16 +304,16 @@ NS_IMETHODIMP nsMailboxService::DisplayMessage(const char* aMessageURI,
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMailboxService::StreamMessage(const char *aMessageURI, nsISupports *aConsumer,
|
||||
nsIMsgWindow *aMsgWindow,
|
||||
nsIUrlListener *aUrlListener,
|
||||
nsMailboxService::StreamMessage(const char *aMessageURI, nsISupports *aConsumer,
|
||||
nsIMsgWindow *aMsgWindow,
|
||||
nsIUrlListener *aUrlListener,
|
||||
PRBool /* aConvertData */,
|
||||
const char *aAdditionalHeader,
|
||||
nsIURI **aURL)
|
||||
nsIURI **aURL)
|
||||
{
|
||||
// The mailbox protocol object will look for "header=filter" or
|
||||
// "header=attach" to decide if it wants to convert the data instead of
|
||||
// using aConvertData. It turns out to be way too hard to pass aConvertData
|
||||
// The mailbox protocol object will look for "header=filter" or
|
||||
// "header=attach" to decide if it wants to convert the data instead of
|
||||
// using aConvertData. It turns out to be way too hard to pass aConvertData
|
||||
// all the way over to the mailbox protocol object.
|
||||
nsCAutoString aURIString(aMessageURI);
|
||||
if (aAdditionalHeader)
|
||||
|
@ -323,16 +323,16 @@ nsMailboxService::StreamMessage(const char *aMessageURI, nsISupports *aConsumer,
|
|||
aURIString += aAdditionalHeader;
|
||||
}
|
||||
|
||||
return FetchMessage(aURIString.get(), aConsumer, aMsgWindow, aUrlListener, nsnull,
|
||||
return FetchMessage(aURIString.get(), aConsumer, aMsgWindow, aUrlListener, nsnull,
|
||||
nsIMailboxUrl::ActionFetchMessage, nsnull, aURL);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMailboxService::OpenAttachment(const char *aContentType,
|
||||
NS_IMETHODIMP nsMailboxService::OpenAttachment(const char *aContentType,
|
||||
const char *aFileName,
|
||||
const char *aUrl,
|
||||
const char *aMessageUri,
|
||||
nsISupports *aDisplayConsumer,
|
||||
nsIMsgWindow *aMsgWindow,
|
||||
const char *aUrl,
|
||||
const char *aMessageUri,
|
||||
nsISupports *aDisplayConsumer,
|
||||
nsIMsgWindow *aMsgWindow,
|
||||
nsIUrlListener *aUrlListener)
|
||||
{
|
||||
nsCOMPtr <nsIURI> URL;
|
||||
|
@ -356,15 +356,15 @@ NS_IMETHODIMP nsMailboxService::OpenAttachment(const char *aContentType,
|
|||
loadInfo->SetLoadType(nsIDocShellLoadInfo::loadLink);
|
||||
return docShell->LoadURI(URL, loadInfo, nsIWebNavigation::LOAD_FLAGS_NONE, PR_FALSE);
|
||||
}
|
||||
return RunMailboxUrl(URL, aDisplayConsumer);
|
||||
|
||||
return RunMailboxUrl(URL, aDisplayConsumer);
|
||||
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMailboxService::SaveMessageToDisk(const char *aMessageURI,
|
||||
nsIFile *aFile,
|
||||
PRBool aAddDummyEnvelope,
|
||||
NS_IMETHODIMP
|
||||
nsMailboxService::SaveMessageToDisk(const char *aMessageURI,
|
||||
nsIFile *aFile,
|
||||
PRBool aAddDummyEnvelope,
|
||||
nsIUrlListener *aUrlListener,
|
||||
nsIURI **aURL,
|
||||
PRBool canonicalLineEnding,
|
||||
|
@ -372,9 +372,9 @@ nsMailboxService::SaveMessageToDisk(const char *aMessageURI,
|
|||
{
|
||||
nsresult rv = NS_OK;
|
||||
nsCOMPtr<nsIMailboxUrl> mailboxurl;
|
||||
|
||||
|
||||
rv = PrepareMessageUrl(aMessageURI, aUrlListener, nsIMailboxUrl::ActionSaveMessageToDisk, getter_AddRefs(mailboxurl), aMsgWindow);
|
||||
|
||||
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
nsCOMPtr<nsIMsgMessageUrl> msgUrl = do_QueryInterface(mailboxurl);
|
||||
|
@ -384,14 +384,14 @@ nsMailboxService::SaveMessageToDisk(const char *aMessageURI,
|
|||
msgUrl->SetAddDummyEnvelope(aAddDummyEnvelope);
|
||||
msgUrl->SetCanonicalLineEnding(canonicalLineEnding);
|
||||
}
|
||||
|
||||
|
||||
nsCOMPtr<nsIURI> url = do_QueryInterface(mailboxurl);
|
||||
rv = RunMailboxUrl(url);
|
||||
}
|
||||
|
||||
|
||||
if (aURL)
|
||||
mailboxurl->QueryInterface(NS_GET_IID(nsIURI), (void **) aURL);
|
||||
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
@ -416,11 +416,11 @@ nsresult nsMailboxService::RunMailboxUrl(nsIURI * aMailboxUrl, nsISupports * aDi
|
|||
// create a protocol instance to run the url..
|
||||
nsresult rv = NS_OK;
|
||||
nsMailboxProtocol * protocol = new nsMailboxProtocol(aMailboxUrl);
|
||||
|
||||
|
||||
if (protocol)
|
||||
{
|
||||
rv = protocol->Initialize(aMailboxUrl);
|
||||
if (NS_FAILED(rv))
|
||||
if (NS_FAILED(rv))
|
||||
{
|
||||
delete protocol;
|
||||
return rv;
|
||||
|
@ -429,11 +429,11 @@ nsresult nsMailboxService::RunMailboxUrl(nsIURI * aMailboxUrl, nsISupports * aDi
|
|||
rv = protocol->LoadUrl(aMailboxUrl, aDisplayConsumer);
|
||||
NS_RELEASE(protocol); // after loading, someone else will have a ref cnt on the mailbox
|
||||
}
|
||||
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
// This function takes a message uri, converts it into a file path & msgKey
|
||||
// This function takes a message uri, converts it into a file path & msgKey
|
||||
// pair. It then turns that into a mailbox url object. It also registers a url
|
||||
// listener if appropriate. AND it can take in a mailbox action and set that field
|
||||
// on the returned url as well.
|
||||
|
@ -454,7 +454,7 @@ nsresult nsMailboxService::PrepareMessageUrl(const char * aSrcMsgMailboxURI, nsI
|
|||
rv = nsParseLocalMessageURI(aSrcMsgMailboxURI, folderURI, &msgKey);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
rv = nsLocalURI2Path(kMailboxRootURI, folderURI.get(), folderPath);
|
||||
|
||||
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
// set up the url spec and initialize the url with it.
|
||||
|
@ -469,17 +469,17 @@ nsresult nsMailboxService::PrepareMessageUrl(const char * aSrcMsgMailboxURI, nsI
|
|||
urlSpec = PR_smprintf("mailbox://%s?number=%d&%s", buf.get(), msgKey, header);
|
||||
else
|
||||
urlSpec = PR_smprintf("mailbox://%s?number=%d", buf.get(), msgKey);
|
||||
|
||||
|
||||
nsCOMPtr <nsIMsgMailNewsUrl> url = do_QueryInterface(*aMailboxUrl);
|
||||
url->SetSpec(nsDependentCString(urlSpec));
|
||||
PR_Free(urlSpec);
|
||||
|
||||
|
||||
(*aMailboxUrl)->SetMailboxAction(aMailboxAction);
|
||||
|
||||
|
||||
// set up the url listener
|
||||
if (aUrlListener)
|
||||
rv = url->RegisterListener(aUrlListener);
|
||||
|
||||
|
||||
url->SetMsgWindow(msgWindow);
|
||||
nsCOMPtr<nsIMsgMessageUrl> msgUrl = do_QueryInterface(url);
|
||||
if (msgUrl)
|
||||
|
@ -487,32 +487,32 @@ nsresult nsMailboxService::PrepareMessageUrl(const char * aSrcMsgMailboxURI, nsI
|
|||
msgUrl->SetOriginalSpec(aSrcMsgMailboxURI);
|
||||
msgUrl->SetUri(aSrcMsgMailboxURI);
|
||||
}
|
||||
|
||||
|
||||
} // if we got a url
|
||||
} // if we got a url
|
||||
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMailboxService::GetScheme(nsACString &aScheme)
|
||||
{
|
||||
aScheme = "mailbox";
|
||||
return NS_OK;
|
||||
aScheme = "mailbox";
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMailboxService::GetDefaultPort(PRInt32 *aDefaultPort)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
if (aDefaultPort)
|
||||
*aDefaultPort = -1; // mailbox doesn't use a port!!!!!
|
||||
else
|
||||
rv = NS_ERROR_NULL_POINTER;
|
||||
return rv;
|
||||
nsresult rv = NS_OK;
|
||||
if (aDefaultPort)
|
||||
*aDefaultPort = -1; // mailbox doesn't use a port!!!!!
|
||||
else
|
||||
rv = NS_ERROR_NULL_POINTER;
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMailboxService::AllowPort(PRInt32 port, const char *scheme, PRBool *_retval)
|
||||
{
|
||||
// don't override anything.
|
||||
// don't override anything.
|
||||
*_retval = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -521,7 +521,7 @@ NS_IMETHODIMP nsMailboxService::GetProtocolFlags(PRUint32 *result)
|
|||
{
|
||||
*result = URI_STD | URI_FORBIDS_AUTOMATIC_DOCUMENT_REPLACEMENT |
|
||||
URI_DANGEROUS_TO_LOAD;
|
||||
return NS_OK;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMailboxService::NewURI(const nsACString &aSpec,
|
||||
|
@ -531,18 +531,18 @@ NS_IMETHODIMP nsMailboxService::NewURI(const nsACString &aSpec,
|
|||
{
|
||||
nsresult rv = NS_OK;
|
||||
nsCOMPtr<nsIURI> aMsgUri = do_CreateInstance(kCMailboxUrl, &rv);
|
||||
|
||||
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
if (aBaseURI)
|
||||
if (aBaseURI)
|
||||
{
|
||||
nsCAutoString newSpec;
|
||||
rv = aBaseURI->Resolve(aSpec, newSpec);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
aMsgUri->SetSpec(newSpec);
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
aMsgUri->SetSpec(aSpec);
|
||||
}
|
||||
|
@ -561,7 +561,7 @@ NS_IMETHODIMP nsMailboxService::NewChannel(nsIURI *aURI, nsIChannel **_retval)
|
|||
|
||||
if (spec.Find("?uidl=") >= 0 || spec.Find("&uidl=") >= 0)
|
||||
{
|
||||
nsCOMPtr<nsIProtocolHandler> handler =
|
||||
nsCOMPtr<nsIProtocolHandler> handler =
|
||||
do_GetService(kCPop3ServiceCID, &rv);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
|
@ -576,7 +576,7 @@ NS_IMETHODIMP nsMailboxService::NewChannel(nsIURI *aURI, nsIChannel **_retval)
|
|||
if (protocol)
|
||||
{
|
||||
rv = protocol->Initialize(aURI);
|
||||
if (NS_FAILED(rv))
|
||||
if (NS_FAILED(rv))
|
||||
{
|
||||
delete protocol;
|
||||
return rv;
|
||||
|
@ -585,7 +585,7 @@ NS_IMETHODIMP nsMailboxService::NewChannel(nsIURI *aURI, nsIChannel **_retval)
|
|||
}
|
||||
else
|
||||
rv = NS_ERROR_NULL_POINTER;
|
||||
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
@ -596,7 +596,7 @@ nsresult nsMailboxService::DisplayMessageForPrinting(const char* aMessageURI,
|
|||
nsIURI ** aURL)
|
||||
{
|
||||
mPrintingOperation = PR_TRUE;
|
||||
nsresult rv = FetchMessage(aMessageURI, aDisplayConsumer, aMsgWindow,aUrlListener, nsnull,
|
||||
nsresult rv = FetchMessage(aMessageURI, aDisplayConsumer, aMsgWindow,aUrlListener, nsnull,
|
||||
nsIMailboxUrl::ActionFetchMessage, nsnull, aURL);
|
||||
mPrintingOperation = PR_FALSE;
|
||||
return rv;
|
||||
|
@ -607,13 +607,13 @@ NS_IMETHODIMP nsMailboxService::Search(nsIMsgSearchSession *aSearchSession, nsIM
|
|||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsresult
|
||||
nsMailboxService::DecomposeMailboxURI(const char * aMessageURI, nsIMsgFolder ** aFolder, nsMsgKey *aMsgKey)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aMessageURI);
|
||||
NS_ENSURE_ARG_POINTER(aFolder);
|
||||
NS_ENSURE_ARG_POINTER(aMsgKey);
|
||||
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
nsCAutoString folderURI;
|
||||
rv = nsParseLocalMessageURI(aMessageURI, folderURI, aMsgKey);
|
||||
|
|
|
@ -55,29 +55,29 @@ class nsMailboxService : public nsIMailboxService, public nsIMsgMessageService,
|
|||
{
|
||||
public:
|
||||
|
||||
nsMailboxService();
|
||||
virtual ~nsMailboxService();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
nsMailboxService();
|
||||
virtual ~nsMailboxService();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIMAILBOXSERVICE
|
||||
NS_DECL_NSIMSGMESSAGESERVICE
|
||||
NS_DECL_NSIMSGMESSAGEFETCHPARTSERVICE
|
||||
NS_DECL_NSIPROTOCOLHANDLER
|
||||
|
||||
protected:
|
||||
PRBool mPrintingOperation;
|
||||
PRBool mPrintingOperation;
|
||||
|
||||
// helper functions used by the service
|
||||
nsresult PrepareMessageUrl(const char * aSrcMsgMailboxURI, nsIUrlListener * aUrlListener,
|
||||
nsMailboxAction aMailboxAction, nsIMailboxUrl ** aMailboxUrl,
|
||||
nsIMsgWindow *msgWindow);
|
||||
// helper functions used by the service
|
||||
nsresult PrepareMessageUrl(const char * aSrcMsgMailboxURI, nsIUrlListener * aUrlListener,
|
||||
nsMailboxAction aMailboxAction, nsIMailboxUrl ** aMailboxUrl,
|
||||
nsIMsgWindow *msgWindow);
|
||||
|
||||
nsresult RunMailboxUrl(nsIURI * aMailboxUrl, nsISupports * aDisplayConsumer = nsnull);
|
||||
nsresult RunMailboxUrl(nsIURI * aMailboxUrl, nsISupports * aDisplayConsumer = nsnull);
|
||||
|
||||
nsresult FetchMessage(const char* aMessageURI,
|
||||
nsISupports * aDisplayConsumer,
|
||||
nsISupports * aDisplayConsumer,
|
||||
nsIMsgWindow * aMsgWindow,
|
||||
nsIUrlListener * aUrlListener,
|
||||
nsIUrlListener * aUrlListener,
|
||||
const char * aFileName, /* only used by open attachment */
|
||||
nsMailboxAction mailboxAction,
|
||||
const char * aCharsetOverride,
|
||||
|
|
|
@ -85,7 +85,7 @@ nsMailboxUrl::nsMailboxUrl()
|
|||
m_canonicalLineEnding = PR_FALSE;
|
||||
m_curMsgIndex = 0;
|
||||
}
|
||||
|
||||
|
||||
nsMailboxUrl::~nsMailboxUrl()
|
||||
{
|
||||
PR_Free(m_messageID);
|
||||
|
@ -114,7 +114,7 @@ nsresult nsMailboxUrl::SetMailboxParser(nsIStreamListener * aMailboxParser)
|
|||
nsresult nsMailboxUrl::GetMailboxParser(nsIStreamListener ** aConsumer)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aConsumer);
|
||||
|
||||
|
||||
NS_IF_ADDREF(*aConsumer = m_mailboxParser);
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -129,13 +129,13 @@ nsresult nsMailboxUrl::SetMailboxCopyHandler(nsIStreamListener * aMailboxCopyHan
|
|||
nsresult nsMailboxUrl::GetMailboxCopyHandler(nsIStreamListener ** aMailboxCopyHandler)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aMailboxCopyHandler);
|
||||
|
||||
|
||||
if (aMailboxCopyHandler)
|
||||
{
|
||||
*aMailboxCopyHandler = m_mailboxCopyHandler;
|
||||
NS_IF_ADDREF(*aMailboxCopyHandler);
|
||||
}
|
||||
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -184,7 +184,7 @@ NS_IMETHODIMP nsMailboxUrl::GetUri(char ** aURI)
|
|||
{
|
||||
// if we have been given a uri to associate with this url, then use it
|
||||
// otherwise try to reconstruct a URI on the fly....
|
||||
|
||||
|
||||
if (!mURI.IsEmpty())
|
||||
*aURI = ToNewCString(mURI);
|
||||
else
|
||||
|
@ -208,7 +208,7 @@ NS_IMETHODIMP nsMailboxUrl::GetUri(char ** aURI)
|
|||
else
|
||||
*aURI = nsnull;
|
||||
}
|
||||
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -219,9 +219,9 @@ nsresult nsMailboxUrl::GetMsgHdrForKey(nsMsgKey msgKey, nsIMsgDBHdr ** aMsgHdr)
|
|||
{
|
||||
nsCOMPtr<nsIMsgDatabase> mailDBFactory;
|
||||
nsCOMPtr<nsIMsgDatabase> mailDB;
|
||||
|
||||
|
||||
nsCOMPtr<nsIMsgDBService> msgDBService = do_GetService(NS_MSGDB_SERVICE_CONTRACTID, &rv);
|
||||
|
||||
|
||||
if (msgDBService)
|
||||
rv = msgDBService->OpenMailDBFromFile(m_filePath, PR_FALSE, PR_FALSE, (nsIMsgDatabase **) getter_AddRefs(mailDB));
|
||||
if (NS_SUCCEEDED(rv) && mailDB) // did we get a db back?
|
||||
|
@ -249,7 +249,7 @@ nsresult nsMailboxUrl::GetMsgHdrForKey(nsMsgKey msgKey, nsIMsgDBHdr ** aMsgHdr)
|
|||
}
|
||||
else
|
||||
rv = NS_ERROR_NULL_POINTER;
|
||||
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
@ -264,7 +264,7 @@ NS_IMPL_GETSET(nsMailboxUrl, CanonicalLineEnding, PRBool, m_canonicalLineEnding)
|
|||
NS_IMETHODIMP
|
||||
nsMailboxUrl::GetOriginalSpec(char **aSpec)
|
||||
{
|
||||
if (!aSpec || m_originalSpec.IsEmpty())
|
||||
if (!aSpec || m_originalSpec.IsEmpty())
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
*aSpec = ToNewCString(m_originalSpec);
|
||||
return NS_OK;
|
||||
|
@ -294,7 +294,7 @@ NS_IMETHODIMP nsMailboxUrl::GetMessageFile(nsIFile ** aFile)
|
|||
NS_IMETHODIMP nsMailboxUrl::IsUrlType(PRUint32 type, PRBool *isType)
|
||||
{
|
||||
NS_ENSURE_ARG(isType);
|
||||
|
||||
|
||||
switch(type)
|
||||
{
|
||||
case nsIMsgMailNewsUrl::eCopy:
|
||||
|
@ -308,10 +308,10 @@ NS_IMETHODIMP nsMailboxUrl::IsUrlType(PRUint32 type, PRBool *isType)
|
|||
break;
|
||||
default:
|
||||
*isType = PR_FALSE;
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
return NS_OK;
|
||||
|
||||
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -334,18 +334,18 @@ nsresult nsMailboxUrl::ParseSearchPart()
|
|||
m_mailboxAction = nsIMailboxUrl::ActionFetchPart;
|
||||
else
|
||||
m_mailboxAction = nsIMailboxUrl::ActionFetchMessage;
|
||||
|
||||
|
||||
char * messageKey = extractAttributeValue(searchPart.get(), "number=");
|
||||
m_messageID = extractAttributeValue(searchPart.get(),"messageid=");
|
||||
if (messageKey)
|
||||
m_messageKey = atol(messageKey); // convert to a long...
|
||||
|
||||
|
||||
PR_Free(msgPart);
|
||||
PR_Free(messageKey);
|
||||
}
|
||||
else
|
||||
m_mailboxAction = nsIMailboxUrl::ActionParseMailbox;
|
||||
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
@ -375,7 +375,7 @@ nsresult nsMailboxUrl::ParseUrl()
|
|||
nsCOMPtr <nsIFile> fileURLFile;
|
||||
fileURL->GetFile(getter_AddRefs(fileURLFile));
|
||||
m_filePath = do_QueryInterface(fileURLFile, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
GetPath(m_file);
|
||||
|
@ -398,7 +398,7 @@ NS_IMETHODIMP nsMailboxUrl::SetQuery(const nsACString &aQuery)
|
|||
return rv;
|
||||
}
|
||||
|
||||
// takes a string like ?messageID=fooo&number=MsgKey and returns a new string
|
||||
// takes a string like ?messageID=fooo&number=MsgKey and returns a new string
|
||||
// containing just the attribute value. i.e you could pass in this string with
|
||||
// an attribute name of messageID and I'll return fooo. Use PR_Free to delete
|
||||
// this string...
|
||||
|
@ -407,7 +407,7 @@ NS_IMETHODIMP nsMailboxUrl::SetQuery(const nsACString &aQuery)
|
|||
char * extractAttributeValue(const char * searchString, const char * attributeName)
|
||||
{
|
||||
char * attributeValue = nsnull;
|
||||
|
||||
|
||||
if (searchString && attributeName)
|
||||
{
|
||||
// search the string for attributeName
|
||||
|
@ -423,15 +423,15 @@ char * extractAttributeValue(const char * searchString, const char * attributeNa
|
|||
attributeValue = PL_strndup(startOfAttribute, endofAttribute - startOfAttribute);
|
||||
else // there is nothing left so eat up rest of line.
|
||||
attributeValue = PL_strdup(startOfAttribute);
|
||||
|
||||
|
||||
// now unescape the string...
|
||||
if (attributeValue)
|
||||
attributeValue = nsUnescape(attributeValue); // unescape the string...
|
||||
} // if we have a attribute value
|
||||
|
||||
|
||||
} // if we have a attribute name
|
||||
} // if we got non-null search string and attribute name values
|
||||
|
||||
|
||||
return attributeValue;
|
||||
}
|
||||
|
||||
|
@ -444,7 +444,7 @@ nsresult nsMailboxUrl::GetFolder(nsIMsgFolder **msgFolder)
|
|||
nsCString uri;
|
||||
GetUri(getter_Copies(uri));
|
||||
NS_ENSURE_TRUE(!uri.IsEmpty(), NS_ERROR_FAILURE);
|
||||
nsCOMPtr<nsIMsgDBHdr> msg;
|
||||
nsCOMPtr<nsIMsgDBHdr> msg;
|
||||
GetMsgDBHdrFromURI(uri.get(), getter_AddRefs(msg));
|
||||
NS_ENSURE_TRUE(msg, NS_ERROR_FAILURE);
|
||||
return msg->GetFolder(msgFolder);
|
||||
|
@ -475,7 +475,7 @@ NS_IMETHODIMP nsMailboxUrl::GetFolderCharsetOverride(PRBool * aCharacterSetOverr
|
|||
NS_IMETHODIMP nsMailboxUrl::GetCharsetOverRide(char ** aCharacterSet)
|
||||
{
|
||||
if (!mCharsetOverride.IsEmpty())
|
||||
*aCharacterSet = ToNewCString(mCharsetOverride);
|
||||
*aCharacterSet = ToNewCString(mCharsetOverride);
|
||||
else
|
||||
*aCharacterSet = nsnull;
|
||||
return NS_OK;
|
||||
|
|
|
@ -91,7 +91,7 @@ protected:
|
|||
nsCOMPtr<nsIStreamListener> m_mailboxCopyHandler;
|
||||
|
||||
nsMailboxAction m_mailboxAction; // the action this url represents...parse mailbox, display messages, etc.
|
||||
nsCOMPtr <nsILocalFile> m_filePath;
|
||||
nsCOMPtr <nsILocalFile> m_filePath;
|
||||
char *m_messageID;
|
||||
PRUint32 m_messageSize;
|
||||
nsMsgKey m_messageKey;
|
||||
|
|
|
@ -48,12 +48,12 @@ class nsNoneService : public nsIMsgProtocolInfo, public nsINoneService
|
|||
{
|
||||
public:
|
||||
|
||||
nsNoneService();
|
||||
virtual ~nsNoneService();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
nsNoneService();
|
||||
virtual ~nsNoneService();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIMSGPROTOCOLINFO
|
||||
NS_DECL_NSINONESERVICE
|
||||
NS_DECL_NSINONESERVICE
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -293,25 +293,25 @@ void nsMsgMailboxParser::UpdateProgressPercent ()
|
|||
|
||||
int nsMsgMailboxParser::ProcessMailboxInputStream(nsIURI* aURL, nsIInputStream *aIStream, PRUint32 aLength)
|
||||
{
|
||||
nsresult ret = NS_OK;
|
||||
nsresult ret = NS_OK;
|
||||
|
||||
PRUint32 bytesRead = 0;
|
||||
PRUint32 bytesRead = 0;
|
||||
|
||||
if (NS_SUCCEEDED(m_inputStream.GrowBuffer(aLength)))
|
||||
{
|
||||
// OK, this sucks, but we're going to have to copy into our
|
||||
// own byte buffer, and then pass that to the line buffering code,
|
||||
// which means a couple buffer copies.
|
||||
ret = aIStream->Read(m_inputStream.GetBuffer(), aLength, &bytesRead);
|
||||
if (NS_SUCCEEDED(ret))
|
||||
ret = BufferInput(m_inputStream.GetBuffer(), bytesRead);
|
||||
}
|
||||
if (m_graph_progress_total > 0)
|
||||
{
|
||||
if (NS_SUCCEEDED(ret))
|
||||
m_graph_progress_received += bytesRead;
|
||||
}
|
||||
return (ret);
|
||||
if (NS_SUCCEEDED(m_inputStream.GrowBuffer(aLength)))
|
||||
{
|
||||
// OK, this sucks, but we're going to have to copy into our
|
||||
// own byte buffer, and then pass that to the line buffering code,
|
||||
// which means a couple buffer copies.
|
||||
ret = aIStream->Read(m_inputStream.GetBuffer(), aLength, &bytesRead);
|
||||
if (NS_SUCCEEDED(ret))
|
||||
ret = BufferInput(m_inputStream.GetBuffer(), bytesRead);
|
||||
}
|
||||
if (m_graph_progress_total > 0)
|
||||
{
|
||||
if (NS_SUCCEEDED(ret))
|
||||
m_graph_progress_received += bytesRead;
|
||||
}
|
||||
return (ret);
|
||||
}
|
||||
|
||||
void nsMsgMailboxParser::DoneParsingFolder(nsresult status)
|
||||
|
@ -321,27 +321,27 @@ void nsMsgMailboxParser::DoneParsingFolder(nsresult status)
|
|||
PublishMsgHeader(nsnull);
|
||||
|
||||
// only mark the db valid if we've succeeded.
|
||||
if (NS_SUCCEEDED(status) && m_mailDB) // finished parsing, so flush db folder info
|
||||
if (NS_SUCCEEDED(status) && m_mailDB) // finished parsing, so flush db folder info
|
||||
UpdateDBFolderInfo();
|
||||
else if (m_mailDB)
|
||||
m_mailDB->SetSummaryValid(PR_FALSE);
|
||||
|
||||
// if (m_folder != nsnull)
|
||||
// m_folder->SummaryChanged();
|
||||
// if (m_folder != nsnull)
|
||||
// m_folder->SummaryChanged();
|
||||
FreeBuffers();
|
||||
}
|
||||
|
||||
void nsMsgMailboxParser::FreeBuffers()
|
||||
{
|
||||
/* We're done reading the folder - we don't need these things
|
||||
any more. */
|
||||
PR_FREEIF (m_obuffer);
|
||||
m_obuffer_size = 0;
|
||||
/* We're done reading the folder - we don't need these things
|
||||
any more. */
|
||||
PR_FREEIF (m_obuffer);
|
||||
m_obuffer_size = 0;
|
||||
}
|
||||
|
||||
void nsMsgMailboxParser::UpdateDBFolderInfo()
|
||||
{
|
||||
UpdateDBFolderInfo(m_mailDB);
|
||||
UpdateDBFolderInfo(m_mailDB);
|
||||
}
|
||||
|
||||
// update folder info in db so we know not to reparse.
|
||||
|
@ -375,7 +375,7 @@ PRInt32 nsMsgMailboxParser::PublishMsgHeader(nsIMsgWindow *msgWindow)
|
|||
m_newMsgHdr = nsnull;
|
||||
}
|
||||
else
|
||||
NS_ASSERTION(PR_FALSE, "no database while parsing local folder"); // should have a DB, no?
|
||||
NS_ASSERTION(PR_FALSE, "no database while parsing local folder"); // should have a DB, no?
|
||||
}
|
||||
else if (m_mailDB)
|
||||
{
|
||||
|
@ -395,59 +395,59 @@ void nsMsgMailboxParser::AbortNewHeader()
|
|||
|
||||
PRInt32 nsMsgMailboxParser::HandleLine(char *line, PRUint32 lineLength)
|
||||
{
|
||||
int status = 0;
|
||||
int status = 0;
|
||||
|
||||
/* If this is the very first line of a non-empty folder, make sure it's an envelope */
|
||||
if (m_graph_progress_received == 0)
|
||||
{
|
||||
/* This is the first block from the file. Check to see if this
|
||||
looks like a mail file. */
|
||||
const char *s = line;
|
||||
const char *end = s + lineLength;
|
||||
while (s < end && IS_SPACE(*s))
|
||||
s++;
|
||||
if ((end - s) < 20 || !IsEnvelopeLine(s, end - s))
|
||||
{
|
||||
// char buf[500];
|
||||
// PR_snprintf (buf, sizeof(buf),
|
||||
// XP_GetString(MK_MSG_NON_MAIL_FILE_READ_QUESTION),
|
||||
// folder_name);
|
||||
// else if (!FE_Confirm (m_context, buf))
|
||||
// return NS_MSG_NOT_A_MAIL_FOLDER; /* #### NOT_A_MAIL_FILE */
|
||||
}
|
||||
}
|
||||
// m_graph_progress_received += lineLength;
|
||||
/* If this is the very first line of a non-empty folder, make sure it's an envelope */
|
||||
if (m_graph_progress_received == 0)
|
||||
{
|
||||
/* This is the first block from the file. Check to see if this
|
||||
looks like a mail file. */
|
||||
const char *s = line;
|
||||
const char *end = s + lineLength;
|
||||
while (s < end && IS_SPACE(*s))
|
||||
s++;
|
||||
if ((end - s) < 20 || !IsEnvelopeLine(s, end - s))
|
||||
{
|
||||
// char buf[500];
|
||||
// PR_snprintf (buf, sizeof(buf),
|
||||
// XP_GetString(MK_MSG_NON_MAIL_FILE_READ_QUESTION),
|
||||
// folder_name);
|
||||
// else if (!FE_Confirm (m_context, buf))
|
||||
// return NS_MSG_NOT_A_MAIL_FOLDER; /* #### NOT_A_MAIL_FILE */
|
||||
}
|
||||
}
|
||||
// m_graph_progress_received += lineLength;
|
||||
|
||||
// mailbox parser needs to do special stuff when it finds an envelope
|
||||
// after parsing a message body. So do that.
|
||||
if (line[0] == 'F' && IsEnvelopeLine(line, lineLength))
|
||||
{
|
||||
// **** This used to be
|
||||
// PR_ASSERT (m_parseMsgState->m_state == nsMailboxParseBodyState);
|
||||
// **** I am not sure this is a right thing to do. This happens when
|
||||
// going online, downloading a message while playing back append
|
||||
// draft/template offline operation. We are mixing
|
||||
// mailbox parser needs to do special stuff when it finds an envelope
|
||||
// after parsing a message body. So do that.
|
||||
if (line[0] == 'F' && IsEnvelopeLine(line, lineLength))
|
||||
{
|
||||
// **** This used to be
|
||||
// PR_ASSERT (m_parseMsgState->m_state == nsMailboxParseBodyState);
|
||||
// **** I am not sure this is a right thing to do. This happens when
|
||||
// going online, downloading a message while playing back append
|
||||
// draft/template offline operation. We are mixing
|
||||
// nsMailboxParseBodyState &&
|
||||
// nsMailboxParseHeadersState. David I need your help here too. **** jt
|
||||
// nsMailboxParseHeadersState. David I need your help here too. **** jt
|
||||
|
||||
NS_ASSERTION (m_state == nsIMsgParseMailMsgState::ParseBodyState ||
|
||||
m_state == nsIMsgParseMailMsgState::ParseHeadersState, "invalid parse state"); /* else folder corrupted */
|
||||
PublishMsgHeader(nsnull);
|
||||
Clear();
|
||||
status = StartNewEnvelope(line, lineLength);
|
||||
NS_ASSERTION(status >= 0, " error starting envelope parsing mailbox");
|
||||
// at the start of each new message, update the progress bar
|
||||
UpdateProgressPercent();
|
||||
if (status < 0)
|
||||
return status;
|
||||
}
|
||||
// otherwise, the message parser can handle it completely.
|
||||
else if (m_mailDB != nsnull) // if no DB, do we need to parse at all?
|
||||
return ParseFolderLine(line, lineLength);
|
||||
NS_ASSERTION (m_state == nsIMsgParseMailMsgState::ParseBodyState ||
|
||||
m_state == nsIMsgParseMailMsgState::ParseHeadersState, "invalid parse state"); /* else folder corrupted */
|
||||
PublishMsgHeader(nsnull);
|
||||
Clear();
|
||||
status = StartNewEnvelope(line, lineLength);
|
||||
NS_ASSERTION(status >= 0, " error starting envelope parsing mailbox");
|
||||
// at the start of each new message, update the progress bar
|
||||
UpdateProgressPercent();
|
||||
if (status < 0)
|
||||
return status;
|
||||
}
|
||||
// otherwise, the message parser can handle it completely.
|
||||
else if (m_mailDB != nsnull) // if no DB, do we need to parse at all?
|
||||
return ParseFolderLine(line, lineLength);
|
||||
else
|
||||
return NS_ERROR_NULL_POINTER; // need to error out if we don't have a db.
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
|
@ -656,19 +656,19 @@ nsParseMailMessageState::IsEnvelopeLine(const char *buf, PRInt32 buf_size)
|
|||
{
|
||||
#ifdef STRICT_ENVELOPE
|
||||
/* The required format is
|
||||
From jwz Fri Jul 1 09:13:09 1994
|
||||
But we should also allow at least:
|
||||
From jwz Fri, Jul 01 09:13:09 1994
|
||||
From jwz Fri Jul 1 09:13:09 1994 PST
|
||||
From jwz Fri Jul 1 09:13:09 1994 (+0700)
|
||||
From jwz Fri Jul 1 09:13:09 1994
|
||||
But we should also allow at least:
|
||||
From jwz Fri, Jul 01 09:13:09 1994
|
||||
From jwz Fri Jul 1 09:13:09 1994 PST
|
||||
From jwz Fri Jul 1 09:13:09 1994 (+0700)
|
||||
|
||||
We can't easily call XP_ParseTimeString() because the string is not
|
||||
null terminated (ok, we could copy it after a quick check...) but
|
||||
XP_ParseTimeString() may be too lenient for our purposes.
|
||||
We can't easily call XP_ParseTimeString() because the string is not
|
||||
null terminated (ok, we could copy it after a quick check...) but
|
||||
XP_ParseTimeString() may be too lenient for our purposes.
|
||||
|
||||
DANGER!! The released version of 2.0b1 was (on some systems,
|
||||
some Unix, some NT, possibly others) writing out envelope lines
|
||||
like "From - 10/13/95 11:22:33" which STRICT_ENVELOPE will reject!
|
||||
DANGER!! The released version of 2.0b1 was (on some systems,
|
||||
some Unix, some NT, possibly others) writing out envelope lines
|
||||
like "From - 10/13/95 11:22:33" which STRICT_ENVELOPE will reject!
|
||||
*/
|
||||
const char *date, *end;
|
||||
|
||||
|
@ -681,55 +681,55 @@ nsParseMailMessageState::IsEnvelopeLine(const char *buf, PRInt32 buf_size)
|
|||
|
||||
/* Skip horizontal whitespace between "From " and user name. */
|
||||
while ((*date == ' ' || *date == '\t') && date < end)
|
||||
date++;
|
||||
date++;
|
||||
|
||||
/* If at the end, it doesn't match. */
|
||||
if (IS_SPACE(*date) || date == end)
|
||||
return PR_FALSE;
|
||||
return PR_FALSE;
|
||||
|
||||
/* Skip over user name. */
|
||||
while (!IS_SPACE(*date) && date < end)
|
||||
date++;
|
||||
date++;
|
||||
|
||||
/* Skip horizontal whitespace between user name and date. */
|
||||
while ((*date == ' ' || *date == '\t') && date < end)
|
||||
date++;
|
||||
date++;
|
||||
|
||||
/* Don't want this to be localized. */
|
||||
# define TMP_ISALPHA(x) (((x) >= 'A' && (x) <= 'Z') || \
|
||||
((x) >= 'a' && (x) <= 'z'))
|
||||
((x) >= 'a' && (x) <= 'z'))
|
||||
|
||||
/* take off day-of-the-week. */
|
||||
if (date >= end - 3)
|
||||
return PR_FALSE;
|
||||
return PR_FALSE;
|
||||
if (!TMP_ISALPHA(date[0]) || !TMP_ISALPHA(date[1]) || !TMP_ISALPHA(date[2]))
|
||||
return PR_FALSE;
|
||||
return PR_FALSE;
|
||||
date += 3;
|
||||
/* Skip horizontal whitespace (and commas) between dotw and month. */
|
||||
if (*date != ' ' && *date != '\t' && *date != ',')
|
||||
return PR_FALSE;
|
||||
return PR_FALSE;
|
||||
while ((*date == ' ' || *date == '\t' || *date == ',') && date < end)
|
||||
date++;
|
||||
date++;
|
||||
|
||||
/* take off month. */
|
||||
if (date >= end - 3)
|
||||
return PR_FALSE;
|
||||
return PR_FALSE;
|
||||
if (!TMP_ISALPHA(date[0]) || !TMP_ISALPHA(date[1]) || !TMP_ISALPHA(date[2]))
|
||||
return PR_FALSE;
|
||||
return PR_FALSE;
|
||||
date += 3;
|
||||
/* Skip horizontal whitespace between month and dotm. */
|
||||
if (date == end || (*date != ' ' && *date != '\t'))
|
||||
return PR_FALSE;
|
||||
return PR_FALSE;
|
||||
while ((*date == ' ' || *date == '\t') && date < end)
|
||||
date++;
|
||||
date++;
|
||||
|
||||
/* Skip over digits and whitespace. */
|
||||
while (((*date >= '0' && *date <= '9') || *date == ' ' || *date == '\t') &&
|
||||
date < end)
|
||||
date++;
|
||||
date < end)
|
||||
date++;
|
||||
/* Next character should be a colon. */
|
||||
if (date >= end || *date != ':')
|
||||
return PR_FALSE;
|
||||
return PR_FALSE;
|
||||
|
||||
/* Ok, that ought to be enough... */
|
||||
|
||||
|
@ -753,7 +753,7 @@ NS_IMETHODIMP nsParseMailMessageState::FinishHeader()
|
|||
if (m_newMsgHdr)
|
||||
{
|
||||
m_newMsgHdr->SetMessageKey(m_envelope_pos);
|
||||
m_newMsgHdr->SetMessageSize(m_position - m_envelope_pos); // dmb - no longer number of lines.
|
||||
m_newMsgHdr->SetMessageSize(m_position - m_envelope_pos); // dmb - no longer number of lines.
|
||||
m_newMsgHdr->SetLineCount(m_body_lines);
|
||||
}
|
||||
|
||||
|
@ -1001,7 +1001,7 @@ SEARCH_NEWLINE:
|
|||
;
|
||||
/* If "\r\n " or "\r\n\t" is next, that doesn't terminate the header. */
|
||||
else if (buf+2 < buf_end &&
|
||||
(buf[0] == '\r' && buf[1] == '\n') &&
|
||||
(buf[0] == '\r' && buf[1] == '\n') &&
|
||||
(buf[2] == ' ' || buf[2] == '\t'))
|
||||
{
|
||||
buf += 3;
|
||||
|
@ -1010,7 +1010,7 @@ SEARCH_NEWLINE:
|
|||
/* If "\r " or "\r\t" or "\n " or "\n\t" is next, that doesn't terminate
|
||||
the header either. */
|
||||
else if ((buf[0] == '\r' || buf[0] == '\n') &&
|
||||
(buf[1] == ' ' || buf[1] == '\t'))
|
||||
(buf[1] == ' ' || buf[1] == '\t'))
|
||||
{
|
||||
buf += 2;
|
||||
goto SEARCH_NEWLINE;
|
||||
|
@ -1025,7 +1025,7 @@ SEARCH_NEWLINE:
|
|||
if (*buf == '\r' && buf[1] == '\n')
|
||||
buf++;
|
||||
buf++;
|
||||
*last = 0; /* short-circuit const, and null-terminate header. */
|
||||
*last = 0; /* short-circuit const, and null-terminate header. */
|
||||
}
|
||||
|
||||
if (header)
|
||||
|
@ -1160,7 +1160,7 @@ the rest. */
|
|||
nsresult nsParseMailMessageState::InternRfc822 (struct message_header *header,
|
||||
char **ret_name)
|
||||
{
|
||||
char *s;
|
||||
char *s;
|
||||
nsresult ret=NS_OK;
|
||||
|
||||
if (!header || header->length == 0)
|
||||
|
@ -1212,7 +1212,7 @@ int nsParseMailMessageState::FinalizeHeaders()
|
|||
nsMsgPriorityValue priorityFlags = nsMsgPriority::notSet;
|
||||
PRUint32 labelFlags = 0;
|
||||
|
||||
if (!m_mailDB) // if we don't have a valid db, skip the header.
|
||||
if (!m_mailDB) // if we don't have a valid db, skip the header.
|
||||
return 0;
|
||||
|
||||
struct message_header to;
|
||||
|
@ -1228,7 +1228,7 @@ int nsParseMailMessageState::FinalizeHeaders()
|
|||
cc.length ? &cc :
|
||||
m_newsgroups.length ? &m_newsgroups :
|
||||
sender);
|
||||
ccList = (cc.length ? &cc : 0);
|
||||
ccList = (cc.length ? &cc : 0);
|
||||
subject = (m_subject.length ? &m_subject : 0);
|
||||
id = (m_message_id.length ? &m_message_id : 0);
|
||||
references = (m_references.length ? &m_references : 0);
|
||||
|
@ -1241,7 +1241,7 @@ int nsParseMailMessageState::FinalizeHeaders()
|
|||
deliveryDate = (m_delivery_date.length ? &m_delivery_date : 0);
|
||||
priority = (m_priority.length ? &m_priority : 0);
|
||||
keywords = (m_keywords.length ? &m_keywords : 0);
|
||||
mdn_dnt = (m_mdn_dnt.length ? &m_mdn_dnt : 0);
|
||||
mdn_dnt = (m_mdn_dnt.length ? &m_mdn_dnt : 0);
|
||||
inReplyTo = (m_in_reply_to.length ? &m_in_reply_to : 0);
|
||||
replyTo = (m_replyTo.length ? &m_replyTo : 0);
|
||||
content_type = (m_content_type.length ? &m_content_type : 0);
|
||||
|
@ -1263,7 +1263,7 @@ int nsParseMailMessageState::FinalizeHeaders()
|
|||
}
|
||||
delta = (m_headerstartpos +
|
||||
(mozstatus->value - m_headers.GetBuffer()) -
|
||||
(2 + X_MOZILLA_STATUS_LEN) /* 2 extra bytes for ": ". */
|
||||
(2 + X_MOZILLA_STATUS_LEN) /* 2 extra bytes for ": ". */
|
||||
) - m_envelope_pos;
|
||||
}
|
||||
|
||||
|
@ -1274,7 +1274,7 @@ int nsParseMailMessageState::FinalizeHeaders()
|
|||
flags |= flags2;
|
||||
}
|
||||
|
||||
if (!(flags & MSG_FLAG_EXPUNGED)) // message was deleted, don't bother creating a hdr.
|
||||
if (!(flags & MSG_FLAG_EXPUNGED)) // message was deleted, don't bother creating a hdr.
|
||||
{
|
||||
nsresult ret = m_mailDB->CreateNewHdr(m_envelope_pos, getter_AddRefs(m_newMsgHdr));
|
||||
if (NS_SUCCEEDED(ret) && m_newMsgHdr)
|
||||
|
@ -1307,9 +1307,9 @@ int nsParseMailMessageState::FinalizeHeaders()
|
|||
m_newMsgHdr->SetLabel(labelFlags);
|
||||
}
|
||||
if (delta < 0xffff)
|
||||
{ /* Only use if fits in 16 bits. */
|
||||
{ /* Only use if fits in 16 bits. */
|
||||
m_newMsgHdr->SetStatusOffset((PRUint16) delta);
|
||||
if (!m_IgnoreXMozillaStatus) { // imap doesn't care about X-MozillaStatus
|
||||
if (!m_IgnoreXMozillaStatus) { // imap doesn't care about X-MozillaStatus
|
||||
PRUint32 offset;
|
||||
(void)m_newMsgHdr->GetStatusOffset(&offset);
|
||||
NS_ASSERTION(offset < 10000, "invalid status offset"); /* ### Debugging hack */
|
||||
|
@ -1343,8 +1343,8 @@ int nsParseMailMessageState::FinalizeHeaders()
|
|||
// note that we're now setting the whole recipient list,
|
||||
// not just the pretty name of the first recipient.
|
||||
PRUint32 numAddresses;
|
||||
char *names;
|
||||
char *addresses;
|
||||
char *names;
|
||||
char *addresses;
|
||||
|
||||
ret = m_HeaderAddressParser->ParseHeaderAddresses (nsnull, recipient->value, &names, &addresses, &numAddresses);
|
||||
if (ret == NS_OK)
|
||||
|
@ -1353,15 +1353,15 @@ int nsParseMailMessageState::FinalizeHeaders()
|
|||
PR_Free(addresses);
|
||||
PR_Free(names);
|
||||
}
|
||||
else { // hmm, should we just use the original string?
|
||||
else { // hmm, should we just use the original string?
|
||||
m_newMsgHdr->SetRecipients(recipient->value);
|
||||
}
|
||||
}
|
||||
if (ccList)
|
||||
{
|
||||
PRUint32 numAddresses;
|
||||
char *names;
|
||||
char *addresses;
|
||||
char *names;
|
||||
char *addresses;
|
||||
|
||||
ret = m_HeaderAddressParser->ParseHeaderAddresses (nsnull, ccList->value, &names, &addresses, &numAddresses);
|
||||
if (ret == NS_OK)
|
||||
|
@ -1370,7 +1370,7 @@ int nsParseMailMessageState::FinalizeHeaders()
|
|||
PR_Free(addresses);
|
||||
PR_Free(names);
|
||||
}
|
||||
else // hmm, should we just use the original string?
|
||||
else // hmm, should we just use the original string?
|
||||
m_newMsgHdr->SetCcList(ccList->value);
|
||||
}
|
||||
status = InternSubject (subject);
|
||||
|
@ -1454,7 +1454,7 @@ int nsParseMailMessageState::FinalizeHeaders()
|
|||
// Received: -> Delivery-date: -> date
|
||||
// 'Date' uses:
|
||||
// date -> PR_Now()
|
||||
//
|
||||
//
|
||||
// date is:
|
||||
// Date: -> m_envelope_date
|
||||
|
||||
|
@ -1654,11 +1654,11 @@ void nsParseNewMailState::DoneParsingFolder(nsresult status)
|
|||
m_ibuffer_fp = 0;
|
||||
}
|
||||
PublishMsgHeader(nsnull);
|
||||
if (!moved && m_mailDB) // finished parsing, so flush db folder info
|
||||
if (!moved && m_mailDB) // finished parsing, so flush db folder info
|
||||
UpdateDBFolderInfo();
|
||||
|
||||
/* We're done reading the folder - we don't need these things
|
||||
any more. */
|
||||
any more. */
|
||||
PR_FREEIF (m_ibuffer);
|
||||
m_ibuffer_size = 0;
|
||||
PR_FREEIF (m_obuffer);
|
||||
|
@ -2055,7 +2055,7 @@ NS_IMETHODIMP nsParseNewMailState::ApplyFilterHit(nsIMsgFilter *filter, nsIMsgWi
|
|||
break;
|
||||
case nsMsgFilterAction::FetchBodyFromPop3Server:
|
||||
{
|
||||
PRUint32 flags = 0;
|
||||
PRUint32 flags = 0;
|
||||
nsCOMPtr <nsIMsgFolder> downloadFolder;
|
||||
msgHdr->GetFolder(getter_AddRefs(downloadFolder));
|
||||
nsCOMPtr <nsIMsgLocalMailFolder> localFolder = do_QueryInterface(downloadFolder);
|
||||
|
@ -2300,7 +2300,7 @@ nsresult nsParseNewMailState::MoveIncorporatedMessage(nsIMsgDBHdr *mailHdr,
|
|||
|
||||
nsCOMPtr <nsISupports> myISupports = do_QueryInterface(static_cast<nsIMsgParseMailMsgState*>(this));
|
||||
|
||||
// NS_RELEASE(myThis);
|
||||
// NS_RELEASE(myThis);
|
||||
// Make sure no one else is writing into this folder
|
||||
if (destIFolder && (err = destIFolder->AcquireSemaphore (myISupports)) != 0)
|
||||
{
|
||||
|
@ -2317,7 +2317,7 @@ nsresult nsParseNewMailState::MoveIncorporatedMessage(nsIMsgDBHdr *mailHdr,
|
|||
if (destIFolder)
|
||||
destIFolder->ReleaseSemaphore (myISupports);
|
||||
|
||||
return NS_MSG_FOLDER_UNREADABLE; // ### dmb
|
||||
return NS_MSG_FOLDER_UNREADABLE; // ### dmb
|
||||
}
|
||||
nsCOMPtr <nsISeekableStream> seekableStream = do_QueryInterface(m_inboxFileStream);
|
||||
seekableStream->Seek(nsISeekableStream::NS_SEEK_SET, m_curHdrOffset);
|
||||
|
|
|
@ -83,10 +83,10 @@ class nsParseMailMessageState : public nsIMsgParseMailMsgState
|
|||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIMSGPARSEMAILMSGSTATE
|
||||
|
||||
|
||||
nsParseMailMessageState();
|
||||
virtual ~nsParseMailMessageState();
|
||||
|
||||
|
||||
void Init(PRUint32 fileposition);
|
||||
virtual PRInt32 ParseFolderLine(const char *line, PRUint32 lineLength);
|
||||
virtual int StartNewEnvelope(const char *line, PRUint32 lineLength);
|
||||
|
@ -95,24 +95,24 @@ public:
|
|||
int ParseEnvelope (const char *line, PRUint32 line_size);
|
||||
int InternSubject (struct message_header *header);
|
||||
nsresult InternRfc822 (struct message_header *header, char **ret_name);
|
||||
|
||||
static PRBool IsEnvelopeLine(const char *buf, PRInt32 buf_size);
|
||||
static int msg_UnHex(char C);
|
||||
|
||||
|
||||
static PRBool IsEnvelopeLine(const char *buf, PRInt32 buf_size);
|
||||
static int msg_UnHex(char C);
|
||||
|
||||
nsCOMPtr<nsIMsgHeaderParser> m_HeaderAddressParser;
|
||||
|
||||
|
||||
nsCOMPtr<nsIMsgDBHdr> m_newMsgHdr; /* current message header we're building */
|
||||
nsCOMPtr<nsIMsgDatabase> m_mailDB;
|
||||
|
||||
|
||||
nsMailboxParseState m_state;
|
||||
PRUint32 m_position;
|
||||
PRUint32 m_envelope_pos;
|
||||
PRUint32 m_headerstartpos;
|
||||
|
||||
|
||||
nsByteArray m_headers;
|
||||
|
||||
|
||||
nsByteArray m_envelope;
|
||||
|
||||
|
||||
struct message_header m_message_id;
|
||||
struct message_header m_references;
|
||||
struct message_header m_date;
|
||||
|
@ -127,14 +127,14 @@ public:
|
|||
struct message_header m_in_reply_to;
|
||||
struct message_header m_replyTo;
|
||||
struct message_header m_content_type;
|
||||
|
||||
|
||||
// Support for having multiple To or Cc header lines in a message
|
||||
nsVoidArray m_toList;
|
||||
nsVoidArray m_ccList;
|
||||
struct message_header *GetNextHeaderInAggregate (nsVoidArray &list);
|
||||
void GetAggregateHeader (nsVoidArray &list, struct message_header *);
|
||||
void ClearAggregateHeader (nsVoidArray &list);
|
||||
|
||||
|
||||
struct message_header m_envelope_from;
|
||||
struct message_header m_envelope_date;
|
||||
struct message_header m_priority;
|
||||
|
@ -147,10 +147,10 @@ public:
|
|||
|
||||
PRTime m_receivedTime;
|
||||
PRUint16 m_body_lines;
|
||||
|
||||
|
||||
PRBool m_IgnoreXMozillaStatus;
|
||||
|
||||
// this enables extensions to add the values of particular headers to
|
||||
// this enables extensions to add the values of particular headers to
|
||||
// the .msf file as properties of nsIMsgHdr. It is initialized from a
|
||||
// pref, mailnews.customDBHeaders
|
||||
nsCStringArray m_customDBHeaders;
|
||||
|
@ -166,7 +166,7 @@ inline int nsParseMailMessageState::msg_UnHex(char C)
|
|||
((C >= 'a' && C <= 'f') ? C - 'a' + 10 : 0)));
|
||||
}
|
||||
|
||||
// This class is part of the mailbox parsing state machine
|
||||
// This class is part of the mailbox parsing state machine
|
||||
class nsMsgMailboxParser : public nsIStreamListener, public nsParseMailMessageState, public nsMsgLineBuffer, public nsIDBChangeListener
|
||||
{
|
||||
public:
|
||||
|
@ -178,7 +178,7 @@ public:
|
|||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
// we suppport the nsIStreamListener interface
|
||||
// we suppport the nsIStreamListener interface
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
NS_DECL_NSIREQUESTOBSERVER
|
||||
NS_DECL_NSISTREAMLISTENER
|
||||
|
@ -189,8 +189,8 @@ public:
|
|||
// message socket libnet callbacks, which come through folder pane
|
||||
virtual int ProcessMailboxInputStream(nsIURI* aURL, nsIInputStream *aIStream, PRUint32 aLength);
|
||||
|
||||
virtual void DoneParsingFolder(nsresult status);
|
||||
virtual void AbortNewHeader();
|
||||
virtual void DoneParsingFolder(nsresult status);
|
||||
virtual void AbortNewHeader();
|
||||
|
||||
// for nsMsgLineBuffer
|
||||
virtual PRInt32 HandleLine(char *line, PRUint32 line_length);
|
||||
|
@ -222,38 +222,38 @@ private:
|
|||
// the following flag is used to determine when a url is currently being run. It is cleared on calls
|
||||
// to ::StopBinding and it is set whenever we call Load on a url
|
||||
PRBool m_urlInProgress;
|
||||
nsWeakPtr m_folder;
|
||||
nsWeakPtr m_folder;
|
||||
void Init();
|
||||
void ReleaseFolderLock();
|
||||
|
||||
};
|
||||
|
||||
class nsParseNewMailState : public nsMsgMailboxParser
|
||||
class nsParseNewMailState : public nsMsgMailboxParser
|
||||
, public nsIMsgFilterHitNotify
|
||||
{
|
||||
public:
|
||||
nsParseNewMailState();
|
||||
virtual ~nsParseNewMailState();
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
nsresult Init(nsIMsgFolder *rootFolder, nsIMsgFolder *downloadFolder, nsILocalFile *folder,
|
||||
nsresult Init(nsIMsgFolder *rootFolder, nsIMsgFolder *downloadFolder, nsILocalFile *folder,
|
||||
nsIInputStream *inboxFileStream, nsIMsgWindow *aMsgWindow,
|
||||
PRBool downloadingToTempFile);
|
||||
|
||||
virtual void DoneParsingFolder(nsresult status);
|
||||
|
||||
|
||||
virtual void DoneParsingFolder(nsresult status);
|
||||
|
||||
void DisableFilters() {m_disableFilters = PR_TRUE;}
|
||||
|
||||
|
||||
NS_DECL_NSIMSGFILTERHITNOTIFY
|
||||
|
||||
|
||||
nsOutputFileStream *GetLogFile();
|
||||
virtual PRInt32 PublishMsgHeader(nsIMsgWindow *msgWindow);
|
||||
void GetMsgWindow(nsIMsgWindow **aMsgWindow);
|
||||
nsresult EndMsgDownload();
|
||||
|
||||
nsresult AppendMsgFromFile(nsIInputStream *fileStream, PRInt32 offset,
|
||||
nsresult AppendMsgFromFile(nsIInputStream *fileStream, PRInt32 offset,
|
||||
PRUint32 length, nsILocalFile *destFile);
|
||||
|
||||
virtual void ApplyFilters(PRBool *pMoved, nsIMsgWindow *msgWindow,
|
||||
virtual void ApplyFilters(PRBool *pMoved, nsIMsgWindow *msgWindow,
|
||||
PRUint32 msgOffset);
|
||||
nsresult ApplyForwardAndReplyFilter(nsIMsgWindow *msgWindow);
|
||||
void NotifyGlobalListeners(nsIMsgDBHdr *newHdr);
|
||||
|
@ -263,8 +263,8 @@ public:
|
|||
PRInt32 m_numNotNewMessages;
|
||||
protected:
|
||||
virtual nsresult GetTrashFolder(nsIMsgFolder **pTrashFolder);
|
||||
virtual nsresult MoveIncorporatedMessage(nsIMsgDBHdr *mailHdr,
|
||||
nsIMsgDatabase *sourceDB,
|
||||
virtual nsresult MoveIncorporatedMessage(nsIMsgDBHdr *mailHdr,
|
||||
nsIMsgDatabase *sourceDB,
|
||||
nsIMsgFolder *destIFolder,
|
||||
nsIMsgFilter *filter,
|
||||
nsIMsgWindow *msgWindow);
|
||||
|
@ -291,10 +291,10 @@ protected:
|
|||
PRUint32 m_ibuffer_size;
|
||||
// used for applying move filters, because in the case of using a temporary
|
||||
// download file, the offset/key in the msg hdr is not right.
|
||||
PRUint32 m_curHdrOffset;
|
||||
PRUint32 m_curHdrOffset;
|
||||
|
||||
// we have to apply the reply/forward filters in a second pass, after
|
||||
// msg quarantining and moving to other local folders, so we remember the
|
||||
// we have to apply the reply/forward filters in a second pass, after
|
||||
// msg quarantining and moving to other local folders, so we remember the
|
||||
// info we'll need to apply them with these vars.
|
||||
// these need to be arrays in case we have multiple reply/forward filters.
|
||||
nsCStringArray m_forwardTo;
|
||||
|
|
|
@ -1974,7 +1974,7 @@ nsPop3Protocol::GetStat()
|
|||
nsCOMPtr<nsIMsgMailNewsUrl> mailnewsUrl = do_QueryInterface(m_url);
|
||||
if (mailnewsUrl)
|
||||
rv = mailnewsUrl->GetMsgWindow(getter_AddRefs(msgWindow));
|
||||
// NS_ASSERTION(NS_SUCCEEDED(rv) && msgWindow, "no msg window");
|
||||
// NS_ASSERTION(NS_SUCCEEDED(rv) && msgWindow, "no msg window");
|
||||
|
||||
rv = m_nsIPop3Sink->BeginMailDelivery(m_pop3ConData->only_uidl != nsnull, msgWindow,
|
||||
&m_pop3ConData->msg_del_started);
|
||||
|
@ -2529,7 +2529,7 @@ PRInt32 nsPop3Protocol::GetMsg()
|
|||
* no longer want to keep it there */
|
||||
if (!m_pop3ConData->newuidl)
|
||||
{
|
||||
m_pop3ConData->newuidl = PL_NewHashTable(20, PL_HashString, PL_CompareStrings,
|
||||
m_pop3ConData->newuidl = PL_NewHashTable(20, PL_HashString, PL_CompareStrings,
|
||||
PL_CompareValues, &gHashAllocOps, nsnull);
|
||||
if (!m_pop3ConData->newuidl)
|
||||
return MK_OUT_OF_MEMORY;
|
||||
|
@ -3109,7 +3109,7 @@ nsPop3Protocol::TopResponse(nsIInputStream* inputStream, PRUint32 length)
|
|||
}
|
||||
|
||||
if(m_pop3ConData->cur_msg_size == -1 && /* first line after TOP command sent */
|
||||
!m_pop3ConData->command_succeeded) /* and TOP command failed */
|
||||
!m_pop3ConData->command_succeeded) /* and TOP command failed */
|
||||
{
|
||||
/* TOP doesn't work so we can't retrieve the first part of this msg.
|
||||
So just go download the whole thing, and warn the user.
|
||||
|
@ -3170,7 +3170,7 @@ nsPop3Protocol::HandleLine(char *line, PRUint32 line_length)
|
|||
// line contains only a single dot and linebreak -> message end
|
||||
if (line_length == 1 + MSG_LINEBREAK_LEN && line[0] == '.')
|
||||
{
|
||||
m_pop3ConData->assumed_end = PR_TRUE; /* in case byte count from server is */
|
||||
m_pop3ConData->assumed_end = PR_TRUE; /* in case byte count from server is */
|
||||
/* wrong, mark we may have had the end */
|
||||
if (!m_pop3ConData->dot_fix || m_pop3ConData->truncating_cur_msg ||
|
||||
(m_pop3ConData->parsed_bytes >= (m_pop3ConData->pop3_size -3)))
|
||||
|
|
|
@ -66,7 +66,7 @@ things need to happen: #define POP_ALWAYS_USE_UIDL_FOR_DUPLICATES, verify that
|
|||
the uidl's are correctly getting added when the delete response is received,
|
||||
and change the POP3_QUIT_RESPONSE state to flush the newly committed deletes. */
|
||||
|
||||
/*
|
||||
/*
|
||||
* Cannot have the following line uncommented. It is defined.
|
||||
* #ifdef POP_ALWAYS_USE_UIDL_FOR_DUPLICATES will always be evaluated
|
||||
* as PR_TRUE.
|
||||
|
@ -119,7 +119,7 @@ enum Pop3CapabilityEnum {
|
|||
|
||||
enum Pop3StatesEnum {
|
||||
POP3_READ_PASSWORD, // 0
|
||||
//
|
||||
//
|
||||
POP3_START_CONNECT, // 1
|
||||
POP3_FINISH_CONNECT, // 2
|
||||
POP3_WAIT_FOR_RESPONSE, // 3
|
||||
|
@ -208,22 +208,22 @@ typedef struct _Pop3ConData {
|
|||
server and only download a partial
|
||||
message. */
|
||||
PRUint32 capability_flags; /* What capability this server has? */
|
||||
|
||||
|
||||
Pop3StatesEnum next_state; /* the next state or action to be taken */
|
||||
Pop3StatesEnum next_state_after_response;
|
||||
PRBool pause_for_read; /* Pause now for next read? */
|
||||
|
||||
Pop3StatesEnum next_state_after_response;
|
||||
PRBool pause_for_read; /* Pause now for next read? */
|
||||
|
||||
PRBool command_succeeded; /* did the last command succeed? */
|
||||
PRBool list_done; /* did we get the complete list of msgIDs? */
|
||||
PRBool list_done; /* did we get the complete list of msgIDs? */
|
||||
PRInt32 first_msg;
|
||||
|
||||
PRUint32 obuffer_size;
|
||||
PRUint32 obuffer_fp;
|
||||
|
||||
PRInt32 really_new_messages;
|
||||
PRInt32 real_new_counter;
|
||||
|
||||
PRInt32 really_new_messages;
|
||||
PRInt32 real_new_counter;
|
||||
PRInt32 number_of_messages;
|
||||
Pop3MsgInfo *msg_info; /* Message sizes and uidls (used only if we
|
||||
Pop3MsgInfo *msg_info; /* Message sizes and uidls (used only if we
|
||||
are playing games that involve leaving
|
||||
messages on the server). */
|
||||
PRInt32 last_accessed_msg;
|
||||
|
@ -234,14 +234,14 @@ typedef struct _Pop3ConData {
|
|||
*/
|
||||
PRBool only_check_for_new_mail;
|
||||
nsMsgBiffState biffstate; /* If just checking for, what the answer is. */
|
||||
|
||||
|
||||
void *msg_closure;
|
||||
|
||||
|
||||
PRBool graph_progress_bytes_p; /* whether we should display info about
|
||||
the bytes transferred (usually we
|
||||
display info about the number of
|
||||
messages instead.) */
|
||||
|
||||
|
||||
Pop3UidlHost *uidlinfo;
|
||||
PLHashTable *newuidl;
|
||||
char *only_uidl; /* If non-NULL, then load only this UIDL. */
|
||||
|
@ -255,11 +255,11 @@ typedef struct _Pop3ConData {
|
|||
PRInt32 logonFailureCount;
|
||||
} Pop3ConData;
|
||||
|
||||
// State Flags (Note, I use the word state in terms of storing
|
||||
// State Flags (Note, I use the word state in terms of storing
|
||||
// state information about the connection (authentication, have we sent
|
||||
// commands, etc. I do not intend it to refer to protocol state)
|
||||
#define POP3_PAUSE_FOR_READ 0x00000001 /* should we pause for the next read */
|
||||
#define POP3_PASSWORD_FAILED 0x00000002
|
||||
#define POP3_PAUSE_FOR_READ 0x00000001 /* should we pause for the next read */
|
||||
#define POP3_PASSWORD_FAILED 0x00000002
|
||||
#define POP3_STOPLOGIN 0x00000004 /* error loging in, so stop here */
|
||||
#define POP3_AUTH_FAILURE 0x00000008 /* extended code said authentication failed */
|
||||
|
||||
|
@ -267,9 +267,9 @@ typedef struct _Pop3ConData {
|
|||
class nsPop3Protocol : public nsMsgProtocol, public nsIPop3Protocol
|
||||
{
|
||||
public:
|
||||
nsPop3Protocol(nsIURI* aURL);
|
||||
nsPop3Protocol(nsIURI* aURL);
|
||||
virtual ~nsPop3Protocol();
|
||||
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSIPOP3PROTOCOL
|
||||
|
||||
|
@ -285,11 +285,11 @@ public:
|
|||
NS_IMETHOD OnStopRequest(nsIRequest *request, nsISupports * aContext, nsresult aStatus);
|
||||
NS_IMETHOD Cancel(nsresult status);
|
||||
|
||||
static void MarkMsgInHashTable(PLHashTable *hashTable, const Pop3UidlEntry *uidl,
|
||||
static void MarkMsgInHashTable(PLHashTable *hashTable, const Pop3UidlEntry *uidl,
|
||||
PRBool *changed);
|
||||
|
||||
static nsresult MarkMsgForHost(const char *hostName, const char *userName,
|
||||
nsILocalFile *mailDirectory,
|
||||
nsILocalFile *mailDirectory,
|
||||
nsVoidArray &UIDLArray);
|
||||
private:
|
||||
nsCString m_ApopTimestamp;
|
||||
|
@ -306,14 +306,14 @@ private:
|
|||
void UpdateStatus(PRInt32 aStatusID);
|
||||
void UpdateStatusWithString(const PRUnichar * aString);
|
||||
|
||||
PRInt32 m_bytesInMsgReceived;
|
||||
PRInt32 m_totalFolderSize;
|
||||
PRInt32 m_totalDownloadSize; /* Number of bytes we're going to
|
||||
PRInt32 m_bytesInMsgReceived;
|
||||
PRInt32 m_totalFolderSize;
|
||||
PRInt32 m_totalDownloadSize; /* Number of bytes we're going to
|
||||
download. Might be much less
|
||||
than the total_folder_size. */
|
||||
PRInt32 m_totalBytesReceived; // total # bytes received for the connection
|
||||
|
||||
virtual nsresult ProcessProtocolState(nsIURI * url, nsIInputStream * inputStream,
|
||||
virtual nsresult ProcessProtocolState(nsIURI * url, nsIInputStream * inputStream,
|
||||
PRUint32 sourceOffset, PRUint32 length);
|
||||
virtual nsresult CloseSocket();
|
||||
virtual PRInt32 SendData(nsIURI * aURL, const char * dataBuffer, PRBool aSuppressLogging = PR_FALSE);
|
||||
|
@ -348,9 +348,9 @@ private:
|
|||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Begin Pop3 protocol state handlers
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
PRInt32 WaitForStartOfConnectionResponse(nsIInputStream* inputStream,
|
||||
PRInt32 WaitForStartOfConnectionResponse(nsIInputStream* inputStream,
|
||||
PRUint32 length);
|
||||
PRInt32 WaitForResponse(nsIInputStream* inputStream,
|
||||
PRInt32 WaitForResponse(nsIInputStream* inputStream,
|
||||
PRUint32 length);
|
||||
PRInt32 Error(PRInt32 err_code);
|
||||
PRInt32 SendAuth();
|
||||
|
|
|
@ -252,7 +252,7 @@ nsPop3Sink::CheckPartialMessages(nsIPop3Protocol *protocol)
|
|||
PRBool found = PR_TRUE;
|
||||
partialMsg = static_cast<partialRecord *>(m_partialMsgsArray.ElementAt(i));
|
||||
protocol->CheckMessage(partialMsg->m_uidl.get(), &found);
|
||||
if (!found)
|
||||
if (!found)
|
||||
{
|
||||
m_newMailParser->m_mailDB->DeleteHeader(partialMsg->m_msgDBHdr, nsnull, PR_FALSE, PR_TRUE);
|
||||
deleted = PR_TRUE;
|
||||
|
@ -260,7 +260,7 @@ nsPop3Sink::CheckPartialMessages(nsIPop3Protocol *protocol)
|
|||
delete partialMsg;
|
||||
}
|
||||
m_partialMsgsArray.Clear();
|
||||
if (deleted)
|
||||
if (deleted)
|
||||
{
|
||||
nsCOMPtr<nsIMsgLocalMailFolder> localFolder = do_QueryInterface(m_folder);
|
||||
if (localFolder)
|
||||
|
@ -352,8 +352,8 @@ nsPop3Sink::BeginMailDelivery(PRBool uidlDownload, nsIMsgWindow *aMsgWindow, PRB
|
|||
nsCOMPtr <nsIInputStream> inboxInputStream = do_QueryInterface(m_outFileStream);
|
||||
rv = m_newMailParser->Init(serverFolder, m_folder, (m_downloadingToTempFile) ? m_tmpDownloadFile : path,
|
||||
inboxInputStream, aMsgWindow, m_downloadingToTempFile);
|
||||
// if we failed to initialize the parser, then just don't use it!!!
|
||||
// we can still continue without one...
|
||||
// if we failed to initialize the parser, then just don't use it!!!
|
||||
// we can still continue without one...
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
{
|
||||
|
@ -399,7 +399,7 @@ nsPop3Sink::EndMailDelivery(nsIPop3Protocol *protocol)
|
|||
if (m_newMailParser)
|
||||
{
|
||||
if (m_outFileStream)
|
||||
m_outFileStream->Flush(); // try this.
|
||||
m_outFileStream->Flush(); // try this.
|
||||
m_newMailParser->OnStopRequest(nsnull, nsnull, NS_OK);
|
||||
m_newMailParser->SetDBFolderStream(nsnull); // stream is going away
|
||||
m_newMailParser->EndMsgDownload();
|
||||
|
@ -662,13 +662,13 @@ nsPop3Sink::GetDummyEnvelope(void)
|
|||
time_t now = time ((time_t *) 0);
|
||||
#if defined (XP_WIN)
|
||||
if (now < 0 || now > 0x7FFFFFFF)
|
||||
now = 0x7FFFFFFF;
|
||||
now = 0x7FFFFFFF;
|
||||
#endif
|
||||
ct = ctime(&now);
|
||||
PR_ASSERT(ct[24] == '\r' || ct[24] == '\n');
|
||||
ct[24] = 0;
|
||||
/* This value must be in ctime() format, with English abbreviations.
|
||||
strftime("... %c ...") is no good, because it is localized. */
|
||||
strftime("... %c ...") is no good, because it is localized. */
|
||||
PL_strcpy(result, "From - ");
|
||||
PL_strcpy(result + 7, ct);
|
||||
PL_strcpy(result + 7 + 24, MSG_LINEBREAK);
|
||||
|
@ -897,7 +897,7 @@ nsPop3Sink::IncorporateComplete(nsIMsgWindow *aMsgWindow, PRInt32 aSize)
|
|||
rv = MsgReopenFileStream(m_tmpDownloadFile, inboxInputStream);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
} else
|
||||
m_newMailParser->PublishMsgHeader(aMsgWindow);
|
||||
m_newMailParser->PublishMsgHeader(aMsgWindow);
|
||||
// run any reply/forward filter after we've finished with the
|
||||
// temp quarantine file, and/or moved the message to another folder.
|
||||
m_newMailParser->ApplyForwardAndReplyFilter(aMsgWindow);
|
||||
|
|
|
@ -63,7 +63,7 @@ public:
|
|||
void CheckPartialMessages(nsIPop3Protocol *protocol);
|
||||
|
||||
static char* GetDummyEnvelope(void);
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
nsresult WriteLineToMailbox(const char *buffer);
|
||||
|
@ -82,7 +82,7 @@ protected:
|
|||
nsIPop3IncomingServer *m_popServer;
|
||||
//Currently the folder we want to update about biff info
|
||||
nsIMsgFolder *m_folder;
|
||||
nsParseNewMailState *m_newMailParser;
|
||||
nsParseNewMailState *m_newMailParser;
|
||||
#ifdef DEBUG
|
||||
PRInt32 m_fileCounter;
|
||||
#endif
|
||||
|
|
|
@ -49,13 +49,13 @@
|
|||
nsPop3URL::nsPop3URL(): nsMsgMailNewsUrl()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
nsPop3URL::~nsPop3URL()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED1(nsPop3URL, nsMsgMailNewsUrl, nsIPop3URL)
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED1(nsPop3URL, nsMsgMailNewsUrl, nsIPop3URL)
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////
|
||||
// Begin nsIPop3URL specific support
|
||||
|
@ -97,9 +97,9 @@ nsPop3URL::SetMessageUri(const char *aMessageUri)
|
|||
|
||||
nsresult nsPop3URL::ParseUrl(const nsString& aSpec)
|
||||
{
|
||||
// mscott - i don't believe I'm going to need this
|
||||
// method anymore..
|
||||
NS_ASSERTION(0, "we shouldn't need to call this method anymore");
|
||||
// mscott - i don't believe I'm going to need this
|
||||
// method anymore..
|
||||
NS_ASSERTION(0, "we shouldn't need to call this method anymore");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче