imapserver: implement NOTIFY extension from RFC 5465

NOTIFY is like IDLE, but where IDLE watches just the selected mailbox, NOTIFY
can watch all mailboxes. With NOTIFY, a client can also ask a server to
immediately return configurable fetch attributes for new messages, e.g. a
message preview, certain header fields, or simply the entire message.

Mild testing with evolution and fairemail.
This commit is contained in:
Mechiel Lukkien
2025-04-07 23:21:03 +02:00
parent 5a7d5fce98
commit 8bab38eac4
30 changed files with 1926 additions and 161 deletions

View File

@ -185,13 +185,18 @@ func (c *Conn) xflush() {
}
}
func (c *Conn) xtrace(level slog.Level) func() {
c.xflush()
func (c *Conn) xtraceread(level slog.Level) func() {
c.tr.SetTrace(level)
return func() {
c.tr.SetTrace(mlog.LevelTrace)
}
}
func (c *Conn) xtracewrite(level slog.Level) func() {
c.xflush()
c.xtw.SetTrace(level)
return func() {
c.xflush()
c.tr.SetTrace(mlog.LevelTrace)
c.xtw.SetTrace(mlog.LevelTrace)
}
}
@ -357,9 +362,10 @@ func (c *Conn) WriteSyncLiteral(s string) (untagged []Untagged, rerr error) {
_, err = c.Readline()
c.xcheckf(err, "read continuation line")
defer c.xtracewrite(mlog.LevelTracedata)()
_, err = c.xbw.Write([]byte(s))
c.xcheckf(err, "write literal data")
c.xflush()
c.xtracewrite(mlog.LevelTrace)
return nil, nil
}
untagged, result, err := c.Response()