• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

golang IMAP client library


Commit MetaInfo

Revisão7f94357bdecc28f9b2ad87c921dfe2a6f367b77d (tree)
Hora2011-10-28 11:14:04
AutorEvan Martin <martine@dang...>
CommiterEvan Martin

Mensagem de Log

make mutt accept my envelope from

Mudança Sumário

Diff

--- a/main.go
+++ b/main.go
@@ -113,13 +113,15 @@ func (ui *UI) fetch(im *imap.IMAP, mailbox string) {
113113 ch, err := im.FetchAsync(query, []string{"RFC822"})
114114 check(err)
115115
116+ envelopeDate := time.LocalTime().Format(time.ANSIC)
117+
116118 i := 1
117119 L:
118120 for {
119121 r := <-ch
120122 switch r := r.(type) {
121123 case *imap.ResponseFetch:
122- mbox.writeMessage(r.Rfc822)
124+ mbox.writeMessage("imapsync@none", envelopeDate, r.Rfc822)
123125 ui.status("got message %d/%d", i, examine.Exists)
124126 i++
125127 case *imap.ResponseStatus:
--- a/mbox.go
+++ b/mbox.go
@@ -4,6 +4,7 @@ import (
44 "bytes"
55 "io"
66 "os"
7+ "fmt"
78 )
89
910 type fromEncodingWriter struct {
@@ -54,8 +55,8 @@ func newMbox(w io.Writer) *mbox {
5455 return &mbox{w}
5556 }
5657
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)))
5960 if err != nil {
6061 return err
6162 }