[geary/mjog/mail-merge-plugin: 146/157] Plugin.Email: Mark Geary.EmailHeaderSet as a prerequisite



commit 20cee76d50cbbffaf98aca043eef2d921255c517
Author: Michael Gratton <mike vee net>
Date:   Thu May 7 17:24:04 2020 +1000

    Plugin.Email: Mark Geary.EmailHeaderSet as a prerequisite
    
    Allows plugins access to all standard email headers.

 .../application-email-store-factory.vala           | 55 ++++++++++++++++++----
 .../desktop-notifications.vala                     |  2 +-
 src/client/plugin/plugin-email.vala                |  7 ++-
 3 files changed, 51 insertions(+), 13 deletions(-)
---
diff --git a/src/client/application/application-email-store-factory.vala 
b/src/client/application/application-email-store-factory.vala
index 9ac04e24b..542ab5022 100644
--- a/src/client/application/application-email-store-factory.vala
+++ b/src/client/application/application-email-store-factory.vala
@@ -112,7 +112,9 @@ internal class Application.EmailStoreFactory : Geary.BaseObject {
 
 
     /** Implementation of the plugin email interface. */
-    internal class EmailImpl : Geary.BaseObject, Plugin.Email {
+    internal class EmailImpl : Geary.BaseObject,
+        Geary.EmailHeaderSet,
+        Plugin.Email {
 
 
         public Plugin.EmailIdentifier identifier {
@@ -125,14 +127,53 @@ internal class Application.EmailStoreFactory : Geary.BaseObject {
         }
         private IdImpl? _id = null;
 
-        public Geary.EmailFlags flags {
-            get { return this.backing.email_flags; }
+        public Geary.RFC822.MailboxAddresses? from {
+            get { return this.backing.from; }
+        }
+
+        public Geary.RFC822.MailboxAddress? sender {
+            get { return this.backing.sender; }
+        }
+
+        public Geary.RFC822.MailboxAddresses? reply_to {
+            get { return this.backing.reply_to; }
+        }
+
+        public Geary.RFC822.MailboxAddresses? to {
+            get { return this.backing.to; }
+        }
+
+        public Geary.RFC822.MailboxAddresses? cc {
+            get { return this.backing.cc; }
+        }
+
+        public Geary.RFC822.MailboxAddresses? bcc {
+            get { return this.backing.bcc; }
         }
 
-        public string subject {
-            get { return this._subject; }
+        public Geary.RFC822.MessageID? message_id {
+            get { return this.backing.message_id; }
+        }
+
+        public Geary.RFC822.MessageIDList? in_reply_to {
+            get { return this.backing.in_reply_to; }
+        }
+
+        public Geary.RFC822.MessageIDList? references {
+            get { return this.backing.references; }
+        }
+
+        public Geary.RFC822.Subject? subject {
+            get { return this.backing.subject; }
+        }
+
+        public Geary.RFC822.Date? date {
+            get { return this.backing.date; }
+        }
+
+        public Geary.EmailFlags flags {
+            get { return this.backing.email_flags; }
         }
-        string _subject;
 
         internal Geary.Email backing { get; private set; }
         internal PluginManager.AccountImpl account { get; private set; }
@@ -142,8 +183,6 @@ internal class Application.EmailStoreFactory : Geary.BaseObject {
                            PluginManager.AccountImpl account) {
             this.backing = backing;
             this.account = account;
-            Geary.RFC822.Subject? subject = this.backing.subject;
-            this._subject = subject != null ? subject.to_string() : "";
         }
 
         public Geary.RFC822.MailboxAddress? get_primary_originator() {
diff --git a/src/client/plugin/desktop-notifications/desktop-notifications.vala 
b/src/client/plugin/desktop-notifications/desktop-notifications.vala
index 353c0abee..afdb2d40f 100644
--- a/src/client/plugin/desktop-notifications/desktop-notifications.vala
+++ b/src/client/plugin/desktop-notifications/desktop-notifications.vala
@@ -127,7 +127,7 @@ public class Plugin.DesktopNotifications :
             );
         }
 
-        string body = email.subject;
+        string body = Util.Email.strip_subject_prefixes(email);
         if (total > 1) {
             body = ngettext(
                 /// Notification body when a message as been received
diff --git a/src/client/plugin/plugin-email.vala b/src/client/plugin/plugin-email.vala
index 7283cde2d..1ae5b0853 100644
--- a/src/client/plugin/plugin-email.vala
+++ b/src/client/plugin/plugin-email.vala
@@ -10,7 +10,9 @@
  *
  * Instances of these may be obtained from {@link EmailStore}.
  */
-public interface Plugin.Email : Geary.BaseObject {
+public interface Plugin.Email :
+    Geary.BaseObject,
+    Geary.EmailHeaderSet {
 
 
     /** Returns a unique identifier for this email. */
@@ -19,9 +21,6 @@ public interface Plugin.Email : Geary.BaseObject {
     /** Returns the set of mutable flags for the email. */
     public abstract Geary.EmailFlags flags { get; }
 
-    /** Returns the subject header value for the this email. */
-    public abstract string subject { get; }
-
     /**
      * Returns the email's primary originator.
      *


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]