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