servertest: add NNTP support
ClosedPublic

Authored by pino on Jul 29 2017, 3:37 PM.

Details

Summary

Add the defines for the NNTP/NNTPS strings and ports;, implement the
basic conversation to get the capabilities of the server (if supported),
to know whether TLS is supported, and which authentication methods are
available.

Test Plan

Run the servertest with some NNTP server, e.g. news.gmane.org,
nntp.perl.org, news.mozilla.org.

Diff Detail

Repository
R84 PIM: KMail Transport
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
pino created this revision.Jul 29 2017, 3:37 PM
Restricted Application added a project: KDE PIM. · View Herald TranscriptJul 29 2017, 3:37 PM
mlaurent requested changes to this revision.Jul 30 2017, 6:41 AM
mlaurent added inline comments.
src/kmailtransport/servertest.cpp
422

Why use normalStage as reference ?
We don't use it as reference in other place as it's already defined

> it avoids to add an extra test

This revision now requires changes to proceed.Jul 30 2017, 6:41 AM
pino added inline comments.Jul 30 2017, 8:32 AM
src/kmailtransport/servertest.cpp
422

Why use normalStage as reference ?

Because every time there is a new line of data read from the socket, the stage is increased (see few lines above this). Since:

  • we want to stay at stage 1 until the reply of CAPABILITIES is over
  • it happens that the reply is read in multiple batches, and not just at once

then we need to reset the stage to be still 1 -- see the comment at the end of handleNntpConversation.

mlaurent added inline comments.Jul 31 2017, 4:36 AM
src/kmailtransport/servertest.cpp
422

So we can use a reference not necessary a pointer where we need to check with Q_ASSERT if it's empty or not
and we don't need to use *stage == ... no ?

pino added inline comments.Jul 31 2017, 5:33 AM
src/kmailtransport/servertest.cpp
422

The pointer instead of the reference makes it more clear it is subject to change, which is not when using a reference. This is also the case for the shouldStartTLS parameter, in both the handlePopConversation function (already existing), and the handleNntpConversation which I added.

mlaurent accepted this revision.Aug 1 2017, 5:58 AM

Ok why not, I am not convinced but ok

This revision is now accepted and ready to land.Aug 1 2017, 5:58 AM
This revision was automatically updated to reflect the committed changes.