line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::Lyskom::MiscInfo; |
2
|
1
|
|
|
1
|
|
6
|
use base qw{Net::Lyskom::Object}; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
86
|
|
3
|
|
|
|
|
|
|
|
4
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
30
|
|
5
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
27
|
|
6
|
1
|
|
|
1
|
|
4
|
use Carp; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
1096
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 NAME |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
Net::Lyskom::MiscInfo - objects holding misc_info data for texts. |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 SYNOPSIS |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
$mi = Net::Lyskom::MiscInfo->new(type => "recpt", data => 6); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head1 DESCRIPTION |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
Object that holds misc_info information. |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=head2 Methods |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=over |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=item ->type() |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
Returns the type of the misc_info. Can be one of the following strings: |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
recpt, cc_recpt, comm_to, comm_in, footn_to, footn_in, loc_no, |
29
|
|
|
|
|
|
|
rec_time, sent_by, sent_at, bcc_recpt |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=item ->data() |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
The data corresponding to the type. Numbers in all cases except for |
34
|
|
|
|
|
|
|
C, where it is a L object. |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=item ->loc_no() |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
The local text number. Exists in the C versions of the |
39
|
|
|
|
|
|
|
C types. |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=item ->rec_time() |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
As above, but for C. |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=item ->sent_by() |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
As above, but for C. |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=item ->sent_at() |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
As above, but for C. |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=item ->compact() |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
Class method rather than object method. Takes a misc_info list and |
56
|
|
|
|
|
|
|
puts the recipient metadata in the recipient type objects. This makes |
57
|
|
|
|
|
|
|
it very much easier to process misc_info arrays with C, |
58
|
|
|
|
|
|
|
C |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=cut |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
our %type = ( |
63
|
|
|
|
|
|
|
recpt => 0, |
64
|
|
|
|
|
|
|
cc_recpt => 1, |
65
|
|
|
|
|
|
|
comm_to => 2, |
66
|
|
|
|
|
|
|
comm_in => 3, |
67
|
|
|
|
|
|
|
footn_to => 4, |
68
|
|
|
|
|
|
|
footn_in => 5, |
69
|
|
|
|
|
|
|
loc_no => 6, |
70
|
|
|
|
|
|
|
rec_time => 7, |
71
|
|
|
|
|
|
|
sent_by => 8, |
72
|
|
|
|
|
|
|
sent_at => 9, |
73
|
|
|
|
|
|
|
bcc_recpt => 15 |
74
|
|
|
|
|
|
|
); |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
our %epyt = reverse %type; |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
sub new { |
79
|
1
|
|
|
1
|
0
|
3
|
my $s = {}; |
80
|
1
|
|
|
|
|
3
|
my $class = shift; |
81
|
1
|
|
|
|
|
5
|
my %a = @_; |
82
|
|
|
|
|
|
|
|
83
|
1
|
50
|
|
|
|
7
|
$class = ref($class) if ref($class); |
84
|
1
|
|
|
|
|
4
|
bless $s,$class; |
85
|
|
|
|
|
|
|
|
86
|
1
|
50
|
|
|
|
7
|
if (!defined($type{$a{type}})) { |
87
|
0
|
|
|
|
|
0
|
croak "Unknown MiscInfo type: $a{type}\n"; |
88
|
|
|
|
|
|
|
} |
89
|
1
|
|
|
|
|
15
|
$s->{type} = $type{$a{type}}; |
90
|
1
|
|
|
|
|
4
|
$s->{data} = $a{data}; |
91
|
|
|
|
|
|
|
|
92
|
1
|
|
|
|
|
5
|
return $s; |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
sub new_from_stream { |
96
|
15
|
|
|
15
|
0
|
21
|
my $s = {}; |
97
|
15
|
|
|
|
|
16
|
my $class = shift; |
98
|
15
|
|
|
|
|
15
|
my $arg = $_[0]; |
99
|
|
|
|
|
|
|
|
100
|
15
|
50
|
|
|
|
26
|
$class = ref($class) if ref($class); |
101
|
15
|
|
|
|
|
37
|
bless $s, $class; |
102
|
|
|
|
|
|
|
|
103
|
15
|
|
|
|
|
12
|
$s->{type} = shift @{$arg}; |
|
15
|
|
|
|
|
75
|
|
104
|
|
|
|
|
|
|
|
105
|
15
|
100
|
|
|
|
252
|
if ($s->{type} == $type{recpt}) { |
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
106
|
2
|
|
|
|
|
2
|
$s->{data} = shift @{$arg}; |
|
2
|
|
|
|
|
5
|
|
107
|
|
|
|
|
|
|
} elsif ($s->{type} == $type{cc_recpt}) { |
108
|
2
|
|
|
|
|
3
|
$s->{data} = shift @{$arg}; |
|
2
|
|
|
|
|
5
|
|
109
|
|
|
|
|
|
|
} elsif ($s->{type} == $type{comm_to}) { |
110
|
0
|
|
|
|
|
0
|
$s->{data} = shift @{$arg}; |
|
0
|
|
|
|
|
0
|
|
111
|
|
|
|
|
|
|
} elsif ($s->{type} == $type{comm_in}) { |
112
|
1
|
|
|
|
|
2
|
$s->{data} = shift @{$arg}; |
|
1
|
|
|
|
|
2
|
|
113
|
|
|
|
|
|
|
} elsif ($s->{type} == $type{footn_to}) { |
114
|
0
|
|
|
|
|
0
|
$s->{data} = shift @{$arg}; |
|
0
|
|
|
|
|
0
|
|
115
|
|
|
|
|
|
|
} elsif ($s->{type} == $type{footn_in}) { |
116
|
0
|
|
|
|
|
0
|
$s->{data} = shift @{$arg}; |
|
0
|
|
|
|
|
0
|
|
117
|
|
|
|
|
|
|
} elsif ($s->{type} == $type{loc_no}) { |
118
|
4
|
|
|
|
|
5
|
$s->{data} = shift @{$arg}; |
|
4
|
|
|
|
|
5
|
|
119
|
|
|
|
|
|
|
} elsif ($s->{type} == $type{rec_time}) { |
120
|
0
|
|
|
|
|
0
|
$s->{data} = Net::Lyskom::Time->new_from_stream($arg); |
121
|
|
|
|
|
|
|
} elsif ($s->{type} == $type{sent_by}) { |
122
|
3
|
|
|
|
|
5
|
$s->{data} = shift @{$arg}; |
|
3
|
|
|
|
|
21
|
|
123
|
|
|
|
|
|
|
} elsif ($s->{type} == $type{sent_at}) { |
124
|
3
|
|
|
|
|
16
|
$s->{data} = Net::Lyskom::Time->new_from_stream($arg); |
125
|
|
|
|
|
|
|
} elsif ($s->{type} == $type{bcc_recpt}) { |
126
|
0
|
|
|
|
|
0
|
$s->{data} = shift @{$arg}; |
|
0
|
|
|
|
|
0
|
|
127
|
|
|
|
|
|
|
} else { |
128
|
0
|
|
|
|
|
0
|
croak "Unknown misc_info type recieved from server: $s->{type}"; |
129
|
|
|
|
|
|
|
} |
130
|
15
|
|
|
|
|
55
|
return $s; |
131
|
|
|
|
|
|
|
} |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
sub type { |
134
|
1
|
|
|
1
|
1
|
571
|
my $s = shift; |
135
|
|
|
|
|
|
|
|
136
|
1
|
|
|
|
|
7
|
return $epyt{$s->{type}}; |
137
|
|
|
|
|
|
|
} |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
sub data { |
140
|
1
|
|
|
1
|
1
|
3
|
my $s = shift; |
141
|
|
|
|
|
|
|
|
142
|
1
|
50
|
|
|
|
6
|
$s->{data} = $_[0] if $_[0]; |
143
|
1
|
|
|
|
|
7
|
return $s->{data}; |
144
|
|
|
|
|
|
|
} |
145
|
|
|
|
|
|
|
|
146
|
0
|
|
|
0
|
1
|
0
|
sub loc_no {my $s = shift; return $s->{loc_no}} |
|
0
|
|
|
|
|
0
|
|
147
|
0
|
|
|
0
|
1
|
0
|
sub rec_time {my $s = shift; return $s->{rec_time}} |
|
0
|
|
|
|
|
0
|
|
148
|
0
|
|
|
0
|
1
|
0
|
sub sent_by {my $s = shift; return $s->{sent_by}} |
|
0
|
|
|
|
|
0
|
|
149
|
0
|
|
|
0
|
1
|
0
|
sub sent_at {my $s = shift; return $s->{sent_at}} |
|
0
|
|
|
|
|
0
|
|
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
sub compact { |
152
|
1
|
|
|
1
|
1
|
2
|
my $s = shift; |
153
|
1
|
|
|
|
|
2
|
my @res; |
154
|
|
|
|
|
|
|
my $last; |
155
|
|
|
|
|
|
|
|
156
|
1
|
|
|
|
|
2
|
$last = shift @_; |
157
|
1
|
|
|
|
|
3
|
foreach my $s (@_) { |
158
|
14
|
100
|
|
|
|
95
|
if ($s->{type} == $type{recpt}) { |
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
159
|
1
|
|
|
|
|
2
|
push @res,$last; |
160
|
1
|
|
|
|
|
2
|
$last = $s; |
161
|
|
|
|
|
|
|
} elsif ($s->{type} == $type{cc_recpt}) { |
162
|
2
|
|
|
|
|
3
|
push @res,$last; |
163
|
2
|
|
|
|
|
4
|
$last = $s; |
164
|
|
|
|
|
|
|
} elsif ($s->{type} == $type{comm_to}) { |
165
|
0
|
|
|
|
|
0
|
push @res,$last; |
166
|
0
|
|
|
|
|
0
|
$last = $s; |
167
|
|
|
|
|
|
|
} elsif ($s->{type} == $type{comm_in}) { |
168
|
1
|
|
|
|
|
8
|
push @res,$last; |
169
|
1
|
|
|
|
|
3
|
$last = $s; |
170
|
|
|
|
|
|
|
} elsif ($s->{type} == $type{footn_to}) { |
171
|
0
|
|
|
|
|
0
|
push @res,$last; |
172
|
0
|
|
|
|
|
0
|
$last = $s; |
173
|
|
|
|
|
|
|
} elsif ($s->{type} == $type{footn_in}) { |
174
|
0
|
|
|
|
|
0
|
push @res,$last; |
175
|
0
|
|
|
|
|
0
|
$last = $s; |
176
|
|
|
|
|
|
|
} elsif ($s->{type} == $type{loc_no}) { |
177
|
4
|
|
|
|
|
7
|
$last->{loc_no} = $s->{data}; |
178
|
|
|
|
|
|
|
} elsif ($s->{type} == $type{rec_time}) { |
179
|
0
|
|
|
|
|
0
|
$last->{rec_time} = $s->{data}; |
180
|
|
|
|
|
|
|
} elsif ($s->{type} == $type{sent_by}) { |
181
|
3
|
|
|
|
|
6
|
$last->{sent_by} = $s->{data}; |
182
|
|
|
|
|
|
|
} elsif ($s->{type} == $type{sent_at}) { |
183
|
3
|
|
|
|
|
7
|
$last->{sent_at} = $s->{data}; |
184
|
|
|
|
|
|
|
} elsif ($s->{type} == $type{bcc_recpt}) { |
185
|
0
|
|
|
|
|
0
|
push @res,$last; |
186
|
0
|
|
|
|
|
0
|
$last = $s; |
187
|
|
|
|
|
|
|
} else { |
188
|
0
|
|
|
|
|
0
|
croak "Unknown misc_info type in compact(): $s->{type}"; |
189
|
|
|
|
|
|
|
} |
190
|
|
|
|
|
|
|
} |
191
|
1
|
|
|
|
|
2
|
push @res,$last; |
192
|
1
|
|
|
|
|
6
|
return @res; |
193
|
|
|
|
|
|
|
} |
194
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
return 1; |