<option>--set-param header:param=value</option>
</arg>
<arg choice="opt">
- <option>-Bbeit mask</option>
+ <option>-BbeIit mask</option>
</arg>
<arg choice="opt">
<option>--save-headers|body|message mask</option>
</listitem>
</varlistentry>
+ <varlistentry>
+ <term>-I mask</term>
+ <listitem>
+ <para>
+ Append mask to the list of content types to completely ignore.
+ There will be no output - no headers, no body, no warning. For a
+ multipart part the entire subtree is removed.
+ </para>
+ </listitem>
+ </varlistentry>
+
<varlistentry>
<term>-i mask</term>
<listitem>
</para>
<para>
- Options -e/-i can also work with multipart subparts of a MIME message. In
- case of -i the entire subtree of that multipart is removed and replaced with
- ignore warning.
+ Options -e/-I/-i can also work with multipart subparts of a MIME message. In
+ case of -I/-i the entire subtree of that multipart is removed; with -i it's
+ replaced with ignore warning.
</para>
<para>
elif content_type in g.binary_mask:
left_binary = True
break
+ elif content_type in g.fully_ignore_mask:
+ return
encoding = msg["Content-Transfer-Encoding"]
if left_binary or encoding in (None, '', '7bit', '8bit', 'binary'):
masks.append('*/*')
for content_type in masks:
- if content_type in g.ignore_mask:
+ if content_type in g.fully_ignore_mask:
+ return
+ elif content_type in g.ignore_mask:
output_headers(msg)
output("%sMessage body of type %s skipped.%s" % (os.linesep, ctype, os.linesep))
if boundary:
totext_mask = [] # A list of content-types to decode
binary_mask = [] # A list of content-types to pass through
decoded_binary_mask = [] # A list of content-types to pass through (content-transfer-decoded)
- ignore_mask = [] # Ignore (skip, do not decode and do not include into output)
+ ignore_mask = [] # Ignore (do not decode and do not include into output) but output a warning instead of the body
+ fully_ignore_mask = [] # Completely ignore - no headers, no body, no warning
error_mask = [] # Raise error if encounter one of these
save_counter = 0
try:
options, arguments = getopt(sys.argv[1:],
- 'hVcCDPH:f:d:p:r:R:b:B:e:i:t:O:o:',
+ 'hVcCDPH:f:d:p:r:R:b:B:e:I:i:t:O:o:',
['help', 'version', 'host=',
'save-headers=', 'save-body=', 'save-message=',
'set-header=', 'set-param='])
g.binary_mask.append(value)
elif option == '-b':
g.decoded_binary_mask.append(value)
+ elif option == '-I':
+ g.fully_ignore_mask.append(value)
elif option == '-i':
g.ignore_mask.append(value)
elif option == '-e':