diff options
author | Matěj Cepl <mcepl@cepl.eu> | 2014-12-24 14:24:24 +0100 |
---|---|---|
committer | Matěj Cepl <mcepl@cepl.eu> | 2014-12-24 14:32:23 +0100 |
commit | 8af6ecfe31a7767f1d76f36581b01ddd26fb3220 (patch) | |
tree | a5cf60c5de6a34843fceb23895473cbb25c80fa2 /cleanup_failing.patch | |
parent | 45552a9cb1ac5433fd2010d1736b41a3393b9b6b (diff) | |
download | pygn-8af6ecfe31a7767f1d76f36581b01ddd26fb3220.tar.gz |
Mighty cleanup
* Use more of the standard methods for OrderedDicts
* remove pyginfo module (with SSOT being mail2news module)
* remove TODO, INSTALL, and changelog.Debian
* all FIXMEs and TODOs are filed as bugs in the issue tracker
Diffstat (limited to 'cleanup_failing.patch')
-rw-r--r-- | cleanup_failing.patch | 113 |
1 files changed, 0 insertions, 113 deletions
diff --git a/cleanup_failing.patch b/cleanup_failing.patch deleted file mode 100644 index d7d049f..0000000 --- a/cleanup_failing.patch +++ /dev/null @@ -1,113 +0,0 @@ -diff --git b/mail2news.py a/mail2news.py -index e7cbcf9..412e4ee 100644 ---- b/mail2news.py -+++ a/mail2news.py -@@ -24,80 +28,41 @@ import pyginfo - - class mail2news: - """news to mail gateway class""" -- - reader = None # mode reader --# newsgroups = None # Newsgroups: local.test,local.moderated... --# approved = None # Approved: kame@aragorn.lorien.org - newsserver = 'localhost' # no comment :) - port = 119 - user = None - password = None - -+# """phase 3: -+# format rfc 822 headers from input article -+# """ -+# -+# m2n.mergeheads() # make unique dict from NNTP and SMTP dicts -+# -+# m2n.addheads() # add some important heads -+# m2n.renameheads() # rename useless heads -+# m2n.removeheads() # remove other heads -+# -+# m2n.sortheads() # sort remaining heads :) -+# -+# if opt.verbose: -+# for line in m2n.headers: -+# print line[:-1] - -@@ -142,14 +108,11 @@ class mail2news: - - self.heads_dict = {} - -- try: -- for header in self.smtpheads.keys(): # fill it w/ smtp old heads -- self.heads_dict[header] = self.smtpheads[header] -- -- # and replace them w/ nntp new heads -- for header in self.nntpheads.keys(): -- self.heads_dict[header] = self.nntpheads[header] -+ # FIXME something like a = set() ; a = self.message.items() ? - -+ try: -+ for header in self.message.keys(): # fill it w/ smtp old heads -+ self.heads_dict[header] = self.message[header] - except KeyError, message: - print message - - -@@ -236,51 +166,32 @@ class mail2news: - def removeheads(self, heads=None): - """remove headers like Xref: Path: Lines: - """ -- -- try: - # removing some others useless headers .... (From is not From:) - - rmheads = ['Received:', 'From', 'NNTP-Posting-Host:', - 'X-Trace:', 'X-Compliants-To:', 'NNTP-Posting-Date:'] -- if(heads): -+ if heads: - rmheads.append(heads) - - for head in rmheads: -- if head in self.heads_dict: -- del self.heads_dict[head] -- --# if 'From' in self.heads_dict: # neither 'From ' nor 'From:' --# del self.heads_dict['From'] -- --# # neither 'From ' nor 'From:' --# if 'NNTP-Posting-Host:' in self.heads_dict: --# del self.heads_dict[''] -- --# if 'Lines:' in self.heads_dict: --# del self.heads_dict['Lines:'] -+ if head in self.message: -+ del self.message[head] - -- # it is usually set by INN, if ng is moderated... --# if 'Sender:' in self.heads_dict: --# del self.heads_dict['Sender:'] -- -- if 'Message-id:' in self.heads_dict: -+ # FIXME the following lines are buggy, because they don't expect -+ # the header 'Message-Id' being already present -+ if 'Message-id:' in self.message: - self.heads_dict['Message-Id:'] = self.heads_dict['Message-id:'] - del(self.heads_dict['Message-id:']) - -- if 'Message-ID:' in self.heads_dict: -+ if 'Message-ID:' in self.message: - self.heads_dict['Message-Id:'] = self.heads_dict['Message-ID:'] - del(self.heads_dict['Message-ID:']) - - # If message-id is not present, I generate it -- if 'Message-Id:' not in self.heads_dict: -+ if 'Message-Id:' not in self.message: - msgid = '<pyg.%d@tuchailepuppapera.org>\n' % (getpid()) - self.heads_dict['Message-Id:'] = msgid - -- except KeyError, message: -- print message -- -- return self.heads_dict -- - def sendemail(self): - """Talk to NNTP server and try to send email.""" - try: |