Change default email address

As discussed in [1], user@rss2email.invalid is less verbose and simpler to
understand.

[1]: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=464077

Reported-by: Noah Slater <nslater@bytesexual.org>
Signed-off-by: Etienne Millon <me@emillon.org>
Don't put UTF8 last in the list of encodings

Sometimes, BIG5 will be selected for english text if quotes make it
not representable in ASCII. See [1] for the original bug report.

This default list is arguably European-centric but at least it documents a good
amount of the alternative encodings.

[1]: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=659920

Reported-by: James Cloos <cloos@jhcloos.com>
Signed-off-by: Etienne Millon <me@emillon.org>
Link to Debian & Ubuntu package pages

(instead of search)

Signed-off-by: Etienne Millon <me@emillon.org>
test:gmane:README: fix "feed.atom" -> "feed.rss" typo

Probably a copy-paste error from seeding with
test/allthingsrss/README.

Signed-off-by: W. Trevor King <wking@tremily.us>
feed: fix the `type` key returned by Feed._get_entry_content

The previous version used the Python object `type` where it should
have used the string 'type'.  I hadn't caught the bug before because
none of my example feeds fell through that far.

Signed-off-by: W. Trevor King <wking@tremily.us>
feed: fix Feed._get_entry_content unpacking in Feed._get_entry_id

_get_entry_content returns a single dict, but _get_entry_id had been
unpacking it as if it was a length-two tuple.

Signed-off-by: W. Trevor King <wking@tremily.us>
feed: fix Feed._get_entry_content unpacking in Feed._get_entry_title

_get_entry_content returns a single dict, but _get_entry_id had been
unpacking it as if it was an object with a `content` attribute.

Also convert HTML to text before extracting the title, to avoid things
like `<p>In the beginning...` in the title.

Signed-off-by: W. Trevor King <wking@tremily.us>
feed: use hashlib.sha1 for fallback IDs in Feed._get_entry_id

This fixes what I broke in

  commit 0fc2ff4465d741823b3dceebcfcf3a98a0081522
  Author: W. Trevor King <wking@tremily.us>
  Date:   Thu Oct 4 08:33:32 2012 -0400

    Cleanup global module configuration.

  diff --git a/rss2email.py b/rss2email.py
  index 216c13d..3919bd7 100755
  --- a/rss2email.py
  +++ b/rss2email.py
  ...
  -hash = hashlib.md5
  ...

I've come back with sha1 instead of md5, mostly because that's what
Git uses ;).  We don't migrate recorded IDs from the old configuration
method, so the change from md5 to sha1 shouldn't affect anyone.

Signed-off-by: W. Trevor King <wking@tremily.us>
feed: fix id fallback in Feed._process_entry

The old `entry['id'] or _id` raised a KeyError when the entry lacked
an ID.  The new `entry.get('id', _id)` falls back appropriately.

Signed-off-by: W. Trevor King <wking@tremily.us>
test:disqus: add a Disqus feed for testing

This raised a few issues with the handling of missing IDs, which I've
just fixed.  The new test will make sure we keep exercising these code
paths.

Signed-off-by: W. Trevor King <wking@tremily.us>
feed: Raise the new InvalidFeedConfig on missing feed.url

You can't fetch a feed without a URL.  This new error message makes
the cause explicit, compared to the somewhat ambigious former error
messages:

  fetch $NAME (None -> $TO)
  process $NAME (None -> $TO)
  HTTP status 200
  could not get HTTP headers: $NAME (None -> $TO)
  unrecognized version: $NAME (None -> $TO)
  sax parsing error: <unknown>:2:0: no element found: $NAME (None -> $TO)

I was getting URL-less feeds when I clobbered my
~/.config/rss2email/config [1], removing some newer entries.  However,
because I never deleted the feeds explicitly, they were repopulated
(without their URL) from ~/.config/rss2email/feeds.dat, and subsequent
runs generated the above error.

[1]: The clobbering was related to my dotfile management, and not due
to an rss2email issue.

Signed-off-by: W. Trevor King <wking@tremily.us>
error: Strip trailing whitespace in module docstring

Signed-off-by: W. Trevor King <wking@tremily.us>
main: Add an explicit --version argument.

Use an explicit `version` action instead of the undocumented (and
deprecated) `version` keyword to ArgumentParser [1,2].

[1]: http://docs.python.org/3.3/library/argparse.html#action
[2]: http://docs.python.org/3.3/library/argparse.html#upgrading-optparse-code

Signed-off-by: W. Trevor King <wking@tremily.us>
version: Add get_versions and teach rss2email --full-version

This makes it easier for users to submit useful bug reports.

Signed-off-by: W. Trevor King <wking@tremily.us>
main: Add missing `# Copyright` tag for update-copyright.py

Signed-off-by: W. Trevor King <wking@tremily.us>
Ran update-copyright.py

Signed-off-by: W. Trevor King <wking@tremily.us>
feed: Split entry link extraction out into Feed._get_entry_link

Now other methods can all access the same link, without having to
extract it in _process_entry and pass the extracted link around
explicitly.  Currently, nothing special happens during link
extraction, but the new method helps future proof us.

Signed-off-by: W. Trevor King <wking@tremily.us>
feeds: Use JSON instead of Pickle for storing dynamic feed state

It's safer, more portable, and possibly faster.  I've also added
version information to the data file for easier future upgrades.

Signed-off-by: W. Trevor King <wking@tremily.us>
feeds: Follow the the XDG Base Directory Specification

This splits config files and data files into different directories (by
default), so we no longer need an rss2email subdirectory (we only have
one config file and one data file).  The default config file is now
~/.config/rss2email.cfg and the default data file is now
~/.local/share/rss2email.json.

Signed-off-by: W. Trevor King <wking@tremily.us>
r2e.1: Update maintainer from Lindsey to me.

This should have happened in:

  commit 6460e8738b5e7c66df6c2143e8a29c048cf308bd
  Author: W. Trevor King <wking@tremily.us>
  Date:   Fri Nov 9 07:46:17 2012 -0500

    Change maintainer from Lindsey to Trevor.

Signed-off-by: W. Trevor King <wking@tremily.us>