diff options
author | Matěj Cepl <mcepl@cepl.eu> | 2014-12-31 01:29:28 +0100 |
---|---|---|
committer | Matěj Cepl <mcepl@cepl.eu> | 2014-12-31 01:29:28 +0100 |
commit | cdd9f1d6a872fbc20e368fc23ddaf98eb1ef3741 (patch) | |
tree | 0079a7ba384c8147b9ad8df7a1bb7dc84168e29e /pygn2m | |
parent | b51ede52742e2b94c77b83959cda081bad9675dd (diff) | |
download | pygn-cdd9f1d6a872fbc20e368fc23ddaf98eb1ef3741.tar.gz |
Make --verbose work.
mail2news produce verbose chatter with -v
Fixes #13
Also cleanup.
Diffstat (limited to 'pygn2m')
-rwxr-xr-x | pygn2m | 20 |
1 files changed, 7 insertions, 13 deletions
@@ -44,7 +44,7 @@ def parse_cmdline(): parser.add_argument('-T', '--test', help='test mode (not send article via SMTP)', action='store_true') - parser.add_argument('-V', '--verbose', help='verbose output', + parser.add_argument('-v', '--verbose', help='verbose output', action='store_true') opts = parser.parse_args() @@ -74,12 +74,12 @@ try: check and set pyg's internal variables """ - n2m = news2mail.news2mail() - owner = None - # it returns only test, other parms are set directly in the actual # parameter args = parse_cmdline() + + n2m = news2mail.news2mail(verbose=args.verbose) + owner = None # check if n2m has some file prefercences set on commandline if args.wlfile is None: @@ -96,9 +96,6 @@ try: wl = whitelist.whitelist(wl, log) - # reads stdin and parses article separating head from body - n2m.readfile() - """phase 2: check whitelist for user's permission """ @@ -137,12 +134,9 @@ try: open smtp connection and send e-mail """ - if len(n2m.headers) > 0: - wl.logmsg(n2m.heads_dict, wl.ACCEPT, owner) - if not args.test: - n2m.sendarticle() - else: - print('Error: No Headers!!!') + wl.logmsg(n2m.heads_dict, wl.ACCEPT, owner) + if not args.test: + n2m.sendarticle() except KeyboardInterrupt: print('Keyboard Interrupt') |