aboutsummaryrefslogtreecommitdiffstats
path: root/widgets
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2019-05-16 12:15:34 -0400
committerDrew DeVault <sir@cmpwn.com>2019-05-16 12:15:34 -0400
commit475b697bdfd7a5821282174f14f8d904e47aff4d (patch)
tree7febf2e25cede5809f1d40c934d379315e06bd64 /widgets
parent2b3e123cb86f9b4c5853e31d9e76c2b0d083f90a (diff)
downloadaerc-475b697bdfd7a5821282174f14f8d904e47aff4d.tar.gz
Implement (basic form) of :reply
Diffstat (limited to 'widgets')
-rw-r--r--widgets/account.go12
-rw-r--r--widgets/compose.go14
2 files changed, 19 insertions, 7 deletions
diff --git a/widgets/account.go b/widgets/account.go
index c252e38e..ab32f5de 100644
--- a/widgets/account.go
+++ b/widgets/account.go
@@ -84,6 +84,14 @@ func (acct *AccountView) AccountConfig() *config.AccountConfig {
return acct.acct
}
+func (acct *AccountView) Worker() *types.Worker {
+ return acct.worker
+}
+
+func (acct *AccountView) Logger() *log.Logger {
+ return acct.logger
+}
+
func (acct *AccountView) Name() string {
return acct.acct.Name
}
@@ -110,10 +118,6 @@ func (acct *AccountView) Focus(focus bool) {
// TODO: Unfocus children I guess
}
-func (acct *AccountView) Worker() *types.Worker {
- return acct.worker
-}
-
func (acct *AccountView) connected(msg types.WorkerMessage) {
switch msg := msg.(type) {
case *types.Done:
diff --git a/widgets/compose.go b/widgets/compose.go
index 2359cad4..02a9d0c3 100644
--- a/widgets/compose.go
+++ b/widgets/compose.go
@@ -14,6 +14,7 @@ import (
"github.com/mattn/go-runewidth"
"git.sr.ht/~sircmpwn/aerc2/config"
+ "git.sr.ht/~sircmpwn/aerc2/lib"
"git.sr.ht/~sircmpwn/aerc2/lib/ui"
"git.sr.ht/~sircmpwn/aerc2/worker/types"
)
@@ -123,6 +124,13 @@ func (c *Composer) Defaults(defaults map[string]string) *Composer {
return c
}
+func (c *Composer) FocusTerminal() *Composer {
+ c.focusable[c.focused].Focus(false)
+ c.focused = 3
+ c.focusable[c.focused].Focus(true)
+ return c
+}
+
func (c *Composer) OnSubjectChange(fn func(subject string)) {
c.headers.subject.OnChange(func() {
fn(c.headers.subject.input.String())
@@ -197,9 +205,9 @@ func (c *Composer) PrepareHeader() (*mail.Header, []string, error) {
c.email.Seek(0, os.SEEK_SET)
}
// Update headers
- // TODO: Custom header fields
mhdr := (*message.Header)(&header.Header)
mhdr.SetContentType("text/plain", map[string]string{"charset": "UTF-8"})
+ mhdr.SetText("Message-Id", lib.GenerateMessageId())
if subject, _ := header.Subject(); subject == "" {
header.SetSubject(c.headers.subject.input.String())
}
@@ -228,14 +236,14 @@ func (c *Composer) PrepareHeader() (*mail.Header, []string, error) {
rcpts = append(rcpts, addr.Address)
}
}
+ // TODO: Add cc, bcc to rcpts
// Merge in additional headers
txthdr := mhdr.Header
for key, value := range c.defaults {
- if !txthdr.Has(key) {
+ if !txthdr.Has(key) && value != "" {
mhdr.SetText(key, value)
}
}
- // TODO: Add cc, bcc to rcpts
return &header, rcpts, nil
}