From 40f5d435e5f92abc8b64dae1c029f67d620db1f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20=27Necoro=27=20Neumann?= Date: Sun, 19 Apr 2020 17:53:12 +0200 Subject: Started IMAP connection --- main.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'main.go') diff --git a/main.go b/main.go index bbea985..f90cc50 100644 --- a/main.go +++ b/main.go @@ -2,9 +2,12 @@ package main import ( "flag" + "fmt" + "net/url" "os" "github.com/Necoro/feed2imap-go/internal/config" + "github.com/Necoro/feed2imap-go/internal/imap" "github.com/Necoro/feed2imap-go/internal/log" "github.com/Necoro/feed2imap-go/internal/parse" ) @@ -26,6 +29,18 @@ func run() error { parse.Parse(cfg.Feeds) + imapUrl, err := url.Parse(cfg.GlobalConfig["target"].(string)) + if err != nil { + return fmt.Errorf("parsing 'target': %w", err) + } + + c, err := imap.Connect(imapUrl) + if err != nil { + return err + } + + defer c.Disconnect() + return nil } -- cgit v1.2.3