blib/lib/Net/OSCAR/Callbacks.pm

filter: Statementstmt 50.0% 31 / 62 Branchbran 0.0% 0 / 12 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 66.6% 10 / 15 Podpod 0.0% 0 / 3 totaltotal 43.1% 41 / 95 CC 8 SCAR 26.3
CC
8
Cov
41%
process_snac
42.0
got_buddylist
12.0
__ANON__
2.0
CRAP 13.8
« blib/lib/Net/OSCAR/Buddylist.pm ↑ Summary blib/lib/Net/OSCAR/TLV.pm »
1 =pod
2  
3 =head1 NAME
4  
5 Net::OSCAR::Callbacks -- Process responses from OSCAR server
6  
7 =head1 VERSION
8  
9 version 1.928
10  
11 =cut
12  
13 package Net::OSCAR::Callbacks;
14 4 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
15 4 $Net::OSCAR::Callbacks::VERSION = '1.928';
16 }
17  
18 4 $REVISION = '$Revision$';
19  
20 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
21 4 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
22  
23 4 ▶use Net::OSCAR::Common qw(:all);
Subroutine BEGIN: called CC=1 SCAR=0.0
24 4 ▶use Net::OSCAR::Constants;
Subroutine BEGIN: called CC=1 SCAR=0.0
25 4 ▶use Net::OSCAR::Utility;
Subroutine BEGIN: called CC=1 SCAR=0.0
26 4 ▶use Net::OSCAR::TLV;
Subroutine BEGIN: called CC=1 SCAR=0.0
27 4 ▶use Net::OSCAR::Buddylist;
Subroutine BEGIN: called CC=1 SCAR=0.0
28 4 ▶use Net::OSCAR::_BLInternal;
Subroutine BEGIN: called CC=1 SCAR=0.0
29 4 ▶use Net::OSCAR::XML;
Subroutine BEGIN: called CC=1 SCAR=0.0
30  
31 4 our %protohandlers;
32  
33 0 ▶sub process_snac($$) {
Subroutine process_snac: not called CC=6 SCAR=37.4
Pod undocumented
34 0 our($connection, $snac) = @_;
35 0 our($conntype, $family, $subtype, $data, $reqid) = ($connection->{conntype}, $snac->{family}, $snac->{subtype}, $snac->{data}, $snac->{reqid});
36  
37 0 our $reqdata = delete $connection->{reqdata}->[$family]->{pack("N", $reqid)};
38 0 our $session = $connection->{session};
39  
40 0 my $protobit = snac_to_protobit(%$snac);
41 0 ▶ if(!$protobit) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($protobit) 0 0 0
42 0 return $session->callback_snac_unknown($connection, $snac, $data);
43 }
44  
45 0 ▶ our %data = protoparse($session, $protobit)->unpack($data || "");
Condition0%0/2
$Net::OSCAR::Callbacks::data || ''
l!l
00
MC/DC0%0/1
$Net::OSCAR::Callbacks::data || ''
$Net::OSCAR::Callbacks::data
Truth table0%0/2
A
A= $Net::OSCAR::Callbacks::data
Aresult
11
00
46 0 $connection->log_printf(OSCAR_DBG_DEBUG, "Got SNAC 0x%04X/0x%04X: %s", $snac->{family}, $snac->{subtype}, $protobit);
47  
48 0 ▶ if(!exists($protohandlers{$protobit})) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $Net::OSCAR::Callbacks::protohandlers{$protobit}) 0 0 0
49 0 $protohandlers{$protobit} = eval {
50 0 require "Net/OSCAR/Callbacks/$family/$protobit.pm";
51 };
52 0 ▶ if($@) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 0 0
53 0 my $olderr = $@;
54 0 $protohandlers{$protobit} = eval {
55 0 require "Net/OSCAR/Callbacks/0/$protobit.pm";
56 };
57 0 ▶ if($@) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 0 0
58 0 ▶ $protohandlers{$protobit} = sub {};
Subroutine __ANON__: not called CC=1 SCAR=6.9
59 }
60 }
61 }
62 0 $protohandlers{$protobit}->();
63  
64 0 return 1;
65 }
66  
67 0 ▶sub got_buddylist($$) {
Subroutine got_buddylist: not called CC=3 SCAR=24.8
Pod undocumented
68 0 my($session, $connection) = @_;
69  
70 0 $connection->proto_send(protobit => "add_IM_parameters");
71 0 $connection->ready();
72  
73 0 ▶ $session->set_extended_status("") if $session->{capabilities}->{extended_status};
Branch: 1 branch
BranchTrueFalseTotal
if $session->{"capabilities"}{"extended_status"} 0 0 0
74 0 $connection->proto_send(protobit => "set_idle", protodata => {duration => 0});
75 0 $connection->proto_send(protobit => "buddylist_done");
76  
77 0 $session->{is_on} = 1;
78 0 ▶ $session->callback_signon_done() unless $session->{sent_done}++;
Branch: 1 branch
BranchTrueFalseTotal
unless $session->{"sent_done"}++ 0 0 0
79 }
80  
81 0 ▶sub default_snac_unknown($$$$) {
Subroutine default_snac_unknown: not called CC=1 SCAR=6.9
Pod undocumented
82 0 my($session, $connection, $snac, $data) = @_;
83 0 ▶ $session->log_printf_cond(OSCAR_DBG_WARN, sub { "Unknown SNAC %d/%d: %s", $snac->{family},$snac->{subtype}, hexdump($snac->{data}) });
Subroutine __ANON__: not called CC=1 SCAR=6.9
84 }
85  
86 4 1;
« blib/lib/Net/OSCAR/Buddylist.pm ↑ Summary blib/lib/Net/OSCAR/TLV.pm »