Skip to content

Commit 3e8cc8b

Browse files
fix(GODT-2550): Announce IMAP ID Capability
Feature was built in but never announced to the clients.
1 parent 81e7559 commit 3e8cc8b

5 files changed

Lines changed: 8 additions & 7 deletions

File tree

imap/capabilities.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,12 @@ const (
99
UNSELECT Capability = `UNSELECT`
1010
UIDPLUS Capability = `UIDPLUS`
1111
MOVE Capability = `MOVE`
12+
ID Capability = `ID`
1213
)
1314

1415
func IsCapabilityAvailableBeforeAuth(c Capability) bool {
1516
switch c {
16-
case IMAP4rev1, StartTLS, IDLE:
17+
case IMAP4rev1, StartTLS, IDLE, ID:
1718
return true
1819
case UNSELECT, UIDPLUS, MOVE:
1920
return false

internal/session/handle_capability.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ func (s *Session) getCaps() []imap.Capability {
1616
return s.caps
1717
}
1818

19-
caps := []imap.Capability{}
19+
var caps []imap.Capability
2020
for _, c := range s.caps {
2121
if imap.IsCapabilityAvailableBeforeAuth(c) {
2222
caps = append(caps, c)

internal/session/session.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ func New(
110110
inputCollector: inputCollector,
111111
scanner: scanner,
112112
backend: backend,
113-
caps: []imap.Capability{imap.IMAP4rev1, imap.IDLE, imap.UNSELECT, imap.UIDPLUS, imap.MOVE},
113+
caps: []imap.Capability{imap.IMAP4rev1, imap.IDLE, imap.UNSELECT, imap.UIDPLUS, imap.MOVE, imap.ID},
114114
sessionID: sessionID,
115115
eventCh: eventCh,
116116
idleBulkTime: idleBulkTime,

tests/capability_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ import (
77
func TestCapability(t *testing.T) {
88
runOneToOneTest(t, defaultServerOptions(t), func(c *testConnection, _ *testSession) {
99
c.C("A001 Capability")
10-
c.S(`* CAPABILITY IDLE IMAP4rev1 STARTTLS`)
10+
c.S(`* CAPABILITY ID IDLE IMAP4rev1 STARTTLS`)
1111
c.S("A001 OK CAPABILITY")
1212

1313
c.C(`A002 login "user" "pass"`)
14-
c.S(`A002 OK [CAPABILITY IDLE IMAP4rev1 MOVE STARTTLS UIDPLUS UNSELECT] Logged in`)
14+
c.S(`A002 OK [CAPABILITY ID IDLE IMAP4rev1 MOVE STARTTLS UIDPLUS UNSELECT] Logged in`)
1515

1616
c.C("A003 Capability")
17-
c.S(`* CAPABILITY IDLE IMAP4rev1 MOVE STARTTLS UIDPLUS UNSELECT`)
17+
c.S(`* CAPABILITY ID IDLE IMAP4rev1 MOVE STARTTLS UIDPLUS UNSELECT`)
1818
c.S("A003 OK CAPABILITY")
1919
})
2020
}

tests/login_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ func TestLoginLiteralFailure(t *testing.T) {
9090
func TestLoginCapabilities(t *testing.T) {
9191
runOneToOneTest(t, defaultServerOptions(t), func(c *testConnection, _ *testSession) {
9292
c.C("A001 login user pass")
93-
c.S(`A001 OK [CAPABILITY IDLE IMAP4rev1 MOVE STARTTLS UIDPLUS UNSELECT] Logged in`)
93+
c.S(`A001 OK [CAPABILITY ID IDLE IMAP4rev1 MOVE STARTTLS UIDPLUS UNSELECT] Logged in`)
9494
})
9595
}
9696

0 commit comments

Comments
 (0)