mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-03-02 06:22:20 +00:00
parent
b90810b4b1
commit
d382493ea0
@ -58,10 +58,7 @@ interface nsINNTPNewsgroupPost : nsISupports {
|
||||
readonly attribute string newsgroups;
|
||||
|
||||
attribute string subject;
|
||||
readonly attribute string messageID;
|
||||
attribute string path;
|
||||
|
||||
boolean isValid();
|
||||
|
||||
/* Secion 2.2 - optional headers */
|
||||
attribute string replyTo;
|
||||
@ -70,7 +67,6 @@ interface nsINNTPNewsgroupPost : nsISupports {
|
||||
attribute string dateRecieved;
|
||||
attribute string expires;
|
||||
|
||||
void AddReference(in string referenceID);
|
||||
readonly attribute string references;
|
||||
|
||||
attribute string control;
|
||||
|
@ -44,33 +44,6 @@
|
||||
#include "plstr.h"
|
||||
#include "prmem.h"
|
||||
|
||||
// for CRLF
|
||||
//#include "fe_proto.h"
|
||||
|
||||
const char* nsNNTPNewsgroupPost::m_headerName[HEADER_LAST+1]=
|
||||
{
|
||||
"From: ",
|
||||
"Newsgroups: ",
|
||||
"Subject: ",
|
||||
|
||||
"Path: ",
|
||||
"Date: ",
|
||||
|
||||
"Reply-To: ",
|
||||
"Sender: ",
|
||||
"Followup-To: ",
|
||||
"Date-Received: ",
|
||||
"Expires: ",
|
||||
"Control: ",
|
||||
"Distribution: ",
|
||||
"Organization: ",
|
||||
"References: ",
|
||||
|
||||
"Relay-Version: ",
|
||||
"Posting-Version: ",
|
||||
"Message-ID: ",
|
||||
};
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsNNTPNewsgroupPost, nsINNTPNewsgroupPost)
|
||||
|
||||
nsNNTPNewsgroupPost::nsNNTPNewsgroupPost()
|
||||
@ -99,30 +72,6 @@ nsNNTPNewsgroupPost::~nsNNTPNewsgroupPost()
|
||||
NS_IF_RELEASE(m_postMessageFile);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsNNTPNewsgroupPost::IsValid(PRBool *_retval)
|
||||
{
|
||||
if (!_retval) return NS_OK;
|
||||
|
||||
// hack to get lazy-generated message ID to work
|
||||
char *messageid;
|
||||
GetMessageID(&messageid);
|
||||
|
||||
PRBool valid=PR_TRUE;
|
||||
int i;
|
||||
for (i=0; i<=HEADER_LAST_REQUIRED;i++) {
|
||||
if (!m_header[i]) {
|
||||
valid=PR_FALSE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
*_retval=valid;
|
||||
printf("nsNNTPNewsgroupPost::IsValid() -> %s (%d is first invalid)\n",
|
||||
*_retval ? "TRUE": "FALSE", i);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
char *
|
||||
nsNNTPNewsgroupPost::AppendAndAlloc(char *string,
|
||||
const char *newSubstring,
|
||||
@ -154,24 +103,6 @@ nsNNTPNewsgroupPost::AddNewsgroup(const char *newsgroup)
|
||||
m_header[HEADER_NEWSGROUPS]=AppendAndAlloc(m_header[HEADER_NEWSGROUPS], newsgroup, PR_TRUE);
|
||||
return NS_OK;
|
||||
}
|
||||
nsresult
|
||||
nsNNTPNewsgroupPost::AddReference(const char *reference)
|
||||
{
|
||||
m_header[HEADER_REFERENCES]=AppendAndAlloc(m_header[HEADER_REFERENCES], reference, PR_FALSE);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsNNTPNewsgroupPost::GetMessageID(char **messageID)
|
||||
{
|
||||
// hack - this is where we will somehow generate the ID
|
||||
static char *fakeID = "<ABCDEFG@mcom.com>";
|
||||
// m_header[HEADER_MESSAGEID] = fakeID;
|
||||
|
||||
*messageID = fakeID;
|
||||
if (!messageID) return NS_ERROR_NULL_POINTER;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
// the message can be stored in a file....allow accessors for getting and setting
|
||||
|
@ -14,12 +14,10 @@
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
@ -88,12 +86,8 @@ public:
|
||||
NS_IMPL_CLASS_GETSET_STR(From, m_header[HEADER_FROM]);
|
||||
NS_IMPL_CLASS_GETSET_STR(Date, m_header[HEADER_DATE]);
|
||||
NS_IMPL_CLASS_GETSET_STR(Subject, m_header[HEADER_SUBJECT]);
|
||||
|
||||
NS_IMETHOD AddNewsgroup(const char *newsgroupName);
|
||||
NS_IMPL_CLASS_GETTER_STR(GetNewsgroups, m_header[HEADER_NEWSGROUPS]);
|
||||
|
||||
NS_IMETHOD GetMessageID(char * *aMessageID);
|
||||
|
||||
|
||||
NS_IMPL_CLASS_GETTER_STR(GetNewsgroups, m_header[HEADER_NEWSGROUPS]);
|
||||
NS_IMPL_CLASS_GETSET_STR(Path, m_header[HEADER_PATH]);
|
||||
|
||||
// Optional Headers
|
||||
@ -106,19 +100,16 @@ public:
|
||||
NS_IMPL_CLASS_GETSET_STR(Distribution, m_header[HEADER_DISTRIBUTION]);
|
||||
NS_IMPL_CLASS_GETSET_STR(Organization, m_header[HEADER_ORGANIZATION]);
|
||||
NS_IMPL_CLASS_GETSET_STR(Body, m_body);
|
||||
|
||||
NS_IMETHOD AddReference(const char *referenceID);
|
||||
NS_IMPL_CLASS_GETTER_STR(GetReferences, m_header[HEADER_REFERENCES]);
|
||||
|
||||
|
||||
NS_IMETHOD IsValid(PRBool *_retval);
|
||||
|
||||
NS_IMPL_CLASS_GETTER(GetIsControl, PRBool, m_isControl);
|
||||
|
||||
// the message can be stored in a file....allow accessors for getting and setting
|
||||
// the file name to post...
|
||||
NS_IMETHOD SetPostMessageFile(nsIFileSpec * aFileName);
|
||||
NS_IMETHOD GetPostMessageFile(nsIFileSpec ** aFileName);
|
||||
// the file name to post...
|
||||
NS_IMETHOD SetPostMessageFile(nsIFileSpec * aFileName);
|
||||
NS_IMETHOD GetPostMessageFile(nsIFileSpec ** aFileName);
|
||||
|
||||
NS_IMETHOD AddNewsgroup(const char *newsgroupName);
|
||||
|
||||
// helper routines
|
||||
static char *AppendAndAlloc(char *string, const char *newSubstring,
|
||||
@ -126,8 +117,6 @@ public:
|
||||
private:
|
||||
nsIFileSpec *m_postMessageFile;
|
||||
char *m_header[HEADER_LAST+1];
|
||||
static const char *m_headerName[HEADER_LAST+1];
|
||||
|
||||
char *m_body;
|
||||
char *m_messageBuffer;
|
||||
PRBool m_isControl;
|
||||
|
Loading…
x
Reference in New Issue
Block a user