From: Oleg Broytman Date: Sat, 8 Mar 2014 17:14:01 +0000 (+0400) Subject: Remove option --remove-params X-Git-Tag: v2.4.0~4 X-Git-Url: https://git.phdru.name/?a=commitdiff_plain;h=502931f2c502991905892ae23548d9b02adf7fd0;p=mimedecode.git Remove option --remove-params --- diff --git a/ANNOUNCE b/ANNOUNCE index 923a772..2faa302 100644 --- a/ANNOUNCE +++ b/ANNOUNCE @@ -47,10 +47,6 @@ WHAT'S NEW in version 2.4.0 (2014-03-??) Add ChangeLog. -WHAT'S NEW in version 2.3.8 (2014-02-26) - - Add option --remove-params=header to remove all parameters from the header. - WHAT'S NEW in version 2.3.7 (2014-02-23) Add option -r to remove headers and option -R to remove headers parameters. diff --git a/mimedecode.docbook b/mimedecode.docbook index 75ec367..7055662 100644 --- a/mimedecode.docbook +++ b/mimedecode.docbook @@ -70,9 +70,6 @@ - - - @@ -328,16 +325,6 @@ - - --remove-params=header - - - Add the header to a list of headers from which all parameters will - be removed; initially the list is empty. - - - - -b mask diff --git a/mimedecode.py b/mimedecode.py index c36e40a..42318f4 100755 --- a/mimedecode.py +++ b/mimedecode.py @@ -18,7 +18,7 @@ Broytman mimedecode.py version %s, %s def usage(code=0, errormsg=''): version(0) sys.stdout.write("""\ -Usage: %s [-h|--help] [-V|--version] [-cCDP] [-H|--host=hostname] [-f charset] [-d header1[,h2,...]|*[,-h1,...]] [-p header1[,h2,h3,...]:param1[,p2,p3,...]] [-r header1[,h2,...]|*[,-h1,...]] [-R header:param] [--remove-params=header] [-beit mask] [-o output_file] [input_file [output_file]] +Usage: %s [-h|--help] [-V|--version] [-cCDP] [-H|--host=hostname] [-f charset] [-d header1[,h2,...]|*[,-h1,...]] [-p header1[,h2,h3,...]:param1[,p2,p3,...]] [-r header1[,h2,...]|*[,-h1,...]] [-R header:param] [-beit mask] [-o output_file] [input_file [output_file]] """ % me) if errormsg: sys.stderr.write(errormsg + '\n') @@ -122,15 +122,15 @@ def decode_headers(msg): for header in header_list: del msg[header] - for header in gopts.remove_all_params: - value = msg[header] - if value is None: # No such header - continue - if ';' not in value: # There are no parameters - continue - del msg[header] # Delete all such headers - # Get the value without parameters and set it back - msg[header] = value.split(';')[0].strip() + #for header in gopts.remove_all_params: + # value = msg[header] + # if value is None: # No such header + # continue + # if ';' not in value: # There are no parameters + # continue + # del msg[header] # Delete all such headers + # # Get the value without parameters and set it back + # msg[header] = value.split(';')[0].strip() for header, param in gopts.remove_header_params: msg.del_param(param, header) @@ -343,8 +343,6 @@ class GlobalOptions: remove_headers = [] # A list of headers parameters to remove remove_header_params = [] - # A list of headers to be stripped of all parameters - remove_all_params = [] totext_mask = [] # A list of content-types to decode binary_mask = [] # A list to pass through @@ -363,7 +361,7 @@ def get_opt(): try: options, arguments = getopt(sys.argv[1:], 'hVcCDPH:f:d:p:r:R:b:e:i:t:o:', - ['help', 'version', 'host=', 'remove-params=']) + ['help', 'version', 'host=']) except GetoptError: usage(1) @@ -394,8 +392,6 @@ def get_opt(): gopts.remove_headers.append(value) elif option == '-R': gopts.remove_header_params.append(value.split(':', 1)) - elif option == '--remove-params': - gopts.remove_all_params.append(value) elif option == '-t': gopts.totext_mask.append(value) elif option == '-b': diff --git a/test/test_all b/test/test_all index ea33070..2ea64c1 100755 --- a/test/test_all +++ b/test/test_all @@ -46,13 +46,13 @@ test_file msg_15.txt msg_15-1.txt -b text/html test_file msg_15.txt msg_15-2.txt -i text/html test_file msg_22.txt msg_22-1.txt -r content-id test_file msg_29.txt msg_29-1.txt -R Content-Type:title -test_file msg_18.txt msg_18-1.txt --remove-params=X-Foobar-Spoink-Defrobnit test_file msg_22.txt msg_22.txt -P -p Content-Type,Content-Disposition:name,filename test_file msg_22.txt msg_22.txt -P -p \*:name,filename test_file msg_22.txt msg_22.txt -P -p Content-Type,Content-Disposition:\* test_file msg_22.txt msg_22.txt -P -p '*,-Content-Id:*,-x-mac-type' test_file msg_16.txt msg_16-1.txt -r Received,List-Help,List-Post,List-Subscribe,List-Id,List-Unsubscribe,List-Archive test_file msg_16.txt msg_16-2.txt -r \*,-mime-version,-content-type +#test_file msg_18.txt msg_18-1.txt --remove-params=X-Foobar-Spoink-Defrobnit if [ "$RC" -eq 0 ]; then echo "All tests passed!"