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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (hide annotations) (download)
Sun Jun 16 10:45:54 2002 UTC (22 years, 5 months ago) by wakaba
Branch: MAIN
Changes since 1.2: +3 -2 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::Default --- Internet Messages -- Definition
5     for Default Namespace of Header Fields
6    
7     =cut
8    
9     package Message::Header::Default;
10     use strict;
11     use vars qw($VERSION);
12 wakaba 1.3 $VERSION=do{my @r=(q$Revision: 1.2 $=~/\d+/g);sprintf "%d."."%02d" x $#r,@r};
13 wakaba 1.1 require Message::Header;
14    
15     our %OPTION;
16    
17     ## Case sensibility of field name
18     $OPTION{case_sensible} = 1;
19 wakaba 1.3 #$OPTION{to_be_goodcase} = \&...;
20 wakaba 1.1 $OPTION{n11n_name} = \&_name_n11n;
21     $OPTION{n11n_prefix} = \&_name_n11n;
22    
23     ## Namespace URI of this namespace
24     $OPTION{namespace_uri} = 'urn:x-suika-fam-cx:msgpm:header:default';
25    
26     ## Force & hyphened prefix name of this namespace (ex. "prefix-name")
27     $OPTION{namespace_phname} = 'default';
28     $OPTION{namespace_phname_goodcase} = 'default';
29    
30     ## `Good' & dotted prefix name of this namespace (ex. "prefix.name", "prefix2.name")
31     $OPTION{namespace_good_prefix} = 'DEFAULT';
32    
33     ## Field body data type (specified by package name)
34     $OPTION{value_type} = {
35     ':default' => ['Message::Field::Unstructured'],
36     };
37    
38 wakaba 1.2 ## mailto: URL safe level
39     $OPTION{uri_mailto_safe} = {
40     ## 1 all (no check) 2 no trace & bcc & from
41     ## 3 no sender's info 4 (default) (currently not used)
42     ## 5 only a few
43     ':default' => 1,
44     };
45    
46 wakaba 1.1 ##
47    
48     $Message::Header::NS_phname2uri{$OPTION{namespace_phname}} = $OPTION{namespace_uri};
49     $Message::Header::NS_uri2phpackage{$OPTION{namespace_uri}} = __PACKAGE__;
50    
51 wakaba 1.2 ## $self->_goodcase ($namespace_package_name, $field_name, \%option)
52     sub _goodcase ($$$\%) {
53 wakaba 1.1 no strict 'refs';
54     my $self = shift;
55 wakaba 1.2 my ($nspack, $name, $option) = @_;
56 wakaba 1.1 if (${$nspack.'::OPTION'}{goodcase}->{$name}) {
57     return ${$nspack.'::OPTION'}{goodcase}->{$name};
58     }
59     $name =~ s/(?:^|-)[a-z]/uc $&/ge;
60     $name;
61     }
62    
63     sub _name_n11n ($$$) {
64     no strict 'refs';
65     my $self = shift;
66     my $nspack = shift;
67     my $name = shift;
68     unless (${$nspack.'::OPTION'}{case_sensible}) {
69     lc $name;
70     } else {
71     $name;
72     }
73     }
74    
75     package Message::Header::XCGI;
76     our %OPTION = %Message::Header::Default::OPTION;
77     $OPTION{namespace_uri} = 'urn:x-suika-fam-cx:msgpm:header:http:cgi:x';
78     $OPTION{namespace_phname} = 'x-cgi';
79     $OPTION{namespace_phname_goodcase} = 'X-CGI';
80    
81     $OPTION{case_sensible} = 0;
82     $OPTION{to_be_goodcase} = \&Message::Header::Default::_goodcase;
83    
84     $Message::Header::NS_phname2uri{$OPTION{namespace_phname}} = $OPTION{namespace_uri};
85     $Message::Header::NS_uri2phpackage{$OPTION{namespace_uri}} = __PACKAGE__;
86    
87 wakaba 1.2
88     ##
89    
90     require Message::Header::RFC822;
91    
92 wakaba 1.1 =head1 LICENSE
93    
94     Copyright 2002 wakaba E<lt>w@suika.fam.cxE<gt>.
95    
96     This program is free software; you can redistribute it and/or modify
97     it under the terms of the GNU General Public License as published by
98     the Free Software Foundation; either version 2 of the License, or
99     (at your option) any later version.
100    
101     This program is distributed in the hope that it will be useful,
102     but WITHOUT ANY WARRANTY; without even the implied warranty of
103     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
104     GNU General Public License for more details.
105    
106     You should have received a copy of the GNU General Public License
107     along with this program; see the file COPYING. If not, write to
108     the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
109     Boston, MA 02111-1307, USA.
110    
111     =head1 CHANGE
112    
113     See F<ChangeLog>.
114 wakaba 1.3 $Date: 2002/05/26 01:18:48 $
115 wakaba 1.1
116     =cut
117    
118     1;

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24