- fix attachment counting stuff to not always re-count everything
- add $count_attachments (similar to scoring works)
- add note about speed issues for counting to manual
git-svn-id: svn://svn.berlios.de/mutt-ng/trunk@544
e385b8ad-14ed-0310-8656-
cc95a2468c6d
The "attachments" and "unattachments" commands were added. The %X
expando has been added to $index_format. The ~X pattern has been
- added. The %Q and %X expandos have been added to $attach_format.
+ added. The %Q and %X expandos have been added to $attach_format. For
+ better control purpose, the $count_attachments variable has been
+ added, too.
As part of the above addition(s), the 'A' message status flag has been
removed again.
that it can be pasted elsewhere.
</para>
+<para>
+ Please note that counting attachments may require lots of data be
+ loaded. This may cause noticeable slowdowns over network links
+ depending on the connection speed and message sizes. To fine-tune the
+ behavior on a per-folder or other basis, the <muttng-doc:varref
+ name="count-attachments"/> variable may be used.
+</para>
+
</sect1>
<sect1>
case 'X':
{
- int count, flags = 0;
-
- if (hdr->content->parts)
- count = mutt_count_body_parts(hdr, flags);
- else {
- mutt_parse_mime_message(ctx, hdr);
- count = mutt_count_body_parts(hdr, flags);
- mutt_free_body(&hdr->content->parts);
+ int count = 0;
+
+ if (option (OPTCOUNTATTACH)) {
+ if (!hdr->content->parts)
+ mutt_parse_mime_message(ctx, hdr);
+ count = mutt_count_body_parts(hdr, 0);
}
/* The recursion allows messages without depth to return 0. */
** When \fIunset\fP, Mutt-ng will not collapse a thread if it contains any
** unread messages.
*/
+ {"count_attachments", DT_BOOL, R_NONE, OPTCOUNTATTACH, "yes"},
+ /*
+ ** .pp
+ ** This variable controls whether attachments should be counted for $$$index_format
+ ** and its \fT%X\fP expando or not. As for scoring, this variable can be used to
+ ** selectively turn counting on or off instead of removing and re-adding rules as
+ ** prefered because counting requires full loading of messages.
+ ** .pp
+ ** If it is \fIset\fP and rules were defined via the \fTattachments\fP and/or
+ ** \fTunattachments\fP commands, counting will be done. If it is \fIunset\fP no
+ ** counting will be done regardless whether rules were defined or not.
+ */
{"uncollapse_jump", DT_BOOL, R_NONE, OPTUNCOLLAPSEJUMP, "no" },
/*
** .pp
OPTCOLLAPSEUNREAD,
OPTCONFIRMAPPEND,
OPTCONFIRMCREATE,
+ OPTCOUNTATTACH,
OPTDELETEUNTAG,
OPTDELSP,
OPTDIGESTCOLLAPSE,
}
int mutt_count_body_parts (HEADER *hdr, int flags) {
+ if (!option (OPTCOUNTATTACH))
+ return (0);
if (hdr->attach_valid && !(flags & M_PARTS_RECOUNT))
return hdr->attach_total;