[evolution] Bug 785719 - [itip] Get Organizer's Sent-By name from Sender header
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution] Bug 785719 - [itip] Get Organizer's Sent-By name from Sender header
- Date: Thu, 27 Sep 2018 10:59:45 +0000 (UTC)
commit ed8f925449d4508fbe2d76b739e5c5060009e77e
Author: Milan Crha <mcrha redhat com>
Date: Thu Sep 27 12:59:10 2018 +0200
Bug 785719 - [itip] Get Organizer's Sent-By name from Sender header
Closes https://bugzilla.gnome.org/show_bug.cgi?id=785719
src/modules/itip-formatter/itip-view.c | 34 +++++++++++++++++++++++++++++++---
1 file changed, 31 insertions(+), 3 deletions(-)
---
diff --git a/src/modules/itip-formatter/itip-view.c b/src/modules/itip-formatter/itip-view.c
index 72edf0e335..d8797c708d 100644
--- a/src/modules/itip-formatter/itip-view.c
+++ b/src/modules/itip-formatter/itip-view.c
@@ -6279,9 +6279,37 @@ itip_view_init_view (ItipView *view)
org = organizer.cn ? organizer.cn : itip_strip_mailto (organizer.value);
itip_view_set_organizer (view, org);
- if (organizer.sentby)
- itip_view_set_organizer_sentby (
- view, itip_strip_mailto (organizer.sentby));
+ if (organizer.sentby) {
+ const gchar *sentby = itip_strip_mailto (organizer.sentby);
+
+ if (sentby && *sentby) {
+ gchar *tmp = NULL;
+
+ if (view->priv->message) {
+ const gchar *sender = camel_medium_get_header
(CAMEL_MEDIUM (view->priv->message), "Sender");
+
+ if (sender && *sender) {
+ CamelInternetAddress *addr;
+ const gchar *name = NULL, *email = NULL;
+
+ addr = camel_internet_address_new ();
+ if (camel_address_decode (CAMEL_ADDRESS
(addr), sender) == 1 &&
+ camel_internet_address_get (addr, 0,
&name, &email) &&
+ name && *name && email && *email &&
+ g_ascii_strcasecmp (sentby, email) == 0) {
+ tmp =
camel_internet_address_format_address (name, sentby);
+ sentby = tmp;
+ }
+
+ g_object_unref (addr);
+ }
+ }
+
+ itip_view_set_organizer_sentby (view, sentby);
+
+ g_free (tmp);
+ }
+ }
if (view->priv->my_address) {
if (!(organizer.value && !g_ascii_strcasecmp (itip_strip_mailto
(organizer.value), view->priv->my_address))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]