line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
=pod |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=head1 NAME |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
Net::OSCAR::ServerCallbacks -- Process responses from OSCAR client |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 VERSION |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
version 1.928 |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=cut |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
package Net::OSCAR::ServerCallbacks; |
14
|
|
|
|
|
|
|
BEGIN { |
15
|
1
|
|
|
1
|
|
29
|
$Net::OSCAR::ServerCallbacks::VERSION = '1.928'; |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
$REVISION = '$Revision$'; |
19
|
|
|
|
|
|
|
|
20
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
27
|
|
21
|
1
|
|
|
1
|
|
4
|
use Carp; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
56
|
|
22
|
|
|
|
|
|
|
|
23
|
1
|
|
|
1
|
|
5
|
use Net::OSCAR::Common qw(:all); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
334
|
|
24
|
1
|
|
|
1
|
|
5
|
use Net::OSCAR::Constants; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
97
|
|
25
|
1
|
|
|
1
|
|
4
|
use Net::OSCAR::Utility; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
112
|
|
26
|
1
|
|
|
1
|
|
5
|
use Net::OSCAR::TLV; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
42
|
|
27
|
1
|
|
|
1
|
|
5
|
use Net::OSCAR::Buddylist; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
17
|
|
28
|
1
|
|
|
1
|
|
6
|
use Net::OSCAR::_BLInternal; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
22
|
|
29
|
1
|
|
|
1
|
|
4
|
use Net::OSCAR::XML; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
57
|
|
30
|
|
|
|
|
|
|
|
31
|
1
|
|
|
1
|
|
5
|
use Digest::MD5 qw(md5); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
33
|
|
32
|
1
|
|
|
1
|
|
5
|
use POSIX qw(ctime); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
7
|
|
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
our %protohandlers; |
35
|
|
|
|
|
|
|
our $SESSIONS = bltie(); |
36
|
|
|
|
|
|
|
our $SCREENNAMES = bltie(); |
37
|
|
|
|
|
|
|
our %COOKIES; |
38
|
|
|
|
|
|
|
$SCREENNAMES->{somedude} = {sn => "Some Dude", pw => "somepass", email => 'some@dude.com', blist => [qw(SomeDude OtherDude)]}; |
39
|
|
|
|
|
|
|
$SCREENNAMES->{otherdude} = {sn => "Other Dude", pw => "otherpass", email => 'other@dude.com', blist => [qw(SomeDude OtherDude)]}; |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub srv_send_error($$$) { |
43
|
0
|
|
|
0
|
0
|
|
my($connection, $family, $errno) = @_; |
44
|
|
|
|
|
|
|
|
45
|
0
|
|
|
|
|
|
$connection->proto_send(family => $family, protobit => "error", protodata => {errno => $errno}); |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub process_snac($$) { |
49
|
0
|
|
|
0
|
0
|
|
our($connection, $snac) = @_; |
50
|
0
|
|
|
|
|
|
our($conntype, $family, $subtype, $data, $reqid) = ($connection->{conntype}, $snac->{family}, $snac->{subtype}, $snac->{data}, $snac->{reqid}); |
51
|
0
|
|
|
|
|
|
our $screenname = $connection->{screenname}; |
52
|
|
|
|
|
|
|
|
53
|
0
|
|
|
|
|
|
our $reqdata = delete $connection->{reqdata}->[$family]->{pack("N", $reqid)}; |
54
|
0
|
|
|
|
|
|
our $session = $connection->{session}; |
55
|
|
|
|
|
|
|
|
56
|
0
|
|
|
|
|
|
our $protobit = snac_to_protobit(%$snac); |
57
|
0
|
0
|
|
|
|
|
if(!$protobit) { |
58
|
0
|
|
|
|
|
|
return $session->callback_snac_unknown($connection, $snac, $data); |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
0
|
|
|
|
|
|
our %data = protoparse($session, $protobit)->unpack($data); |
62
|
0
|
|
|
|
|
|
$connection->log_printf(OSCAR_DBG_DEBUG, "Got SNAC 0x%04X/0x%04X: %s", $snac->{family}, $snac->{subtype}, $protobit); |
63
|
|
|
|
|
|
|
|
64
|
0
|
0
|
|
|
|
|
if(!exists($protohandlers{$protobit})) { |
65
|
0
|
|
|
|
|
|
$protohandlers{$protobit} = eval { |
66
|
0
|
|
|
|
|
|
require "Net/OSCAR/ServerCallbacks/$family/$protobit.pm"; |
67
|
|
|
|
|
|
|
}; |
68
|
0
|
0
|
|
|
|
|
if($@) { |
69
|
0
|
|
|
|
|
|
my $olderr = $@; |
70
|
0
|
|
|
|
|
|
$protohandlers{$protobit} = eval { |
71
|
0
|
|
|
|
|
|
require "Net/OSCAR/ServerCallbacks/0/$protobit.pm"; |
72
|
|
|
|
|
|
|
}; |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
0
|
0
|
|
|
|
|
if($protohandlers{$protobit}) { |
77
|
0
|
|
|
|
|
|
$protohandlers{$protobit}->(); |
78
|
|
|
|
|
|
|
} else { |
79
|
|
|
|
|
|
|
#srv_send_error($connection, $family, 1); |
80
|
0
|
|
|
|
|
|
print "Unhandled protobit: $protobit\n"; |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
1; |