Added the function that quotes emails
[modest] / src / modest-text-utils.h
index f2c59c9..7415003 100644 (file)
@@ -54,6 +54,10 @@ extern const guint ACCOUNT_TITLE_FORBIDDEN_CHARS_LENGTH;
 extern const guint FOLDER_NAME_FORBIDDEN_CHARS_LENGTH;
 extern const guint USER_NAME_FORBIDDEN_CHARS_LENGTH;
 
+/* It includes a white space as RFC 3676 Section 4.3 about usenet
+   message signatures defines */
+#define MODEST_TEXT_UTILS_SIGNATURE_MARKER "-- "
+
 /**
  * modest_text_utils_derived_subject:
  * @subject: a string which contains the original subject
@@ -500,4 +504,45 @@ gchar *modest_text_utils_escape_mnemonics (const gchar *text);
  */
 gchar *modest_text_utils_simplify_recipients (const gchar *recipient);
 
+/**
+ * modest_text_utils_remove_duplicate_addresses_list
+ * @address_list: non-NULL #GSList of email addresses
+ *
+ * remove duplicate addresses from a list of email addresses
+ *
+ * Returns: a list without the duplicate addresses or NULL in case of
+ * error or the original @address_list was NULL
+ */
+GSList *modest_text_utils_remove_duplicate_addresses_list (GSList *address_list);
+
+/**
+ * modest_text_utils_get_secure_header:
+ * @value: the value of a mail header
+ * @header: the header that we're evaluating
+ *
+ * This function returns the secure value for a header. Basically it
+ * avoids DoS attacks caused by specially malformed headers like for
+ * example. From:From:From...From: some@mail.com
+ *
+ * Returns: returns the secured header
+ **/
+gchar * modest_text_utils_get_secure_header (const gchar *value, const gchar *header);
+
+/**
+ * modest_text_utils_quote_names:
+ * @recipients: a list of valid email addresses separated by ',' or ';'
+ *
+ * This function quotes the name part of an email address if it's not
+ * quoted and if it exists. For example
+ * aaa@bbb.com -> aaa@bbb.com
+ * "my name" <aaa@bbb.com> -> "my name" <aaa@bbb.com>
+ * my name aaa@bbb.com -> "my name" aaa@bbb.com
+ *
+ * It even supports things like
+ * my, name <aaa@bbb.com>, aaa@ccc.com -> "my, name" <aaa@bbb.com>; aaa@ccc.com
+ *
+ * Returns: a newly allocated string with the quoted email addresses
+ **/
+gchar * modest_text_utils_quote_names (const gchar *recipients);
+
 #endif /* __MODEST_TEXT_UTILS_H__ */