mirror of
https://github.com/neilalexander/yggmail.git
synced 2026-05-22 19:16:29 +03:00
Please Thunderbird somewhat
This commit is contained in:
@@ -123,6 +123,7 @@ func main() {
|
|||||||
imapServer := server.New(imapBackend)
|
imapServer := server.New(imapBackend)
|
||||||
imapServer.Addr = *imapaddr
|
imapServer.Addr = *imapaddr
|
||||||
imapServer.AllowInsecureAuth = true
|
imapServer.AllowInsecureAuth = true
|
||||||
|
imapServer.Debug = os.Stdout
|
||||||
imapServer.EnableAuth(sasl.Login, func(conn server.Conn) sasl.Server {
|
imapServer.EnableAuth(sasl.Login, func(conn server.Conn) sasl.Server {
|
||||||
return sasl.NewLoginServer(func(username, password string) error {
|
return sasl.NewLoginServer(func(username, password string) error {
|
||||||
_, err := imapBackend.Login(nil, username, password)
|
_, err := imapBackend.Login(nil, username, password)
|
||||||
|
|||||||
@@ -22,6 +22,13 @@ type Mailbox struct {
|
|||||||
func (mbox *Mailbox) getIDsFromSeqSet(uid bool, seqSet *imap.SeqSet) ([]int32, error) {
|
func (mbox *Mailbox) getIDsFromSeqSet(uid bool, seqSet *imap.SeqSet) ([]int32, error) {
|
||||||
var ids []int32
|
var ids []int32
|
||||||
for _, set := range seqSet.Set {
|
for _, set := range seqSet.Set {
|
||||||
|
if set.Stop == 0 {
|
||||||
|
next, err := mbox.backend.Storage.MailNextID(mbox.user.username, mbox.name)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("mbox.backend.Storage.MailNextID: %w", err)
|
||||||
|
}
|
||||||
|
set.Stop = uint32(next - 1)
|
||||||
|
}
|
||||||
for i := set.Start; i <= set.Stop; i++ {
|
for i := set.Start; i <= set.Stop; i++ {
|
||||||
if !uid {
|
if !uid {
|
||||||
pid, err := mbox.backend.Storage.MailIDForSeq(mbox.user.username, mbox.name, int(i))
|
pid, err := mbox.backend.Storage.MailIDForSeq(mbox.user.username, mbox.name, int(i))
|
||||||
@@ -108,13 +115,16 @@ func (mbox *Mailbox) ListMessages(uid bool, seqSet *imap.SeqSet, items []imap.Fe
|
|||||||
return fmt.Errorf("mbox.getIDsFromSeqSet: %w", err)
|
return fmt.Errorf("mbox.getIDsFromSeqSet: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fmt.Println("FETCHING", ids, uid)
|
||||||
|
fmt.Println("SEQ SET", seqSet)
|
||||||
|
|
||||||
for _, id := range ids {
|
for _, id := range ids {
|
||||||
mseq, mid, body, seen, answered, flagged, deleted, datetime, err := mbox.backend.Storage.MailSelect(mbox.user.username, mbox.name, int(id))
|
mseq, mid, body, seen, answered, flagged, deleted, datetime, err := mbox.backend.Storage.MailSelect(mbox.user.username, mbox.name, int(id))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
fetched := imap.NewMessage(uint32(id)+1, items)
|
fetched := imap.NewMessage(uint32(id), items)
|
||||||
fetched.SeqNum = uint32(mseq)
|
fetched.SeqNum = uint32(mseq)
|
||||||
fetched.Uid = uint32(mid)
|
fetched.Uid = uint32(mid)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user