about summary refs log tree commit diff stats
path: root/widgets
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2019-06-02 09:40:47 -0400
committerDrew DeVault <sir@cmpwn.com>2019-06-02 09:40:47 -0400
commit6e745cb9f39bac86bdd3492334b6493ff24401c1 (patch)
tree2c87f8144ddf9b240cae00afda3f1c78548668ff /widgets
parent1894a7e91bd211f6a2bb7a61278b7822e71b824b (diff)
downloadaerc-6e745cb9f39bac86bdd3492334b6493ff24401c1.tar.gz
Enumerate Cc and Bcc lists in composer
Diffstat (limited to 'widgets')
-rw-r--r--widgets/compose.go21
1 files changed, 20 insertions, 1 deletions
diff --git a/widgets/compose.go b/widgets/compose.go
index 7daaf7b..9bd5350 100644
--- a/widgets/compose.go
+++ b/widgets/compose.go
@@ -239,7 +239,26 @@ func (c *Composer) PrepareHeader() (*mail.Header, []string, error) {
 			rcpts = append(rcpts, addr.Address)
 		}
 	}
-	// TODO: Add cc, bcc to rcpts
+	if cc, _ := mhdr.Text("Cc"); cc != "" {
+		cc_rcpts, err := gomail.ParseAddressList(cc)
+		if err != nil {
+			return nil, nil, errors.Wrapf(err, "ParseAddressList(%s)", cc)
+		}
+		// TODO: Update when the user inputs Cc's through the UI
+		for _, addr := range cc_rcpts {
+			rcpts = append(rcpts, addr.Address)
+		}
+	}
+	if bcc, _ := mhdr.Text("Bcc"); bcc != "" {
+		bcc_rcpts, err := gomail.ParseAddressList(bcc)
+		if err != nil {
+			return nil, nil, errors.Wrapf(err, "ParseAddressList(%s)", bcc)
+		}
+		// TODO: Update when the user inputs Bcc's through the UI
+		for _, addr := range bcc_rcpts {
+			rcpts = append(rcpts, addr.Address)
+		}
+	}
 	// Merge in additional headers
 	txthdr := mhdr.Header
 	for key, value := range c.defaults {