return false;
}
}
+
+/**
+ * mutt_email_size - compute the size of an email
+ * @param e Email
+ * @retval num Size of the email, in bytes
+ */
+size_t mutt_email_size(const struct Email *e)
+{
+ if (!e || !e->content)
+ return 0;
+ return e->content->length + e->content->offset - e->content->hdr_offset;
+}
bool mutt_email_cmp_strict(const struct Email *e1, const struct Email *e2);
void mutt_email_free(struct Email **e);
struct Email *mutt_email_new(void);
+size_t mutt_email_size(const struct Email *e);
#endif /* MUTT_EMAIL_EMAIL_H */
case 'c':
colorlen = add_index_color(buf, buflen, flags, MT_COLOR_INDEX_SIZE);
- mutt_str_pretty_size(tmp, sizeof(tmp), (long) e->content->length);
+ mutt_str_pretty_size(tmp, sizeof(tmp), mutt_email_size(e));
mutt_format_s(buf + colorlen, buflen - colorlen, prec, tmp);
add_index_color(buf + colorlen, buflen - colorlen, flags, MT_COLOR_INDEX);
break;
m->notify(m, action);
}
-/**
- * email_size - Helper function to make sure we always use the same metric to
- * compute the size of an email
- * @param e Email
- * @retval num Size of the email, in bytes
- */
-static size_t email_size(const struct Email *e)
-{
- if (!e || !e->content)
- return 0;
- return e->content->length + e->content->offset - e->content->hdr_offset;
-}
-
/**
* mutt_mailbox_size_add - Add an email's size to the total size of a Mailbox
* @param m Mailbox
*/
void mutt_mailbox_size_add(struct Mailbox *m, const struct Email *e)
{
- m->size += email_size(e);
+ m->size += mutt_email_size(e);
}
/**
*/
void mutt_mailbox_size_sub(struct Mailbox *m, const struct Email *e)
{
- m->size -= email_size(e);
+ m->size -= mutt_email_size(e);
}