51 |
|
|
52 |
=over 4 |
=over 4 |
53 |
|
|
54 |
|
=cut |
55 |
|
|
56 |
## Initialize |
## Initialize |
57 |
my %DEFAULT = ( |
my %DEFAULT = ( |
58 |
capitalize => 1, |
capitalize => 1, |
92 |
'max-forwards' => 'Message::Field::Numval', |
'max-forwards' => 'Message::Field::Numval', |
93 |
'mime-version' => 'Message::Field::Numval', |
'mime-version' => 'Message::Field::Numval', |
94 |
'x-jsmail-priority' => 'Message::Field::Numval', |
'x-jsmail-priority' => 'Message::Field::Numval', |
95 |
|
'x-mail-count' => 'Message::Field::Numval', |
96 |
|
'x-ml-count' => 'Message::Field::Numval', |
97 |
'x-priority' => 'Message::Field::Numval', |
'x-priority' => 'Message::Field::Numval', |
98 |
|
|
99 |
path => 'Message::Field::Path', |
path => 'Message::Field::Path', |
100 |
}; |
}; |
101 |
for (qw(cancel-lock importance precedence list-id |
for (qw(archive cancel-lock content-features content-md5 |
102 |
x-face x-mail-count x-msmail-priority x-priority xref)) |
disposition-notification-options encoding |
103 |
|
importance injector-info |
104 |
|
pics-label posted-and-mailed precedence list-id message-type |
105 |
|
original-recipient priority |
106 |
|
sensitivity status x-face x-msmail-priority xref)) |
107 |
{$DEFAULT{field_type}->{$_} = 'Message::Field::Structured'} |
{$DEFAULT{field_type}->{$_} = 'Message::Field::Structured'} |
108 |
for (qw(approved bcc cc complaints-to |
## Not supported yet, but to be supported... |
109 |
|
for (qw(abuse-reports-to apparently-to approved approved-by bcc cc complaints-to |
110 |
delivered-to disposition-notification-to envelope-to |
delivered-to disposition-notification-to envelope-to |
111 |
errors-to fcc from mail-followup-to mail-followup-cc |
errors-to from mail-copies-to mail-followup-to mail-reply-to |
112 |
mail-reply-to |
notice-requested-upon-delivery-to read-receipt-to register-mail-reply-requested-by |
113 |
notice-requested-upon-delivery-to reply-to resent-bcc |
reply-to resent-bcc |
114 |
resent-cc resent-to resent-from resent-sender return-path |
resent-cc resent-to resent-from resent-sender return-path |
115 |
return-receipt-to sender to x-approved x-beenthere |
return-receipt-to return-receipt-requested-to sender to x-abuse-reports-to |
116 |
|
x-admin x-approved |
117 |
|
x-beenthere |
118 |
|
x-confirm-reading-to |
119 |
x-complaints-to x-envelope-from x-envelope-sender |
x-complaints-to x-envelope-from x-envelope-sender |
120 |
x-envelope-to x-ml-address x-ml-command x-ml-to x-nfrom x-nto)) |
x-envelope-to x-ml-address x-ml-command x-ml-to x-nfrom x-nto |
121 |
|
x-rcpt-to x-sender x-x-sender)) |
122 |
{$DEFAULT{field_type}->{$_} = 'Message::Field::Address'} |
{$DEFAULT{field_type}->{$_} = 'Message::Field::Address'} |
123 |
for (qw(date date-received delivery-date expires |
for (qw(date date-received delivery-date expires |
124 |
expire-date nntp-posting-date posted reply-by resent-date x-tcup-date)) |
expire-date nntp-posting-date posted posted-date reply-by resent-date |
125 |
|
x-originalarrivaltime x-tcup-date)) |
126 |
{$DEFAULT{field_type}->{$_} = 'Message::Field::Date'} |
{$DEFAULT{field_type}->{$_} = 'Message::Field::Date'} |
127 |
for (qw(article-updates client-date content-id in-reply-to message-id |
for (qw(article-updates client-date content-id in-reply-to message-id |
128 |
references resent-message-id see-also supersedes)) |
obsoletes references replaces resent-message-id see-also supersedes)) |
129 |
{$DEFAULT{field_type}->{$_} = 'Message::Field::MsgID'} |
{$DEFAULT{field_type}->{$_} = 'Message::Field::MsgID'} |
130 |
for (qw(accept accept-charset accept-encoding accept-language |
for (qw(accept accept-charset accept-encoding accept-language |
131 |
content-language |
content-language |
132 |
content-transfer-encoding encrypted followup-to keywords |
content-transfer-encoding encrypted followup-to keywords |
133 |
list-archive list-digest list-help list-owner |
list-archive list-digest list-help list-owner |
134 |
list-post list-subscribe list-unsubscribe list-url uri newsgroups |
list-post list-subscribe list-unsubscribe list-url uri newsgroups |
135 |
|
posted-to |
136 |
x-brother x-daughter x-respect x-moe x-syster x-wife)) |
x-brother x-daughter x-respect x-moe x-syster x-wife)) |
137 |
{$DEFAULT{field_type}->{$_} = 'Message::Field::CSV'} |
{$DEFAULT{field_type}->{$_} = 'Message::Field::CSV'} |
138 |
for (qw(content-alias content-base content-location location referer |
for (qw(content-alias content-base content-location location referer |
372 |
|| $self->{option}->{field_type}->{':DEFAULT'}; |
|| $self->{option}->{field_type}->{':DEFAULT'}; |
373 |
eval "require $type" or Carp::croak ("_field_body: $type: $@"); |
eval "require $type" or Carp::croak ("_field_body: $type: $@"); |
374 |
unless ($body) { |
unless ($body) { |
375 |
$body = $type->new (-field_name => $name, |
$body = $type->new (-field_name => $name, |
376 |
-format => $self->{option}->{format}); |
-format => $self->{option}->{format} |
377 |
|
, field_name => $name, format => $self->{option}->{format}); |
378 |
} else { |
} else { |
379 |
$body = $type->parse ($body, -field_name => $name, |
$body = $type->parse ($body, -field_name => $name, |
380 |
-format => $self->{option}->{format}); |
-format => $self->{option}->{format}, |
381 |
|
field_name => $name,format => $self->{option}->{format}); |
382 |
} |
} |
383 |
} |
} |
384 |
$body; |
$body; |
398 |
map {$_->{name}} @{$self->{field}}; |
map {$_->{name}} @{$self->{field}}; |
399 |
} |
} |
400 |
|
|
401 |
=head2 $self->add ($field-name, $field-body, [$name, $body, ...]) |
=item $hdr->add ($field-name, $field-body, [$name, $body, ...]) |
402 |
|
|
403 |
Adds an new C<field>. It is not checked whether |
Adds some field name/body pairs. Even if there are |
404 |
the field which named $field_body is already exist or not. |
one or more fields named given C<$field-name>, |
405 |
If you don't want duplicated C<field>s, use C<replace> method. |
given name/body pairs are ADDed. Use C<replace> |
406 |
|
to remove same-name-fields. |
407 |
|
|
408 |
Instead of field name-body pair, you might pass some options. |
Instead of field name-body pair, you might pass some options. |
409 |
Four options are available for this method. |
Four options are available for this method. |
489 |
|
|
490 |
sub delete ($@) { |
sub delete ($@) { |
491 |
my $self = shift; |
my $self = shift; |
492 |
my %delete; |
my %delete; for (@_) {$delete{lc $_} = 1} |
|
for (@_) {$delete{lc $_} = 1} |
|
493 |
for my $field (@{$self->{field}}) { |
for my $field (@{$self->{field}}) { |
494 |
undef $field if $delete{$field->{name}}; |
undef $field if $delete{$field->{name}}; |
495 |
} |
} |