/[suikacvs]/messaging/manakai/lib/Message/Header/RFC822.pm
Suika

Contents of /messaging/manakai/lib/Message/Header/RFC822.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.4 - (hide annotations) (download)
Sun Jun 16 10:45:54 2002 UTC (22 years, 5 months ago) by wakaba
Branch: MAIN
Changes since 1.3: +5 -4 lines
2002-06-16  wakaba <w@suika.fam.cx>

	* Header.pm (_n11n_field_name): Check namespace definition's
	case_sensible option.
	* Entity.pm (_add_ua): Removed.  (Moved to Message::Field::UA.)

1 wakaba 1.1
2     =head1 NAME
3    
4     Message::Header::RFC822 --- Internet Messages -- Definition
5     for RFC822 Namespaces of Header Fields
6    
7     =cut
8    
9     package Message::Header::RFC822;
10     use strict;
11     use vars qw($VERSION);
12 wakaba 1.4 $VERSION=do{my @r=(q$Revision: 1.3 $=~/\d+/g);sprintf "%d."."%02d" x $#r,@r};
13 wakaba 1.1 require Message::Header::Default;
14    
15     our %OPTION = %Message::Header::Default::OPTION;
16     $OPTION{namespace_uri} = 'urn:x-suika-fam-cx:msgpm:header:mail:rfc822';
17     $OPTION{namespace_phname} = 'rfc822';
18     $OPTION{namespace_phname_goodcase} = 'RFC822';
19    
20     $OPTION{case_sensible} = 0;
21    
22     $OPTION{goodcase} = {
23     fax => 'FAX',
24     'pics-label' => 'PICS-Label',
25     'list-url' => 'List-URL',
26     'list-id' => 'List-ID',
27     'message-id' => 'Message-ID',
28     'mime-version' => 'MIME-Version',
29     'nic' => 'NIC',
30     'nntp-posting-date' => 'NNTP-Posting-Date',
31     'nntp-posting-host' => 'NNTP-Posting-Host',
32     url => 'URL',
33     'x-dearfriend' => 'X-DearFriend',
34     'x-jsmail-priority' => 'X-JsMail-Priority',
35     'x-mime-autoconverted' => 'X-MIME-Autoconverted',
36     'x-mimeole' => 'X-MimeOLE',
37 wakaba 1.3 'x-ml-count' => 'X-ML-Count',
38     'x-ml-info' => 'X-ML-Info',
39     'x-ml-name' => 'X-ML-Name',
40 wakaba 1.1 'x-msmail-priority' => 'X-MSMail-Priority',
41     'x-nntp-posting-date' => 'X-NNTP-Posting-Date',
42     'x-nntp-posting-host' => 'X-NNTP-Posting-Host',
43     'x-uidl' => 'X-UIDL',
44     'x-uri' => 'X-URI',
45     'x-url' => 'X-URL',
46     };
47     $OPTION{to_be_goodcase} = \&_goodcase;
48    
49     $OPTION{value_type} = {
50     ':default' => ['Message::Field::Unstructured'],
51    
52     date => ['Message::Field::Date'],
53    
54     received => ['Message::Field::Received'],
55     'x-received' => ['Message::Field::Received'],
56    
57     archive => ['Message::Field::ValueParams'],
58     'auto-submitted' => ['Message::Field::ValueParams'],
59     'injector-info' => ['Message::Field::ValueParams'],
60     p3p => ['Message::Field::Params'],
61     'posted-and-mailed' => ['Message::Field::ValueParams'],
62     'x-face-type' => ['Message::Field::ValueParams'],
63     'x-mozilla-draft-info' => ['Message::Field::ValueParams'],
64    
65     ## A message id
66     'message-id' => ['Message::Field::MsgID'],
67     'resent-message-id' => ['Message::Field::MsgID'],
68    
69     ## Numeric value
70     lines => ['Message::Field::Numval'],
71     'max-forwards' => ['Message::Field::Numval'],
72     'mime-version' => ['Message::Field::Numval'],
73     'x-jsmail-priority' => ['Message::Field::Numval'],
74     'x-mail-count' => ['Message::Field::Numval'],
75     'x-ml-count' => ['Message::Field::Numval'],
76     'x-priority' => ['Message::Field::Numval'],
77    
78     path => ['Message::Field::Path'],
79     'user-agent' => ['Message::Field::UA'],
80 wakaba 1.3 'x-shimbun-agent' => ['Message::Field::UA'],
81 wakaba 1.1
82     subject => ['Message::Field::Subject'],
83     'x-nsubject' => ['Message::Field::Subject'],
84    
85 wakaba 1.4 'x-face' => ['Message::Field::XFace'],
86 wakaba 1.1 };
87     for (qw(cancel-lock disposition-notification-options encoding
88     importance pics-label precedence message-type
89 wakaba 1.4 priority x-list-id sensitivity x-msmail-priority xref))
90 wakaba 1.1 {$OPTION{value_type}->{$_} = ['Message::Field::Structured']}
91     for (qw(abuse-reports-to apparently-to approved approved-by bcc cc complaints-to
92     delivered-to disposition-notification-to envelope-to
93     errors-to from mail-copies-to mail-followup-to mail-reply-to
94     notice-requested-upon-delivery-to read-receipt-to register-mail-reply-requested-by
95     reply-to return-path
96     return-receipt-to return-receipt-requested-to sender to x-abuse-reports-to
97 wakaba 1.2 x-admin x-approved x-beenthere x-biglobe-sender x-confirm-reading-to
98 wakaba 1.1 x-complaints-to x-envelope-from x-envelope-sender
99     x-envelope-to x-ml-address x-ml-command x-ml-to x-nfrom x-nto
100     x-rcpt-to x-sender x-x-sender))
101     {$OPTION{value_type}->{$_} = ['Message::Field::Addresses']}
102     for (qw(client-date date date-received delivery-date expires
103     expire-date nntp-posting-date posted posted-date received-date
104     reply-by resent-date x-originalarrivaltime x-tcup-date))
105     {$OPTION{value_type}->{$_} = ['Message::Field::Date']}
106     for (qw(article-updates in-reply-to
107     obsoletes references replaces see-also supersedes))
108     {$OPTION{value_type}->{$_} = ['Message::Field::MsgIDs']}
109     for (qw(encrypted followup-to keywords uri newsgroups posted-to))
110     {$OPTION{value_type}->{$_} = ['Message::Field::CSV']}
111     for (qw(x-brother x-boss x-classmate x-daughter x-dearfriend x-favoritesong
112     x-friend x-me
113     x-moe x-respect
114     x-sublimate x-son x-sister x-wife))
115     {$OPTION{value_type}->{$_} =[ 'Message::Field::CSV']} ## NOT M::F::XMOE!
116     for (qw(url x-home-page x-http_referer
117     x-info x-pgp-key x-ml-url x-uri x-url x-web))
118     {$OPTION{value_type}->{$_} = ['Message::Field::URI']}
119    
120     $OPTION{uri_mailto_safe} = {
121     ## 1 all (no check) 2 no trace & bcc & from
122     ## 3 no sender's info 4 (default) (currently not used)
123     ## 5 only a few
124     ':default' => 4,
125     'cc' => 5,
126     'bcc' => 1,
127     'body' => 1, ## Not entity body, but "body:" field.
128     'comments' => 5,
129     'date' => 1,
130     'from' => 1,
131     'keywords' => 5,
132     'list-id' => 1,
133     'mail-from' => 1,
134     'message-id' => 1,
135     'mime-version' => 1,
136     'received' => 1,
137     'return-path' => 1,
138     'sender' => 1,
139     'subject' => 5,
140     'summary' => 5,
141     'to' => 5,
142     'user-agent' => 3,
143     'x-face' => 2,
144     'x-mailer' => 3,
145     'x-nsubject' => 5,
146     'x-received' => 1,
147     'x400-received' => 1,
148     };
149    
150     $Message::Header::NS_phname2uri{$OPTION{namespace_phname}} = $OPTION{namespace_uri};
151     $Message::Header::NS_uri2phpackage{$OPTION{namespace_uri}} = __PACKAGE__;
152    
153     ## $self->_goodcase ($namespace_package_name, $field_name, \%option)
154     sub _goodcase ($$$\%) {
155     no strict 'refs';
156     my $self = shift;
157     my ($nspack, $name, $option) = @_;
158     return $name if $option->{format} =~ /uri-url-mailto/;
159     if ($option->{format} =~ /mail-rfc822/) {
160     if ($name eq 'cc' || $name eq 'bcc') {
161     return $name;
162     }
163     }
164     if (${$nspack.'::OPTION'}{goodcase}->{$name}) {
165     return ${$nspack.'::OPTION'}{goodcase}->{$name};
166     }
167     $name =~ s/(?:^|-)[a-z]/uc $&/ge;
168     $name;
169     }
170    
171     package Message::Header::RFC822::Resent;
172     our %OPTION = %Message::Header::RFC822::OPTION;
173     $OPTION{namespace_uri} = 'urn:x-suika-fam-cx:msgpm:header:mail:rfc822:resent';
174     $OPTION{namespace_phname} = 'resent';
175     $OPTION{namespace_phname_goodcase} = 'Resent';
176     $OPTION{namespace_phname_regex} = 'resent';
177    
178     $OPTION{uri_mailto_safe} = {
179     ':default' => 1,
180     };
181    
182     $Message::Header::NS_phname2uri{$OPTION{namespace_phname}} = $OPTION{namespace_uri};
183     $Message::Header::NS_uri2phpackage{$OPTION{namespace_uri}} = __PACKAGE__;
184    
185     package Message::Header::RFC822::Original;
186     our %OPTION = %Message::Header::RFC822::OPTION;
187     $OPTION{namespace_uri} = 'urn:x-suika-fam-cx:msgpm:header:mail:rfc822:original';
188     $OPTION{namespace_phname} = 'original';
189     $OPTION{namespace_phname_goodcase} = 'Original';
190    
191     $OPTION{value_type}->{recipient} = ['Message::Header::Structured'];
192    
193     $OPTION{uri_mailto_safe} = {
194     ':default' => 1,
195     };
196    
197     $Message::Header::NS_phname2uri{$OPTION{namespace_phname}} = $OPTION{namespace_uri};
198     $Message::Header::NS_uri2phpackage{$OPTION{namespace_uri}} = __PACKAGE__;
199    
200     package Message::Header::RFC822::Content;
201     our %OPTION = %Message::Header::RFC822::OPTION;
202     $OPTION{namespace_uri} = 'urn:x-suika-fam-cx:msgpm:header:mail:rfc822:content';
203     $OPTION{namespace_phname} = 'content';
204     $OPTION{namespace_phname_goodcase} = 'Content';
205     $OPTION{namespace_phname_regex} = 'content';
206    
207     $OPTION{goodcase} = {
208     'id' => 'ID',
209     'md5' => 'MD5',
210     'sgml-entity' => 'SGML-Entity',
211     };
212    
213     $OPTION{value_type} = {
214     ':default' => ['Message::Field::Unstructured'],
215     alias => ['Message::Field::URI'],
216     base => ['Message::Field::URI'],
217     disposition => ['Message::Field::ValueParams'],
218     duration => ['Message::Field::Numval'],
219     encoding => ['Message::Field::CSV'],
220     features => ['Message::Field::Structured'],
221     id => ['Message::Field::MsgID'],
222     language => ['Message::Field::CSV'],
223     length => ['Message::Field::Numval'],
224     location => ['Message::Field::URI'],
225     md5 => ['Message::Field::Structured'],
226     range => ['Message::Field::Structured'],
227     'script-type' => ['Message::Field::ContentType'],
228     'style-type' => ['Message::Field::ContentType'],
229     'transfer-encoding' => ['Message::Field::ValueParams'],
230     type => ['Message::Field::ContentType'],
231     version => ['Message::Field::Structured'],
232 wakaba 1.3 'x-properties' => ['Message::Field::Params'],
233 wakaba 1.1 };
234    
235     $OPTION{uri_mailto_safe} = {
236     ':default' => 1,
237     };
238    
239     $Message::Header::NS_phname2uri{$OPTION{namespace_phname}} = $OPTION{namespace_uri};
240     $Message::Header::NS_uri2phpackage{$OPTION{namespace_uri}} = __PACKAGE__;
241    
242     package Message::Header::RFC822::List;
243     our %OPTION = %Message::Header::RFC822::OPTION;
244     $OPTION{namespace_uri} = 'urn:x-suika-fam-cx:msgpm:header:mail:rfc822:list';
245     $OPTION{namespace_phname} = 'list';
246     $OPTION{namespace_phname_goodcase} = 'List';
247    
248     $OPTION{goodcase} = {
249     'id' => 'ID',
250     };
251    
252     $OPTION{value_type} = {
253     ':default' => ['Message::Field::Unstructured'],
254    
255 wakaba 1.4 id => ['Message::Field::ListID'],
256 wakaba 1.1 software => ['Message::Field::UA'],
257    
258     archive => ['Message::Field::CSV'],
259     digest => ['Message::Field::CSV'],
260     help => ['Message::Field::CSV'],
261     owner => ['Message::Field::CSV'],
262     post => ['Message::Field::CSV'],
263     subscribe => ['Message::Field::CSV'],
264     unsubscribe => ['Message::Field::CSV'],
265     url => ['Message::Field::CSV'],
266     };
267    
268     $OPTION{uri_mailto_safe} = {
269     ':default' => 1,
270     };
271    
272     $Message::Header::NS_phname2uri{$OPTION{namespace_phname}} = $OPTION{namespace_uri};
273     $Message::Header::NS_uri2phpackage{$OPTION{namespace_uri}} = __PACKAGE__;
274    
275     =head1 LICENSE
276    
277     Copyright 2002 wakaba E<lt>w@suika.fam.cxE<gt>.
278    
279     This program is free software; you can redistribute it and/or modify
280     it under the terms of the GNU General Public License as published by
281     the Free Software Foundation; either version 2 of the License, or
282     (at your option) any later version.
283    
284     This program is distributed in the hope that it will be useful,
285     but WITHOUT ANY WARRANTY; without even the implied warranty of
286     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
287     GNU General Public License for more details.
288    
289     You should have received a copy of the GNU General Public License
290     along with this program; see the file COPYING. If not, write to
291     the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
292     Boston, MA 02111-1307, USA.
293    
294     =head1 CHANGE
295    
296     See F<ChangeLog>.
297 wakaba 1.4 $Date: 2002/06/09 11:20:24 $
298 wakaba 1.1
299     =cut
300    
301     1;

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24