line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::AIM::TOC::Message; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
42
|
|
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
13
|
use Net::AIM::TOC::Config; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
604
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
sub new { |
8
|
0
|
|
|
0
|
0
|
|
my $class = shift; |
9
|
0
|
|
|
|
|
|
my $toc_type = shift; |
10
|
0
|
|
|
|
|
|
my $data = shift; |
11
|
|
|
|
|
|
|
|
12
|
0
|
|
|
|
|
|
my $self; |
13
|
|
|
|
|
|
|
|
14
|
0
|
0
|
|
|
|
|
if( $data =~ /^(ERROR):(\d*)(:(.*))?$/ ) { |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
15
|
0
|
|
|
|
|
|
$self = Net::AIM::TOC::Message::ERROR->new( $1, $2, $4, $data ); |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
elsif( $data =~ /^(IM_IN):(\w*):([T|F]):(.*)$/ ) { |
18
|
0
|
|
|
|
|
|
$self = Net::AIM::TOC::Message::IM_IN->new( $1, $2, $3, $4, $data ); |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
elsif( $data =~ /^(UPDATE_BUDDY):(\w*):([T|F]):(\d):(\d+):(\d+):(.*)?$/ ) { |
21
|
0
|
|
|
|
|
|
$self = Net::AIM::TOC::Message::UPDATE_BUDDY->new( $1, $2, $3, $4, $5, $6, $7, $data ); |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
elsif( $data =~ /^(NICK):(.*)$/ ) { |
24
|
0
|
|
|
|
|
|
$self = Net::AIM::TOC::Message::GENERIC->new( $1, $2 ); |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
elsif( $data =~ /^(SIGN_ON):(.*)$/ ) { |
27
|
0
|
|
|
|
|
|
$self = Net::AIM::TOC::Message::GENERIC->new( $1, $2 ); |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
elsif( $data =~ /^(PAUSE):(.*)$/ ) { |
30
|
0
|
|
|
|
|
|
$self = Net::AIM::TOC::Message::GENERIC->new( $1, $2 ); |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
elsif( $data =~ // ) { |
33
|
0
|
|
|
|
|
|
$self = Net::AIM::TOC::Message::BLANK_MESSAGE->new( $data ); |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
else { |
36
|
0
|
|
|
|
|
|
throw Net::AIM::TOC::Error( -text => "Invalid message format: $data" ); |
37
|
|
|
|
|
|
|
}; |
38
|
|
|
|
|
|
|
|
39
|
0
|
|
|
|
|
|
$self->{_tocType} = $toc_type; |
40
|
|
|
|
|
|
|
|
41
|
0
|
|
|
|
|
|
return( $self ); |
42
|
|
|
|
|
|
|
}; |
43
|
|
|
|
|
|
|
|
44
|
0
|
|
|
0
|
1
|
|
sub getTocType { return( $_[0]->{_tocType} ) }; |
45
|
0
|
|
|
0
|
1
|
|
sub getType { return( $_[0]->{_type} ) }; |
46
|
0
|
|
|
0
|
1
|
|
sub getMsg { return( $_[0]->{_text} ) }; |
47
|
0
|
|
|
0
|
1
|
|
sub getRawData { return( $_[0]->{_rawData} ) }; |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
package Net::AIM::TOC::Message::IM_IN; |
52
|
|
|
|
|
|
|
|
53
|
1
|
|
|
1
|
|
14
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
271
|
|
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
@Net::AIM::TOC::Message::IM_IN::ISA = qw( Net::AIM::TOC::Message ); |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub new { |
58
|
0
|
|
|
0
|
|
|
my $class = shift; |
59
|
0
|
|
|
|
|
|
my $type = shift; |
60
|
0
|
|
|
|
|
|
my $sender = shift; |
61
|
0
|
|
|
|
|
|
my $autoresponse = shift; |
62
|
0
|
|
|
|
|
|
my $msg = shift; |
63
|
0
|
|
|
|
|
|
my $data = shift; |
64
|
|
|
|
|
|
|
|
65
|
0
|
|
|
|
|
|
my $self = { |
66
|
|
|
|
|
|
|
_type => $type, |
67
|
|
|
|
|
|
|
_sender => $sender, |
68
|
|
|
|
|
|
|
_autoResponse => $autoresponse, |
69
|
|
|
|
|
|
|
_text => $msg, |
70
|
|
|
|
|
|
|
_rawData => $data |
71
|
|
|
|
|
|
|
}; |
72
|
0
|
|
|
|
|
|
bless $self, $class; |
73
|
|
|
|
|
|
|
|
74
|
0
|
|
|
|
|
|
$self->_removeHtmlTags; |
75
|
|
|
|
|
|
|
|
76
|
0
|
|
|
|
|
|
return( $self ); |
77
|
|
|
|
|
|
|
}; |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
sub _removeHtmlTags { |
80
|
0
|
|
|
0
|
|
|
my $self = shift; |
81
|
|
|
|
|
|
|
|
82
|
0
|
|
|
|
|
|
if( Net::AIM::TOC::Config::REMOVE_HTML_TAGS ) { |
83
|
0
|
|
|
|
|
|
$self->{_text} = Net::AIM::TOC::Utils::removeHtmlTags( $self->{_text} ); |
84
|
|
|
|
|
|
|
}; |
85
|
|
|
|
|
|
|
|
86
|
0
|
|
|
|
|
|
return; |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
sub isAutoResponse { |
91
|
0
|
|
|
0
|
|
|
my $self = shift; |
92
|
|
|
|
|
|
|
|
93
|
0
|
0
|
|
|
|
|
if( $self->{_autoResponse} eq 'T' ) { |
94
|
0
|
|
|
|
|
|
return( 1 ); |
95
|
|
|
|
|
|
|
}; |
96
|
|
|
|
|
|
|
|
97
|
0
|
|
|
|
|
|
return; |
98
|
|
|
|
|
|
|
}; |
99
|
|
|
|
|
|
|
|
100
|
0
|
|
|
0
|
|
|
sub getSender { return( $_[0]->{_sender} ) }; |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
package Net::AIM::TOC::Message::ERROR; |
105
|
|
|
|
|
|
|
|
106
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
310
|
|
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
@Net::AIM::TOC::Message::ERROR::ISA = qw( Net::AIM::TOC::Message ); |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
sub new { |
111
|
0
|
|
|
0
|
|
|
my $class = shift; |
112
|
0
|
|
|
|
|
|
my $type = shift; |
113
|
0
|
|
|
|
|
|
my $value = shift; |
114
|
0
|
|
0
|
|
|
|
my $text = shift || ''; |
115
|
0
|
|
0
|
|
|
|
my $data = shift || ''; |
116
|
|
|
|
|
|
|
|
117
|
0
|
|
|
|
|
|
my $self = { |
118
|
|
|
|
|
|
|
_type => $type, |
119
|
|
|
|
|
|
|
_value => $value, |
120
|
|
|
|
|
|
|
_rawData => $data, |
121
|
|
|
|
|
|
|
}; |
122
|
0
|
|
|
|
|
|
bless $self, $class; |
123
|
|
|
|
|
|
|
|
124
|
0
|
|
|
|
|
|
$self->{_text} = $self->_getErrorText( $text ); |
125
|
|
|
|
|
|
|
|
126
|
0
|
0
|
|
|
|
|
unless( $self->isRecoverable ) { |
127
|
0
|
|
|
|
|
|
throw Net::AIM::TOC::Error( -text => $self->{_text} ); |
128
|
|
|
|
|
|
|
}; |
129
|
|
|
|
|
|
|
|
130
|
0
|
|
|
|
|
|
return( $self ); |
131
|
|
|
|
|
|
|
}; |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
sub _getErrorText { |
134
|
0
|
|
|
0
|
|
|
my $self = shift; |
135
|
0
|
|
|
|
|
|
my $text = shift; |
136
|
|
|
|
|
|
|
|
137
|
0
|
|
|
|
|
|
my $raw_err = Net::AIM::TOC::Config::EVENT_ERROR_STRING( $self->{_value} ); |
138
|
0
|
|
|
|
|
|
my $err_text = sprintf( $raw_err, $text ); |
139
|
|
|
|
|
|
|
|
140
|
0
|
|
|
|
|
|
return( $err_text ); |
141
|
|
|
|
|
|
|
}; |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
sub isRecoverable { |
144
|
0
|
|
|
0
|
|
|
my $self = shift; |
145
|
0
|
0
|
|
|
|
|
if( $self->{_value} =~ /^98[0-9]/ ) { |
146
|
0
|
|
|
|
|
|
return( 0 ); |
147
|
|
|
|
|
|
|
} |
148
|
0
|
|
|
|
|
|
return( 1 ); |
149
|
|
|
|
|
|
|
}; |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
package Net::AIM::TOC::Message::UPDATE_BUDDY; |
154
|
|
|
|
|
|
|
|
155
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
249
|
|
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
@Net::AIM::TOC::Message::UPDATE_BUDDY::ISA = qw( Net::AIM::TOC::Message ); |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
sub new { |
160
|
0
|
|
|
0
|
|
|
my $class = shift; |
161
|
0
|
|
|
|
|
|
my $type = shift; |
162
|
0
|
|
|
|
|
|
my $buddy = shift; |
163
|
0
|
|
|
|
|
|
my $online = shift; |
164
|
0
|
|
|
|
|
|
my $evil = shift; |
165
|
0
|
|
|
|
|
|
my $signon_time = shift; |
166
|
0
|
|
|
|
|
|
my $idle_time = shift; |
167
|
0
|
|
|
|
|
|
my $user_class = shift; |
168
|
0
|
|
|
|
|
|
my $data = shift; |
169
|
|
|
|
|
|
|
|
170
|
0
|
|
|
|
|
|
my $self = { |
171
|
|
|
|
|
|
|
_type => $type, |
172
|
|
|
|
|
|
|
_buddy => $buddy, |
173
|
|
|
|
|
|
|
_onlineStatus => $online, |
174
|
|
|
|
|
|
|
_evilAmount => $evil, |
175
|
|
|
|
|
|
|
_signonTime => $signon_time, |
176
|
|
|
|
|
|
|
_idleTime => $idle_time, |
177
|
|
|
|
|
|
|
_userClass => $user_class, |
178
|
|
|
|
|
|
|
_rawData => $data, |
179
|
|
|
|
|
|
|
}; |
180
|
0
|
|
|
|
|
|
bless $self, $class; |
181
|
|
|
|
|
|
|
|
182
|
0
|
|
|
|
|
|
return( $self ); |
183
|
|
|
|
|
|
|
}; |
184
|
|
|
|
|
|
|
|
185
|
0
|
|
|
0
|
|
|
sub getBuddy { return( $_[0]->{_buddy} ) }; |
186
|
0
|
|
|
0
|
|
|
sub getOnlineStatus { return( $_[0]->{_onlineStatus} ) }; |
187
|
0
|
|
|
0
|
|
|
sub getEvilAmount { return( $_[0]->{_evilAmount} ) }; |
188
|
0
|
|
|
0
|
|
|
sub getSignonTime { return( $_[0]->{_signonTime} ) }; |
189
|
0
|
|
|
0
|
|
|
sub getIdleTime { return( $_[0]->{_idleTime} ) }; |
190
|
0
|
|
|
0
|
|
|
sub getUserClass { return( $_[0]->{_userClass} ) }; |
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
package Net::AIM::TOC::Message::GENERIC; |
195
|
|
|
|
|
|
|
|
196
|
1
|
|
|
1
|
|
4
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
86
|
|
197
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
@Net::AIM::TOC::Message::GENERIC::ISA = qw( Net::AIM::TOC::Message ); |
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
sub new { |
201
|
0
|
|
|
0
|
|
|
my $class = shift; |
202
|
0
|
|
|
|
|
|
my $type = shift; |
203
|
0
|
|
|
|
|
|
my $text = shift; |
204
|
|
|
|
|
|
|
|
205
|
0
|
|
|
|
|
|
my $self = { |
206
|
|
|
|
|
|
|
_type => $type, |
207
|
|
|
|
|
|
|
_text => $text, |
208
|
|
|
|
|
|
|
_rawData => $text, |
209
|
|
|
|
|
|
|
}; |
210
|
0
|
|
|
|
|
|
bless $self, $class; |
211
|
|
|
|
|
|
|
|
212
|
0
|
|
|
|
|
|
return( $self ); |
213
|
|
|
|
|
|
|
}; |
214
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
# This sometimes comes through (esp. at signon) |
218
|
|
|
|
|
|
|
package Net::AIM::TOC::Message::BLANK_MESSAGE; |
219
|
|
|
|
|
|
|
|
220
|
1
|
|
|
1
|
|
4
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
114
|
|
221
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
@Net::AIM::TOC::Message::BLANK_MESSAGE::ISA = qw( Net::AIM::TOC::Message ); |
223
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
sub new { |
225
|
0
|
|
|
0
|
|
|
my $class = shift; |
226
|
0
|
|
|
|
|
|
my $text = shift; |
227
|
|
|
|
|
|
|
|
228
|
0
|
|
|
|
|
|
my $self = { |
229
|
|
|
|
|
|
|
_type => 'BLANK_MESSAGE', |
230
|
|
|
|
|
|
|
_text => $text, |
231
|
|
|
|
|
|
|
_rawData => $text, |
232
|
|
|
|
|
|
|
}; |
233
|
0
|
|
|
|
|
|
bless $self, $class; |
234
|
|
|
|
|
|
|
|
235
|
0
|
|
|
|
|
|
return( $self ); |
236
|
|
|
|
|
|
|
}; |
237
|
|
|
|
|
|
|
|
238
|
|
|
|
|
|
|
|
239
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
1; |
241
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
|
243
|
|
|
|
|
|
|
=pod |
244
|
|
|
|
|
|
|
|
245
|
|
|
|
|
|
|
=head1 NAME |
246
|
|
|
|
|
|
|
|
247
|
|
|
|
|
|
|
Net::AIM::TOC::Message - AIM Message object |
248
|
|
|
|
|
|
|
|
249
|
|
|
|
|
|
|
=head1 DESCRIPTION |
250
|
|
|
|
|
|
|
|
251
|
|
|
|
|
|
|
The C object is returned by the C method. It provides a simple means of interrogating a received message to find out if it is an incoming instant message, error message, etc. |
252
|
|
|
|
|
|
|
|
253
|
|
|
|
|
|
|
It should never be necessary to create this object. |
254
|
|
|
|
|
|
|
|
255
|
|
|
|
|
|
|
=head1 SYNOPSIS |
256
|
|
|
|
|
|
|
|
257
|
|
|
|
|
|
|
use Error qw( :try ); |
258
|
|
|
|
|
|
|
use Net::AIM::TOC; |
259
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
try { |
261
|
|
|
|
|
|
|
my $aim = Net::AIM::TOC->new; |
262
|
|
|
|
|
|
|
$aim->sign_on( $screenname, $password ); |
263
|
|
|
|
|
|
|
|
264
|
|
|
|
|
|
|
... |
265
|
|
|
|
|
|
|
|
266
|
|
|
|
|
|
|
my $msgObj = $aim->recv_from_aol; |
267
|
|
|
|
|
|
|
if( $msgObj->getType eq 'IM_IN' ) { |
268
|
|
|
|
|
|
|
print $msgObj->getMsg, "\n"; |
269
|
|
|
|
|
|
|
|
270
|
|
|
|
|
|
|
... |
271
|
|
|
|
|
|
|
|
272
|
|
|
|
|
|
|
|
273
|
|
|
|
|
|
|
=head1 CLASS INTERFACE |
274
|
|
|
|
|
|
|
|
275
|
|
|
|
|
|
|
=head2 OBJECT METHODS |
276
|
|
|
|
|
|
|
|
277
|
|
|
|
|
|
|
=over 4 |
278
|
|
|
|
|
|
|
|
279
|
|
|
|
|
|
|
=item getType () |
280
|
|
|
|
|
|
|
|
281
|
|
|
|
|
|
|
Returns the type of the message. The type can be one of the following (see the Toc PROTOCOL document for a full explanation): |
282
|
|
|
|
|
|
|
|
283
|
|
|
|
|
|
|
-IM_IN |
284
|
|
|
|
|
|
|
-ERROR |
285
|
|
|
|
|
|
|
-UPDATE_BUDDY |
286
|
|
|
|
|
|
|
-NICK |
287
|
|
|
|
|
|
|
|
288
|
|
|
|
|
|
|
=item getMsg () |
289
|
|
|
|
|
|
|
|
290
|
|
|
|
|
|
|
Returns the content of the message (only available to IM_IN and ERROR messages). |
291
|
|
|
|
|
|
|
|
292
|
|
|
|
|
|
|
=item getRawData () |
293
|
|
|
|
|
|
|
|
294
|
|
|
|
|
|
|
Returns the raw message as it was received. |
295
|
|
|
|
|
|
|
|
296
|
|
|
|
|
|
|
=item getTocType () |
297
|
|
|
|
|
|
|
|
298
|
|
|
|
|
|
|
Returns the type of TOC of the message. The type returned is an integer which can be one of the following: |
299
|
|
|
|
|
|
|
|
300
|
|
|
|
|
|
|
-1 (SIGNON) |
301
|
|
|
|
|
|
|
-2 (DATA) |
302
|
|
|
|
|
|
|
-5 (KEEPALIVE) |
303
|
|
|
|
|
|
|
|
304
|
|
|
|
|
|
|
=item getSender () |
305
|
|
|
|
|
|
|
|
306
|
|
|
|
|
|
|
Returns sender of the instant message (only available to IM_IN messages). |
307
|
|
|
|
|
|
|
|
308
|
|
|
|
|
|
|
=item isAutoResponse () |
309
|
|
|
|
|
|
|
|
310
|
|
|
|
|
|
|
Returns true if the message was an auto-generated response (only available to IM_IN messages). |
311
|
|
|
|
|
|
|
|
312
|
|
|
|
|
|
|
=item getBuddy () |
313
|
|
|
|
|
|
|
|
314
|
|
|
|
|
|
|
Returns the buddy name (only available to UPDATE_BUDDY messages). |
315
|
|
|
|
|
|
|
|
316
|
|
|
|
|
|
|
=item getOnlineStatus () |
317
|
|
|
|
|
|
|
|
318
|
|
|
|
|
|
|
Returns the online status of the buddy (only available to UPDATE_BUDDY messages). |
319
|
|
|
|
|
|
|
|
320
|
|
|
|
|
|
|
=item getEvilAmount () |
321
|
|
|
|
|
|
|
|
322
|
|
|
|
|
|
|
Returns the evil amount of the buddy (only available to UPDATE_BUDDY messages). |
323
|
|
|
|
|
|
|
|
324
|
|
|
|
|
|
|
=item getSignonTime () |
325
|
|
|
|
|
|
|
|
326
|
|
|
|
|
|
|
Returns the time (in epoch) at which the buddy signed on (only available to UPDATE_BUDDY messages). |
327
|
|
|
|
|
|
|
|
328
|
|
|
|
|
|
|
=item getIdleTime () |
329
|
|
|
|
|
|
|
|
330
|
|
|
|
|
|
|
Returns the idle time (in minutes) of the buddy (only available to UPDATE_BUDDY messages). |
331
|
|
|
|
|
|
|
|
332
|
|
|
|
|
|
|
=item getUserClass () |
333
|
|
|
|
|
|
|
|
334
|
|
|
|
|
|
|
Returns the user class of the buddy (only available to UPDATE_BUDDY messages). |
335
|
|
|
|
|
|
|
|
336
|
|
|
|
|
|
|
=back |
337
|
|
|
|
|
|
|
|
338
|
|
|
|
|
|
|
=head1 KNOWN BUGS |
339
|
|
|
|
|
|
|
|
340
|
|
|
|
|
|
|
None, but that does not mean there are not any. |
341
|
|
|
|
|
|
|
|
342
|
|
|
|
|
|
|
=head1 SEE ALSO |
343
|
|
|
|
|
|
|
|
344
|
|
|
|
|
|
|
C |
345
|
|
|
|
|
|
|
|
346
|
|
|
|
|
|
|
=head1 AUTHOR |
347
|
|
|
|
|
|
|
|
348
|
|
|
|
|
|
|
Alistair Francis, http://search.cpan.org/~friffin/ |
349
|
|
|
|
|
|
|
|
350
|
|
|
|
|
|
|
=cut |
351
|
|
|
|
|
|
|
|
352
|
|
|
|
|
|
|
|