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

Re: Shimbun backend for FFII

At Mon, 07 Feb 2005 11:18:13 +0900,
TSUCHIYA Masatoshi wrote:
> I received the attached message.  I will be willing to add sb-ffii.el
> to our CVS repository.  Before adding it, I would like to mention
> several suggestions.

Thanks for looking at my code.  I have to apologize for my crappy
module.  An improved version is attached.

> I have just checked the WEB page <http://www.ffii.org/news/rss/>, and
> found more RSS feeds than the current sb-ffii.el supports.  Can you
> add other RSS feeds and improve group names?  


> You can remove `shimbun-ffii-content-start' and
> `shimbun-ffii-content-end' safely.  When they are not specified,
> Shimbun library will remove no snippet from retrieved pages when
> makeing articles.

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

> You can remove `shimbun-ffii-server-name' also.

I put it in there so that the return address looks a bit nicer.

> You should add a copyright header to the file as follows:
>     Copyright (C) 2005 ....


BTW, there's one problem that I didn't solve yet.  In the feed named


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

Perhaps you have a suggestion on how to solve that problem?

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)
;; Keywords: news
;; Created: Feb 07, 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
  '(("Software Patent News: All Sources" . "SwpatcninoEn")
    ("Software Patent News: FFII" . "SwpatcninoEn-ffii")
    ("Softwarepatent-Nachrichten: Alle Quellen" . "SwpatcninoDe")
    ("Softwarepatent-Nachrichten: FFII" . "SwpatcninoDe-ffii")
    ("Nouvelles sur les Brevets Logiciels: toutes sources" . "SwpatcninoFr")
    ("Nouvelles sur les Brevets Logiciels: FFII" . "SwpatcninoFr-ffii")
    ("Laatste Nieuws: wereld" . "SwpatcninoNl")
    ("Laatste Nieuws: FFII" . "SwpatcninoNl-ffii")
    ("Information Infrastructure News" . "FfiinewsEn")
    ("Informations-Infrastruktur-Nachrichten" . "FfiinewsDe")
    ("FFII Project News" . "FfiiprojNewsEn")))

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

(defvar shimbun-ffii-content-start "<html>")
(defvar shimbun-ffii-content-end "</html>")
(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)

(provide 'sb-ffii)

;;; sb-ffii.el ends here