aboutsummaryrefslogtreecommitdiffstats
path: root/pygm2n
diff options
context:
space:
mode:
Diffstat (limited to 'pygm2n')
-rwxr-xr-xpygm2n22
1 files changed, 10 insertions, 12 deletions
diff --git a/pygm2n b/pygm2n
index 451c25a..ac37b77 100755
--- a/pygm2n
+++ b/pygm2n
@@ -17,7 +17,8 @@ from __future__ import print_function
import sys
import nntplib
-
+import logging
+logging.basicConfig(level=logging.DEBUG)
import argparse
import mail2news
@@ -37,21 +38,18 @@ def parse_cmdline():
parser.add_argument('-n', '--newsgroup', default='',
help='newsgroup[s] (specified as comma separated ' +
'without spaces list)', required=True)
- parser.add_argument('-u', '--user', default='')
+ parser.add_argument('-u', '--user', default='',
+ help='NNTP server user (for authentication)')
parser.add_argument('-p', '--password', default='',
- help='password (for auth to newsserver)')
+ help='NNTP server password (for authentication)')
parser.add_argument('-P', '--port', default='')
- # WHAT IS THIS GOOD FOR?
- # parser.add_argument('-M', '--reader', action='store_true')
-
parser.add_argument('-e', '--envellope', default='')
- parser.add_argument('-t', '--to', dest='rcpt')
parser.add_argument('-w', '--wlfile')
parser.add_argument('-l', '--logfile')
parser.add_argument('-T', '--test', action='store_true',
help='test mode (not send article via NNTP)')
- parser.add_argument('-V', '--verbose', action='store_true',
+ parser.add_argument('-v', '--verbose', action='store_true',
help='verbose output ' +
'(usefull with -T option for debugging)')
@@ -76,12 +74,11 @@ try:
"""phase 1:
check and set pyg's internal variables
"""
+ opt = parse_cmdline()
- m2n = mail2news.mail2news()
+ m2n = mail2news.mail2news(verbose=opt.verbose)
owner = None
- opt = parse_cmdline()
-
# reads stdin and parses article separating head from body
m2n.readfile(opt)
# m2n.parseemail()
@@ -104,7 +101,8 @@ try:
if opt.verbose:
print(m2n.message.as_string())
- if len(m2n.headers) > 0 and len(m2n.message.get_payload()) > 0:
+ logging.debug('m2n.payload = len %d', len(m2n.message.get_payload()))
+ if len(m2n.message.get_payload()) > 0:
# wl.logmsg(m2n.heads_dict,wl.ACCEPT,owner)
if not opt.test:
try: