[balsa/gmime3: 21/66] internet_address_list_parse_string() replaced
- From: Peter Bloomfield <peterb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [balsa/gmime3: 21/66] internet_address_list_parse_string() replaced
- Date: Fri, 21 Feb 2020 19:49:33 +0000 (UTC)
commit b581143f0b0103a4c415cb0a6bde8d4c6a39d148
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date: Wed Nov 20 18:47:46 2019 -0800
internet_address_list_parse_string() replaced
by internet_address_list_parse(), with a parser-options argument.
- InternetAddressList *list = internet_address_list_parse_string(string);
+ InternetAddressList *list = internet_address_list_parse(libbalsa_parser_options(), string);
+
libbalsa/address-view.c | 5 +++--
libbalsa/message.c | 12 ++++++------
libbalsa/misc.c | 16 ++++++++++++++++
libbalsa/misc.h | 4 ++++
src/balsa-mime-widget-message.c | 2 +-
src/balsa-mime-widget-vcalendar.c | 2 +-
src/sendmsg-window.c | 4 ++--
7 files changed, 33 insertions(+), 12 deletions(-)
---
diff --git a/libbalsa/address-view.c b/libbalsa/address-view.c
index 7a40b3fad..ec7578e32 100644
--- a/libbalsa/address-view.c
+++ b/libbalsa/address-view.c
@@ -419,7 +419,8 @@ static gboolean
lbav_add_from_string(LibBalsaAddressView * address_view,
GtkTreeIter * iter, const gchar * string)
{
- InternetAddressList *list = internet_address_list_parse_string(string);
+ InternetAddressList *list = internet_address_list_parse(libbalsa_parser_options(), string);
+
gboolean retval = FALSE;
if (list) {
@@ -1255,7 +1256,7 @@ libbalsa_address_view_get_list(LibBalsaAddressView * address_view,
if (this_type == type) {
InternetAddressList *tmp_list =
- internet_address_list_parse_string(name);
+ internet_address_list_parse(libbalsa_parser_options(), name);
if (tmp_list) {
internet_address_list_append(address_list, tmp_list);
g_object_unref(tmp_list);
diff --git a/libbalsa/message.c b/libbalsa/message.c
index fcac44517..b32522d6c 100644
--- a/libbalsa/message.c
+++ b/libbalsa/message.c
@@ -991,7 +991,7 @@ lb_message_headers_basic_from_gmime(LibBalsaMessageHeaders *headers,
g_return_if_fail(mime_msg != NULL);
if (headers->from == NULL)
- headers->from = internet_address_list_parse_string(mime_msg->from);
+ headers->from = internet_address_list_parse(libbalsa_parser_options(), mime_msg->from);
if (headers->date == 0)
g_mime_message_get_date(mime_msg, &headers->date, NULL);
@@ -1029,12 +1029,12 @@ lb_message_headers_extra_from_gmime(LibBalsaMessageHeaders *headers,
if (headers->reply_to == NULL) {
headers->reply_to =
- internet_address_list_parse_string(mime_msg->reply_to);
+ internet_address_list_parse(libbalsa_parser_options(), mime_msg->reply_to);
}
if (headers->dispnotify_to == NULL) {
headers->dispnotify_to =
- internet_address_list_parse_string(g_mime_object_get_header
+ internet_address_list_parse(libbalsa_parser_options(), g_mime_object_get_header
(GMIME_OBJECT(mime_msg),
"Disposition-Notification-To"));
}
@@ -1235,10 +1235,10 @@ lbmsg_set_header(LibBalsaMessage *message,
message->headers->date = g_mime_utils_header_decode_date(value, NULL);
} else if ((message->headers->from == NULL) &&
(g_ascii_strcasecmp(name, "From") == 0)) {
- message->headers->from = internet_address_list_parse_string(value);
+ message->headers->from = internet_address_list_parse(libbalsa_parser_options(), value);
} else if ((message->headers->to_list == NULL) &&
(g_ascii_strcasecmp(name, "To") == 0)) {
- message->headers->to_list = internet_address_list_parse_string(value);
+ message->headers->to_list = internet_address_list_parse(libbalsa_parser_options(), value);
} else if (g_ascii_strcasecmp(name, "In-Reply-To") == 0) {
libbalsa_message_set_in_reply_to_from_string(message, value);
} else if ((message->message_id == NULL) &&
@@ -1251,7 +1251,7 @@ lbmsg_set_header(LibBalsaMessage *message,
message->headers->content_type = g_mime_content_type_new_from_string(value);
} else if ((message->headers->dispnotify_to == NULL) &&
(g_ascii_strcasecmp(name, "Disposition-Notification-To") == 0)) {
- message->headers->dispnotify_to = internet_address_list_parse_string(value);
+ message->headers->dispnotify_to = internet_address_list_parse(libbalsa_parser_options(), value);
} else
#ifdef MESSAGE_COPY_CONTENT
if (g_ascii_strcasecmp(name, "Content-Length") == 0) {
diff --git a/libbalsa/misc.c b/libbalsa/misc.c
index 8a3fad79c..d51919be0 100644
--- a/libbalsa/misc.c
+++ b/libbalsa/misc.c
@@ -1239,3 +1239,19 @@ libbalsa_font_string_to_css(const gchar * font_string,
return g_string_free(string, FALSE);
#endif /* !GTK_CHECK_VERSION(3, 22,0) */
}
+
+static GMimeParserOptions *parser_options;
+
+void
+libbalsa_parser_options_init(void)
+{
+ parser_options = g_mime_parser_options_new();
+ g_mime_parser_options_set_rfc2047_compliance_mode(parser_options,
+ GMIME_RFC_COMPLIANCE_LOOSE);
+}
+
+GMimeParserOptions *
+libbalsa_parser_options(void)
+{
+ return parser_options;
+}
diff --git a/libbalsa/misc.h b/libbalsa/misc.h
index a0954743b..bbc7f9dbe 100644
--- a/libbalsa/misc.h
+++ b/libbalsa/misc.h
@@ -160,4 +160,8 @@ gchar * libbalsa_text_to_html(const gchar * title, const gchar * body, const gch
GString * libbalsa_html_encode_hyperlinks(GString * paragraph);
gchar *libbalsa_font_string_to_css(const gchar * font_string, const gchar * name);
+void libbalsa_parser_options_init(void);
+GMimeParserOptions *libbalsa_parser_options(void);
+
+
#endif /* __LIBBALSA_MISC_H__ */
diff --git a/src/balsa-mime-widget-message.c b/src/balsa-mime-widget-message.c
index 12cda123c..8f9667cef 100644
--- a/src/balsa-mime-widget-message.c
+++ b/src/balsa-mime-widget-message.c
@@ -360,7 +360,7 @@ extbody_send_mail(GtkWidget * button, LibBalsaMessageBody * mime_body)
}
data = libbalsa_message_body_get_parameter(mime_body, "server");
- headers->to_list = internet_address_list_parse_string(data);
+ headers->to_list = internet_address_list_parse(libbalsa_parser_options(), data);
g_free(data);
/* the original body my have some data to be returned as commands... */
diff --git a/src/balsa-mime-widget-vcalendar.c b/src/balsa-mime-widget-vcalendar.c
index 3fe8d4e3f..44d7120d2 100644
--- a/src/balsa-mime-widget-vcalendar.c
+++ b/src/balsa-mime-widget-vcalendar.c
@@ -354,7 +354,7 @@ vevent_reply(GObject * button, GtkWidget * box)
headers = libbalsa_message_get_headers(message);
headers->from = internet_address_list_new();
internet_address_list_add(headers->from, ia);
- headers->to_list = internet_address_list_parse_string(rcpt);
+ headers->to_list = internet_address_list_parse(libbalsa_parser_options(), rcpt);
headers->date = time(NULL);
/* create the message subject */
diff --git a/src/sendmsg-window.c b/src/sendmsg-window.c
index 17ec3f12a..f5933a7f8 100644
--- a/src/sendmsg-window.c
+++ b/src/sendmsg-window.c
@@ -1096,7 +1096,7 @@ update_bsmsg_identity(BalsaSendmsg* bsmsg, LibBalsaIdentity* ident)
bcc_list =
libbalsa_address_view_get_list(bsmsg->recipient_view, "BCC:");
- ident_list = internet_address_list_parse_string(addr);
+ ident_list = internet_address_list_parse(libbalsa_parser_options(), addr);
if (ident_list) {
/* Remove any Bcc addresses that came from the old identity
* from the list. */
@@ -1126,7 +1126,7 @@ update_bsmsg_identity(BalsaSendmsg* bsmsg, LibBalsaIdentity* ident)
/* Add the new Bcc addresses, if any: */
addr = libbalsa_identity_get_bcc(ident);
- ident_list = internet_address_list_parse_string(addr);
+ ident_list = internet_address_list_parse(libbalsa_parser_options(), addr);
if (ident_list) {
internet_address_list_append(bcc_list, ident_list);
g_object_unref(ident_list);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]