=head1 NAME Suikawari::TomikouNikki --- Suikawari module for Tomikou Nikki Ehttp://tomikou.net/nikki/E =cut ## This file is written in EUC-japan encoding. package Suikawari::TomikouNikki; use strict; use vars qw/$VERSION/; $VERSION=do{my @r=(q$Revision: 1.1 $=~/\d+/g);sprintf "%d."."%02d" x $#r,@r}; use Message::MIME::Charset::Jcode 'jcode.pl'; sub msg_regex ($) { <<'EOH',
([0-9]+)月([0-9]+)日[^<]+ ([^<]*) ([^
([\x00-\xFF]*?)
EOH qw (date_month date_day subject misc_img_src_uri misc_img_alt body); } sub meta_regex ($) { <<'EOH',
([^ 富校日記[^<]+担当[^<]+[^0-9]+([0-9]+)期生[^<]+
(?:\xA1\xA1)?([^<]+)
[^<]+日記記者にメールを送る[^<]+[^<]+
(?:\xA1\xA1)?([^<]+)
EOH qw (misc_kisha_shoukai_uri misc_kisha_kao_uri from_name misc_kisha_kai list_info from_mail reply_info); } sub on_load_source ($$) {shift; my $b = shift; $b->set_hook_function (code_conversion => sub { jcode::euc ($_[1]) }); } sub source ($) { (uri => 'http://tomikou.net/nikki/'.((gmtime)[5]+1900).'/'); #(file => '../../nikki.html'); } sub face ($) { my %face; $face{'high-c@tomikou.net'} = <<'EOH'; q:G5-(BB7)u*C6yv4c]Y9T`OX[;eLZwZf"[Q6HAjHZ*0[.%]GUUqPNZVP]M- w,Q{{blX>~"_crO_a#L{}k^bNd-D5d4"V(|SWFhnF{Uw/ mfK-fCZNmLayiDN#SLjq)2?CbyUq8#-.j1\wD#aF8@p?463=hX2mW8z\D$mk pqx3^UvUXe{Kub/4+Ihl.wl1|(lij2+`?X4gHqdLBh?BVrN]6W)FBc.y;=>4 f8*KM;HtoIa0~c2O.s \%face); } sub on_make ($$) {shift; my $b = shift; $b->default_parameter (date_zone => '+0900'); $b->default_parameter (list_name => '富校日記'); $b->default_parameter (list_id => 'nikki.tomikou.net'); $b->default_parameter (msg_id_from => 'news@list.suika.fam.cx'); $b->default_parameter (newsgroups => 'suika.tomikou'); $b->default_parameter (urn_template => 'urn:x-tomikou-net:nikki:%YYYY;:%MM;:%DD;'); $b->set_hook_function (msg_header_add => sub { shift; my ($msg, $p) = @_; my $hdr = $msg->header; ## From my $from = $hdr->field ('from')->item ($p->{from_mail}, -by => 'addr-spec'); $from->display_name ($p->{from_name} . '@' . $p->{misc_kisha_kai}); ## Reply-to my $replyto = $from->clone; $replyto->comment_add ($p->{reply_info}); $hdr->add (reply_to => $replyto); ## Newsgroups my $group = $p->{newsgroups}; $group = 'suika.test' if $Bunshin::DEBUG; $hdr->replace (newsgroups => $group); ## Subject $hdr->replace (subject => $p->{list_name}. (length $p->{subject}? ' '.$p->{subject}: '') ); }); $b->set_hook_function (msg_body => sub { shift; my ($msg, $body, $p) = @_; ## Construct multipart $msg->header->add (content_type => 'multipart/mixed'); $msg->header->add (content_location => $p->{base_uri}) if $p->{base_uri}; ## Text part my $part1 = $msg->body->item (0); $body =~ s/^\xA1\xA1//; my @p = split /
\x0D\x0A(?:\xA1\xA1)?/, $body; my $ct = $part1->header->field ('content-type'); $ct->media_type ('text/plain'); $ct->parameter (format => 'flowed'); $ct->parameter (charset => 'iso-2022-jp'); $part1->header->replace (content_language => 'ja'); $part1->body->value ([ map { my $s = $_; $s =~ s/\x0D\x0A/\x20/gs; {value => $s} } @p ]); ## Image part if ($p->{misc_img_src_uri}) { my $part2 = $msg->body->item (1); $part2->header->add (content_type => 'multipart/alternative'); $part2->header->add (content_description => $p->{misc_img_alt}); ## message/external-body my $part2_1 = $part2->body->item (0); my $ct = $part2_1->header->field ('content-type'); $ct->value ('text/html'); $ct->parameter (charset => 'iso-2022-jp'); my $html = < $p->{list_name}
$p->{misc_img_alt}
EOH $part2_1->body->value ($html); ## message/external-body my $part2_2 = $part2->body->item (1); $part2_2->header->add (content_type => 'message/external-body'); require URI::WithBase; my $uri = URI::WithBase->new ($p->{misc_img_src_uri}, $p->{base_uri}); $part2_2->body->set_reference (url => ct => 'image/jpeg', url => $uri->abs, ); $part2_2->body->option (msg_id_from => $p->{msg_id_from}); } }); } =head1 SEE ALSO Suikawari, Bunshin =head1 LICENSE Copyright 2002 wakaba Ew@suika.fam.cxE. 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 of the License, 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 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. =head1 CHANGE See F. $Date: 2002/06/16 10:50:15 $ =cut 1; ### Suikawari::TomikouNikki ends here