Mercurial > hg > Applications > Calcon
changeset 12:b55c65241693
*** empty log message ***
author | kono |
---|---|
date | Thu, 23 Mar 2006 21:56:08 +0900 |
parents | d8035079fa42 |
children | 3ac4a1a56ca3 |
files | Calcon.pm pool.pl |
diffstat | 2 files changed, 68 insertions(+), 17 deletions(-) [+] |
line wrap: on
line diff
--- a/Calcon.pm Thu Mar 23 19:50:56 2006 +0900 +++ b/Calcon.pm Thu Mar 23 21:56:08 2006 +0900 @@ -3247,7 +3247,7 @@ sub initialize { my ($self) = @_; $self->SUPER::initialize(); - $self->{'vcs_count'} = "PIM00001"; + $self->{'vcf_count'} = "PIM00001"; # open(OUTPUT,"| nkf -w16") or die("nkf required."); # select OUTPUT; } @@ -3265,9 +3265,13 @@ my (%record) = %{$record}; my $data; $self->{'item'} = 1; - $self->{'vcs_count'}++; - open(OUTPUT,"| nkf -s >".$self->{'vcs_count'}.".VCF"); - select OUTPUT; + if (! $self->{'-vcard-opening'}) { + open(VCS,"| nkf -s >".$self->{'vcf_count'}++.".VCF"); + $self->{'-vcard-opening'} = 1; + select VCS; + } else { + select VCS; + } if(defined($record{'office'})) { $record{'office'} = 'etc' if(! $record{'office'}) ; @@ -3396,16 +3400,16 @@ my $data; my $timezone = "Asia/Tokyo"; - $self->{'vcs_count'}++; - open(OUTPUT,"|nkf -s >".$self->{'vcs_count'}.".VCS"); - select OUTPUT; - if (! $self->{'-vcal-opening'}) { - print(<<"EOFEOF"); + open(VCS,"| nkf -s >".$self->{'vcf_count'}++.".VCF"); + $self->{'-vcal-opening'} = 1; + select VCS; + print(<<"EOFEOF"); BEGIN:VCALENDAR VERSION:1.0 EOFEOF - $self->{'-vcal-opening'} = 1; + } else { + select VCS; } if ($record{'date'}->is_allday() && $self->{'-fake-allday'}) { @@ -3461,11 +3465,23 @@ CATEGORIES:PERSONAL RRULE: END:VEVENT -END:VCALENDAR EOFEOF # print "\n"; } +sub end_file { + my ($self,$type) = @_; + + if ($self->{'-vcal-opening'}) { + select VCS; + $self->print(<<"EOFEOF"); +END:VCALENDAR +EOFEOF + $self->{'-vcal-opening'} = 0; + } +} + + #######################################################################/ package Calcon::File_read; @@ -3595,7 +3611,7 @@ next; } if ($self->{'-email-extract'}) { - if(s/[-a-zA-Z0-9.]+@[-a-zA-Z0-9.]+//) { + if(s/[-a-zA-Z0-9._]+@[-a-zA-Z0-9._]+//) { if (defined($record->{'mail'})) { $record->{'mail'} .= ",".$&; } else { @@ -3606,7 +3622,7 @@ } next if (! $_); if(defined $record->{$key}) { - $record->{$key} .= "\n" . $_; # append for duplicated field + $record->{$key} .= "\n " . $_; # append for duplicated field } else { push(@$keys,$key); $record->{$key} = $_; @@ -4119,6 +4135,7 @@ # Vcard / Vcal 形式を読み込む # Vcard に読みがないのが日本語向きじゃないね +# みんな勝手に拡張しているらしい use strict; # use warnings; @@ -4129,6 +4146,12 @@ sub quoted_printable { my ($d) = @_; + while ($d=~ s/\=$//) { # continuation line? + my $r = <F>; + chop($r); + $r =~ s/\r//g; + $d .= $r; + } $d =~ s/=([0-9a-fA-F][0-9a-fA-F])/sprintf("%c",hex($1))/eg; return ": ".$d; } @@ -4152,6 +4175,8 @@ s/\;ENCODING\=QUOTED\-PRINTABLE:(.*)/"ed_printable($1)/eg; if (/^begin:\s*vcalendar/i) { } elsif (/^begin:\s*vcad/i) { +} elsif (/^end:\s*vcalendar/i) { +} elsif (/^begin:\s*vcalendar/i) { } elsif (/^adr(.*):\s*(.*)/i) { $self->items($record,'address',$1,$2); } elsif (/^bday:\s*(.*)/i) { $record->{'birth'} = $self->make_date($1); } elsif (/^begin:\s*vcard/i) { $record = $self->make_record; @@ -4159,8 +4184,19 @@ } elsif (/^calscale:\s*(.*)/i) { } elsif (/^uid:\s*(.*)/i) { } elsif (/^x-gn:\s*(.*)/i) { $record->{'group'} .= $1; -} elsif (/^description:\s*/i) { $record->{'memo'} .= $1; -} elsif (/^note:\s*/i) { $record->{'memo'} .= $1; +} elsif (/^description:\s*(.*)/i) { $record->{'memo'} .= $1; +} elsif (/^class/i) { +} elsif (/^aalarm/i) { +} elsif (/^dalarm/i) { +} elsif (/^photo/i) { +} elsif (/^rrule/i) { +} elsif (/^version/i) { +} elsif (/^X-NEC-SUMMARY:/i) { +} elsif (/^X-NEC-FILENAME:/i) { +} elsif (/^X-NO:/i) { +} elsif (/^X-CLASS:/i) { +} elsif (/^X-GNO:/i) { +} elsif (/^note:\s*(.*)/i) { $record->{'memo'} .= $1; } elsif (/^dtend(.*):\s*(.*)/i) { $record->{'end-date'} = $self->date($2,$1?$1:$record->{'timezone'}); } elsif (/^dtstamp(.*):\s*(.*)/i) { $record->{'modify-date'} = $self->date($2,$1?$1:$record->{'timezone'}); } elsif (/^dtstart(.*):\s*(.*)/i) { $record->{'date'} = $self->date($2,$1?$1:$record->{'timezone'}); @@ -4181,13 +4217,17 @@ } elsif (/^version:\s*(.*)/i) { $record->{'version'} = $1; } elsif (/^X-PHONETIC-LAST-NAME:\s*(.*)/i) { $record->{'name-yomi'} .= "$1 "; } elsif (/^X-PHONETIC-FIRST-NAME:\s*(.*)/i) { $record->{'name-yomi'} .= "$1 "; -} elsif (/^SOUND.*:\s*(.*)/i) { $record->{'name-yomi'} .= "$1 "; +} elsif (/^SOUND.*:\s*(.*)/i) { $record->{'name-yomi'} .= "$1 "; + $record->{'name-yomi'} =~ s/;/ /g; } elsif (/^x-custom1:\s*(.*)/i) { $record->{'name-yomi'} = $1; } elsif (/^x-custom2:\s*(.*)/i) { $record->{'office-yomi'} = $1; } elsif (/^x-wr-calname.*:\s*(.*)/i) { $record->{'calendar'} = $1; } elsif (/^x-wr-timezone.*:\s*(.*)/i) { $record->{'timezone'} = $1; } elsif (/^item\d+(.*):\s*(.*)/i) { $self->items($record,'address',$1,$2); -} else { $record->{'extra'} .= $_; +} else { + chop; + if ($record->{'extra'}) { $record->{'extra'} .= "\n "; } + $record->{'extra'} .= $_; } } $out->end_file('');
--- a/pool.pl Thu Mar 23 19:50:56 2006 +0900 +++ b/pool.pl Thu Mar 23 21:56:08 2006 +0900 @@ -65,6 +65,7 @@ my $type = "file"; my $pool = Calcon::Pool->new(); my $last_flag = 0; +my $first_flag = 1; while(my $file = shift( @ARGV )) { my ($obj,$out,$opt); @@ -74,8 +75,18 @@ $type = $2; $opt = $3; $file = shift(@ARGV); + $first_flag = 0; } else { &usage_die(); + +# +# decode 若喝冴膵違菴茵 +# +# if ($first_flag) { +# &usage_die(); +# } else { +# $file = shift(@ARGV); +# } } if (0 && $#ARGV==1 && $ARGV[0]=~/^-output/) {