51 |
$self->{'hook_'.$name} = $function; |
$self->{'hook_'.$name} = $function; |
52 |
} |
} |
53 |
|
|
54 |
|
sub set_element_decoders ($%) { |
55 |
|
my $self = shift; |
56 |
|
my %list = @_; |
57 |
|
for (keys %list) { |
58 |
|
if ($list{$_} eq 'enentity_html') { |
59 |
|
$list{$_} = \&Message::Util::enentity_html; |
60 |
|
} elsif ($list{$_} eq 'deentity_html') { |
61 |
|
$list{$_} = \&Message::Util::deentity_html; |
62 |
|
## TODO: escape_uri, unescape_uri |
63 |
|
} |
64 |
|
} |
65 |
|
$self->{element_decoder} = %list; |
66 |
|
} |
67 |
|
|
68 |
sub set_format ($$\&) { |
sub set_format ($$\&) { |
69 |
my $self = shift; |
my $self = shift; |
70 |
my $name = shift; |
my $name = shift; |
151 |
for my $i (0..$#{$self->{elements_message}}) { |
for my $i (0..$#{$self->{elements_message}}) { |
152 |
$p{$self->{elements_message}->[$i]} = ${$i+1}; |
$p{$self->{elements_message}->[$i]} = ${$i+1}; |
153 |
} |
} |
154 |
|
for my $n (keys %{$self->{element_decoder}}) { |
155 |
|
if ($p{$n} && ref $self->{element_decoder}->{$n}) { |
156 |
|
$p{$n} = &{ $self->{element_decoder}->{$n} } ($p{$n}); |
157 |
|
} |
158 |
|
} |
159 |
my $msg = &$f ($self, %p); |
my $msg = &$f ($self, %p); |
160 |
push @msg, $msg; |
push @msg, $msg; |
161 |
}gesx; |
}gesx; |