/[suikacvs]/messaging/suikawari/module/TomikouKeijiban.sb
Suika

Contents of /messaging/suikawari/module/TomikouKeijiban.sb

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (hide annotations) (download)
Thu Jun 20 11:33:44 2002 UTC (22 years, 5 months ago) by wakaba
Branch: MAIN
2002-06-20  wakaba <w@suika.fam.cx>

	* TomikouKeijiban.sb, TomikouHokushinKeijiban.sb,
	TomikouThemeKeijiban.sb: New modules.

1 wakaba 1.1
2     =head1 NAME
3    
4     Suikawari::TomikouKeijiban --- Suikawari module for Tomikou Keijiban
5     E<lt>http://tomikou.net/keijiban/E<gt>
6    
7     =cut
8    
9     ## This file is written in EUC-japan encoding.
10    
11     package Suikawari::TomikouKeijiban;
12     use strict;
13     use vars qw/$VERSION/;
14     $VERSION=do{my @r=(q$Revision: 1.1 $=~/\d+/g);sprintf "%d."."%02d" x $#r,@r};
15     use Message::MIME::Charset::Jcode 'jcode.pl';
16    
17     sub msg_regex ($) {
18     <<'EOH',
19     <a name="([0-9]+)-([0-9]+)-([0-9]+)\+([0-9]+):([0-9]+):([0-9]+)"><table border=1 cellspacing=0 cellpadding=2 width=600 bgcolor="#ffffff"><tr><td style="background:([0-9A-Fa-f#]+);color:([0-9A-Fa-f#]+)"><big>■<b>([\x00-\xFF]+?)</b></big></td></tr><tr><td style="[^"]+"><big><a (?:href="mailto:([^"]+)" )?style="[^"]+">■<b>([\x00-\xFF]+?)</a></b></big>&nbsp;&nbsp;<small>[0-9]+年[0-9]+月[0-9]+日\(..\) [0-9]+:[0-9]+</small></td></tr><tr><td style="[^"]+">([\x00-\xFF]*?)</td></tr></table></a><br>
20     EOH
21     qw (date_year date_month date_day date_hour date_minute date_second
22     misc_subject_background_color misc_subject_color subject from_mail from_name body);
23     }
24    
25     sub meta_regex ($) {
26     my $r = <<'EOH';
27     <TITLE>([\x00-\xFF]+?) : [\x00-\xFF]+?</TITLE>
28     EOH
29     $r =~ s/\n$//s;
30     $r, qw (list_name);
31     }
32    
33     sub on_load_source ($$) {shift;
34     my $b = shift;
35     $b->set_hook_function (code_conversion => sub { jcode::euc ($_[1], 'sjis') });
36     }
37    
38     sub source ($) {
39     if ($Bunshin::DEBUG) {
40     (file => 'Tomikou-ban.tmp');
41     } else {
42     (uri => 'http://tomikou.net/keijiban/keijiban.php');
43     }
44     }
45    
46     sub face ($) {
47     # my %face;
48     # (faces => \%face);
49     }
50    
51     sub _my_on_make ($$) {shift;
52     my $b = shift;
53     $b->default_parameter (list_name => 'とみこう掲示板');
54     $b->default_parameter (list_id => 'keijiban.tomikou.net');
55     $b->default_parameter (urn_template => 'urn:x-tomikou-net:keijiban:%YYYY;:%MM;:%DD;');
56     }
57    
58     sub _my_msg_header_add ($$$) {shift;
59     my ($msg, $p) = @_;
60     }
61    
62     sub on_make ($$) {
63     my $self = shift;
64     my $b = shift;
65     $b->default_parameter (date_zone => '+0900');
66     $b->default_parameter (DEFAULT_subject => '(無題)');
67     $b->default_parameter (msg_id_from => 'news@list.suika.fam.cx');
68     $b->default_parameter (newsgroups => 'suika.tomikou');
69     $self->_my_on_make ($b);
70     $b->set_hook_function (msg_header_add => sub {
71     shift;
72     my ($msg, $p) = @_;
73     my $hdr = $msg->header;
74     ## Newsgroups
75     my $group = $p->{newsgroups};
76     $group = 'suika.test' if $Bunshin::DEBUG;
77     $hdr->replace (newsgroups => $group);
78     $self->_my_msg_header_add ($msg, $p);
79     });
80     $b->set_hook_function (msg_body => sub {
81     shift;
82     my ($msg, $body, $p) = @_;
83     my $ct = $msg->header->field ('content-type');
84     $ct->value ('text/html');
85     $ct->parameter (charset => 'iso-2022-jp');
86     $msg->header->add (content_location => $p->{base_uri}) if $p->{base_uri};
87     $body =~ s#<br ?/?>$##;
88     $body =~ s#<br ?/?>#<br>\n#g;
89     my $meta = '';
90     $meta .= qq{<link rev="made" href="$p->{from_mail}">\n} if $p->{from_mail};
91     $meta .= qq{<meta name="author" content="$p->{from_name}">\n} if $p->{from_name};
92     my $html = <<EOH;
93     <!-- DOCTYPE html maybe PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" -->
94     <html>
95     <head>
96     <base href="$p->{base_uri}">
97     <title>$p->{subject}</title>
98     $meta</head>
99     <body>
100     <div>
101     $body
102     </div>
103     </body>
104     EOH
105     $msg->body->value ($html);
106     });
107     }
108    
109     =head1 SEE ALSO
110    
111     Suikawari, Bunshin
112    
113     =head1 LICENSE
114    
115     Copyright 2002 wakaba E<lt>w@suika.fam.cxE<gt>.
116    
117     This program is free software; you can redistribute it and/or modify
118     it under the terms of the GNU General Public License as published by
119     the Free Software Foundation; either version 2 of the License, or
120     (at your option) any later version.
121    
122     This program is distributed in the hope that it will be useful,
123     but WITHOUT ANY WARRANTY; without even the implied warranty of
124     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
125     GNU General Public License for more details.
126    
127     You should have received a copy of the GNU General Public License
128     along with this program; see the file COPYING. If not, write to
129     the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
130     Boston, MA 02111-1307, USA.
131    
132     =head1 CHANGE
133    
134     See F<ChangeLog>.
135     $Date: 2002/06/16 10:50:15 $
136    
137     =cut
138    
139     1;
140     ### Suikawari::TomikouKeijiban ends here

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24