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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (hide annotations) (download)
Tue Sep 10 23:37:00 2002 UTC (22 years, 2 months ago) by wakaba
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +15 -6 lines
2002-09-11  Wakaba <w@suika.fam.cx>

	* TomikouKeijiban.sb (element_encoders): New.

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 wakaba 1.2 sub element_decoders () {
34     (
35     list_name => 'deentity_html',
36     from_name => 'deentity_html',
37     from_mail => 'deentity_html',
38     );
39     }
40    
41 wakaba 1.1 sub on_load_source ($$) {shift;
42     my $b = shift;
43 wakaba 1.2 $b->set_hook_function (code_conversion => sub { (Message::MIME::Charset::decode (shift_jisx0213 => $_[1]))[0] });
44 wakaba 1.1 }
45    
46     sub source ($) {
47     if ($Bunshin::DEBUG) {
48     (file => 'Tomikou-ban.tmp');
49 wakaba 1.2 (uri => 'http://tomikou.net/keijiban/keijiban.php');
50 wakaba 1.1 } else {
51     (uri => 'http://tomikou.net/keijiban/keijiban.php');
52     }
53     }
54    
55     sub face ($) {
56     # my %face;
57     # (faces => \%face);
58     }
59    
60     sub _my_on_make ($$) {shift;
61     my $b = shift;
62     $b->default_parameter (list_name => 'とみこう掲示板');
63     $b->default_parameter (list_id => 'keijiban.tomikou.net');
64     $b->default_parameter (urn_template => 'urn:x-tomikou-net:keijiban:%YYYY;:%MM;:%DD;');
65     }
66    
67     sub _my_msg_header_add ($$$) {shift;
68     my ($msg, $p) = @_;
69     }
70    
71     sub on_make ($$) {
72     my $self = shift;
73     my $b = shift;
74     $b->default_parameter (date_zone => '+0900');
75     $b->default_parameter (DEFAULT_subject => '(無題)');
76     $b->default_parameter (msg_id_from => 'news@list.suika.fam.cx');
77     $b->default_parameter (newsgroups => 'suika.tomikou');
78     $self->_my_on_make ($b);
79     $b->set_hook_function (msg_header_add => sub {
80     shift;
81     my ($msg, $p) = @_;
82     my $hdr = $msg->header;
83     ## Newsgroups
84     my $group = $p->{newsgroups};
85     $group = 'suika.test' if $Bunshin::DEBUG;
86     $hdr->replace (newsgroups => $group);
87     $self->_my_msg_header_add ($msg, $p);
88     });
89     $b->set_hook_function (msg_body => sub {
90     shift;
91     my ($msg, $body, $p) = @_;
92     my $ct = $msg->header->field ('content-type');
93     $ct->value ('text/html');
94     $ct->parameter (charset => 'iso-2022-jp');
95     $msg->header->add (content_location => $p->{base_uri}) if $p->{base_uri};
96     $body =~ s#<br ?/?>$##;
97     $body =~ s#<br ?/?>#<br>\n#g;
98     my $meta = '';
99 wakaba 1.2 $meta .= qq{<link rev="made" href="@{[Message::Util::enentity_html ($p->{from_mail})]}">\n} if $p->{from_mail};
100     $meta .= qq{<meta name="author" content="@{[Message::Util::enentity_html ($p->{from_name})]}">\n} if $p->{from_name};
101 wakaba 1.1 my $html = <<EOH;
102     <!-- DOCTYPE html maybe PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" -->
103     <html>
104     <head>
105 wakaba 1.2 <base href="@{[Message::Util::enentity_html ($p->{base_uri})]}">
106     <title>@{[Message::Util::enentity_html (Message::Util::deentity_html ($p->{subject}))]}</title>
107 wakaba 1.1 $meta</head>
108     <body>
109     <div>
110     $body
111     </div>
112     </body>
113     EOH
114     $msg->body->value ($html);
115     });
116     }
117    
118     =head1 SEE ALSO
119    
120     Suikawari, Bunshin
121    
122     =head1 LICENSE
123    
124     Copyright 2002 wakaba E<lt>w@suika.fam.cxE<gt>.
125    
126     This program is free software; you can redistribute it and/or modify
127     it under the terms of the GNU General Public License as published by
128     the Free Software Foundation; either version 2 of the License, or
129     (at your option) any later version.
130    
131     This program is distributed in the hope that it will be useful,
132     but WITHOUT ANY WARRANTY; without even the implied warranty of
133     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
134     GNU General Public License for more details.
135    
136     You should have received a copy of the GNU General Public License
137     along with this program; see the file COPYING. If not, write to
138     the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
139     Boston, MA 02111-1307, USA.
140    
141     =head1 CHANGE
142    
143     See F<ChangeLog>.
144 wakaba 1.2 $Date: 2002/06/20 11:33:44 $
145 wakaba 1.1
146     =cut
147    
148     1;
149     ### Suikawari::TomikouKeijiban ends here

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24