/[suikacvs]/www/namazu/filter/comchat.pl
Suika

Contents of /www/namazu/filter/comchat.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.7 - (show annotations) (download)
Fri Nov 30 08:49:28 2001 UTC (22 years, 5 months ago) by wakaba
Branch: MAIN
CVS Tags: HEAD
Changes since 1.6: +1 -1 lines
File MIME type: text/plain

2001-11-30  wakaba <wakaba@suika.fam.cx>

	* comchat.pl (pre_codeconv): set 1.
	(post_codeconv): set 0.
	
	* comchat.pl (CHANGE): removed.
	* ChangeLog: new.
	
	* cwj.pl (filter): use NKF.pm.

1 # -*- Perl -*-
2
3 =head1 NAME
4
5 comchat.pl -- namazu filter for comchat log
6
7 =cut
8
9 package comchat;
10 use strict;
11 use Chat::Comchat;
12 require 'util.pl';
13 require 'gfilter.pl';
14 require 'html.pl';
15
16 sub mediatype() {
17 return ('application/x-comchat-log');
18 }
19
20 sub add_magic ($) {
21 my ($magic) = @_;
22 $magic->addSpecials("application/x-comchat-log", "<>.*<>.*<>.*<>.*<>");
23 $magic->addFileExts('\\.comchat$', 'application/x-comchat-log');
24 return;
25 }
26
27 sub status() {
28 return 'yes';
29 }
30
31 sub recursive() {
32 return 1;
33 }
34
35 sub pre_codeconv() {
36 return 1;
37 }
38
39 sub post_codeconv () {
40 return 0;
41 }
42
43 sub filter ($$$$$) {
44 my ($orig_cfile, $cont, $weighted_str, $headings, $fields)
45 = @_;
46 util::vprint("Processing comchat log...\n");
47 my $tmpfile = util::tmpnam('NMZ.pod');
48 {
49 util::vprint("temp: >$tmpfile\n");
50 my $fh = util::efopen("> $tmpfile");
51 print $fh $$cont;
52 }
53
54 my $title = undef;
55 if ($$orig_cfile =~ m#.*?/([^/]+)$#) {
56 $title = "$1 (chat log)";
57 }
58 my $chat = Chat::Comchat->open($tmpfile);
59 $$cont = <<EOH;
60 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
61 <html>
62 <head>
63 <title>${title}</title>
64 </head>
65 <body><ul>
66 EOH
67
68 for my $m ($chat->get()) {
69 for ("<li>", $m->{name}, $m->{text}, $m->{time}, $m->{ip}, "</li>\n") {
70 $$cont .= $_." " if $_;
71 }
72 }
73 $$cont .= <<EOH;
74 </ul></body></html>
75 EOH
76 unlink($tmpfile);
77 return undef;
78 }
79
80
81 =head1 LICENSE
82
83 Copyright wakaba 2001 All rights reserved.
84
85 # This program is free software; you can redistribute it and/or modify
86 # it under the terms of the GNU General Public License as published by
87 # the Free Software Foundation; either versions 2, or (at your option)
88 # any later version.
89 #
90 # This program is distributed in the hope that it will be useful
91 # but WITHOUT ANY WARRANTY; without even the implied warranty of
92 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
93 # GNU General Public License for more details.
94 #
95 # You should have received a copy of the GNU General Public License
96 # along with this program; if not, write to the Free Software
97 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
98 # 02111-1307, USA
99
100 =cut
101
102 1;
103
104 ## comchat.pl ends here

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24