summary refs log tree commit diff stats
path: root/config/accounts.conf
blob: 64621dad6e41eeddbf9bf40fd3216c608c1aa491 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#
# aerc accounts configuration
#
# This file configures each of the available mail accounts.

# You may add an arbitrary number of sections like so:
#
# [Personal]
# source=imaps://username[:password]@hostname[:port]
# outgoing=smtps+plain://username[:password]@hostname[:port]
# copy-to=Sent
# from=Joe Bloe <joe@example.org>
#
# [Work]
# source=imaps://username[:password]@hostname[:port]
# outgoing=/usr/bin/sendmail
# from=Jane Plain <jane@example.org>
# folders=INBOX,Sent,Archives
# default=Archives
#
# Each supported protocol may have some arbitrary number of extra configuration
# options. See aerc-[protocol](5) for details (i.e. aerc-imap).
>10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41




                
                                          

 

                     
             








                                                                       


                                                           
                                                                   


                                                   
                                      

                                                                   








                                                       

                  
package account

import (
	"errors"

	"git.sr.ht/~sircmpwn/aerc/widgets"
)

type Compose struct{}

func init() {
	register(Compose{})
}

func (_ Compose) Aliases() []string {
	return []string{"compose"}
}

func (_ Compose) Complete(aerc *widgets.Aerc, args []string) []string {
	return nil
}

// TODO: Accept arguments for default headers, message body
func (_ Compose) Execute(aerc *widgets.Aerc, args []string) error {
	if len(args) != 1 {
		return errors.New("Usage: compose")
	}
	acct := aerc.SelectedAccount()
	composer := widgets.NewComposer(
		aerc.Config(), acct.AccountConfig(), acct.Worker())
	tab := aerc.NewTab(composer, "New email")
	composer.OnSubjectChange(func(subject string) {
		if subject == "" {
			tab.Name = "New email"
		} else {
			tab.Name = subject
		}
		tab.Content.Invalidate()
	})
	return nil
}