File Coverage

blib/lib/Net/OSCAR/Callbacks/1/service_redirect_response.pm
Criterion Covered Total %
statement 10 10 100.0
branch n/a
condition n/a
subroutine 4 4 100.0
pod n/a
total 14 14 100.0


line stmt bran cond sub pod time code
1             package Net::OSCAR::Callbacks;
2             BEGIN {
3 1     1   34 $Net::OSCAR::Callbacks::VERSION = '1.928';
4             }
5 1     1   12 use strict;
  1         2  
  1         43  
6 1     1   4 use warnings;
  1         3  
  1         47  
7 1     1   6 use vars qw($connection $snac $conntype $family $subtype $data $reqid $reqdata $session $protobit %data);
  1         12  
  1         481  
8             sub {
9              
10             my $conntype;
11             my %chatdata;
12              
13             my $svctype = $data{service_type};
14              
15             my $svcmap = tlv();
16             $svcmap->{$_} = $_ foreach (CONNTYPE_LOGIN, CONNTYPE_CHATNAV, CONNTYPE_CHAT, CONNTYPE_ADMIN, CONNTYPE_BOS, CONNTYPE_ICON);
17             $conntype = $svcmap->{$svctype} || sprintf("unknown (0x%04X)", $svctype);
18             if($svctype == CONNTYPE_CHAT) {
19             %chatdata = %{$session->{chats}->{$reqid}};
20             $conntype = "chat $chatdata{name}";
21             }
22              
23             $connection->log_print(OSCAR_DBG_NOTICE, "Got redirect for $svctype.");
24              
25             my $newconn = $session->addconn(auth => $data{auth_cookie}, conntype => $svctype, description => $conntype, peer => $data{server_ip});
26             if($svctype == CONNTYPE_CHAT) {
27             $session->{chats}->{$reqid} = $newconn;
28             my($key, $val);
29             while(($key, $val) = each(%chatdata)) { $session->{chats}->{$reqid}->{$key} = $val; }
30             }
31              
32             };