summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Reichel <sre@ring0.de>2020-09-05 21:55:56 +0200
committerSebastian Reichel <sre@ring0.de>2020-09-05 21:56:04 +0200
commit6ba3fe4bf2cd77147c940cbbf1f738b7a7ec6de1 (patch)
tree86c9220ba60c8998a58c7b90996d81d8d6b79a7b
parent609fd01605f31e09d5c0ea273cbc8f053bfc4e75 (diff)
downloadserial-barcode-scanner-6ba3fe4bf2cd77147c940cbbf1f738b7a7ec6de1.tar.bz2
Fix missing To Header in mails
The public interface expects internal type, which maps the enum differently. Specifically the internal RecipientType.TO is mapped to 0 for the internal code, but 0 means AddressType.Sender in GMime. As a result the supplied mail addresses end up in the Sender field instead.
-rw-r--r--src/mail/mail.vala12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/mail/mail.vala b/src/mail/mail.vala
index f6cedc0..b863014 100644
--- a/src/mail/mail.vala
+++ b/src/mail/mail.vala
@@ -99,8 +99,16 @@ public class MailImplementation {
}
#endif
- public void add_recipient(MailContact contact, GMime.AddressType type) throws DBusError, IOError {
- m.add_mailbox(type, contact.name, contact.email);
+ public void add_recipient(MailContact contact, RecipientType type) throws DBusError, IOError {
+ GMime.AddressType gmime_type;
+
+ switch(type) {
+ case RecipientType.BCC: gmime_type = GMime.AddressType.BCC; break;
+ case RecipientType.CC: gmime_type = GMime.AddressType.CC; break;
+ default: gmime_type = GMime.AddressType.TO; break;
+ }
+
+ m.add_mailbox(gmime_type, contact.name, contact.email);
recipients += contact.email;
}