Refactored the code that joins the addresses in a single string
[modest] / src / modest-text-utils.h
index 3608935..59c0714 100644 (file)
@@ -45,6 +45,7 @@
 #define _MD(str) dgettext("maemo-af-desktop",str)
 #define _AB(str) dgettext("osso-addressbook",str)
 #define _KR(str) dgettext("ke-recv",str)
 #define _MD(str) dgettext("maemo-af-desktop",str)
 #define _AB(str) dgettext("osso-addressbook",str)
 #define _KR(str) dgettext("ke-recv",str)
+#define _UR(str) dgettext("osso-uri",str)
 
 /* Forbidden char arrays */
 extern const gchar account_title_forbidden_chars[];
 
 /* Forbidden char arrays */
 extern const gchar account_title_forbidden_chars[];
@@ -396,6 +397,21 @@ gboolean     modest_text_utils_validate_recipient (const gchar *recipient,
  **/
 GSList      *modest_text_utils_split_addresses_list (const gchar *addresses);
 
  **/
 GSList      *modest_text_utils_split_addresses_list (const gchar *addresses);
 
+/**
+ * modest_text_utils_join_addresses:
+ * @from: comma separated string of addresses
+ * @to: comma separated string of addresses
+ * @cc: comma separated string of addresses
+ * @bcc: comma separated string of addresses
+ *
+ * joins all the addresses in a single comma-separated string
+ *
+ * Returns: a newly allocated string with a list of addresses
+ **/
+gchar       *modest_text_utils_join_addresses (const gchar *from,
+                                              const gchar *to,
+                                              const gchar *cc,
+                                              const gchar *bcc);
 
 /**
  * modest_text_utils_get_addresses_indexes:
 
 /**
  * modest_text_utils_get_addresses_indexes:
@@ -515,4 +531,34 @@ gchar *modest_text_utils_simplify_recipients (const gchar *recipient);
  */
 GSList *modest_text_utils_remove_duplicate_addresses_list (GSList *address_list);
 
  */
 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__ */
 #endif /* __MODEST_TEXT_UTILS_H__ */