Package: rss2email
Version: 1:2.55.dfsg1-1
Severity: wishlist

patch attached

-- System Information:
Debian Release: testing/unstable
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.13-rc6
Locale: LANG=en_US, LC_CTYPE=en_US (charmap=ISO-8859-1)

Versions of packages rss2email depends on:
ii  python                 2.3.5-3           An interactive high-level object-o
ii  python-feedparser      3.3+cvs20051220-1 Universal Feed Parser for Python

rss2email recommends no packages.

-- no debconf information
diff -ruN ./rss2email-original/r2e ./rss2email-2.55.dfsg1/r2e
--- ./rss2email-original/r2e    2006-01-20 09:11:24.000000000 -0700
+++ ./rss2email-2.55.dfsg1/r2e  2006-01-20 10:19:30.000000000 -0700
@@ -4,4 +4,4 @@
        mkdir ~/.rss2email
 fi
 cd ~/.rss2email/
-exec python /usr/share/rss2email/rss2email.py feeds.dat $*
+exec python /usr/share/rss2email/rss2email.py feeds.dat "[EMAIL PROTECTED]"
diff -ruN ./rss2email-original/r2e.1 ./rss2email-2.55.dfsg1/r2e.1
--- ./rss2email-original/r2e.1  2006-01-20 09:11:24.000000000 -0700
+++ ./rss2email-2.55.dfsg1/r2e.1        2006-01-20 10:04:24.000000000 -0700
@@ -15,8 +15,8 @@
 .P
 .RS
 .nf
-.BI "r2e new " [EMAIL PROTECTED]
-.BI "r2e add " http://feed.url/somewhere.rss
+.BI "r2e new " [EMAIL PROTECTED] " 
+.BI "r2e add " http://feed.url/somewhere.rss " [youremail] [bonus_header]"
 .BI "r2e run "
 .RE
 .P
@@ -28,10 +28,11 @@
 Create a new feedfile. If the second option is specified, it sets the
 default email address that mails are sent to.
 .TP
-.B add url [youremail]
-Subscribe to a feed. The first option is the URL of the feed.
-The optional second option is the email address to send new items to.
-Repeat for each feed you want to subscribe to.
+.B add url ... [youremail] [bonus_header]
+Subscribe to a feed. The leading option(s) is the URL of the feed.
+The first optional trailing argument is the email address to send new items to.
+The last optional trailing argument is an extra header added to the Email 
(useful for procmail(1) processing).
+Repeat this command for each feed you want to subscribe to.
 .TP
 .B run [--no-send] [num]
 Scan the feeds and send emails for new items. This can be run in a cron
diff -ruN ./rss2email-original/rss2email.py ./rss2email-2.55.dfsg1/rss2email.py
--- ./rss2email-original/rss2email.py   2006-01-20 09:11:24.000000000 -0700
+++ ./rss2email-2.55.dfsg1/rss2email.py 2006-01-20 09:46:28.000000000 -0700
@@ -6,7 +6,7 @@
   new [youremail] (create new feedfile)
   email yournewemail (update default email)
   run [--no-send] [num]
-  add feedurl [youremail]
+  add feedurl [youremail] [bonus_header]
   list
   delete n
 """
@@ -239,9 +239,10 @@
 ### Simple Database of Feeds ###
 
 class Feed:
-       def __init__(self, url, to):
+       def __init__(self, url, to, bonus_header):
                self.url, self.etag, self.modified, self.seen = url, None, 
None, {}
                self.to = to            
+               self.bonus_header = bonus_header
 
 def load(lock=1):
        if not os.path.exists(feedfile):
@@ -271,17 +272,29 @@
 ### Program Functions ###
 
 def add(*args):
-       if len(args) == 2 and contains(args[1], '@') and not contains(args[1], 
'://'):
-               urls, to = [args[0]], args[1]
-       else:
-               urls, to = args, None
+       to = None
+       bonus_header = None
+       # grab bonus header
+       if len(args) > 1 :
+               if contains(args[-1], ': ') and not contains(args[1], '://'):
+                       bonus_header = args[-1]
+                       args = args[:-1]
+
+       # grab alternative address
+       if len(args) > 1 :
+               if contains(args[-1], '@') and not contains(args[1], '://'):
+                       to = args[-1]
+                       args = args[:-1]
+
+       # the rest are feeds
+       urls = args
        
        feeds, feedfileObject = load()
        if feeds and not isstr(feeds[0]) and to is None:
                print "No email address has been defined. Please run 'email 
newaddr' or"
                print "'add url addr'."
                sys.exit(1)
-       for url in urls: feeds.append(Feed(url, to))
+       for url in urls: feeds.append(Feed(url, to, bonus_header))
        unlock(feeds, feedfileObject)
 
 def run(num=None):
@@ -404,13 +417,18 @@
                                        
                                        from_addr = unu(getEmail(r.feed, entry))
 
+                                       
+                                       feed_bonus_header = ''
+                                       if f.bonus_header is not None :
+                                               feed_bonus_header += "\n" + 
f.bonus_header
+
                                        message = (
                                        "From: " + 
quote822(header7bit(getName(r, entry))) + " <"+from_addr+">" +
                                        "\nTo: " + header7bit(unu(f.to or 
default_to)) + # set a default email!
                                        "\nSubject: " + header7bit(title) +
                                        "\nDate: " + time.strftime("%a, %d %b 
%Y %H:%M:%S -0000", datetime) +
                                        "\nUser-Agent: rss2email" + # really 
should be X-Mailer 
-                                       BONUS_HEADER +
+                                       BONUS_HEADER + feed_bonus_header + 
                                        "\nContent-Type: ")         # but 
backwards-compatibility
                                        
                                        if ishtml(content):
@@ -462,7 +480,7 @@
                print "default email:", default_to
        else: ifeeds = feeds; i = 0
        for f in ifeeds:
-               print `i`+':', f.url, '('+(f.to or ('default: '+default_to))+')'
+               print `i`+':', f.url, '('+(f.to or ('default: 
'+default_to))+')', 'bonus_header="%s"' % ( str(f.bonus_header),) 
                if not (f.to or default_to):
                        print "   W: Please define a default address with 'r2e 
email addr'"
                i+= 1

Reply via email to