Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
PIM
KMime
Commits
4b96436e
Commit
4b96436e
authored
Nov 03, 2020
by
Laurent Montel
😁
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Modernize code (using auto)
parent
34069b3b
Pipeline
#39370
passed with stage
in 5 minutes and 12 seconds
Changes
8
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
74 additions
and
74 deletions
+74
-74
autotests/contentindextest.cpp
autotests/contentindextest.cpp
+4
-4
autotests/contenttest.cpp
autotests/contenttest.cpp
+25
-25
autotests/headertest.cpp
autotests/headertest.cpp
+25
-25
autotests/messagetest.cpp
autotests/messagetest.cpp
+9
-9
autotests/utiltest.cpp
autotests/utiltest.cpp
+1
-1
src/kmime_content.cpp
src/kmime_content.cpp
+7
-7
src/kmime_message.cpp
src/kmime_message.cpp
+1
-1
src/kmime_parsers.cpp
src/kmime_parsers.cpp
+2
-2
No files found.
autotests/contentindextest.cpp
View file @
4b96436e
...
...
@@ -47,12 +47,12 @@ void ContentIndexTest::testFromString()
void
ContentIndexTest
::
testContent
()
{
Content
*
c1
=
new
Content
();
auto
*
c1
=
new
Content
();
QCOMPARE
(
c1
->
content
(
ContentIndex
()),
c1
);
QCOMPARE
(
c1
->
content
(
ContentIndex
(
QLatin1String
(
"1"
))),
(
Content
*
)
nullptr
);
QCOMPARE
(
c1
->
indexForContent
(
c1
),
ContentIndex
());
Content
*
c11
=
new
Content
();
auto
*
c11
=
new
Content
();
// this makes c1 multipart/mixed, ie. c11 will be the second child!
c1
->
addContent
(
c11
);
QCOMPARE
(
c1
->
content
(
ContentIndex
(
QLatin1String
(
"2"
))),
c11
);
...
...
@@ -62,10 +62,10 @@ void ContentIndexTest::testContent()
QCOMPARE
(
c1
->
indexForContent
(
c11
),
ContentIndex
(
QLatin1String
(
"2"
)));
QCOMPARE
(
c1
->
indexForContent
(
c1
->
contents
().
first
()),
ContentIndex
(
QLatin1String
(
"1"
)));
Content
*
c12
=
new
Content
();
auto
*
c12
=
new
Content
();
c1
->
addContent
(
c12
);
// c12 becomes multipart/mixed, ie. c12 will be the second child!
Content
*
c121
=
new
Content
();
auto
*
c121
=
new
Content
();
c12
->
addContent
(
c121
);
QCOMPARE
(
c1
->
content
(
ContentIndex
(
QLatin1String
(
"3"
))),
c12
);
QCOMPARE
(
c1
->
content
(
ContentIndex
(
QLatin1String
(
"3.2"
))),
c121
);
...
...
autotests/contenttest.cpp
View file @
4b96436e
...
...
@@ -19,14 +19,14 @@ QTEST_MAIN(ContentTest)
void
ContentTest
::
testGetHeaderInstance
()
{
// stuff that looks trivial but breaks if you mess with virtual method signatures (see r534381)
Headers
::
From
*
myfrom
=
new
Headers
::
From
();
auto
*
myfrom
=
new
Headers
::
From
();
QCOMPARE
(
myfrom
->
type
(),
"From"
);
Headers
::
Base
*
mybase
=
myfrom
;
QCOMPARE
(
mybase
->
type
(),
"From"
);
delete
myfrom
;
// getHeaderInstance() is protected, so we need to test it via KMime::Message
Message
*
c
=
new
Message
();
auto
*
c
=
new
Message
();
Headers
::
From
*
f1
=
c
->
from
(
true
);
Headers
::
From
*
f2
=
c
->
from
(
true
);
QCOMPARE
(
f1
,
f2
);
...
...
@@ -36,7 +36,7 @@ void ContentTest::testGetHeaderInstance()
void
ContentTest
::
testHeaderAddRemove
()
{
// Add a Content-Description header to a content.
Content
*
c
=
new
Content
;
auto
*
c
=
new
Content
;
QVERIFY
(
!
c
->
contentDescription
(
false
));
c
->
contentDescription
()
->
from7BitString
(
"description"
);
...
...
@@ -86,12 +86,12 @@ void ContentTest::testHeaderAddRemove()
void
ContentTest
::
testHeaderAppend
()
{
Content
*
c
=
new
Content
;
auto
*
c
=
new
Content
;
QByteArray
d1
(
"Resent-From: test1@example.com"
);
QByteArray
d2
(
"Resent-From: test2@example.com"
);
Headers
::
Generic
*
h1
=
new
Headers
::
Generic
(
"Resent-From"
);
auto
*
h1
=
new
Headers
::
Generic
(
"Resent-From"
);
h1
->
from7BitString
(
"test1@example.com"
);
Headers
::
Generic
*
h2
=
new
Headers
::
Generic
(
"Resent-From"
);
auto
*
h2
=
new
Headers
::
Generic
(
"Resent-From"
);
h2
->
from7BitString
(
"test2@example.com"
);
c
->
appendHeader
(
h1
);
c
->
appendHeader
(
h2
);
...
...
@@ -100,7 +100,7 @@ void ContentTest::testHeaderAppend()
QCOMPARE
(
c
->
head
(),
head
);
QByteArray
d3
(
"Resent-From: test3@example.com"
);
Headers
::
Generic
*
h3
=
new
Headers
::
Generic
(
"Resent-From"
);
auto
*
h3
=
new
Headers
::
Generic
(
"Resent-From"
);
h3
->
from7BitString
(
"test3@example.com"
);
c
->
appendHeader
(
h3
);
c
->
assemble
();
...
...
@@ -111,11 +111,11 @@ void ContentTest::testHeaderAppend()
void
ContentTest
::
testImplicitMultipartGeneration
()
{
Content
*
c1
=
new
Content
();
auto
*
c1
=
new
Content
();
c1
->
contentType
()
->
from7BitString
(
"text/plain"
);
c1
->
setBody
(
"textpart"
);
Content
*
c2
=
new
Content
();
auto
*
c2
=
new
Content
();
c2
->
contentType
()
->
from7BitString
(
"text/html"
);
c2
->
setBody
(
"htmlpart"
);
...
...
@@ -154,14 +154,14 @@ void ContentTest::testImplicitMultipartGeneration()
void
ContentTest
::
testExplicitMultipartGeneration
()
{
Content
*
c1
=
new
Content
();
auto
*
c1
=
new
Content
();
c1
->
contentType
()
->
from7BitString
(
"multipart/mixed"
);
Content
*
c2
=
new
Content
();
auto
*
c2
=
new
Content
();
c2
->
contentType
()
->
from7BitString
(
"text/plain"
);
c2
->
setBody
(
"textpart"
);
Content
*
c3
=
new
Content
();
auto
*
c3
=
new
Content
();
c3
->
contentType
()
->
from7BitString
(
"text/html"
);
c3
->
setBody
(
"htmlpart"
);
...
...
@@ -190,7 +190,7 @@ void ContentTest::testExplicitMultipartGeneration()
void
ContentTest
::
testSetContent
()
{
Content
*
c
=
new
Content
();
auto
*
c
=
new
Content
();
QVERIFY
(
!
c
->
hasContent
());
// head and body present
...
...
@@ -245,7 +245,7 @@ void ContentTest::testEncodedContent()
"
\n
"
"--simple boundary--
\n
"
;
Message
*
msg
=
new
Message
;
auto
*
msg
=
new
Message
;
msg
->
setContent
(
data
);
msg
->
parse
();
...
...
@@ -302,7 +302,7 @@ void ContentTest::testEncodedContent()
void
ContentTest
::
testDecodedContent
()
{
Content
*
c
=
new
Content
();
auto
*
c
=
new
Content
();
c
->
setBody
(
"
\0
"
);
QVERIFY
(
c
->
decodedContent
()
==
QByteArray
());
c
->
setBody
(
QByteArray
());
...
...
@@ -325,7 +325,7 @@ void ContentTest::testMultipleHeaderExtraction()
"Received: from dev2.kde.org ([192.168.100.3])
\n
"
" by ktown.kde.org ([192.168.100.1])
\n
"
;
Message
*
msg
=
new
Message
();
auto
*
msg
=
new
Message
();
msg
->
setContent
(
data
);
// FAILS identically to ContentTest::testMultipartMixed
// QCOMPARE( msg->encodedContent(), data );
...
...
@@ -426,7 +426,7 @@ void ContentTest::testMultipartMixed()
"--simple boundary--
\n
"
;
// test parsing
Message
*
msg
=
new
Message
();
auto
*
msg
=
new
Message
();
msg
->
setContent
(
data
);
QCOMPARE
(
msg
->
encodedContent
(),
data
);
msg
->
parse
();
...
...
@@ -572,7 +572,7 @@ void ContentTest::testParsingUuencoded()
"end
\n
"
"
\n
"
;
Message
*
msg
=
new
Message
();
auto
*
msg
=
new
Message
();
msg
->
setContent
(
uuencodedMsg
);
msg
->
parse
();
auto
contents
=
msg
->
contents
();
...
...
@@ -599,22 +599,22 @@ void ContentTest::testParsingUuencoded()
void
ContentTest
::
testParent
()
{
Content
*
c1
=
new
Content
();
auto
*
c1
=
new
Content
();
c1
->
contentType
()
->
from7BitString
(
"multipart/mixed"
);
Content
*
c2
=
new
Content
();
auto
*
c2
=
new
Content
();
c2
->
contentType
()
->
from7BitString
(
"text/plain"
);
c2
->
setBody
(
"textpart"
);
Content
*
c3
=
new
Content
();
auto
*
c3
=
new
Content
();
c3
->
contentType
()
->
from7BitString
(
"text/html"
);
c3
->
setBody
(
"htmlpart"
);
Content
*
c4
=
new
Content
();
auto
*
c4
=
new
Content
();
c4
->
contentType
()
->
from7BitString
(
"text/html"
);
c4
->
setBody
(
"htmlpart2"
);
Content
*
c5
=
new
Content
();
auto
*
c5
=
new
Content
();
c5
->
contentType
()
->
from7BitString
(
"multipart/mixed"
);
//c2 doesn't have a parent yet
...
...
@@ -667,7 +667,7 @@ void ContentTest::testParent()
"This is the epilogue. It is also to be ignored.
\n
"
;
// test parsing
Message
*
msg
=
new
Message
();
auto
*
msg
=
new
Message
();
msg
->
setContent
(
data
);
msg
->
parse
();
QCOMPARE
(
msg
->
parent
(),
(
Content
*
)
nullptr
);
...
...
@@ -709,7 +709,7 @@ void ContentTest::testFreezing()
"
\n
"
"This is the epilogue. It is also to be ignored.
\n
"
;
Message
*
msg
=
new
Message
;
auto
*
msg
=
new
Message
;
msg
->
setContent
(
data
);
msg
->
setFrozen
(
true
);
...
...
autotests/headertest.cpp
View file @
4b96436e
...
...
@@ -23,7 +23,7 @@ QTEST_MAIN(HeaderTest)
void
HeaderTest
::
testIdentHeader
()
{
// empty header
Headers
::
Generics
::
Ident
*
h
=
new
Headers
::
Generics
::
Ident
();
auto
*
h
=
new
Headers
::
Generics
::
Ident
();
QVERIFY
(
h
->
isEmpty
());
// parse single identifier
...
...
@@ -77,7 +77,7 @@ void HeaderTest::testIdentHeader()
void
HeaderTest
::
testAddressListHeader
()
{
// empty header
Headers
::
Generics
::
AddressList
*
h
=
new
Headers
::
Generics
::
AddressList
();
auto
*
h
=
new
Headers
::
Generics
::
AddressList
();
QVERIFY
(
h
->
isEmpty
());
// parse single simple address
...
...
@@ -129,7 +129,7 @@ void HeaderTest::testAddressListHeader()
// same again with some interessting quoting
h
=
new
Headers
::
Generics
::
AddressList
();
h
->
from7BitString
(
"
\
"
Joe Q. Public
\
"
<john.q.public@example.com>, <boss@nil.test>,
\
"
Giant;
\\
\"
Big
\
\\
"
Box
\
"
<sysservices@example.net>"
);
h
->
from7BitString
(
R"(
"Joe Q. Public" <john.q.public@example.com>, <boss@nil.test>, "Giant; \"Big\" Box" <sysservices@example.net>
)
"
);
QCOMPARE
(
h
->
addresses
().
count
(),
3
);
names
=
h
->
displayNames
();
QCOMPARE
(
names
.
takeFirst
(),
QLatin1String
(
"Joe Q. Public"
));
...
...
@@ -301,7 +301,7 @@ void HeaderTest::testAddressListHeader()
void
HeaderTest
::
testMailboxListHeader
()
{
// empty header
Headers
::
Generics
::
MailboxList
*
h
=
new
Headers
::
Generics
::
MailboxList
();
auto
*
h
=
new
Headers
::
Generics
::
MailboxList
();
QVERIFY
(
h
->
isEmpty
());
// parse single simple address
...
...
@@ -328,7 +328,7 @@ void HeaderTest::testMailboxListHeader()
void
HeaderTest
::
testSingleMailboxHeader
()
{
// empty header
Headers
::
Generics
::
SingleMailbox
*
h
=
new
Headers
::
Generics
::
SingleMailbox
();
auto
*
h
=
new
Headers
::
Generics
::
SingleMailbox
();
QVERIFY
(
h
->
isEmpty
());
// parse single simple address
...
...
@@ -352,7 +352,7 @@ void HeaderTest::testSingleMailboxHeader()
QLatin1String
(
"
\"
John Smith
\"
<joe_smith@where.test>"
));
// parse quoted display name with \ in it
h
->
from7BitString
(
"
\
"
Lastname
\
\
, Firstname
\
"
<firstname.lastname@example.com>"
);
h
->
from7BitString
(
R"(
"Lastname\, Firstname" <firstname.lastname@example.com>
)
"
);
QVERIFY
(
!
h
->
isEmpty
());
QCOMPARE
(
h
->
addresses
().
count
(),
1
);
QCOMPARE
(
h
->
addresses
().
first
(),
QByteArray
(
"firstname.lastname@example.com"
));
...
...
@@ -366,7 +366,7 @@ void HeaderTest::testSingleMailboxHeader()
"
\"
Lastname, Firstname
\"
<firstname.lastname@example.com>"
);
// parse quoted display name with " in it
h
->
from7BitString
(
"
\
"
John
\\
\"
the guru
\
\\
"
Smith
\
"
<john.smith@mail.domain>"
);
h
->
from7BitString
(
R"(
"John \"the guru\" Smith" <john.smith@mail.domain>
)
"
);
QVERIFY
(
!
h
->
isEmpty
());
QCOMPARE
(
h
->
addresses
().
count
(),
1
);
QCOMPARE
(
h
->
addresses
().
first
().
data
(),
"john.smith@mail.domain"
);
...
...
@@ -1004,24 +1004,24 @@ void HeaderTest::testReturnPath()
void
HeaderTest
::
noAbstractHeaders
()
{
From
*
h2
=
new
From
();
delete
h2
;
Sender
*
h3
=
new
Sender
();
delete
h3
;
auto
*
h3
=
new
Sender
();
delete
h3
;
To
*
h4
=
new
To
();
delete
h4
;
Cc
*
h5
=
new
Cc
();
delete
h5
;
Bcc
*
h6
=
new
Bcc
();
delete
h6
;
ReplyT
o
*
h7
=
new
ReplyTo
();
delete
h7
;
Keywords
*
h8
=
new
Keywords
();
delete
h8
;
MIMEVersion
*
h9
=
new
MIMEVersion
();
delete
h9
;
MessageID
*
h10
=
new
MessageID
();
delete
h10
;
ContentID
*
h11
=
new
ContentID
();
delete
h11
;
Supersedes
*
h12
=
new
Supersedes
();
delete
h12
;
InReplyT
o
*
h13
=
new
InReplyTo
();
delete
h13
;
References
*
h14
=
new
References
();
delete
h14
;
Generic
*
h15
=
new
Generic
();
delete
h15
;
Subject
*
h16
=
new
Subject
();
delete
h16
;
Organization
*
h17
=
new
Organization
();
delete
h17
;
ContentDescription
*
h18
=
new
ContentDescription
();
delete
h18
;
FollowUpT
o
*
h22
=
new
FollowUpTo
();
delete
h22
;
UserAgent
*
h24
=
new
UserAgent
();
delete
h24
;
aut
o
*
h7
=
new
ReplyTo
();
delete
h7
;
auto
*
h8
=
new
Keywords
();
delete
h8
;
auto
*
h9
=
new
MIMEVersion
();
delete
h9
;
auto
*
h10
=
new
MessageID
();
delete
h10
;
auto
*
h11
=
new
ContentID
();
delete
h11
;
auto
*
h12
=
new
Supersedes
();
delete
h12
;
aut
o
*
h13
=
new
InReplyTo
();
delete
h13
;
auto
*
h14
=
new
References
();
delete
h14
;
auto
*
h15
=
new
Generic
();
delete
h15
;
auto
*
h16
=
new
Subject
();
delete
h16
;
auto
*
h17
=
new
Organization
();
delete
h17
;
auto
*
h18
=
new
ContentDescription
();
delete
h18
;
aut
o
*
h22
=
new
FollowUpTo
();
delete
h22
;
auto
*
h24
=
new
UserAgent
();
delete
h24
;
}
void
HeaderTest
::
testInvalidButOkQEncoding
()
...
...
@@ -1080,14 +1080,14 @@ void HeaderTest::testBug271192()
(
quote
?
QLatin1String
(
"
\"
"
)
:
QString
())
+
QLatin1String
(
" <"
)
+
addrSpec
+
QLatin1String
(
">"
);
Headers
::
Generics
::
SingleMailbox
*
h
=
new
Headers
::
Generics
::
SingleMailbox
();
auto
*
h
=
new
Headers
::
Generics
::
SingleMailbox
();
h
->
fromUnicodeString
(
mailbox
,
"utf-8"
);
QCOMPARE
(
h
->
displayNames
().
size
(),
1
);
QCOMPARE
(
h
->
displayNames
().
first
().
toUtf8
(),
displayName
.
remove
(
QLatin1String
(
"
\\
"
)).
toUtf8
());
delete
h
;
h
=
nullptr
;
Headers
::
Generics
::
MailboxList
*
h2
=
new
Headers
::
Generics
::
MailboxList
();
auto
*
h2
=
new
Headers
::
Generics
::
MailboxList
();
h2
->
fromUnicodeString
(
mailbox
+
QLatin1String
(
","
)
+
mailbox
,
"utf-8"
);
QCOMPARE
(
h2
->
displayNames
().
size
(),
2
);
QCOMPARE
(
h2
->
displayNames
()[
0
].
toUtf8
(),
displayName
.
remove
(
QLatin1String
(
"
\\
"
)).
toUtf8
());
...
...
@@ -1106,7 +1106,7 @@ void HeaderTest::testBug271192_data()
QTest
::
newRow
(
"Firstname_2"
)
<<
QString
::
fromUtf8
(
"Интернет-компания Lastname"
)
<<
false
;
QTest
::
newRow
(
"Lastname"
)
<<
QString
::
fromUtf8
(
"Tobias König"
)
<<
false
;
QTest
::
newRow
(
"Firstname_Lastname"
)
<<
QString
::
fromUtf8
(
"Интернет-компания König"
)
<<
false
;
QTest
::
newRow
(
"Quotemarks"
)
<<
QString
::
fromUtf8
(
"
John
\\
\"
Rocky
\
\\
"
Doe"
)
<<
true
;
QTest
::
newRow
(
"Quotemarks"
)
<<
QString
::
fromUtf8
(
R"(
John \"Rocky\" Doe
)
"
)
<<
true
;
QTest
::
newRow
(
"Quotemarks_nonascii"
)
<<
QString
::
fromUtf8
(
"Jöhn
\\\"
Röcky
\\\"
Döe"
)
<<
true
;
QTest
::
newRow
(
"quote_Plain"
)
<<
QString
::
fromUtf8
(
"John Doe"
)
<<
true
;
...
...
autotests/messagetest.cpp
View file @
4b96436e
...
...
@@ -16,11 +16,11 @@ QTEST_MAIN(MessageTest)
void
MessageTest
::
testMainBodyPart
()
{
Message
*
msg
=
new
Message
();
Message
*
msg2
=
new
Message
();
Content
*
text
=
new
Content
();
auto
*
msg
=
new
Message
();
auto
*
msg2
=
new
Message
();
auto
*
text
=
new
Content
();
text
->
contentType
()
->
setMimeType
(
"text/plain"
);
Content
*
html
=
new
Content
();
auto
*
html
=
new
Content
();
html
->
contentType
()
->
setMimeType
(
"text/html"
);
// empty message
...
...
@@ -58,10 +58,10 @@ void MessageTest::testMainBodyPart()
QCOMPARE
(
msg
->
mainBodyPart
(
"text/html"
),
html
);
// mulitpart/alternative inside multipart/mixed
Message
*
msg3
=
new
Message
();
auto
*
msg3
=
new
Message
();
msg3
->
contentType
()
->
setMimeType
(
"multipart/mixed"
);
msg3
->
addContent
(
msg
);
Content
*
attach
=
new
Content
();
auto
*
attach
=
new
Content
();
attach
->
contentType
()
->
setMimeType
(
"text/plain"
);
QCOMPARE
(
msg3
->
mainBodyPart
(),
html
);
...
...
@@ -87,7 +87,7 @@ void MessageTest::testBrunosMultiAssembleBug()
"
\n
"
"body"
;
Message
*
msg
=
new
Message
;
auto
*
msg
=
new
Message
;
msg
->
setContent
(
data
);
msg
->
parse
();
msg
->
assemble
();
...
...
@@ -118,7 +118,7 @@ void MessageTest::testWillsAndTillsCrash()
"X-KMail-SignatureState:
\n
"
"X-KMail-MDN-Sent:
\n\n
"
;
KMime
::
Message
*
msg
=
new
KMime
::
Message
;
auto
*
msg
=
new
KMime
::
Message
;
msg
->
setContent
(
deadlyMail
);
msg
->
parse
();
QVERIFY
(
!
msg
->
date
()
->
isEmpty
());
...
...
@@ -298,7 +298,7 @@ void MessageTest::testUtf16()
QCOMPARE
(
msg
.
decodedText
(
false
,
true
),
QLatin1String
(
"This is UTF-16 Text."
));
// Add a new To header, for testings
KMime
::
Headers
::
T
o
*
to
=
new
KMime
::
Headers
::
To
;
aut
o
*
to
=
new
KMime
::
Headers
::
To
;
KMime
::
Types
::
Mailbox
address
;
address
.
setAddress
(
"test@test.de"
);
address
.
setName
(
QStringLiteral
(
"Fränz Töster"
));
...
...
autotests/utiltest.cpp
View file @
4b96436e
...
...
@@ -132,7 +132,7 @@ void UtilTest::testAddQuotes_data()
QTest
::
newRow
(
""
)
<<
QByteArray
(
"Lastname, Firstname"
)
<<
QByteArray
(
"
\"
Lastname, Firstname
\"
"
)
<<
false
;
QTest
::
newRow
(
""
)
<<
QByteArray
(
"John
\"
the hacker
\"
Smith"
)
<<
QByteArray
(
"
\
"
John
\\
\"
the hacker
\
\\
"
Smith
\
"
"
)
<<
false
;
<<
QByteArray
(
R"(
"John \"the hacker\" Smith"
)
"
)
<<
false
;
// Test the whole thing on strings as well, for one example
QString
string
(
QLatin1String
(
"John
\"
the hacker
\"
Smith"
));
...
...
src/kmime_content.cpp
View file @
4b96436e
...
...
@@ -485,7 +485,7 @@ void Content::addContent(Content *c, bool prepend)
// If this message is single-part; make it multipart first.
if
(
d
->
multipartContents
.
isEmpty
()
&&
!
contentType
()
->
isMultipart
())
{
// The current body will be our first sub-Content.
Content
*
main
=
new
Content
(
this
);
auto
*
main
=
new
Content
(
this
);
// Move the MIME headers to the newly created sub-Content.
// NOTE: The other headers (RFC5322 headers like From:, To:, as well as X-headers
...
...
@@ -819,7 +819,7 @@ Content *Content::parent() const
Content
*
Content
::
topLevel
()
const
{
Content
*
top
=
const_cast
<
Content
*>
(
this
);
auto
*
top
=
const_cast
<
Content
*>
(
this
);
Content
*
c
=
parent
();
while
(
c
)
{
top
=
c
;
...
...
@@ -918,7 +918,7 @@ bool ContentPrivate::parseUuencoded(Content *q)
// Add the plain text part first.
Q_ASSERT
(
multipartContents
.
isEmpty
());
{
Content
*
c
=
new
Content
(
q
);
auto
*
c
=
new
Content
(
q
);
c
->
contentType
()
->
setMimeType
(
"text/plain"
);
c
->
contentTransferEncoding
()
->
setEncoding
(
Headers
::
CE7Bit
);
c
->
setBody
(
uup
.
textPart
());
...
...
@@ -927,7 +927,7 @@ bool ContentPrivate::parseUuencoded(Content *q)
// Now add each of the binary parts as sub-Contents.
for
(
int
i
=
0
;
i
<
uup
.
binaryParts
().
count
();
++
i
)
{
Content
*
c
=
new
Content
(
q
);
auto
*
c
=
new
Content
(
q
);
c
->
contentType
()
->
setMimeType
(
uup
.
mimeTypes
().
at
(
i
));
c
->
contentType
()
->
setName
(
QLatin1String
(
uup
.
filenames
().
at
(
i
)),
QByteArray
(
/*charset*/
));
c
->
contentTransferEncoding
()
->
setEncoding
(
Headers
::
CEuuenc
);
...
...
@@ -974,7 +974,7 @@ bool ContentPrivate::parseYenc(Content *q)
// Add the plain text part first.
Q_ASSERT
(
multipartContents
.
isEmpty
());
{
Content
*
c
=
new
Content
(
q
);
auto
*
c
=
new
Content
(
q
);
c
->
contentType
()
->
setMimeType
(
"text/plain"
);
c
->
contentTransferEncoding
()
->
setEncoding
(
Headers
::
CE7Bit
);
c
->
setBody
(
yenc
.
textPart
());
...
...
@@ -983,7 +983,7 @@ bool ContentPrivate::parseYenc(Content *q)
// Now add each of the binary parts as sub-Contents.
for
(
int
i
=
0
;
i
<
yenc
.
binaryParts
().
count
();
i
++
)
{
Content
*
c
=
new
Content
(
q
);
auto
*
c
=
new
Content
(
q
);
c
->
contentType
()
->
setMimeType
(
yenc
.
mimeTypes
().
at
(
i
));
c
->
contentType
()
->
setName
(
QLatin1String
(
yenc
.
filenames
().
at
(
i
)),
QByteArray
(
/*charset*/
));
c
->
contentTransferEncoding
()
->
setEncoding
(
Headers
::
CEbinary
);
...
...
@@ -1026,7 +1026,7 @@ bool ContentPrivate::parseMultipart(Content *q)
body
.
clear
();
const
auto
parts
=
mpp
.
parts
();
for
(
const
QByteArray
&
part
:
parts
)
{
Content
*
c
=
new
Content
(
q
);
auto
*
c
=
new
Content
(
q
);
c
->
setContent
(
part
);
c
->
setFrozen
(
frozen
);
c
->
parse
();
...
...
src/kmime_message.cpp
View file @
4b96436e
...
...
@@ -31,7 +31,7 @@ QByteArray Message::assembleHeaders()
from
(
true
);
// Make sure the mandatory MIME-Version field (RFC2045) is present and valid.
Headers
::
MIMEVersion
*
mimeVersion
=
header
<
Headers
::
MIMEVersion
>
(
true
);
auto
*
mimeVersion
=
header
<
Headers
::
MIMEVersion
>
(
true
);
mimeVersion
->
from7BitString
(
"1.0"
);
// Assemble all header fields.
...
...
src/kmime_parsers.cpp
View file @
4b96436e
...
...
@@ -33,7 +33,7 @@ bool MultiPart::parse()
m_parts
.
clear
();
//find the first valid boundary
while
(
1
)
{
while
(
true
)
{
if
((
pos1
=
m_src
.
indexOf
(
b
,
pos1
))
==
-
1
||
pos1
==
0
||
m_src
[
pos1
-
1
]
==
'\n'
)
{
//valid boundary found or no boundary at all
break
;
...
...
@@ -59,7 +59,7 @@ bool MultiPart::parse()
//now search the next linebreak
//now find the next valid boundary
pos2
=
++
pos1
;
//pos1 and pos2 point now to the beginning of the next line after the boundary
while
(
1
)
{
while
(
true
)
{
if
((
pos2
=
m_src
.
indexOf
(
b
,
pos2
))
==
-
1
||
m_src
[
pos2
-
1
]
==
'\n'
)
{
//valid boundary or no more boundaries found
break
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment