[Xfce4-commits] <postler:master> Recognize notifications based on a unified list
Christian Dywan
noreply at xfce.org
Mon Jul 18 00:50:02 CEST 2011
Updating branch refs/heads/master
to da8c2d56a95becb40071a75d50cce52556ca0b86 (commit)
from 5c9426e13c985e5d9649cf5f49ff35832641cf31 (commit)
commit da8c2d56a95becb40071a75d50cce52556ca0b86
Author: Christian Dywan <christian at twotoasts.de>
Date: Sun Jul 17 22:29:04 2011 +0200
Recognize notifications based on a unified list
postler/postler-message.vala | 26 ++++++++++++++++++--------
1 files changed, 18 insertions(+), 8 deletions(-)
diff --git a/postler/postler-message.vala b/postler/postler-message.vala
index 8371c92..cd75e0f 100644
--- a/postler/postler-message.vala
+++ b/postler/postler-message.vala
@@ -274,6 +274,21 @@ namespace Postler {
read_from_stream (stream);
}
+ struct ProjectSpec {
+ string name;
+ string suffix;
+ }
+
+ const ProjectSpec[] project_specs = {
+ { "CouchSurfing", "@couchsurfing." },
+ { "eBay", "@ebay" },
+ { "Google+", "@plus.google.com" },
+ { "Facebook", "@facebook" },
+ { "LinkedIn", "@linkedin.com" },
+ { "PayPal", "@paypal.com" },
+ { "Twitter", "@postmaster.twitter.com" }
+ };
+
void read_from_stream (GLib.DataInputStream stream,
GLib.Cancellable? cancellable = null) throws GLib.Error {
@@ -330,10 +345,9 @@ namespace Postler {
fields.insert (field, parse_encoded (parts[1], out sender_charset));
if (sender == null)
sender = get_field (field);
- if (sender.has_suffix ("@postmaster.twitter.com"))
- project = "Twitter";
- else if (sender.has_suffix ("@linkedin.com"))
- project = "LinkedIn";
+ foreach (var spec in project_specs)
+ if (sender.str (spec.suffix) != null)
+ project = spec.name;
}
else if (field == "x-bugzilla-who") {
string sender_charset = null;
@@ -369,10 +383,6 @@ namespace Postler {
if (field == "x-launchpad-bug")
can_reply_personally = false;
}
- else if (field == "x-facebook-notify")
- project = "Facebook";
- else if (field == "x-notification-id" && sender.has_suffix ("@plus.google.com"))
- project = "Google+";
else if (field == "list-id") {
string field_charset = null;
list = parse_encoded (parts[1], out field_charset);
More information about the Xfce4-commits
mailing list