[evolution] ECompEditor: Extract plain email address from backend property
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution] ECompEditor: Extract plain email address from backend property
- Date: Fri, 30 Oct 2020 10:43:50 +0000 (UTC)
commit cae42eab20bb23e037dbe5eca9c38eee3da54c7e
Author: Milan Crha <mcrha redhat com>
Date: Fri Oct 30 11:40:24 2020 +0100
ECompEditor: Extract plain email address from backend property
The code expects the property to be a plain email address, without
the name and the other things, thus, in case the backend returns
email address with the name, extract only the plain address out of it.
src/calendar/gui/e-comp-editor.c | 25 +++++++++++++++++++++++--
1 file changed, 23 insertions(+), 2 deletions(-)
---
diff --git a/src/calendar/gui/e-comp-editor.c b/src/calendar/gui/e-comp-editor.c
index 9c9b957642..94eda02a05 100644
--- a/src/calendar/gui/e-comp-editor.c
+++ b/src/calendar/gui/e-comp-editor.c
@@ -2936,6 +2936,27 @@ e_comp_editor_get_managed_widget (ECompEditor *comp_editor,
return widget;
}
+static gchar *
+e_comp_editor_extract_email_address (const gchar *email_address)
+{
+ CamelInternetAddress *addr;
+ const gchar *str_addr;
+ gchar *address;
+
+ if (!email_address || !*email_address)
+ return NULL;
+
+ addr = camel_internet_address_new ();
+ if (camel_address_unformat (CAMEL_ADDRESS (addr), email_address) == 1 &&
+ camel_internet_address_get (addr, 0, NULL, &str_addr)) {
+ address = g_strdup (str_addr);
+ } else {
+ address = g_strdup (email_address);
+ }
+
+ return address;
+}
+
const gchar *
e_comp_editor_get_alarm_email_address (ECompEditor *comp_editor)
{
@@ -2954,7 +2975,7 @@ e_comp_editor_set_alarm_email_address (ECompEditor *comp_editor,
return;
g_free (comp_editor->priv->alarm_email_address);
- comp_editor->priv->alarm_email_address = g_strdup (alarm_email_address);
+ comp_editor->priv->alarm_email_address = e_comp_editor_extract_email_address (alarm_email_address);
g_object_notify (G_OBJECT (comp_editor), "alarm-email-address");
}
@@ -2977,7 +2998,7 @@ e_comp_editor_set_cal_email_address (ECompEditor *comp_editor,
return;
g_free (comp_editor->priv->cal_email_address);
- comp_editor->priv->cal_email_address = g_strdup (cal_email_address);
+ comp_editor->priv->cal_email_address = e_comp_editor_extract_email_address (cal_email_address);
g_object_notify (G_OBJECT (comp_editor), "cal-email-address");
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]