Skip to content

Commit

Permalink
Merge support for CHILDREN extension
Browse files Browse the repository at this point in the history
  • Loading branch information
foxcpp authored and emersion committed Nov 1, 2020
1 parent 61057f7 commit 7b7dd37
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Expand Up @@ -136,6 +136,7 @@ includes:
* [LITERAL+](https://tools.ietf.org/html/rfc7888)
* [SASL-IR](https://tools.ietf.org/html/rfc4959)
* [SPECIAL-USE](https://tools.ietf.org/html/rfc6154)
* [CHILDREN](https://tools.ietf.org/html/rfc3348)

Support for other extensions is provided via separate packages. See below.

Expand Down
10 changes: 10 additions & 0 deletions mailbox.go
Expand Up @@ -58,6 +58,16 @@ const (
TrashAttr = "\\Trash"
)

// Mailbox attributes defined in RFC 3348 (CHILDREN extension)
const (
// The presence of this attribute indicates that the mailbox has child
// mailboxes.
HasChildrenAttr = "\\HasChildren"
// The presence of this attribute indicates that the mailbox has no child
// mailboxes.
HasNoChildrenAttr = "\\HasNoChildren"
)

// Basic mailbox info.
type MailboxInfo struct {
// The mailbox attributes.
Expand Down
2 changes: 1 addition & 1 deletion server/conn.go
Expand Up @@ -163,7 +163,7 @@ func (c *conn) Close() error {
}

func (c *conn) Capabilities() []string {
caps := []string{"IMAP4rev1", "LITERAL+", "SASL-IR"}
caps := []string{"IMAP4rev1", "LITERAL+", "SASL-IR", "CHILDREN"}

if c.ctx.State == imap.NotAuthenticatedState {
if !c.IsTLS() && c.s.TLSConfig != nil {
Expand Down
2 changes: 1 addition & 1 deletion server/server_test.go
Expand Up @@ -10,7 +10,7 @@ import (
)

// Extnesions that are always advertised by go-imap server.
const builtinExtensions = "LITERAL+ SASL-IR"
const builtinExtensions = "LITERAL+ SASL-IR CHILDREN"

func testServer(t *testing.T) (s *server.Server, conn net.Conn) {
bkd := memory.New()
Expand Down

0 comments on commit 7b7dd37

Please sign in to comment.