golang IMAP client library
Revisão | 7f94357bdecc28f9b2ad87c921dfe2a6f367b77d (tree) |
---|---|
Hora | 2011-10-28 11:14:04 |
Autor | Evan Martin <martine@dang...> |
Commiter | Evan Martin |
make mutt accept my envelope from
@@ -113,13 +113,15 @@ func (ui *UI) fetch(im *imap.IMAP, mailbox string) { | ||
113 | 113 | ch, err := im.FetchAsync(query, []string{"RFC822"}) |
114 | 114 | check(err) |
115 | 115 | |
116 | + envelopeDate := time.LocalTime().Format(time.ANSIC) | |
117 | + | |
116 | 118 | i := 1 |
117 | 119 | L: |
118 | 120 | for { |
119 | 121 | r := <-ch |
120 | 122 | switch r := r.(type) { |
121 | 123 | case *imap.ResponseFetch: |
122 | - mbox.writeMessage(r.Rfc822) | |
124 | + mbox.writeMessage("imapsync@none", envelopeDate, r.Rfc822) | |
123 | 125 | ui.status("got message %d/%d", i, examine.Exists) |
124 | 126 | i++ |
125 | 127 | case *imap.ResponseStatus: |
@@ -4,6 +4,7 @@ import ( | ||
4 | 4 | "bytes" |
5 | 5 | "io" |
6 | 6 | "os" |
7 | + "fmt" | |
7 | 8 | ) |
8 | 9 | |
9 | 10 | type fromEncodingWriter struct { |
@@ -54,8 +55,8 @@ func newMbox(w io.Writer) *mbox { | ||
54 | 55 | return &mbox{w} |
55 | 56 | } |
56 | 57 | |
57 | -func (m *mbox) writeMessage(rfc822 []byte) os.Error { | |
58 | - _, err := m.Write([]byte("From whatever\r\n")) | |
58 | +func (m *mbox) writeMessage(envelopeFrom string, envelopeDate string, rfc822 []byte) os.Error { | |
59 | + _, err := m.Write([]byte(fmt.Sprintf("From %s %s\r\n", envelopeFrom, envelopeDate))) | |
59 | 60 | if err != nil { |
60 | 61 | return err |
61 | 62 | } |