aboutsummaryrefslogtreecommitdiff
path: root/libsylph
diff options
context:
space:
mode:
Diffstat (limited to 'libsylph')
-rw-r--r--libsylph/procheader.c25
-rw-r--r--libsylph/procheader.h1
2 files changed, 26 insertions, 0 deletions
diff --git a/libsylph/procheader.c b/libsylph/procheader.c
index 2c931e07..22a8acc5 100644
--- a/libsylph/procheader.c
+++ b/libsylph/procheader.c
@@ -775,6 +775,31 @@ gchar *procheader_get_fromname(const gchar *str)
return name;
}
+gchar *procheader_get_toname(const gchar *str)
+{
+ GSList *addr_list, *cur;
+ GString *toname;
+ gchar *name;
+
+ if (strchr(str, ',') == NULL)
+ return procheader_get_fromname(str);
+
+ addr_list = address_list_append_orig(NULL, str);
+ toname = g_string_new(NULL);
+
+ for (cur = addr_list; cur != NULL; cur = cur->next) {
+ name = procheader_get_fromname((gchar *)cur->data);
+ g_string_append(toname, name);
+ g_free(name);
+ if (cur->next)
+ g_string_append(toname, ", ");
+ }
+
+ slist_free_strings(addr_list);
+
+ return g_string_free(toname, FALSE);
+}
+
static gint procheader_scan_date_string(const gchar *str,
gchar *weekday, gint *day,
gchar *month, gint *year,
diff --git a/libsylph/procheader.h b/libsylph/procheader.h
index 6054f5d3..0260b45e 100644
--- a/libsylph/procheader.h
+++ b/libsylph/procheader.h
@@ -89,6 +89,7 @@ MsgInfo *procheader_parse_stream (FILE *fp,
gboolean full);
gchar *procheader_get_fromname (const gchar *str);
+gchar *procheader_get_toname (const gchar *str);
time_t procheader_date_parse (gchar *dest,
const gchar *src,