Skip to content

Commit d7a53ee

Browse files
committed
fix: imap idle writter with nil connection
1 parent 66b94cd commit d7a53ee

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

imap/idle.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ func (c *conn) handleIdle(tag string) error {
2121
}
2222

2323
done := make(chan struct{})
24-
err := c.handler.Idle(&idleWriter{}, done, c.ctx)
24+
err := c.handler.Idle(newIdleWriter(c.tpc), done, c.ctx)
2525
if err != nil {
2626
return err
2727
}
@@ -57,6 +57,10 @@ type idleWriter struct {
5757
tpc *textproto.Conn
5858
}
5959

60+
func newIdleWriter(tpc *textproto.Conn) *idleWriter {
61+
return &idleWriter{tpc: tpc}
62+
}
63+
6064
func (w *idleWriter) WriteNumMessages(n uint32) error {
6165
return w.tpc.PrintfLine("* %v EXISTS", n)
6266
}
@@ -66,5 +70,5 @@ func (w *idleWriter) WriteMessageFlags(msn uint32, flags []Flag) error {
6670
}
6771

6872
func (w *idleWriter) WriteExpunge(msn uint32) error {
69-
return w.tpc.PrintfLine("%v EXPUNGE", msn)
73+
return w.tpc.PrintfLine("* %v EXPUNGE", msn)
7074
}

0 commit comments

Comments
 (0)