+
+guint64
+modest_tny_msg_estimate_size (const gchar *plain_body, const gchar *html_body,
+ guint64 parts_count,
+ guint64 parts_size)
+{
+ guint64 result;
+
+ /* estimation of headers size */
+ result = 1024;
+
+ /* We add a 20% of size due to the increase in 7bit encoding */
+ if (plain_body) {
+ result += strlen (plain_body) * 120 / 100;
+ }
+ if (html_body) {
+ result += strlen (html_body) * 120 / 100;
+ }
+
+ /* 256 bytes per additional part because of their headers */
+ result += parts_count * 256;
+
+ /* 150% of increase per encoding */
+ result += parts_size * 3 / 2;
+
+ return result;
+}
+
+GSList *
+modest_tny_msg_header_get_all_recipients_list (TnyHeader *header)
+{
+ GSList *recipients = NULL;
+ gchar *from = NULL, *to = NULL, *cc = NULL, *bcc = NULL;
+
+ if (header == NULL)
+ return NULL;
+
+ from = tny_header_dup_from (header);
+ to = tny_header_dup_to (header);
+ cc = tny_header_dup_cc (header);
+ bcc = tny_header_dup_bcc (header);
+
+ recipients = NULL;
+ if (from)
+ recipients = g_slist_concat (recipients, modest_text_utils_split_addresses_list (from));
+ if (to)
+ recipients = g_slist_concat (recipients, modest_text_utils_split_addresses_list (to));
+ if (cc)
+ recipients = g_slist_concat (recipients, modest_text_utils_split_addresses_list (cc));
+ if (bcc)
+ recipients = g_slist_concat (recipients, modest_text_utils_split_addresses_list (bcc));
+
+ g_free (from);
+ g_free (to);
+ g_free (cc);
+ g_free (bcc);
+
+ return recipients;
+}
+
+GSList *
+modest_tny_msg_get_all_recipients_list (TnyMsg *msg)
+{
+ TnyHeader *header = NULL;
+ GSList *recipients = NULL;
+
+ if (msg == NULL)
+ return NULL;
+
+ header = tny_msg_get_header (msg);
+ if (header == NULL)
+ return NULL;
+
+ recipients = modest_tny_msg_header_get_all_recipients_list (header);
+ g_object_unref (header);
+
+ return recipients;
+}
+