Load IMAP worker for imap+insecure
This commit is contained in:
parent
cc90cd2161
commit
2dc436555d
3 changed files with 13 additions and 4 deletions
|
@ -37,7 +37,8 @@ func NewAccountView(conf *config.AercConfig, acct *config.AccountConfig,
|
||||||
|
|
||||||
worker, err := worker.NewWorker(acct.Source, logger)
|
worker, err := worker.NewWorker(acct.Source, logger)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
host.SetStatus(fmt.Sprintf("%s: %s", acct.Name, err))
|
host.SetStatus(fmt.Sprintf("%s: %s", acct.Name, err)).
|
||||||
|
Color(tcell.ColorDefault, tcell.ColorRed)
|
||||||
return &AccountView{
|
return &AccountView{
|
||||||
acct: acct,
|
acct: acct,
|
||||||
grid: grid,
|
grid: grid,
|
||||||
|
@ -74,6 +75,9 @@ func NewAccountView(conf *config.AercConfig, acct *config.AccountConfig,
|
||||||
}
|
}
|
||||||
|
|
||||||
func (acct *AccountView) Tick() bool {
|
func (acct *AccountView) Tick() bool {
|
||||||
|
if acct.worker == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
select {
|
select {
|
||||||
case msg := <-acct.worker.Messages:
|
case msg := <-acct.worker.Messages:
|
||||||
msg = acct.worker.ProcessMessage(msg)
|
msg = acct.worker.ProcessMessage(msg)
|
||||||
|
|
|
@ -71,10 +71,9 @@ func (w *IMAPWorker) handleMessage(msg types.WorkerMessage) error {
|
||||||
|
|
||||||
w.config.addr = u.Host
|
w.config.addr = u.Host
|
||||||
if !strings.ContainsRune(w.config.addr, ':') {
|
if !strings.ContainsRune(w.config.addr, ':') {
|
||||||
w.config.addr += ":" + u.Scheme
|
w.config.addr += ":" + w.config.scheme
|
||||||
}
|
}
|
||||||
|
|
||||||
w.config.scheme = u.Scheme
|
|
||||||
w.config.user = u.User
|
w.config.user = u.User
|
||||||
case *types.Connect:
|
case *types.Connect:
|
||||||
var (
|
var (
|
||||||
|
|
|
@ -7,6 +7,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Guesses the appropriate worker type based on the given source string
|
// Guesses the appropriate worker type based on the given source string
|
||||||
|
@ -16,7 +17,12 @@ func NewWorker(source string, logger *log.Logger) (*types.Worker, error) {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
worker := types.NewWorker(logger)
|
worker := types.NewWorker(logger)
|
||||||
switch u.Scheme {
|
scheme := u.Scheme
|
||||||
|
if strings.ContainsRune(scheme, '+') {
|
||||||
|
scheme = scheme[:strings.IndexRune(scheme, '+')]
|
||||||
|
fmt.Println(scheme)
|
||||||
|
}
|
||||||
|
switch scheme {
|
||||||
case "imap":
|
case "imap":
|
||||||
fallthrough
|
fallthrough
|
||||||
case "imaps":
|
case "imaps":
|
||||||
|
|
Loading…
Reference in a new issue