- validateMsgNum parses and range-checks message-number arguments,
replacing five copies of the parse/check/respond sequence in the
LIST, UIDL, DELE, RETR and TOP arms (wire responses unchanged).
- listMessages implements LIST and UIDL, which differ only in the
per-message value reported.
- sendMessageLines unifies sendMessage/sendMessageTop via a body line
limit, negative meaning unlimited.
Adds a direct unit test for validateMsgNum and an equivalence test
asserting TOP with a large line limit matches RETR output. All
scripted session tests from the previous commit pass unchanged.
Signed-off-by: James Hillyerd <james@hillyerd.com>
Covers the POP3 TRANSACTION state machine via scripted sessions over
net.Pipe, mirroring the SMTP handler test harness: STAT/LIST/UIDL/DELE/
RETR/TOP/NOOP/RSET/QUIT including argument error paths, deleted-message
behavior, dot-stuffing, RETR/TOP source error paths, mailbox load
errors, session read error handling (idle timeout vs other), and the
TCP listener lifecycle (Start/serve/Notify/Drain).
No production code changes; current behavior is pinned as-is. Two
known RFC deviations are documented in tests (RETR/TOP of messages
marked deleted) for follow-up fixes. Package coverage: 24.4% -> 93.2%.
Signed-off-by: James Hillyerd <james@hillyerd.com>
* fix: POP3 server now uses TLS HandshakeContext
Signed-off-by: James Hillyerd <james@hillyerd.com>
* fix: Web server now uses Listen with context
Signed-off-by: James Hillyerd <james@hillyerd.com>
* fix: replace interface{} with any
Signed-off-by: James Hillyerd <james@hillyerd.com>
---------
Signed-off-by: James Hillyerd <james@hillyerd.com>
* Update to golangci lint 2.0.x
Signed-off-by: James Hillyerd <james@hillyerd.com>
* Fix new lint warnings
Signed-off-by: James Hillyerd <james@hillyerd.com>
---------
Signed-off-by: James Hillyerd <james@hillyerd.com>
* chore: Update Go deps
Signed-off-by: James Hillyerd <james@hillyerd.com>
* Fix lint warnings for loopvars
Signed-off-by: James Hillyerd <james@hillyerd.com>
---------
Signed-off-by: James Hillyerd <james@hillyerd.com>
* chore: rename BeforeMailAccepted to BeforeMailFromAccepted
Signed-off-by: James Hillyerd <james@hillyerd.com>
* chore: update BeforeMailAccepted to use SMTPSession
Signed-off-by: James Hillyerd <james@hillyerd.com>
---------
Signed-off-by: James Hillyerd <james@hillyerd.com>
* chore: faster hash to string conv
Signed-off-by: James Hillyerd <james@hillyerd.com>
* chore: require NoError in integration test setup
Signed-off-by: James Hillyerd <james@hillyerd.com>
---------
Signed-off-by: James Hillyerd <james@hillyerd.com>
* chore: convert smtp/handler if-else chain to switch-case
Signed-off-by: James Hillyerd <james@hillyerd.com>
* chore: extract long case into parseMailCmd func
Signed-off-by: James Hillyerd <james@hillyerd.com>
* chore: remove extraneous braces in cases
Signed-off-by: James Hillyerd <james@hillyerd.com>
---------
Signed-off-by: James Hillyerd <james@hillyerd.com>
* chore: colocate SMTP session WaitGroup incr/decr
Signed-off-by: James Hillyerd <james@hillyerd.com>
* fix: smtp tests that hang on panic/t.Fatal
Signed-off-by: James Hillyerd <james@hillyerd.com>
* chore: reorder smtp/handler test helpers
Signed-off-by: James Hillyerd <james@hillyerd.com>
---------
Signed-off-by: James Hillyerd <james@hillyerd.com>
* fix whitespace warnings
Signed-off-by: James Hillyerd <james@hillyerd.com>
* fix a number of typos
Signed-off-by: James Hillyerd <james@hillyerd.com>
* fix many cosmetic linter warnings
Signed-off-by: James Hillyerd <james@hillyerd.com>
---------
Signed-off-by: James Hillyerd <james@hillyerd.com>
* event: Use pointers for InboundMessage addresses
To ease conversions to/from MessageMetadata
Signed-off-by: James Hillyerd <james@hillyerd.com>
* message: test StoreManager.MailboxForAddress()
Signed-off-by: James Hillyerd <james@hillyerd.com>
---------
Signed-off-by: James Hillyerd <james@hillyerd.com>