--- gateway_cgi.py.orig 2011-01-30 09:34:05.000000000 +0900 +++ gateway_cgi.py 2011-01-30 09:41:39.000000000 +0900 @@ -288,6 +287,9 @@ buf = '

%s

' % buf return buf + def find_replays(self, plain): + return re.findall(">>([a-z0-9]{8})", plain): + def print_rss(self): rss = RSS(encode = "UTF-8", title = self.message["logo"], @@ -300,6 +302,7 @@ now = int(time()) for cache in cachelist: if cache.valid_stamp + config.rss_range >= now: + ids = cache.keys() title = self.escape(self.file_decode(cache.datfile)) path = self.appli[cache.type]+self.sep+self.str_encode(title) for r in cache: @@ -321,6 +324,34 @@ cache.datfile, r.id, r.stamp, suffix, r.stamp, suffix) + replays = self.find_replays(r.get("body", "")) + if replays: + content += '\n
' + c = 1 + tmp = [] + while (replays): + if c > config.rrdepth: + break + replay = replays.pop() + if replay in tmp: + continue + tmp.append(replay) + idstr=None + for id in ids: + if (id.split("_")[1][:8] == replay): + idstr = id + break + if idstr: + rec = Record(datfile=cache.datfile, idstr=idstr) + rec.load_body() + rereplays = self.find_replays(rec.get("body", "")) + if rereplays: + for rereplay in rereplays: + replays.append(rereplay) + content += '\n

%s:
%s

' % \ + (replay, self.rss_html_format(rec.get("body", ""), self.appli[cache.type], title)) + rec.free() + c += 1 if cache.type == "thread": permapath = "%s/%s" % (path[1:], r.id[:8]) else: --- config.py.orig 2011-01-30 09:34:14.000000000 +0900 +++ config.py 2011-01-30 09:34:27.000000000 +0900 @@ -165,6 +165,7 @@ broadcast = "../tool/broadcast.py" # Broadcast script path rss = "1" # RSS version; must be "1" +rrdepth = 3 google = "http://www.google.co.jp/search" language = "en" # Language code (see RFC3066)