line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package EWS::Folder::Item; |
2
|
|
|
|
|
|
|
BEGIN { |
3
|
1
|
|
|
1
|
|
23
|
$EWS::Folder::Item::VERSION = '1.143070'; |
4
|
|
|
|
|
|
|
} |
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
23
|
use Moose; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
6
|
|
7
|
1
|
|
|
1
|
|
6173
|
use Moose::Util::TypeConstraints; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
9
|
|
8
|
1
|
|
|
1
|
|
2048
|
use DateTime::Format::ISO8601; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
30
|
|
9
|
1
|
|
|
1
|
|
5
|
use DateTime; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
21
|
|
10
|
1
|
|
|
1
|
|
5
|
use HTML::Strip; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
24
|
|
11
|
1
|
|
|
1
|
|
5
|
use Encode; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
600
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
has ChildFolderCount => ( |
14
|
|
|
|
|
|
|
is => 'ro', |
15
|
|
|
|
|
|
|
isa => 'Int', |
16
|
|
|
|
|
|
|
); |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
has DisplayName => ( |
19
|
|
|
|
|
|
|
is => 'ro', |
20
|
|
|
|
|
|
|
isa => 'Str', |
21
|
|
|
|
|
|
|
required => 1, |
22
|
|
|
|
|
|
|
); |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
has ExtendedProperty => ( |
25
|
|
|
|
|
|
|
is => 'ro', |
26
|
|
|
|
|
|
|
isa => 'ArrayRef', |
27
|
|
|
|
|
|
|
); |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
has FolderClass => ( |
30
|
|
|
|
|
|
|
is => 'ro', |
31
|
|
|
|
|
|
|
isa => 'Str', |
32
|
|
|
|
|
|
|
required => 0, |
33
|
|
|
|
|
|
|
); |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
has FolderId => ( |
36
|
|
|
|
|
|
|
is => 'ro', |
37
|
|
|
|
|
|
|
isa => 'Any', |
38
|
|
|
|
|
|
|
lazy_build => 1, |
39
|
|
|
|
|
|
|
); |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub _build_FolderId { |
42
|
0
|
|
|
0
|
|
|
my $self = shift; |
43
|
0
|
|
|
|
|
|
return $self->{Id}; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
has FudgeSize => ( |
47
|
|
|
|
|
|
|
is => 'ro', |
48
|
|
|
|
|
|
|
isa => 'Int', |
49
|
|
|
|
|
|
|
lazy_build => 1, |
50
|
|
|
|
|
|
|
); |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub _build_FudgeSize { |
53
|
0
|
|
|
0
|
|
|
my $self = shift; |
54
|
|
|
|
|
|
|
# This appears to be the difference between the sizes returned from Exchange |
55
|
|
|
|
|
|
|
# and those in Outlook |
56
|
0
|
|
|
|
|
|
my $size = $self->MessageSize; |
57
|
0
|
0
|
|
|
|
|
if ( defined( $self->TotalCount ) ) { |
58
|
0
|
|
|
|
|
|
$size += $self->TotalCount * 8000; |
59
|
|
|
|
|
|
|
} |
60
|
0
|
|
|
|
|
|
return $size; |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
has MessageSize => ( |
64
|
|
|
|
|
|
|
is => 'ro', |
65
|
|
|
|
|
|
|
isa => 'Int', |
66
|
|
|
|
|
|
|
lazy_build => 1, |
67
|
|
|
|
|
|
|
); |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
sub _build_MessageSize { |
70
|
0
|
|
|
0
|
|
|
my $self = shift; |
71
|
0
|
|
|
|
|
|
my $size = 0; |
72
|
0
|
|
|
|
|
|
foreach my $prop (@{$self->{ExtendedProperty}}) { |
|
0
|
|
|
|
|
|
|
73
|
0
|
0
|
|
|
|
|
if ($prop->{ExtendedFieldURI}->{PropertyTag} eq '0xe08') { |
74
|
0
|
|
|
|
|
|
$size = $prop->{Value}; |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
} |
77
|
0
|
|
|
|
|
|
return $size; |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
has ParentFolderId => ( |
81
|
|
|
|
|
|
|
is => 'ro', |
82
|
|
|
|
|
|
|
isa => 'Any', |
83
|
|
|
|
|
|
|
lazy_build => 1, |
84
|
|
|
|
|
|
|
); |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
sub _build_ParentFolderId { |
87
|
0
|
|
|
0
|
|
|
my $self = shift; |
88
|
0
|
|
|
|
|
|
return $self->{Id}; |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
has TotalCount => ( |
92
|
|
|
|
|
|
|
is => 'ro', |
93
|
|
|
|
|
|
|
isa => 'Int', |
94
|
|
|
|
|
|
|
); |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
has SubFolders => ( |
97
|
|
|
|
|
|
|
is => 'ro', |
98
|
|
|
|
|
|
|
isa => 'ArrayRef[EWS::Folder::Item]', |
99
|
|
|
|
|
|
|
lazy_build => 1, |
100
|
|
|
|
|
|
|
); |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
sub _build_SubFolders { |
103
|
0
|
|
|
0
|
|
|
my $self = shift; |
104
|
0
|
0
|
|
|
|
|
return exists $self->{items} ? $self->{items} : []; |
105
|
|
|
|
|
|
|
} |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
sub BUILDARGS { |
108
|
0
|
|
|
0
|
1
|
|
my ($class, @rest) = @_; |
109
|
0
|
0
|
|
|
|
|
my $params = (scalar @rest == 1 ? $rest[0] : {@rest}); |
110
|
|
|
|
|
|
|
|
111
|
0
|
|
|
|
|
|
return $params; |
112
|
|
|
|
|
|
|
} |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
sub SubFolder_count { |
115
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
116
|
0
|
|
|
|
|
|
return scalar @{$self->SubFolders}; |
|
0
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
} |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
has iterator => ( |
120
|
|
|
|
|
|
|
is => 'ro', |
121
|
|
|
|
|
|
|
isa => 'MooseX::Iterator::Array', |
122
|
|
|
|
|
|
|
handles => [qw/ |
123
|
|
|
|
|
|
|
next |
124
|
|
|
|
|
|
|
has_next |
125
|
|
|
|
|
|
|
peek |
126
|
|
|
|
|
|
|
reset |
127
|
|
|
|
|
|
|
/], |
128
|
|
|
|
|
|
|
lazy_build => 1, |
129
|
|
|
|
|
|
|
); |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
132
|
1
|
|
|
1
|
|
6
|
no Moose; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
sub _build_iterator { |
135
|
0
|
|
|
0
|
|
|
my $self = shift; |
136
|
0
|
|
|
|
|
|
return MooseX::Iterator::Array->new( collection => $self->SubFolders ); |
137
|
|
|
|
|
|
|
} |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
sub printAndSumSizes { |
140
|
0
|
|
|
0
|
0
|
|
my ($self, $pad) = @_; |
141
|
|
|
|
|
|
|
# my $size = $self->MessageSize; |
142
|
0
|
|
|
|
|
|
my $size = $self->FudgeSize; |
143
|
0
|
|
|
|
|
|
my $dispSize = $size; |
144
|
|
|
|
|
|
|
|
145
|
0
|
0
|
|
|
|
|
if ( $dispSize > 1024 ) { |
146
|
0
|
|
|
|
|
|
$dispSize = commify($dispSize / 1024). " KB"; |
147
|
|
|
|
|
|
|
} |
148
|
0
|
0
|
|
|
|
|
if ( $self->ChildFolderCount > 0 ) { |
149
|
0
|
|
|
|
|
|
print $pad. $self->DisplayName. ":\n"; |
150
|
0
|
|
|
|
|
|
foreach my $item (@{$self->SubFolders}) { |
|
0
|
|
|
|
|
|
|
151
|
0
|
|
|
|
|
|
$size += $item->printAndSumSizes($pad." "); |
152
|
|
|
|
|
|
|
} |
153
|
0
|
|
|
|
|
|
print $pad. $self->DisplayName. " Size=". $dispSize. " Total=$size\n"; |
154
|
|
|
|
|
|
|
} |
155
|
|
|
|
|
|
|
else { |
156
|
0
|
|
|
|
|
|
print $pad. $self->DisplayName. " Size=". $dispSize. "\n"; |
157
|
|
|
|
|
|
|
} |
158
|
0
|
|
|
|
|
|
return $size; |
159
|
|
|
|
|
|
|
} |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
sub commify { |
162
|
0
|
|
|
0
|
0
|
|
my $text = reverse sprintf "%.0f", $_[0]; |
163
|
0
|
|
|
|
|
|
$text =~ s/(\d\d\d)(?=\d)(?!d*\.)/$1,/g; |
164
|
0
|
|
|
|
|
|
return scalar reverse $text; |
165
|
|
|
|
|
|
|
} |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
sub toString { |
168
|
0
|
|
|
0
|
0
|
|
my ($self, $pad) = @_; |
169
|
|
|
|
|
|
|
|
170
|
0
|
|
|
|
|
|
print $pad. $self->DisplayName. ": Size=". $self->MessageSize. "\n"; |
171
|
0
|
0
|
|
|
|
|
if ( $self->ChildFolderCount > 0 ) { |
172
|
0
|
|
|
|
|
|
foreach my $item (@{$self->SubFolders}) { |
|
0
|
|
|
|
|
|
|
173
|
0
|
|
|
|
|
|
$item->toString($pad." "); |
174
|
|
|
|
|
|
|
} |
175
|
|
|
|
|
|
|
} |
176
|
|
|
|
|
|
|
} |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
1; |