Kaydet (Commit) 98478024 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

HEADER_FIELD_TEXT is the only used HeaderFieldType

Change-Id: Ia4e5554e1aaed9e821bdea18b9b3acff001dd6e7
üst 8e8ad3f6
......@@ -88,101 +88,6 @@ typedef std::unordered_map<OString, INetContentTypeParameter, OStringHash>
class TOOLS_DLLPUBLIC INetMIME
{
public:
/** The various types of message header field bodies, with respect to
encoding and decoding them.
@descr At the moment, five different types of header fields suffice
to describe how to encoded and decode any known message header field
body, but need for more types may arise in the future as new header
fields are introduced.
@descr The following is an exhaustive list of all the header fields
currently known to our implementation. For every header field, it
includes a 'canonic' (with regard to capitalization) name, a grammar
rule for the body (using RFC 822 and RFC 2234 conventions), a list of
relevant sources of information, and the HeaderFieldType value to use
with that header field. The list is based on RFC 2076 and draft-
palme-mailext-headers-02.txt (see also <http://www.dsv.su.se/~jpalme/
ietf/jp-ietf-home.html#anchor1003783>).
Approved: address ;RFC 1036; HEADER_FIELD_ADDRESS
bcc: #address ;RFCs 822, 2047; HEADER_FIELD_ADDRESS
cc: 1#address ;RFCs 822, 2047; HEADER_FIELD_ADDRESS
Comments: *text ;RFCs 822, RFC 2047; HEADER_FIELD_TEXT
Content-Base: absoluteURI ;RFC 2110; HEADER_FIELD_TEXT
Content-Description: *text ;RFC 2045, RFC 2047; HEADER_FIELD_TEXT
Content-Disposition: disposition-type *(";" disposition-parm)
;RFC 1806; HEADER_FIELD_STRUCTURED
Content-ID: msg-id ;RFC 2045, RFC 2047; HEADER_FIELD_MESSAGE_ID
Content-Location: absoluteURI / relativeURI ;RFC 2110;
HEADER_FIELD_TEXT
Content-Transfer-Encoding: mechanism ;RFC 2045, RFC 2047;
HEADER_FIELD_STRUCTURED
Content-Type: type "/" subtype *(";" parameter) ;RFC 2045, RFC 2047;
HEADER_FIELD_STRUCTURED
Control: *text ;RFC 1036; HEADER_FIELD_TEXT
Date: date-time ;RFC 822, RFC 1123, RFC 2047; HEADER_FIELD_STRUCTURED
Distribution: 1#atom ;RFC 1036; HEADER_FIELD_STRUCTURED
Encrypted: 1#2word ;RFC 822, RFC 2047; HEADER_FIELD_STRUCTURED
Expires: date-time ;RFC 1036; HEADER_FIELD_STRUCTURED
Followup-To: 1#(atom *("." atom)) ;RFC 1036; HEADER_FIELD_STRUCTURED
From: mailbox / 1#mailbox ;RFC 822, RFC 2047; HEADER_FIELD_ADDRESS
In-Reply-To: *(phrase / msg-id) ;RFC 822, RFC 2047;
HEADER_FIELD_ADDRESS
Keywords: #phrase ;RFC 822, RFC 2047; HEADER_FIELD_PHRASE
MIME-Version: 1*DIGIT "." 1*DIGIT ;RFC 2045, RFC 2047;
HEADER_FIELD_STRUCTURED
Message-ID: msg-id ;RFC 822, RFC 2047; HEADER_FIELD_MESSAGE_ID
Newsgroups: 1#(atom *("." atom)) ;RFC 1036, RFC 2047;
HEADER_FIELD_STRUCTURED
Organization: *text ;RFC 1036; HEADER_FIELD_TEXT
Received: ["from" domain] ["by" domain] ["via" atom] *("with" atom)
["id" msg-id] ["for" addr-spec] ";" date-time ;RFC 822, RFC 1123,
RFC 2047; HEADER_FIELD_STRUCTURED
References: *(phrase / msg-id) ;RFC 822, RFC 2047;
HEADER_FIELD_ADDRESS
Reply-To: 1#address ;RFC 822, RFC 2047; HEADER_FIELD_ADDRESS
Resent-Date: date-time ;RFC 822, RFC 1123, RFC 2047;
HEADER_FIELD_STRUCTURED
Resent-From: mailbox / 1#mailbox ;RFC 822, RFC 2047;
HEADER_FIELD_ADDRESS
Resent-Message-ID: msg-id ;RFC 822, RFC 2047; HEADER_FIELD_MESSAGE_ID
Resent-Reply-To: 1#address ;RFC 822, RFC 2047; HEADER_FIELD_ADDRESS
Resent-Sender: mailbox ;RFC 822, RFC 2047; HEADER_FIELD_ADDRESS
Resent-To: 1#address ;RFC 822, RFC 2047; HEADER_FIELD_ADDRESS
Resent-bcc: #address ;RFC 822, RFC 2047; HEADER_FIELD_ADDRESS
Resent-cc: 1#address ;RFC 822, RFC 2047; HEADER_FIELD_ADDRESS
Return-path: route-addr / ("<" ">") ;RFC 822, RFC 1123, RFC 2047;
HEADER_FIELD_STRUCTURED
Return-Receipt-To: address ;Not Internet standard;
HEADER_FIELD_ADDRES
Sender: mailbox ;RFC 822, RFC 2047; HEADER_FIELD_ADDRESS
Subject: *text ;RFC 822, RFC 2047; HEADER_FIELD_TEXT
Summary: *text ;RFC 1036; HEADER_FIELD_TEXT
To: 1#address ;RFC 822, RFC 2047; HEADER_FIELD_ADDRESS
X-CHAOS-Marked: "YES" / "NO" ;local; HEADER_FIELD_STRUCTURED
X-CHAOS-Read: "YES" / "NO" ;local; HEADER_FIELD_STRUCTURED
X-CHAOS-Recipients: #*("<" atom word ">") ;local;
HEADER_FIELD_STRUCTURED
X-CHAOS-Size: 1*DIGIT ;local; HEADER_FIELD_STRUCTURED
X-Mailer: *text ;Not Internet standard; HEADER_FIELD_TEXT
X-Mozilla-Status: 4HEXDIG ;Mozilla; HEADER_FIELD_STRUCTURED
X-Newsreader: *text ;Not Internet standard; HEADER_FIELD_TEXT
X-Priority: "1" / "2" / "3" / "4" / "5" ;Not Internet standard;
HEADER_FIELD_STRUCTURED
Xref: sub-domain
1*((atom / string) *("." (atom / string)) ":" msg-number)
;RFCs 1036, 2047, local; HEADER_FIELD_STRUCTURED
*/
enum HeaderFieldType
{
HEADER_FIELD_TEXT,
HEADER_FIELD_STRUCTURED,
HEADER_FIELD_PHRASE,
HEADER_FIELD_MESSAGE_ID,
HEADER_FIELD_ADDRESS
};
/** Check for US-ASCII white space character.
@param nChar Some UCS-4 character.
......@@ -436,7 +341,6 @@ public:
static void writeUTF8(INetMIMEOutputSink & rSink, sal_uInt32 nChar);
static void writeHeaderFieldBody(INetMIMEOutputSink & rSink,
HeaderFieldType eType,
const OUString& rBody,
rtl_TextEncoding ePreferredEncoding,
bool bInitialSpace = true);
......@@ -446,8 +350,7 @@ public:
rtl_TextEncoding eEncoding,
sal_uInt32 & rCharacter);
static OUString decodeHeaderFieldBody(HeaderFieldType eType,
const OString& rBody);
static OUString decodeHeaderFieldBody(const OString& rBody);
/** Get the UTF-32 character at the head of a UTF-16 encoded string.
......
......@@ -83,10 +83,10 @@ class TOOLS_DLLPUBLIC INetMIMEMessage
OString m_aBoundary;
OUString GetHeaderValue_Impl (
sal_uIntPtr nIndex, INetMIME::HeaderFieldType eType) const
sal_uIntPtr nIndex) const
{
if ( nIndex < m_aHeaderList.size() ) {
return INetMIME::decodeHeaderFieldBody(eType, m_aHeaderList[ nIndex ]->GetValue());
return INetMIME::decodeHeaderFieldBody(m_aHeaderList[ nIndex ]->GetValue());
} else {
return OUString();
}
......@@ -109,7 +109,6 @@ class TOOLS_DLLPUBLIC INetMIMEMessage
}
void SetHeaderField_Impl (
INetMIME::HeaderFieldType eType,
const OString &rName,
const OUString &rValue,
sal_uIntPtr &rnIndex);
......@@ -150,8 +149,7 @@ public:
OUString GetContentType() const
{
return GetHeaderValue_Impl(
m_nMIMEIndex.at(InetMessageMime::CONTENT_TYPE),
INetMIME::HEADER_FIELD_TEXT);
m_nMIMEIndex.at(InetMessageMime::CONTENT_TYPE));
}
void SetContentTransferEncoding (const OUString& rEncoding);
......
......@@ -42,8 +42,7 @@ namespace
bool Test::testDecode(char const * input, char const * expected)
{
OUString result = INetMIME::decodeHeaderFieldBody(
INetMIME::HEADER_FIELD_TEXT, input);
OUString result = INetMIME::decodeHeaderFieldBody(input);
return result.equalsAscii(expected);
}
......
This diff is collapsed.
......@@ -41,14 +41,13 @@ inline bool ascii_isLetter( sal_Unicode ch )
}
void INetMIMEMessage::SetHeaderField_Impl (
INetMIME::HeaderFieldType eType,
const OString &rName,
const OUString &rValue,
sal_uIntPtr &rnIndex)
{
INetMIMEOutputSink aSink;
INetMIME::writeHeaderFieldBody (
aSink, eType, rValue, osl_getThreadTextEncoding(), false);
aSink, rValue, osl_getThreadTextEncoding(), false);
SetHeaderField_Impl (
INetMessageHeader (rName, aSink.takeBuffer()), rnIndex);
}
......@@ -233,7 +232,6 @@ INetMIMEMessage::~INetMIMEMessage()
void INetMIMEMessage::SetMIMEVersion (const OUString& rVersion)
{
SetHeaderField_Impl (
INetMIME::HEADER_FIELD_TEXT,
ImplINetMIMEMessageHeaderData.at(InetMessageMime::VERSION), rVersion,
m_nMIMEIndex[InetMessageMime::VERSION]);
}
......@@ -241,7 +239,6 @@ void INetMIMEMessage::SetMIMEVersion (const OUString& rVersion)
void INetMIMEMessage::SetContentDisposition (const OUString& rDisposition)
{
SetHeaderField_Impl (
INetMIME::HEADER_FIELD_TEXT,
ImplINetMIMEMessageHeaderData.at(InetMessageMime::CONTENT_DISPOSITION), rDisposition,
m_nMIMEIndex[InetMessageMime::CONTENT_DISPOSITION]);
}
......@@ -249,7 +246,6 @@ void INetMIMEMessage::SetContentDisposition (const OUString& rDisposition)
void INetMIMEMessage::SetContentType (const OUString& rType)
{
SetHeaderField_Impl (
INetMIME::HEADER_FIELD_TEXT,
ImplINetMIMEMessageHeaderData.at(InetMessageMime::CONTENT_TYPE), rType,
m_nMIMEIndex[InetMessageMime::CONTENT_TYPE]);
}
......@@ -258,7 +254,6 @@ void INetMIMEMessage::SetContentTransferEncoding (
const OUString& rEncoding)
{
SetHeaderField_Impl (
INetMIME::HEADER_FIELD_TEXT,
ImplINetMIMEMessageHeaderData.at(InetMessageMime::CONTENT_TRANSFER_ENCODING), rEncoding,
m_nMIMEIndex[InetMessageMime::CONTENT_TRANSFER_ENCODING]);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment