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