Fixing to have the proper version of go-imap from foxcpp.

This commit is contained in:
2025-12-08 22:52:36 +02:00
parent d8ddb6be71
commit 226c7e6cf0
207 changed files with 15166 additions and 15437 deletions

41
responses/search.go Normal file
View File

@@ -0,0 +1,41 @@
package responses
import (
"github.com/emersion/go-imap"
)
const searchName = "SEARCH"
// A SEARCH response.
// See RFC 3501 section 7.2.5
type Search struct {
Ids []uint32
}
func (r *Search) Handle(resp imap.Resp) error {
name, fields, ok := imap.ParseNamedResp(resp)
if !ok || name != searchName {
return ErrUnhandled
}
r.Ids = make([]uint32, len(fields))
for i, f := range fields {
if id, err := imap.ParseNumber(f); err != nil {
return err
} else {
r.Ids[i] = id
}
}
return nil
}
func (r *Search) WriteTo(w *imap.Writer) (err error) {
fields := []interface{}{searchName}
for _, id := range r.Ids {
fields = append(fields, id)
}
resp := imap.NewUntaggedResp(fields)
return resp.WriteTo(w)
}