aerc: use aerc as an mbox viewer
Use Aerc as an mbox viewer. Open an mbox file from the command line in a new tab with the mbox backend. Provide a convenient and quick way to display emails from an mbox. Usage: aerc mbox://<path> where the path can either be a directory or an mbox file. If it is a directory, every file with an .mbox suffix will be loaded as a folder. The account config will be copied from the selected account. This allows the answer emails in the mbox account. Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
This commit is contained in:
parent
a1a276e002
commit
c24a576876
3 changed files with 39 additions and 0 deletions
lib
|
@ -21,6 +21,7 @@ type AercServer struct {
|
|||
logger *log.Logger
|
||||
listener net.Listener
|
||||
OnMailto func(addr *url.URL) error
|
||||
OnMbox func(source string) error
|
||||
}
|
||||
|
||||
func StartServer(logger *log.Logger) (*AercServer, error) {
|
||||
|
@ -92,6 +93,16 @@ func (as *AercServer) handleClient(conn net.Conn) {
|
|||
} else {
|
||||
conn.Write([]byte("result: success\n"))
|
||||
}
|
||||
case "mbox":
|
||||
var err error
|
||||
if as.OnMbox != nil {
|
||||
err = as.OnMbox(msg)
|
||||
}
|
||||
if err != nil {
|
||||
conn.Write([]byte(fmt.Sprintf("result: %v\n", err)))
|
||||
} else {
|
||||
conn.Write([]byte("result: success\n"))
|
||||
}
|
||||
}
|
||||
}
|
||||
as.logger.Printf("Closed Unix connection %d", clientId)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue