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
KIMAP
Commits
bbf40ff9
Commit
bbf40ff9
authored
Nov 03, 2020
by
Laurent Montel
😁
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Modernize code (using auto)
parent
6bca3e59
Pipeline
#39364
passed with stage
in 10 minutes and 18 seconds
Changes
30
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
30 changed files
with
119 additions
and
119 deletions
+119
-119
autotests/appendjobtest.cpp
autotests/appendjobtest.cpp
+1
-1
autotests/capabilitiesjobtest.cpp
autotests/capabilitiesjobtest.cpp
+1
-1
autotests/createjobtest.cpp
autotests/createjobtest.cpp
+1
-1
autotests/deletejobtest.cpp
autotests/deletejobtest.cpp
+1
-1
autotests/expungejobtest.cpp
autotests/expungejobtest.cpp
+1
-1
autotests/fakeservertest.cpp
autotests/fakeservertest.cpp
+1
-1
autotests/fetchjobtest.cpp
autotests/fetchjobtest.cpp
+5
-5
autotests/getmetadatajobtest.cpp
autotests/getmetadatajobtest.cpp
+14
-14
autotests/idjobtest.cpp
autotests/idjobtest.cpp
+2
-2
autotests/idlejobtest.cpp
autotests/idlejobtest.cpp
+4
-4
autotests/kimaptest/fakeserver.cpp
autotests/kimaptest/fakeserver.cpp
+1
-1
autotests/kimaptest/sslserver.cpp
autotests/kimaptest/sslserver.cpp
+3
-3
autotests/listjobtest.cpp
autotests/listjobtest.cpp
+3
-3
autotests/logoutjobtest.cpp
autotests/logoutjobtest.cpp
+2
-2
autotests/quotarootjobtest.cpp
autotests/quotarootjobtest.cpp
+1
-1
autotests/renamejobtest.cpp
autotests/renamejobtest.cpp
+4
-4
autotests/searchjobtest.cpp
autotests/searchjobtest.cpp
+3
-3
autotests/selectjobtest.cpp
autotests/selectjobtest.cpp
+4
-4
autotests/setmetadatajobtest.cpp
autotests/setmetadatajobtest.cpp
+5
-5
autotests/statusjobtest.cpp
autotests/statusjobtest.cpp
+1
-1
autotests/storejobtest.cpp
autotests/storejobtest.cpp
+1
-1
autotests/subscribejobtest.cpp
autotests/subscribejobtest.cpp
+1
-1
autotests/testsession.cpp
autotests/testsession.cpp
+13
-13
autotests/unsubscribejobtest.cpp
autotests/unsubscribejobtest.cpp
+1
-1
src/fetchjob.cpp
src/fetchjob.cpp
+1
-1
src/rfccodecs.cpp
src/rfccodecs.cpp
+1
-1
src/session.cpp
src/session.cpp
+1
-1
src/sessionthread.cpp
src/sessionthread.cpp
+1
-1
tests/testimapidle.cpp
tests/testimapidle.cpp
+7
-7
tests/testimapserver.cpp
tests/testimapserver.cpp
+34
-34
No files found.
autotests/appendjobtest.cpp
View file @
bbf40ff9
...
...
@@ -77,7 +77,7 @@ private Q_SLOTS:
fakeServer
.
startAndWait
();
KIMAP
::
Session
session
(
QStringLiteral
(
"127.0.0.1"
),
5989
);
KIMAP
::
AppendJob
*
job
=
new
KIMAP
::
AppendJob
(
&
session
);
auto
*
job
=
new
KIMAP
::
AppendJob
(
&
session
);
job
->
setContent
(
content
);
job
->
setFlags
(
flags
);
job
->
setInternalDate
(
internaldate
);
...
...
autotests/capabilitiesjobtest.cpp
View file @
bbf40ff9
...
...
@@ -64,7 +64,7 @@ private Q_SLOTS:
fakeServer
.
startAndWait
();
KIMAP
::
Session
session
(
QStringLiteral
(
"127.0.0.1"
),
5989
);
KIMAP
::
CapabilitiesJob
*
job
=
new
KIMAP
::
CapabilitiesJob
(
&
session
);
auto
*
job
=
new
KIMAP
::
CapabilitiesJob
(
&
session
);
bool
result
=
job
->
exec
();
QEXPECT_FAIL
(
"bad"
,
"Expected failure on BAD response"
,
Continue
);
QVERIFY
(
result
);
...
...
autotests/createjobtest.cpp
View file @
bbf40ff9
...
...
@@ -67,7 +67,7 @@ private Q_SLOTS:
fakeServer
.
startAndWait
();
KIMAP
::
Session
session
(
QStringLiteral
(
"127.0.0.1"
),
5989
);
KIMAP
::
CreateJob
*
job
=
new
KIMAP
::
CreateJob
(
&
session
);
auto
*
job
=
new
KIMAP
::
CreateJob
(
&
session
);
job
->
setMailBox
(
mailbox
);
bool
result
=
job
->
exec
();
QEXPECT_FAIL
(
"bad"
,
"Expected failure on BAD response"
,
Continue
);
...
...
autotests/deletejobtest.cpp
View file @
bbf40ff9
...
...
@@ -74,7 +74,7 @@ private Q_SLOTS:
KIMAP
::
Session
session
(
QStringLiteral
(
"127.0.0.1"
),
5989
);
KIMAP
::
DeleteJob
*
job
=
new
KIMAP
::
DeleteJob
(
&
session
);
auto
*
job
=
new
KIMAP
::
DeleteJob
(
&
session
);
job
->
setMailBox
(
mailbox
);
bool
result
=
job
->
exec
();
QEXPECT_FAIL
(
"bad"
,
"Expected failure on BAD response"
,
Continue
);
...
...
autotests/expungejobtest.cpp
View file @
bbf40ff9
...
...
@@ -61,7 +61,7 @@ private Q_SLOTS:
KIMAP
::
Session
session
(
QStringLiteral
(
"127.0.0.1"
),
5989
);
KIMAP
::
ExpungeJob
*
job
=
new
KIMAP
::
ExpungeJob
(
&
session
);
auto
*
job
=
new
KIMAP
::
ExpungeJob
(
&
session
);
bool
result
=
job
->
exec
();
QEXPECT_FAIL
(
"bad"
,
"Expected failure on BAD response"
,
Continue
);
QEXPECT_FAIL
(
"no"
,
"Expected failure on NO response"
,
Continue
);
...
...
autotests/fakeservertest.cpp
View file @
bbf40ff9
...
...
@@ -43,7 +43,7 @@ private Q_SLOTS:
KIMAP
::
Session
session
(
QStringLiteral
(
"127.0.0.1"
),
5989
);
KIMAP
::
ListJob
*
job
=
new
KIMAP
::
ListJob
(
&
session
);
auto
*
job
=
new
KIMAP
::
ListJob
(
&
session
);
job
->
setIncludeUnsubscribed
(
true
);
QVERIFY
(
job
->
exec
());
...
...
autotests/fetchjobtest.cpp
View file @
bbf40ff9
...
...
@@ -172,7 +172,7 @@ private Q_SLOTS:
KIMAP
::
Session
session
(
QStringLiteral
(
"127.0.0.1"
),
5989
);
KIMAP
::
FetchJob
*
job
=
new
KIMAP
::
FetchJob
(
&
session
);
auto
*
job
=
new
KIMAP
::
FetchJob
(
&
session
);
job
->
setUidBased
(
uidBased
);
job
->
setSequenceSet
(
set
);
job
->
setScope
(
scope
);
...
...
@@ -221,8 +221,8 @@ private Q_SLOTS:
QList
<
QByteArray
>
scenario
;
scenario
<<
FakeServer
::
preauth
()
<<
"C: A000001 FETCH 1:2 (BODYSTRUCTURE UID)"
<<
"
S: * 1 FETCH (UID 10 BODYSTRUCTURE (
\
"
TEXT
\
"
\
"
PLAIN
\
"
(
\
"
CHARSET
\
"
\
"
ISO-8859-1
\
"
) NIL NIL
\
"
7BIT
\
"
5 1 NIL NIL NIL))"
<<
"
S: * 2 FETCH (UID 20 BODYSTRUCTURE ((((
\
"
TEXT
\
"
\
"
PLAIN
\
"
(
\
"
CHARSET
\
"
\
"
ISO-8859-1
\
"
) NIL NIL
\
"
7BIT
\
"
72 4 NIL NIL NIL)(
\
"
TEXT
\
"
\
"
HTML
\
"
(
\
"
CHARSET
\
"
\
"
ISO-8859-1
\
"
) NIL NIL
\
"
QUOTED-PRINTABLE
\
"
281 5 NIL NIL NIL)
\
"
ALTERNATIVE
\
"
(
\
"
BOUNDARY
\
"
\
"
0001
\
"
) NIL NIL)(
\
"
IMAGE
\
"
\
"
GIF
\
"
(
\
"
NAME
\
"
\
"
B56.gif
\
"
)
\
"
<B56@goomoji.gmail>
\
"
NIL
\
"
BASE64
\
"
528 NIL NIL NIL)
\
"
RELATED
\
"
(
\
"
BOUNDARY
\
"
\
"
0002
\
"
) NIL NIL)(
\
"
IMAGE
\
"
\
"
JPEG
\
"
(
\
"
NAME
\
"
\
"
photo.jpg
\
"
) NIL NIL
\
"
BASE64
\
"
53338 NIL (
\
"
ATTACHMENT
\
"
(
\
"
FILENAME
\
"
\
"
photo.jpg
\
"
)) NIL)
\
"
MIXED
\
"
(
\
"
BOUNDARY
\
"
\
"
0003
\
"
) NIL NIL))"
<<
R"(
S: * 1 FETCH (UID 10 BODYSTRUCTURE ("TEXT" "PLAIN" ("CHARSET" "ISO-8859-1") NIL NIL "7BIT" 5 1 NIL NIL NIL))
)
"
<<
R"(
S: * 2 FETCH (UID 20 BODYSTRUCTURE (((("TEXT" "PLAIN" ("CHARSET" "ISO-8859-1") NIL NIL "7BIT" 72 4 NIL NIL NIL)("TEXT" "HTML" ("CHARSET" "ISO-8859-1") NIL NIL "QUOTED-PRINTABLE" 281 5 NIL NIL NIL) "ALTERNATIVE" ("BOUNDARY" "0001") NIL NIL)("IMAGE" "GIF" ("NAME" "B56.gif") "<B56@goomoji.gmail>" NIL "BASE64" 528 NIL NIL NIL) "RELATED" ("BOUNDARY" "0002") NIL NIL)("IMAGE" "JPEG" ("NAME" "photo.jpg") NIL NIL "BASE64" 53338 NIL ("ATTACHMENT" ("FILENAME" "photo.jpg")) NIL) "MIXED" ("BOUNDARY" "0003") NIL NIL))
)
"
<<
"S: A000001 OK fetch done"
;
KIMAP
::
FetchJob
::
FetchScope
scope
;
...
...
@@ -234,7 +234,7 @@ private Q_SLOTS:
KIMAP
::
Session
session
(
QStringLiteral
(
"127.0.0.1"
),
5989
);
KIMAP
::
FetchJob
*
job
=
new
KIMAP
::
FetchJob
(
&
session
);
auto
*
job
=
new
KIMAP
::
FetchJob
(
&
session
);
job
->
setUidBased
(
false
);
job
->
setSequenceSet
(
KIMAP
::
ImapSet
(
1
,
2
));
job
->
setScope
(
scope
);
...
...
@@ -298,7 +298,7 @@ private Q_SLOTS:
KIMAP
::
Session
session
(
QStringLiteral
(
"127.0.0.1"
),
5989
);
KIMAP
::
FetchJob
*
job
=
new
KIMAP
::
FetchJob
(
&
session
);
auto
*
job
=
new
KIMAP
::
FetchJob
(
&
session
);
job
->
setUidBased
(
false
);
job
->
setSequenceSet
(
KIMAP
::
ImapSet
(
2
,
2
));
job
->
setScope
(
scope
);
...
...
autotests/getmetadatajobtest.cpp
View file @
bbf40ff9
...
...
@@ -33,8 +33,8 @@ private Q_SLOTS:
QList
<
QByteArray
>
scenario
;
scenario
<<
FakeServer
::
preauth
()
<<
"C: A000001 GETMETADATA (DEPTH infinity)
\"
Folder1
\"
(/shared)"
<<
"
S: * METADATA
\
"
Folder1
\
"
(/shared/comment
\
"
Shared comment
\
"
)"
<<
"
S: * METADATA
\
"
Folder1
\
"
(/private/comment
\
"
My own comment
\
"
)"
<<
R"(
S: * METADATA "Folder1" (/shared/comment "Shared comment"
)
)"
<<
R"(
S: * METADATA "Folder1" (/private/comment "My own comment"
)
)"
<<
"S: A000001 OK GETMETADATA complete"
;
QMap
<
QByteArray
,
QByteArray
>
expected
;
expected
.
insert
(
"/shared/comment"
,
"Shared comment"
);
...
...
@@ -45,7 +45,7 @@ private Q_SLOTS:
QList
<
QByteArray
>
scenario
;
scenario
<<
FakeServer
::
preauth
()
<<
"C: A000001 GETMETADATA (DEPTH infinity)
\"
Folder1
\"
(/shared)"
<<
"
S: * METADATA
\
"
Folder1
\
"
(/shared/comment
\
"
Shared comment
\
"
/private/comment
\
"
My own comment
\
"
)"
<<
R"(
S: * METADATA "Folder1" (/shared/comment "Shared comment" /private/comment "My own comment"
)
)"
<<
"S: A000001 OK GETMETADATA complete"
;
QMap
<
QByteArray
,
QByteArray
>
expected
;
expected
.
insert
(
"/shared/comment"
,
"Shared comment"
);
...
...
@@ -56,7 +56,7 @@ private Q_SLOTS:
QList
<
QByteArray
>
scenario
;
scenario
<<
FakeServer
::
preauth
()
<<
"C: A000001 GETMETADATA (DEPTH infinity)
\"
Folder1
\"
(/shared)"
<<
"
S: * METADATA
\
"
Folder1
\
"
(/shared/comment
\
"
NIL
\
"
/private/comment
\
"
NIL
\
"
)"
<<
R"(
S: * METADATA "Folder1" (/shared/comment "NIL" /private/comment "NIL"
)
)"
<<
"S: A000001 OK GETMETADATA complete"
;
QMap
<
QByteArray
,
QByteArray
>
expected
;
expected
.
insert
(
"/shared/comment"
,
""
);
...
...
@@ -77,7 +77,7 @@ private Q_SLOTS:
KIMAP
::
Session
session
(
QLatin1String
(
"127.0.0.1"
),
5989
);
KIMAP
::
GetMetaDataJob
*
getMetadataJob
=
new
KIMAP
::
GetMetaDataJob
(
&
session
);
auto
*
getMetadataJob
=
new
KIMAP
::
GetMetaDataJob
(
&
session
);
getMetadataJob
->
setServerCapability
(
KIMAP
::
MetaDataJobBase
::
Metadata
);
getMetadataJob
->
setMailBox
(
mailbox
);
getMetadataJob
->
setDepth
(
KIMAP
::
GetMetaDataJob
::
AllLevels
);
...
...
@@ -129,7 +129,7 @@ private Q_SLOTS:
KIMAP
::
Session
session
(
QStringLiteral
(
"127.0.0.1"
),
5989
);
//C: A000001 GETMETADATA "Folder1" (/shared)
KIMAP
::
GetMetaDataJob
*
getMetadataJob
=
new
KIMAP
::
GetMetaDataJob
(
&
session
);
auto
*
getMetadataJob
=
new
KIMAP
::
GetMetaDataJob
(
&
session
);
getMetadataJob
->
setServerCapability
(
KIMAP
::
MetaDataJobBase
::
Metadata
);
getMetadataJob
->
setMailBox
(
QStringLiteral
(
"Folder1"
));
getMetadataJob
->
addRequestedEntry
(
"/shared"
);
...
...
@@ -225,7 +225,7 @@ private Q_SLOTS:
{
QList
<
QByteArray
>
scenario
;
scenario
<<
FakeServer
::
preauth
()
<<
"
C: A000001 GETANNOTATION
\
"
Folder1
\
"
\
"
*
\
"
\
"
value.shared
\
"
"
<<
R"(
C: A000001 GETANNOTATION "Folder1" "*" "value.shared"
)
"
<<
"S: * ANNOTATION Folder1 /comment (value.shared
\"
Shared comment
\"
)"
<<
"S: * ANNOTATION Folder1 /comment (value.priv
\"
My own comment
\"
)"
<<
"S: A000001 OK annotations retrieved"
;
...
...
@@ -238,7 +238,7 @@ private Q_SLOTS:
{
QList
<
QByteArray
>
scenario
;
scenario
<<
FakeServer
::
preauth
()
<<
"
C: A000001 GETANNOTATION
\
"
Folder1
\
"
\
"
/comment
\
"
\
"
value.shared
\
"
"
<<
R"(
C: A000001 GETANNOTATION "Folder1" "/comment" "value.shared"
)
"
<<
"S: * ANNOTATION Folder1 /comment (value.shared
\"
Shared comment
\"
)"
<<
"S: * ANNOTATION Folder1 /comment (value.priv
\"
My own comment
\"
)"
<<
"S: A000001 OK annotations retrieved"
;
...
...
@@ -263,7 +263,7 @@ private Q_SLOTS:
KIMAP
::
Session
session
(
QStringLiteral
(
"127.0.0.1"
),
5989
);
KIMAP
::
GetMetaDataJob
*
getMetadataJob
=
new
KIMAP
::
GetMetaDataJob
(
&
session
);
auto
*
getMetadataJob
=
new
KIMAP
::
GetMetaDataJob
(
&
session
);
getMetadataJob
->
setServerCapability
(
KIMAP
::
MetaDataJobBase
::
Annotatemore
);
getMetadataJob
->
setMailBox
(
mailbox
);
getMetadataJob
->
addRequestedEntry
(
entry
);
...
...
@@ -290,7 +290,7 @@ private Q_SLOTS:
scenario
<<
FakeServer
::
preauth
()
<<
"C: A000001 GETANNOTATION
\"
Folder1
\"
"
<<
"S: A000001 OK annotations retrieved"
<<
"
C: A000002 GETANNOTATION
\
"
Folder1
\
"
(
\
"
/comment
\
"
\
"
/motd
\
"
) (
\
"
value.priv
\
"
\
"
value.shared
\
"
)"
<<
R"(
C: A000002 GETANNOTATION "Folder1" ("/comment" "/motd") ("value.priv" "value.shared"
)
)"
<<
"S: A000002 OK annotations retrieved"
;
fakeServer
.
setScenario
(
scenario
);
fakeServer
.
startAndWait
();
...
...
@@ -298,7 +298,7 @@ private Q_SLOTS:
KIMAP
::
Session
session
(
QStringLiteral
(
"127.0.0.1"
),
5989
);
//C: A000001 GETANNOTATION "Folder1"
KIMAP
::
GetMetaDataJob
*
getMetadataJob
=
new
KIMAP
::
GetMetaDataJob
(
&
session
);
auto
*
getMetadataJob
=
new
KIMAP
::
GetMetaDataJob
(
&
session
);
getMetadataJob
->
setServerCapability
(
KIMAP
::
MetaDataJobBase
::
Annotatemore
);
getMetadataJob
->
setMailBox
(
QStringLiteral
(
"Folder1"
));
QVERIFY
(
getMetadataJob
->
exec
());
...
...
@@ -324,9 +324,9 @@ private Q_SLOTS:
QList
<
QByteArray
>
scenario
;
scenario
<<
FakeServer
::
preauth
()
<<
"
C: A000001 GETANNOTATION
\
"
Folder1
\
"
(
\
"
/comment
\
"
\
"
/motd
\
"
)
\
"
value.shared
\
"
"
<<
R"(
C: A000001 GETANNOTATION "Folder1" ("/comment" "/motd") "value.shared"
)
"
<<
"S: A000001 OK annotations retrieved"
<<
"
C: A000002 GETANNOTATION
\
"
Folder1
\
"
\
"
/comment
\
"
(
\
"
value.priv
\
"
\
"
value.shared
\
"
)"
<<
R"(
C: A000002 GETANNOTATION "Folder1" "/comment" ("value.priv" "value.shared"
)
)"
<<
"S: A000002 OK annotations retrieved"
;
fakeServer
.
setScenario
(
scenario
);
fakeServer
.
startAndWait
();
...
...
@@ -334,7 +334,7 @@ private Q_SLOTS:
KIMAP
::
Session
session
(
QStringLiteral
(
"127.0.0.1"
),
5989
);
//C: A000001 GETANNOTATION "Folder1" ("/comment" "/motd") "value.shared"
KIMAP
::
GetMetaDataJob
*
getMetadataJob
=
new
KIMAP
::
GetMetaDataJob
(
&
session
);
auto
*
getMetadataJob
=
new
KIMAP
::
GetMetaDataJob
(
&
session
);
getMetadataJob
->
setServerCapability
(
KIMAP
::
MetaDataJobBase
::
Annotatemore
);
getMetadataJob
->
setMailBox
(
QStringLiteral
(
"Folder1"
));
getMetadataJob
->
addRequestedEntry
(
"/shared/comment"
);
...
...
autotests/idjobtest.cpp
View file @
bbf40ff9
...
...
@@ -23,7 +23,7 @@ void testId_data() {
QTest
::
addColumn
<
ArrayMap
>
(
"values"
);
QList
<
QByteArray
>
scenario
;
scenario
<<
"S: * PREAUTH"
<<
"
C: A000001 ID (
\
"
name
\
"
\
"
clientid
\
"
)"
<<
R"(
C: A000001 ID ("name" "clientid"
)
)"
<<
"S: * ID NIL"
<<
"S: A000001 OK ID completed"
;
...
...
@@ -42,7 +42,7 @@ void testId()
fakeServer
.
startAndWait
();
KIMAP
::
Session
session
(
QStringLiteral
(
"127.0.0.1"
),
5989
);
KIMAP
::
IdJob
*
job
=
new
KIMAP
::
IdJob
(
&
session
);
auto
*
job
=
new
KIMAP
::
IdJob
(
&
session
);
foreach
(
const
QByteArray
&
key
,
values
.
keys
())
{
job
->
setField
(
key
,
values
.
value
(
key
));
}
...
...
autotests/idlejobtest.cpp
View file @
bbf40ff9
...
...
@@ -185,11 +185,11 @@ private Q_SLOTS:
KIMAP
::
Session
session
(
QStringLiteral
(
"127.0.0.1"
),
5989
);
KIMAP
::
SelectJob
*
select
=
new
KIMAP
::
SelectJob
(
&
session
);
auto
*
select
=
new
KIMAP
::
SelectJob
(
&
session
);
select
->
setMailBox
(
expectedMailBox
);
QVERIFY
(
select
->
exec
());
KIMAP
::
IdleJob
*
idle
=
new
KIMAP
::
IdleJob
(
&
session
);
auto
*
idle
=
new
KIMAP
::
IdleJob
(
&
session
);
QSignalSpy
statsSpy
(
idle
,
&
KIMAP
::
IdleJob
::
mailBoxStats
);
QSignalSpy
flagsSpy
(
idle
,
&
KIMAP
::
IdleJob
::
mailBoxMessageFlagsChanged
);
...
...
@@ -263,11 +263,11 @@ private Q_SLOTS:
KIMAP
::
Session
session
(
QStringLiteral
(
"127.0.0.1"
),
5989
);
const
int
originalTimeout
=
session
.
timeout
();
KIMAP
::
SelectJob
*
select
=
new
KIMAP
::
SelectJob
(
&
session
);
auto
*
select
=
new
KIMAP
::
SelectJob
(
&
session
);
select
->
setMailBox
(
QStringLiteral
(
"INBOX"
));
QVERIFY
(
select
->
exec
());
KIMAP
::
IdleJob
*
idle
=
new
KIMAP
::
IdleJob
(
&
session
);
auto
*
idle
=
new
KIMAP
::
IdleJob
(
&
session
);
idle
->
exec
();
QCOMPARE
(
session
.
timeout
(),
originalTimeout
);
...
...
autotests/kimaptest/fakeserver.cpp
View file @
bbf40ff9
...
...
@@ -51,7 +51,7 @@ void FakeServer::dataAvailable()
{
QMutexLocker
locker
(
&
m_mutex
);
QTcpSocket
*
socket
=
qobject_cast
<
QTcpSocket
*>
(
sender
());
auto
*
socket
=
qobject_cast
<
QTcpSocket
*>
(
sender
());
QVERIFY
(
socket
);
int
scenarioNumber
=
m_clientSockets
.
indexOf
(
socket
);
...
...
autotests/kimaptest/sslserver.cpp
View file @
bbf40ff9
...
...
@@ -59,7 +59,7 @@ SslServer::SslServer(QSsl::SslProtocol protocol, bool waitForStartTls)
void
SslServer
::
incomingConnection
(
qintptr
handle
)
{
QSslSocket
*
socket
=
new
QSslSocket
();
auto
*
socket
=
new
QSslSocket
();
socket
->
setSocketDescriptor
(
handle
);
socket
->
setProtocol
(
mProtocol
);
...
...
@@ -93,7 +93,7 @@ void SslServer::sslErrors(const QList<QSslError> &errors)
for
(
const
QSslError
&
error
:
errors
)
{
qWarning
()
<<
"Received ssl error: "
<<
error
.
errorString
();
}
QSslSocket
*
socket
=
qobject_cast
<
QSslSocket
*>
(
QObject
::
sender
());
auto
*
socket
=
qobject_cast
<
QSslSocket
*>
(
QObject
::
sender
());
if
(
socket
)
{
socket
->
disconnectFromHost
();
}
...
...
@@ -101,7 +101,7 @@ void SslServer::sslErrors(const QList<QSslError> &errors)
void
SslServer
::
error
(
QAbstractSocket
::
SocketError
error
)
{
QSslSocket
*
socket
=
qobject_cast
<
QSslSocket
*>
(
QObject
::
sender
());
auto
*
socket
=
qobject_cast
<
QSslSocket
*>
(
QObject
::
sender
());
if
(
socket
)
{
qWarning
()
<<
socket
->
errorString
();
}
...
...
autotests/listjobtest.cpp
View file @
bbf40ff9
...
...
@@ -38,7 +38,7 @@ private Q_SLOTS:
<<
"S: * LIST (
\\
HasChildren ) / INBOX"
<<
"S: * LIST (
\\
HasNoChildren ) / INBOX/&AOQ- &APY- &APw- @ &IKw-"
<<
"S: * LIST (
\\
HasChildren ) / INBOX/lost+found"
<<
"
S: * LIST (
\
\
HasNoChildren ) /
\
"
INBOX/lost+found/Calendar Public-20080128
\
"
"
<<
R"(
S: * LIST ( \HasNoChildren ) / "INBOX/lost+found/Calendar Public-20080128"
)
"
<<
"S: A000001 OK LIST completed"
;
KIMAP
::
MailBoxDescriptor
descriptor
;
QList
<
KIMAP
::
MailBoxDescriptor
>
listresult
;
...
...
@@ -64,7 +64,7 @@ private Q_SLOTS:
<<
"S: * LIST (
\\
HasChildren ) / Inbox"
<<
"S: * LIST (
\\
HasNoChildren ) / Inbox/&AOQ- &APY- &APw- @ &IKw-"
<<
"S: * LIST (
\\
HasChildren ) / Inbox/lost+found"
<<
"
S: * LIST (
\
\
HasNoChildren ) /
\
"
Inbox/lost+found/Calendar Public-20080128
\
"
"
<<
R"(
S: * LIST ( \HasNoChildren ) / "Inbox/lost+found/Calendar Public-20080128"
)
"
<<
"S: A000001 OK LIST completed"
;
listresult
.
clear
();
...
...
@@ -191,7 +191,7 @@ private Q_SLOTS:
KIMAP
::
Session
session
(
QStringLiteral
(
"127.0.0.1"
),
5989
);
KIMAP
::
ListJob
*
job
=
new
KIMAP
::
ListJob
(
&
session
);
auto
*
job
=
new
KIMAP
::
ListJob
(
&
session
);
job
->
setIncludeUnsubscribed
(
unsubscribed
);
QSignalSpy
spy
(
job
,
...
...
autotests/logoutjobtest.cpp
View file @
bbf40ff9
...
...
@@ -34,7 +34,7 @@ private Q_SLOTS:
KIMAP
::
Session
*
session
=
new
KIMAP
::
Session
(
QStringLiteral
(
"127.0.0.1"
),
5989
);
KIMAP
::
LogoutJob
*
logout
=
new
KIMAP
::
LogoutJob
(
session
);
auto
*
logout
=
new
KIMAP
::
LogoutJob
(
session
);
QVERIFY
(
logout
->
exec
());
fakeServer
.
quit
();
...
...
@@ -54,7 +54,7 @@ private Q_SLOTS:
KIMAP
::
Session
*
session
=
new
KIMAP
::
Session
(
QStringLiteral
(
"127.0.0.1"
),
5989
);
KIMAP
::
LogoutJob
*
logout
=
new
KIMAP
::
LogoutJob
(
session
);
auto
*
logout
=
new
KIMAP
::
LogoutJob
(
session
);
QVERIFY
(
logout
->
exec
());
fakeServer
.
quit
();
...
...
autotests/quotarootjobtest.cpp
View file @
bbf40ff9
...
...
@@ -146,7 +146,7 @@ private Q_SLOTS:
KIMAP
::
Session
session
(
QStringLiteral
(
"127.0.0.1"
),
5989
);
KIMAP
::
GetQuotaRootJob
*
job
=
new
KIMAP
::
GetQuotaRootJob
(
&
session
);
auto
*
job
=
new
KIMAP
::
GetQuotaRootJob
(
&
session
);
job
->
setMailBox
(
mailbox
);
bool
result
=
job
->
exec
();
QEXPECT_FAIL
(
"bad"
,
"Expected failure on BAD response"
,
Continue
);
...
...
autotests/renamejobtest.cpp
View file @
bbf40ff9
...
...
@@ -29,19 +29,19 @@ private Q_SLOTS:
QList
<
QByteArray
>
scenario
;
scenario
<<
FakeServer
::
preauth
()
<<
"
C: A000001 RENAME
\
"
INBOX
\
"
\
"
oldmail
\
"
"
<<
R"(
C: A000001 RENAME "INBOX" "oldmail"
)
"
<<
"S: A000001 OK RENAME completed"
;
QTest
::
newRow
(
"good"
)
<<
"INBOX"
<<
"oldmail"
<<
scenario
;
scenario
.
clear
();
scenario
<<
FakeServer
::
preauth
()
<<
"
C: A000001 RENAME
\
"
INBOX-FAIL-BAD
\
"
\
"
oldmail-bad
\
"
"
<<
R"(
C: A000001 RENAME "INBOX-FAIL-BAD" "oldmail-bad"
)
"
<<
"S: A000001 BAD command unknown or arguments invalid"
;
QTest
::
newRow
(
"bad"
)
<<
"INBOX-FAIL-BAD"
<<
"oldmail-bad"
<<
scenario
;
scenario
.
clear
();
scenario
<<
FakeServer
::
preauth
()
<<
"
C: A000001 RENAME
\
"
INBOX-FAIL-NO
\
"
\
"
oldmail-no
\
"
"
<<
R"(
C: A000001 RENAME "INBOX-FAIL-NO" "oldmail-no"
)
"
<<
"S: A000001 NO rename failure"
;
QTest
::
newRow
(
"no"
)
<<
"INBOX-FAIL-NO"
<<
"oldmail-no"
<<
scenario
;
}
...
...
@@ -58,7 +58,7 @@ private Q_SLOTS:
KIMAP
::
Session
session
(
QStringLiteral
(
"127.0.0.1"
),
5989
);
KIMAP
::
RenameJob
*
job
=
new
KIMAP
::
RenameJob
(
&
session
);
auto
*
job
=
new
KIMAP
::
RenameJob
(
&
session
);
job
->
setSourceMailBox
(
mailbox
);
job
->
setDestinationMailBox
(
newname
);
bool
result
=
job
->
exec
();
...
...
autotests/searchjobtest.cpp
View file @
bbf40ff9
...
...
@@ -90,7 +90,7 @@ private Q_SLOTS:
KIMAP
::
Session
session
(
QStringLiteral
(
"127.0.0.1"
),
5989
);
KIMAP
::
SearchJob
*
job
=
new
KIMAP
::
SearchJob
(
&
session
);
auto
*
job
=
new
KIMAP
::
SearchJob
(
&
session
);
job
->
setUidBased
(
uidbased
);
job
->
setSearchLogic
(
searchLogic
);
for
(
const
SearchCriteriaValuePair
&
pair
:
qAsConst
(
searchCriteria
))
{
...
...
@@ -156,7 +156,7 @@ private Q_SLOTS:
{
QList
<
QByteArray
>
scenario
;
scenario
<<
FakeServer
::
preauth
()
<<
"
C: A000001 UID SEARCH OR HEADER Message-Id
\
"
<1234567@mail.box>
\
"
(OR HEADER Message-Id
\
"
<7654321@mail.box>
\
"
(OR HEADER Message-Id
\
"
<abcdefg@mail.box>
\
"
HEADER Message-Id
\
"
<gfedcba@mail.box>
\
"
))"
<<
R"(
C: A000001 UID SEARCH OR HEADER Message-Id "<1234567@mail.box>" (OR HEADER Message-Id "<7654321@mail.box>" (OR HEADER Message-Id "<abcdefg@mail.box>" HEADER Message-Id "<gfedcba@mail.box>"
)
))"
<<
"S: * SEARCH 1 2 3 4"
<<
"S: A000001 OK search done"
;
KIMAP
::
Term
term
{
KIMAP
::
Term
::
Or
,
{
KIMAP
::
Term
{
QStringLiteral
(
"Message-Id"
),
QStringLiteral
(
"<1234567@mail.box>"
)},
...
...
@@ -180,7 +180,7 @@ private Q_SLOTS:
KIMAP
::
Session
session
(
QStringLiteral
(
"127.0.0.1"
),
5989
);
KIMAP
::
SearchJob
*
job
=
new
KIMAP
::
SearchJob
(
&
session
);
auto
*
job
=
new
KIMAP
::
SearchJob
(
&
session
);
job
->
setUidBased
(
uidbased
);
job
->
setTerm
(
searchTerm
);
...
...
autotests/selectjobtest.cpp
View file @
bbf40ff9
...
...
@@ -47,8 +47,8 @@ private Q_SLOTS:
<<
"S: * OK [UIDVALIDITY 3857529045] UIDs valid"
<<
"S: * OK [UIDNEXT 4392] Predicted next UID"
<<
"S: * OK [HIGHESTMODSEQ 123456789]"
<<
"
S: * FLAGS (
\
\
Answered
\
\
Flagged
\
\
Deleted
\
\
Seen
\
\
Draft)"
<<
"
S: * OK [PERMANENTFLAGS (
\
\
Deleted
\
\
Seen
\
\
*)] Limited"
<<
R"(
S: * FLAGS (\Answered \Flagged \Deleted \Seen \Draft)
)
"
<<
R"(
S: * OK [PERMANENTFLAGS (\Deleted \Seen \*)] Limited
)
"
<<
"S: A000001 OK [READ-WRITE] SELECT completed"
;
flags
<<
"
\\
Answered"
<<
"
\\
Flagged"
<<
"
\\
Deleted"
<<
"
\\
Seen"
<<
"
\\
Draft"
;
...
...
@@ -91,7 +91,7 @@ private Q_SLOTS:
KIMAP
::
Session
session
(
QStringLiteral
(
"127.0.0.1"
),
5989
);
KIMAP
::
SelectJob
*
job
=
new
KIMAP
::
SelectJob
(
&
session
);
auto
*
job
=
new
KIMAP
::
SelectJob
(
&
session
);
job
->
setCondstoreEnabled
(
condstoreEnabled
);
job
->
setMailBox
(
QStringLiteral
(
"INBOX"
));
bool
result
=
job
->
exec
();
...
...
@@ -126,7 +126,7 @@ private Q_SLOTS:
KIMAP
::
Session
session
(
QStringLiteral
(
"127.0.0.1"
),
5989
);
KIMAP
::
SelectJob
*
job
=
new
KIMAP
::
SelectJob
(
&
session
);
auto
*
job
=
new
KIMAP
::
SelectJob
(
&
session
);
job
->
setMailBox
(
QStringLiteral
(
"INBOX"
));
QVERIFY
(
job
->
exec
());
...
...
autotests/setmetadatajobtest.cpp
View file @
bbf40ff9
...
...
@@ -30,7 +30,7 @@ private Q_SLOTS:
{
QList
<
QByteArray
>
scenario
;
scenario
<<
FakeServer
::
preauth
()
<<
"
C: A000001 SETMETADATA
\
"
Folder1
\
"
(
\
"
/public/comment
\
"
\
"
comment2
\
"
\
"
/shared/comment
\
"
\
"
Shared comment
\
"
)"
<<
R"(
C: A000001 SETMETADATA "Folder1" ("/public/comment" "comment2" "/shared/comment" "Shared comment"
)
)"
<<
"S: A000001 OK SETMETADATA complete"
;
QMap
<
QByteArray
,
QByteArray
>
annotations
;
annotations
.
insert
(
"/public/comment"
,
"comment2"
);
...
...
@@ -50,7 +50,7 @@ private Q_SLOTS:
{
QList
<
QByteArray
>
scenario
;
scenario
<<
FakeServer
::
preauth
()
<<
"
C: A000001 SETMETADATA
\
"
Folder1
\
"
(
\
"
/shared/comment
\
"
NIL)"
<<
R"(
C: A000001 SETMETADATA "Folder1" ("/shared/comment" NIL)
)
"
<<
"S: A000001 OK SETMETADATA complete"
;
QMap
<
QByteArray
,
QByteArray
>
annotations
;
annotations
.
insert
(
"/shared/comment"
,
""
);
...
...
@@ -90,7 +90,7 @@ private Q_SLOTS:
KIMAP
::
Session
session
(
QStringLiteral
(
"127.0.0.1"
),
5989
);
KIMAP
::
SetMetaDataJob
*
setMetadataJob
=
new
KIMAP
::
SetMetaDataJob
(
&
session
);
auto
*
setMetadataJob
=
new
KIMAP
::
SetMetaDataJob
(
&
session
);
setMetadataJob
->
setServerCapability
(
KIMAP
::
MetaDataJobBase
::
Metadata
);
setMetadataJob
->
setMailBox
(
mailbox
);
foreach
(
const
QByteArray
&
entry
,
annotations
.
keys
())
{
...
...
@@ -112,7 +112,7 @@ private Q_SLOTS:
{
QList
<
QByteArray
>
scenario
;
scenario
<<
FakeServer
::
preauth
()
<<
"
C: A000001 SETANNOTATION
\
"
Folder1
\
"
\
"
/comment
\
"
(
\
"
value.shared
\
"
\
"
Shared comment
\
"
)"
<<
R"(
C: A000001 SETANNOTATION "Folder1" "/comment" ("value.shared" "Shared comment"
)
)"
<<
"S: A000001 OK annotations changed"
;
QMap
<
QByteArray
,
QByteArray
>
annotations
;
...
...
@@ -135,7 +135,7 @@ private Q_SLOTS:
KIMAP
::
Session
session
(
QStringLiteral
(
"127.0.0.1"
),
5989
);
KIMAP
::
SetMetaDataJob
*
setMetadataJob
=
new
KIMAP
::
SetMetaDataJob
(
&
session
);
auto
*
setMetadataJob
=
new
KIMAP
::
SetMetaDataJob
(
&
session
);
setMetadataJob
->
setServerCapability
(
KIMAP
::
MetaDataJobBase
::
Annotatemore
);
setMetadataJob
->
setMailBox
(
mailbox
);
foreach
(
const
QByteArray
&
entry
,
annotations
.
keys
())
{
...
...
autotests/statusjobtest.cpp
View file @
bbf40ff9
...
...
@@ -86,7 +86,7 @@ private Q_SLOTS:
fakeServer
.
startAndWait
();
KIMAP
::
Session
session
(
QStringLiteral
(
"127.0.0.1"
),
5989
);
KIMAP
::
StatusJob
*
job
=
new
KIMAP
::
StatusJob
(
&
session
);
auto
*
job
=
new
KIMAP
::
StatusJob
(
&
session
);
job
->
setMailBox
(
QStringLiteral
(
"INBOX"
));
job
->
setDataItems
(
dataItems
);
bool
result
=
job
->
exec
();
...
...
autotests/storejobtest.cpp
View file @
bbf40ff9
...
...
@@ -64,7 +64,7 @@ private Q_SLOTS:
KIMAP
::
Session
session
(
QStringLiteral
(
"127.0.0.1"
),
5989
);
KIMAP
::
StoreJob
*
job
=
new
KIMAP
::
StoreJob
(
&
session
);
auto
*
job
=
new
KIMAP
::
StoreJob
(
&
session
);
job
->
setUidBased
(
uidBased
);
job
->
setSequenceSet
(
KIMAP
::
ImapSet
(
uidBased
?
uid
:
id
));
job
->
setFlags
(
flags
);
...
...
autotests/subscribejobtest.cpp
View file @
bbf40ff9
...
...
@@ -56,7 +56,7 @@ private Q_SLOTS:
KIMAP
::
Session
session
(
QStringLiteral
(
"127.0.0.1"
),
5989
);
KIMAP
::
SubscribeJob
*
job
=
new
KIMAP
::
SubscribeJob
(
&
session
);
auto
*
job
=
new
KIMAP
::
SubscribeJob
(
&
session
);
job
->
setMailBox
(
mailbox
);
bool
result
=
job
->
exec
();
QEXPECT_FAIL
(
"bad"
,
"Expected failure on BAD scenario"
,
Continue
);
...
...
autotests/testsession.cpp
View file @
bbf40ff9
...
...
@@ -135,13 +135,13 @@ private Q_SLOTS:
fakeServer
.
startAndWait
();
KIMAP
::
Session
s
(
QStringLiteral
(
"127.0.0.1"
),
5989
);
MockJob
*
j1
=
new
MockJob
(
&
s
);
auto
*
j1
=
new
MockJob
(
&
s
);
connect
(
j1
,
SIGNAL
(
result
(
KJob
*
)),
this
,
SLOT
(
jobDone
(
KJob
*
)));
MockJob
*
j2
=
new
MockJob
(
&
s
);
auto
*
j2
=
new
MockJob
(
&
s
);
connect
(
j2
,
SIGNAL
(
result
(
KJob
*
)),
this
,
SLOT
(
jobDone
(
KJob
*
)));
MockJob
*
j3
=
new
MockJob
(
&
s
);
auto
*
j3
=
new
MockJob
(
&
s
);
connect
(
j3
,
SIGNAL
(
result
(
KJob
*
)),
this
,
SLOT
(
jobDone
(
KJob
*
)));
MockJob
*
j4
=
new
MockJob
(
&
s
);
auto
*
j4
=
new
MockJob
(
&
s
);
connect
(
j4
,
SIGNAL
(
result
(
KJob
*
)),
this
,
SLOT
(
jobDone
(
KJob
*
)));
j4
->
start
();
...
...
@@ -173,10 +173,10 @@ private Q_SLOTS:
QCOMPARE
(
s
.
jobQueueSize
(),
0
);
MockJob
*
j1
=
new
MockJob
(
&
s
);
MockJob
*
j2
=
new
MockJob
(
&
s
);
MockJob
*
j3
=
new
MockJob
(
&
s
);
MockJob
*
j4
=
new
MockJob
(
&
s
);
auto
*
j1
=
new
MockJob
(
&
s
);
auto
*
j2
=
new
MockJob
(
&
s
);
auto
*
j3
=
new
MockJob
(
&
s
);
auto
*
j4
=
new
MockJob
(
&
s
);
connect
(
j4
,
SIGNAL
(
result
(
KJob
*
)),
&
m_eventLoop
,
SLOT
(
quit
()));
QCOMPARE
(
s
.
jobQueueSize
(),
0
);
...
...
@@ -241,7 +241,7 @@ private Q_SLOTS:
QSignalSpy
spyLost
(
&
s
,
SIGNAL
(
connectionLost
()));
QSignalSpy
spyState
(
&
s
,
SIGNAL
(
stateChanged
(
KIMAP
::
Session
::
State
,
KIMAP
::
Session
::
State
)));
MockJob
*
mock
=
new
MockJob
(
&
s
);
auto
*
mock
=
new
MockJob
(
&
s
);
mock
->
setCommand
(
"DUMMY"
);
mock
->
exec
();
...
...
@@ -263,15 +263,15 @@ private Q_SLOTS:
KIMAP
::
Session
s
(
QStringLiteral
(
"127.0.0.1"
),
5989
);
s
.
setTimeout
(
1
);
MockJob
*
j1
=
new
MockJob
(
&
s
);
auto
*
j1
=
new
MockJob
(
&
s
);
QSignalSpy
spyResult1
(
j1
,
SIGNAL
(
result
(
KJob
*
)));
QSignalSpy
spyDestroyed1
(
j1
,
SIGNAL
(
destroyed
()));
MockJob
*
j2
=
new
MockJob
(
&
s
);
auto
*
j2
=
new
MockJob
(
&
s
);
QSignalSpy
spyResult2
(
j2
,
SIGNAL
(
result
(
KJob
*
)));
QSignalSpy
spyDestroyed2
(
j2
,
SIGNAL
(
destroyed
()));
MockJob
*
j3
=
new
MockJob
(
&
s
);
auto
*
j3
=
new
MockJob
(
&
s
);
QSignalSpy
spyResult3
(
j3
,
SIGNAL
(
result
(
KJob
*
)));
QSignalSpy
spyDestroyed3
(
j3
,
SIGNAL
(
destroyed
()));
...
...
@@ -314,7 +314,7 @@ private Q_SLOTS:
QSignalSpy
spyLost
(
&
s
,
SIGNAL
(
connectionLost
()));
QSignalSpy
spyState
(
&
s
,
SIGNAL
(
stateChanged
(
KIMAP
::
Session
::
State
,
KIMAP
::
Session
::
State
)));
MockJob
*
mock
=
new
MockJob
(
&
s
);
auto
*
mock
=
new
MockJob
(
&
s
);
mock
->
setTimeout
(
5000
);
mock
->
setCommand
(
"DUMMY"
);
...
...
autotests/unsubscribejobtest.cpp
View file @
bbf40ff9
...
...
@@ -56,7 +56,7 @@ private Q_SLOTS:
KIMAP
::
Session
session
(
QStringLiteral
(
"127.0.0.1"
),
5989
);
KIMAP
::
UnsubscribeJob
*
job
=
new
KIMAP
::
UnsubscribeJob
(
&
session
);
auto
*
job
=
new
KIMAP
::
UnsubscribeJob
(
&
session
);
job
->
setMailBox
(
mailbox
);
bool
result
=
job
->
exec
();
QEXPECT_FAIL
(
"bad"
,
"Expected failure on BAD scenario"
,
Continue
);
...
...