change tag to something unlikely, be less pessimistic about errors

This commit is contained in:
Alexander Weinhold 2017-09-01 18:17:16 +02:00
parent 89642c258e
commit 5734364517

View File

@ -12,7 +12,7 @@ import (
) )
const ( const (
tag = ". " tag = "<<unreadMail>> "
other = "* " other = "* "
maxRead = 11000000 maxRead = 11000000
timeout = 3000 // ms timeout = 3000 // ms
@ -115,12 +115,13 @@ func searchUnseen(c *connection) stateFunc {
} }
func fetch(c *connection, ids []int) stateFunc { func fetch(c *connection, ids []int) stateFunc {
nErrs := 0
for _, id := range ids { for _, id := range ids {
c.write(cmd(fmt.Sprintf("uid fetch %d body[]", id))) c.write(cmd(fmt.Sprintf("uid fetch %d body[]", id)))
if c.err == nil { if len(c.err) == nErrs {
s := c.read("uid fetch of " + strconv.Itoa(id)) s := c.read("uid fetch of " + strconv.Itoa(id))
s = strings.TrimRight(s, ")\r\n") s = strings.TrimRight(s, ")\r\n")
if c.err == nil { if len(c.err) == nErrs {
mail, err := parseMail(s) mail, err := parseMail(s)
if err == nil { if err == nil {
c.unreadMails = append(c.unreadMails, mail) c.unreadMails = append(c.unreadMails, mail)
@ -129,6 +130,7 @@ func fetch(c *connection, ids []int) stateFunc {
} }
} }
} }
nErrs = len(c.err)
} }
return logout return logout
} }