[Date Prev][Date Next][Thread Prev][][Date Index][Thread Index]

Re: Shimbun backend for FFII

At Tue, 08 Feb 2005 13:27:12 +0900,
TSUCHIYA Masatoshi wrote:
> (3) You SHOULD select group names in USENET style.  It means that
>     small characters are preferred in group names, and that period(.)
>     is preferred as an delimiter to show hierarchical structure in
>     groups.
> Unfortunately, your program violates the third item.  Can you change
> group names in sb-ffii.el in order to keep consistency among all
> Shimbun modules?

Done: I prepended language identification codes, substituted spaces by
underscores, and lowercased all characters (it's on purpose that some
words are separated by underscores and others by dashes).  IMO, this
makes things harder to read.  Also, I don't see a reason for this
convention.  After all, for example in IMAP folder hierarchies it's not
uncommon to have spaces and uppercase characters.  But I don't want to
start a dispute over this - I don't have the expertise with Shimbun and
I lack time.

> >I already tried removing them before I submitted my first version.
> >The problem is that when I leave away "shimbun-ffii-content-start"
> >and "shimbun-ffii-content-end", then I get the following error
> >message with all messages that I tried to read:
> > byte-code: Wrong type argument: stringp, nil
> This must be a bug of shimbun.el.  I believe that it has been fixed.
> Can you try the CVS head version of shimbun.el?

Works.  Thanks.

> >there is an item "<dc:date></dc:date>".  When I try to synchronize
> >message from that feed, then I get the following error message:
> > if: Wrong type argument: stringp, nil
> Add the follwing code to sb-ffii.el, which provides dummy date string
> if date information is lacked.

This doesn't seem to work: I tested it with a backup I had of the faulty
stream, and I get the same error message as before.  Anyways, the
current stream has been fixed, and at the FFII there are plans to
overhaul the software for creating streams.  In a nutshell: There's no
need to spend much time on this work-around, IMO.

I attached the new module.  Don't hesitate to point out further
deficiencies.  I want this module to be as easy to use as possible.
After all, one reason why I write this module, is that I want to make
people interested in the software patent cause.

Felix E. Klee

===File ~/projects/emacs/sb-ffii.el=========================
;;; sb-ffii.el --- shimbun backend for <http://www.ffii.org/news/rss/>

;; Copyright (C) 2004, 2005
;; Felix E. Klee <felix.klee@inka.de>
;; Andreas Seltenreich <seltenreich@gmx.de>

;; Authors: 
;; * Felix E. Klee <felix.klee@inka.de>
;; * Andreas Seltenreich <seltenreich@gmx.de> (author of sb-n24-de.el
;;   which was used as a base for this module)
;; * TSUCHIYA Masatoshi (work around for missing date information)
;; Keywords: news
;; Created: Feb 09, 2005

;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.

;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with this program; if not, you can either send email to this
;; program's maintainer or write to: The Free Software Foundation,
;; Inc.; 59 Temple Place, Suite 330; Boston, MA 02111-1307, USA.

;;; Code:

(require 'shimbun)
(require 'sb-rss)

(luna-define-class shimbun-ffii (shimbun-rss) ())

(defvar shimbun-ffii-groups-alist
  '(("en.software_patent_news" . "SwpatcninoEn")
    ("en.software_patent_news.ffii" . "SwpatcninoEn-ffii")
    ("de.softwarepatent-nachrichten" . "SwpatcninoDe")
    ("de.softwarepatent-nachrichten.ffii" . "SwpatcninoDe-ffii")
    ("fr.nouvelles_sur_les_brevets_logiciels" . "SwpatcninoFr")
    ("fr.nouvelles_sur_les_brevets_logiciels.ffii" . "SwpatcninoFr-ffii")
    ("nl.laatste_nieuws" . "SwpatcninoNl")
    ("nl.laatste_nieuws.ffii" . "SwpatcninoNl-ffii")
    ("en.information_infrastructure_news" . "FfiinewsEn")
    ("de.informations-infrastruktur-nachrichten" . "FfiinewsDe")
    ("en.ffii_project_news" . "FfiiprojNewsEn")))

(defvar shimbun-ffii-groups
  (mapcar 'car shimbun-ffii-groups-alist))

(defvar shimbun-ffii-server-name "FFII")
(defvar shimbun-ffii-from-address "info@ffii.org")

(luna-define-method shimbun-headers :before ((shimbun shimbun-ffii)
					     &rest range)

(luna-define-method shimbun-groups ((shimbun shimbun-ffii))

;; Returns a Message-ID created from the URL url and the date date.
(luna-define-method shimbun-rss-build-message-id
  ((shimbun shimbun-ffii) url date)
  (let (page host datedesc)
    ; Sometimes URLs are broken (e.g. I've seen something like http:http://x/).
    ; The following expression tries to deal with cases like this.
    (unless (string-match "[^:]*:\\/\\/\\([^\/]+\\)\\([^@<>]*\\)" url)
      (error "Cannot parse URL for message-id base"))
     host (match-string-no-properties 1 url)
     page (match-string-no-properties 2 url))
    ; Sometimes dates are broken, therefore the following expression is very
    ; fault tolerant.
    (unless (string-match 
      (error "Cannot parse date for message-id base"))
    (setq datedesc (concat (match-string-no-properties 1 date)
			   (match-string-no-properties 2 date)
			   (match-string-no-properties 3 date)
			   (match-string-no-properties 4 date)
			   (match-string-no-properties 5 date)))
    (format "<%s%%%s@%s>" datedesc page host)))

 shimbun-index-url ((shimbun shimbun-ffii))
 (concat "http://www.ffii.org/news/rss/";
         (cdr (assoc (shimbun-current-group-internal shimbun)

;; Provides a dummy date string if date information is lacking.
 shimbun-rss-process-date :around ((shimbun shimbun-ffii)
 (if (stringp date)
   (let ((time (decode-time)))
     (shimbun-make-date-string (nth 5 time)
                               (nth 1 time)
                               (nth 3 time)))))

(provide 'sb-ffii)

;;; sb-ffii.el ends here