Skip to content

Commit 2335f80

Browse files
committed
Restructure.
There was some error reading the AUTH file (atleast on windows). Changed imapsync to use user and pass provided as arguments.
1 parent 23870e6 commit 2335f80

File tree

12 files changed

+14
-9
lines changed

12 files changed

+14
-9
lines changed

src/imap/doc.go renamed to doc.go

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

src/imapsync/main.go renamed to imapsync/main.go

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,16 @@ import (
55
"crypto/tls"
66
"flag"
77
"fmt"
8-
"imap"
98
"io"
109
"log"
1110
"os"
11+
"taliesinb/go-imap"
1212
"time"
1313
)
1414

1515
var dumpProtocol *bool = flag.Bool("dumpprotocol", false, "dump imap stream")
16+
var username string
17+
var password string
1618

1719
func check(err error) {
1820
if err != nil {
@@ -71,7 +73,9 @@ func readExtra(im *imap.IMAP) {
7173
}
7274

7375
func (ui *UI) connect(useNetmon bool) *imap.IMAP {
74-
user, pass := loadAuth("auth")
76+
//user, pass := loadAuth("auth")
77+
user := username
78+
pass := password
7579

7680
ui.log("connecting...")
7781
conn, err := tls.Dial("tcp", "imap.gmail.com:993", nil)
@@ -184,7 +188,7 @@ func (ui *UI) reportOnStatus() {
184188
}
185189
}
186190
fmt.Printf("\n")
187-
}
191+
}
188192

189193
func (ui *UI) runFetch(mailbox string) {
190194
ui.statusChan = make(chan interface{})
@@ -216,14 +220,13 @@ func (ui *UI) runList() {
216220
}()
217221

218222
ui.reportOnStatus()
219-
}
220-
223+
}
221224

222225
func usage() {
223226
fmt.Printf("usage: %s command\n", os.Args[0])
224227
fmt.Printf("commands are:\n")
225-
fmt.Printf(" list list mailboxes\n")
226-
fmt.Printf(" fetch download mailbox\n")
228+
fmt.Printf(" list user pass list mailboxes\n")
229+
fmt.Printf(" fetch user pass download mailbox\n")
227230
os.Exit(0)
228231
}
229232

@@ -232,11 +235,13 @@ func main() {
232235
flag.Parse()
233236

234237
args := flag.Args()
235-
if len(args) < 1 {
238+
if len(args) < 3 {
236239
usage()
237240
}
238241
mode := args[0]
239-
args = args[1:]
242+
username = args[1]
243+
password = args[2]
244+
args = args[3:]
240245

241246
ui := new(UI)
242247

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)