line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::YahooMessenger::Buddy; |
2
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
42
|
|
3
|
|
|
|
|
|
|
|
4
|
1
|
|
|
1
|
|
5
|
use constant IM_AVAILABLE => 0; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
82
|
|
5
|
1
|
|
|
1
|
|
5
|
use constant BE_RIGHT_BACK => 1; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
37
|
|
6
|
1
|
|
|
1
|
|
5
|
use constant BUSY => 2; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
43
|
|
7
|
1
|
|
|
1
|
|
5
|
use constant NOT_AT_HOME => 3; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
54
|
|
8
|
1
|
|
|
1
|
|
4
|
use constant NOT_AT_MY_DESK => 4; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
36
|
|
9
|
1
|
|
|
1
|
|
5
|
use constant NOT_IN_THE_OFFICE => 5; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
45
|
|
10
|
1
|
|
|
1
|
|
4
|
use constant ON_THE_PHONE => 6; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
42
|
|
11
|
1
|
|
|
1
|
|
4
|
use constant ON_VACATION => 7; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
37
|
|
12
|
1
|
|
|
1
|
|
5
|
use constant OUT_TO_LUNCH => 8; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
118
|
|
13
|
1
|
|
|
1
|
|
5
|
use constant STEPPED_OUT => 9; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
44
|
|
14
|
1
|
|
|
1
|
|
5
|
use constant CUSTOM_STATUS => 99; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
38
|
|
15
|
1
|
|
|
1
|
|
4
|
use constant SLEEP => 999; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
726
|
|
16
|
|
|
|
|
|
|
|
17
|
1
|
|
|
1
|
|
7
|
use constant ICON_AVAILABLE => 0; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
50
|
|
18
|
1
|
|
|
1
|
|
4
|
use constant ICON_BUSY => 1; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
32
|
|
19
|
1
|
|
|
1
|
|
4
|
use constant ICON_SLEEP => 2; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
50
|
|
20
|
|
|
|
|
|
|
|
21
|
1
|
|
|
|
|
41
|
use constant STATUS_MESSAGE => [ |
22
|
|
|
|
|
|
|
"I'm Available", |
23
|
|
|
|
|
|
|
'Be Right Back', |
24
|
|
|
|
|
|
|
'Busy', |
25
|
|
|
|
|
|
|
'Not At Home', |
26
|
|
|
|
|
|
|
'Not At My Desk', |
27
|
|
|
|
|
|
|
'Not In The Office', |
28
|
|
|
|
|
|
|
'On The Phone', |
29
|
|
|
|
|
|
|
'On Vacation', |
30
|
|
|
|
|
|
|
'Out To Lunch', |
31
|
|
|
|
|
|
|
'Stepped Out', |
32
|
1
|
|
|
1
|
|
4
|
]; |
|
1
|
|
|
|
|
1
|
|
33
|
|
|
|
|
|
|
|
34
|
1
|
|
|
1
|
|
4
|
use constant IS_ONLINE => 1; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
36
|
|
35
|
1
|
|
|
1
|
|
3
|
use constant IS_OFFLINE => 0; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
624
|
|
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub new { |
38
|
0
|
|
|
0
|
0
|
|
my $class = shift; |
39
|
0
|
|
|
|
|
|
bless { |
40
|
|
|
|
|
|
|
name => 'nobody', |
41
|
|
|
|
|
|
|
status => IM_AVAILABLE, |
42
|
|
|
|
|
|
|
custom_status => '', |
43
|
|
|
|
|
|
|
busy => ICON_AVAILABLE, |
44
|
|
|
|
|
|
|
online => IS_OFFLINE, |
45
|
|
|
|
|
|
|
session_id => 0, |
46
|
|
|
|
|
|
|
}, $class; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub name { |
50
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
51
|
0
|
0
|
|
|
|
|
$self->{name} = shift if @_; |
52
|
0
|
|
|
|
|
|
$self->{name}; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub status { |
56
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
57
|
0
|
0
|
|
|
|
|
if (@_) { |
58
|
0
|
|
|
|
|
|
$self->{status} = shift; |
59
|
0
|
0
|
|
|
|
|
$self->busy(ICON_BUSY) if $self->{status} <= STEPPED_OUT; |
60
|
0
|
0
|
|
|
|
|
$self->busy(ICON_SLEEP) if $self->{status} == SLEEP; |
61
|
0
|
0
|
0
|
|
|
|
$self->busy(ICON_AVAILABLE) |
62
|
|
|
|
|
|
|
if $self->{status} == CUSTOM_STATUS |
63
|
|
|
|
|
|
|
|| $self->{status} == IM_AVAILABLE; |
64
|
|
|
|
|
|
|
} |
65
|
0
|
|
|
|
|
|
$self->{status}; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
sub custom_status { |
69
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
70
|
0
|
0
|
|
|
|
|
if (@_) { |
71
|
0
|
|
|
|
|
|
$self->{custom_status} = shift; |
72
|
0
|
|
|
|
|
|
$self->status(CUSTOM_STATUS); |
73
|
|
|
|
|
|
|
} |
74
|
0
|
|
|
|
|
|
$self->{custom_status}; |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
sub busy { |
78
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
79
|
0
|
0
|
|
|
|
|
if (@_) { |
80
|
0
|
|
|
|
|
|
$self->{busy} = shift; |
81
|
|
|
|
|
|
|
} |
82
|
0
|
|
|
|
|
|
$self->{busy}; |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
sub online { |
86
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
87
|
0
|
0
|
|
|
|
|
if (@_) { |
88
|
0
|
|
|
|
|
|
$self->{online} = shift; |
89
|
|
|
|
|
|
|
} |
90
|
0
|
|
|
|
|
|
$self->{online}; |
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
sub session_id { |
94
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
95
|
0
|
0
|
|
|
|
|
$self->{session_id} = shift if @_; |
96
|
0
|
|
|
|
|
|
$self->{session_id}; |
97
|
|
|
|
|
|
|
} |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
sub is_online { |
100
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
101
|
0
|
|
|
|
|
|
$self->online; |
102
|
|
|
|
|
|
|
} |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
sub get_status_message { |
105
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
106
|
0
|
0
|
|
|
|
|
return unless $self->is_online; |
107
|
|
|
|
|
|
|
|
108
|
0
|
0
|
0
|
|
|
|
if ( $self->status == SLEEP ) { |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
109
|
0
|
|
|
|
|
|
return sprintf '%s', 'Sleep'; |
110
|
|
|
|
|
|
|
} |
111
|
|
|
|
|
|
|
elsif ( $self->status == CUSTOM_STATUS ) { |
112
|
0
|
|
|
|
|
|
return sprintf '%s', $self->custom_status; |
113
|
|
|
|
|
|
|
} |
114
|
|
|
|
|
|
|
elsif ( $self->status >= IM_AVAILABLE && $self->status <= STEPPED_OUT ) { |
115
|
0
|
|
|
|
|
|
return sprintf '%s', STATUS_MESSAGE->[ $self->status ]; |
116
|
|
|
|
|
|
|
} |
117
|
|
|
|
|
|
|
else { |
118
|
0
|
|
|
|
|
|
return 'Unknown'; |
119
|
|
|
|
|
|
|
} |
120
|
|
|
|
|
|
|
} |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
sub to_string { |
123
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
124
|
0
|
0
|
|
|
|
|
if ( $self->is_online ) { |
125
|
|
|
|
|
|
|
return |
126
|
0
|
0
|
|
|
|
|
sprintf "%s %s (%s)", |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
127
|
|
|
|
|
|
|
$self->busy == ICON_AVAILABLE ? ':-)' |
128
|
|
|
|
|
|
|
: $self->busy == ICON_BUSY ? ':-@' |
129
|
|
|
|
|
|
|
: $self->busy == ICON_SLEEP ? '|-I' |
130
|
|
|
|
|
|
|
: '?', |
131
|
|
|
|
|
|
|
$self->name, |
132
|
|
|
|
|
|
|
$self->get_status_message; |
133
|
|
|
|
|
|
|
} |
134
|
|
|
|
|
|
|
else { |
135
|
0
|
|
|
|
|
|
return sprintf "%s %s (%s)", ' ', $self->name, 'Not online'; |
136
|
|
|
|
|
|
|
} |
137
|
|
|
|
|
|
|
} |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
1; |
140
|
|
|
|
|
|
|
__END__ |