diff options
author | Matěj Cepl <mcepl@cepl.eu> | 2014-12-22 00:26:30 +0100 |
---|---|---|
committer | Matěj Cepl <mcepl@cepl.eu> | 2014-12-22 00:46:41 +0100 |
commit | 5b25c51d3a02d49db2c7e33f9b65fad5432219f4 (patch) | |
tree | 6e8231c81e84d4b6873cb45c78a24a2a4d31074c /pygn2m | |
parent | d3b3442e6bd72e3ba91cceb5c94e5e222b61af3a (diff) | |
download | pygn-5b25c51d3a02d49db2c7e33f9b65fad5432219f4.tar.gz |
pygn2m and news2mail.py use stdlib email parser.
Instead of doing it on their own (poorly).
Diffstat (limited to 'pygn2m')
-rwxr-xr-x | pygn2m | 20 |
1 files changed, 10 insertions, 10 deletions
@@ -87,15 +87,15 @@ try: args = parse_cmdline() # check if n2m has some file prefercences set on commandline - if n2m.wlfile is None: - wl = os.environ['HOME'] + '/pyg.whitelist' + if args.wlfile is None: + wl = os.path.expanduser('~/pyg.whitelist') else: - wl = n2m.wlfile + wl = args.wlfile - if n2m.logfile is None: - log = os.environ['HOME'] + '/pyg.log' + if args.logfile is None: + log = os.path.expanduser('~/pyg.log') else: - log = n2m.logfile + log = args.logfile # print 'using %s %s\n' % (wl,log) @@ -103,17 +103,17 @@ try: # reads stdin and parses article separating head from body n2m.readfile() - n2m.parsearticle() +# n2m.parsearticle() """phase 2: check whitelist for user's permission """ # make a first check of From: address - owner = wl.checkfrom(n2m.nntpheads['From:']) + owner = wl.checkfrom(n2m.nntpheads['From']) if owner is None: if sys.stdin.isatty() == 1 or args.test: - print ('"%s" is not in whitelist!' % (n2m.nntpheads['From:'][:-1])) + print ('"%s" is not in whitelist!' % (n2m.nntpheads['From'][:-1])) else: wl.logmsg(n2m.nntpheads, wl.DENY) @@ -139,7 +139,7 @@ try: for line in n2m.headers: print(line[:-1]) - if args.owner is None: + if owner is None: sys.exit(1) """phase 4: |