blib/lib/Net/OSCAR/_BLInternal.pm

filter: Statementstmt 6.9% 24 / 346 Branchbran 0.0% 0 / 140 Conditioncond 0.0% 0 / 96 MC/DCmcdc 0.0% 0 / 56 Subroutinesub 40.0% 8 / 20 Podpod 0.0% 0 / 8 totaltotal 4.8% 32 / 666 CC 130 SCAR 73.2
CC
130
Cov
4%
BLI_to_NO
2450.0
NO_to_BLI
1892.0
BLI_to_OSCAR
812.0
CRAP 1507.0
« blib/lib/Net/OSCAR/Connection/Direct.pm ↑ Summary blib/lib/Net/OSCAR/XML.pm »
1 =pod
2  
3 =head1 NAME
4  
5 Net::OSCAR::_BLInternal -- internal buddylist stuff
6  
7 =head1 VERSION
8  
9 version 1.928
10  
11 =head1 DESCRIPTION
12  
13 This handles conversion of Net::OSCAR to "OSCAR buddylist format",
14 and the sending of buddylist changes to the OSCAR server.
15  
16 =cut
17  
18 package Net::OSCAR::_BLInternal;
19 4 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
20 4 $Net::OSCAR::_BLInternal::VERSION = '1.928';
21 }
22  
23 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
24 4 ▶use Net::OSCAR::Common qw(:all);
Subroutine BEGIN: called CC=1 SCAR=0.0
25 4 ▶use Net::OSCAR::Constants;
Subroutine BEGIN: called CC=1 SCAR=0.0
26 4 ▶use Net::OSCAR::Utility;
Subroutine BEGIN: called CC=1 SCAR=0.0
27 4 ▶use Net::OSCAR::TLV;
Subroutine BEGIN: called CC=1 SCAR=0.0
28 4 ▶use Net::OSCAR::XML;
Subroutine BEGIN: called CC=1 SCAR=0.0
29  
30 4 ▶use vars qw($REVISION);
Subroutine BEGIN: called CC=1 SCAR=0.0
31 4 $REVISION = '$Revision$';
32  
33 0 ▶sub init_entry($$$$) {
Subroutine init_entry: not called CC=6 SCAR=37.4
Pod undocumented
34 0 my($blinternal, $type, $gid, $bid) = @_;
35  
36 0 ▶ $blinternal->{$type} ||= tlv();
Condition0%0/3
$blinternal->{$type} ||= &tlv()
l!l&&r!l&&!r
000
MC/DC0%0/2
$blinternal->{$type} ||= &tlv()
$blinternal->{$type} &tlv()
Truth table0%0/3
A ||= B
A= $blinternal->{$type}B= &tlv()
ABresult
1X1
011
000
37 0 ▶ $blinternal->{$type}->{$gid} ||= tlv();
Condition0%0/3
$blinternal->{$type}{$gid} ||= &tlv()
l!l&&r!l&&!r
000
MC/DC0%0/2
$blinternal->{$type}{$gid} ||= &tlv()
$blinternal->{$type}{$gid} &tlv()
Truth table0%0/3
A ||= B
A= $blinternal->{$type}{$gid}B= &tlv()
ABresult
1X1
011
000
38 0 ▶ $blinternal->{$type}->{$gid}->{$bid} ||= {};
Condition0%0/2
$blinternal->{$type}{$gid}{$bid} ||= {}
l!l
00
MC/DC0%0/1
$blinternal->{$type}{$gid}{$bid} ||= {}
$blinternal->{$type}{$gid}{$bid}
Truth table0%0/2
A
A= $blinternal->{$type}{$gid}{$bid}
Aresult
11
00
39 0 ▶ $blinternal->{$type}->{$gid}->{$bid}->{name} ||= "";
Condition0%0/2
$blinternal->{$type}{$gid}{$bid}{"name"} ||= ""
l!l
00
MC/DC0%0/1
$blinternal->{$type}{$gid}{$bid}{"name"} ||= ""
$blinternal->{$type}{$gid}{$bid}{"name"}
Truth table0%0/2
A
A= $blinternal->{$type}{$gid}{$bid}{"name"}
Aresult
11
00
40 0 ▶ $blinternal->{$type}->{$gid}->{$bid}->{data} ||= tlv();
Condition0%0/3
$blinternal->{$type}{$gid}{$bid}{"data"} ||= &tlv()
l!l&&r!l&&!r
000
MC/DC0%0/2
$blinternal->{$type}{$gid}{$bid}{"data"} ||= &tlv()
$blinternal->{$type}{$gid}{$bid}{"data"} &tlv()
Truth table0%0/3
A ||= B
A= $blinternal->{$type}{$gid}{$bid}{"data"}B= &tlv()
ABresult
1X1
011
000
41 0 $blinternal->{$type}->{$gid}->{$bid}->{__BLI_DIRTY} = 1;
42 0 $blinternal->{$type}->{$gid}->{$bid}->{__BLI_DELETED} = 0;
43 }
44  
45 0 ▶sub blentry_clear($%) {
Subroutine blentry_clear: not called CC=2 SCAR=17.9
Pod undocumented
46 0 my($session, %data) = @_;
47  
48 0 ▶ if(chain_exists($session->{blinternal}, $data{entry_type}, $data{group_id}, $data{buddy_id})) {
Branch: 1 branch
BranchTrueFalseTotal
if (&chain_exists($session->{"blinternal"}, $data{"entry_type"}, $data{"group_id"}, $data{"buddy_id"})) 0 0 0
49 0 $session->{blinternal}->{$data{entry_type}}->{$data{group_id}}->{$data{buddy_id}}->{__BLI_DELETED} = 1;
50 }
51 }
52  
53 0 ▶sub blentry_set($%) {
Subroutine blentry_set: not called CC=3 SCAR=24.8
Pod undocumented
54 0 my($session, %data) = @_;
55  
56 0 init_entry($session->{blinternal}, $data{entry_type}, $data{group_id}, $data{buddy_id});
57 0 my $typedata = tlv_decode($data{entry_data});
58  
59 0 ▶ $session->{blinternal}->{$data{entry_type}}->{$data{group_id}}->{$data{buddy_id}}->{name} = $data{entry_name} if $data{entry_name};
Branch: 1 branch
BranchTrueFalseTotal
if $data{"entry_name"} 0 0 0
60 0 ▶ while(my($key, $value) = each %$typedata) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = each %$typedata) 0 0 0
61 0 $session->{blinternal}->{$data{entry_type}}->{$data{group_id}}->{$data{buddy_id}}->{data}->{$key} = $value;
62 }
63 0 ▶ $session->log_printf_cond(OSCAR_DBG_DEBUG, sub { "Got BLI entry %s 0x%04X/0x%04X/0x%04X with %d bytes of data:%s", $data{entry_name}, $data{entry_type}, $data{group_id}, $data{buddy_id}, length($typedata), hexdump($data{entry_data}) });
Subroutine __ANON__: not called CC=1 SCAR=6.9
64 }
65  
66 0 ▶sub blparse($$) {
Subroutine blparse: not called CC=2 SCAR=17.9
Pod undocumented
67 0 my($session, $data) = @_;
68  
69 0 $session->{visibility} = VISMODE_PERMITALL; # If we don't have p/d data, this is default.
70  
71 0 delete $session->{blinternal};
72 0 $session->{blinternal} = tlv();
73  
74 0 ▶ while(length($data) > 4) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $data > 4) 0 0 0
75 0 my($name) = unpack("n/a*", $data);
76 0 substr($data, 0, 2+length($name)) = "";
77 0 my($gid, $bid, $type, $sublen) = unpack("n4", substr($data, 0, 8, ""));
78 0 my $typedata = substr($data, 0, $sublen, "");
79 0 blentry_set($session,
80 entry_type => $type,
81 group_id => $gid,
82 buddy_id => $bid,
83 entry_name => $name,
84 entry_data => $typedata
85 );
86 }
87  
88 0 BLI_to_NO($session);
89 }
90  
91 # Buddylist-Internal -> Net::OSCAR
92 # Sets various $session hashkeys from blinternal.
93 # That's what Brian Bli-to-no'd do. ;)
94 0 ▶sub BLI_to_NO($) {
Subroutine BLI_to_NO: not called CC=49 SCAR=78.0
Pod undocumented
95 0 my($session) = @_;
96 0 my $bli = $session->{blinternal};
97  
98 0 delete $session->{blinternal_visbid};
99 0 delete $session->{blinternal_iconbid};
100  
101 0 ▶ $session->{buddies} ||= bltie(1);
Condition0%0/3
$session->{"buddies"} ||= &bltie(1)
l!l&&r!l&&!r
000
MC/DC0%0/2
$session->{"buddies"} ||= &bltie(1)
$session->{"buddies"} &bltie(1)
Truth table0%0/3
A ||= B
A= $session->{"buddies"}B= &bltie(1)
ABresult
1X1
011
000
102 0 $session->{buddies}->{__BLI_DIRTY} = 0;
103  
104 0 ▶ $session->{permit} ||= bltie;
Condition0%0/3
$session->{"permit"} ||= &bltie()
l!l&&r!l&&!r
000
MC/DC0%0/2
$session->{"permit"} ||= &bltie()
$session->{"permit"} &bltie()
Truth table0%0/3
A ||= B
A= $session->{"permit"}B= &bltie()
ABresult
1X1
011
000
105 0 ▶ $session->{deny} ||= bltie;
Condition0%0/3
$session->{"deny"} ||= &bltie()
l!l&&r!l&&!r
000
MC/DC0%0/2
$session->{"deny"} ||= &bltie()
$session->{"deny"} &bltie()
Truth table0%0/3
A ||= B
A= $session->{"deny"}B= &bltie()
ABresult
1X1
011
000
106  
107  
108 0 foreach my $type ([2, "permit"], [3, "deny"]) {
109 0 my($num, $name) = @$type;
110  
111 0 ▶ if(exists $bli->{$num}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $bli->{$num}) 0 0 0
112 0 foreach my $bid(keys(%{$bli->{$num}->{0}})) {
113 0 my $item = $bli->{$num}->{0}->{$bid};
114  
115 0 ▶ if($item->{__BLI_DELETED}) {
Branch: 2 branches
BranchTrueFalseTotal
if ($item->{'__BLI_DELETED'}) { } 0 0 0
elsif ($item->{'__BLI_DIRTY'}) { } 0 0 0
116 0 delete $session->{$name}->{$item->{name}};
117 0 delete $bli->{$num}->{0}->{$bid};
118 } elsif($item->{__BLI_DIRTY}) {
119 0 $session->{$name}->{$item->{name}} = {buddyid => $bid};
120 0 $item->{__BLI_DIRTY} = 0;
121 }
122 }
123 }
124 }
125  
126  
127 0 foreach my $type (4, 5, 0x14) {
128 0 delete $bli->{$type}->{0}->{$_} foreach grep { $bli->{$type}->{0}->{$_}->{__BLI_DELETED} } keys %{$bli->{$type}->{0}};
129 }
130  
131 0 ▶ if(exists $bli->{4} and exists $bli->{4}->{0} and (my($visbid) = grep {exists($bli->{4}->{0}->{$_}->{data}->{0xCB})} keys %{$bli->{4}->{0}})) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $bli->{'4'} and exists $bli->{'4'}{'0'} and my($visbid) = grep({exists $bli->{'4'}{'0'}{$_}{'data'}{'203'};} keys %{$$bli{'4'}{'0'};})) { } 0 0 0
Condition0%0/6
exists $bli->{4} and exists $bli->{4}{0} and my($visbid) = grep({exists $bli->{4}{0}{$_}{"data"}{203};} keys %{$$bli{4}{0};})
!ll&&!rl&&r
000
exists $bli->{4} and exists $bli->{4}{0}
!ll&&!rl&&r
000
MC/DC0%0/3
exists $bli->{4} and exists $bli->{4}{0} and my($visbid) = grep({exists $bli->{4}{0}{$_}{"data"}{203};} keys %{$$bli{4}{0};})
exists $bli->{4} exists $bli->{4}{0} my($visbid) = grep({exists $bli->{4}{0}{$_}{"data"}{203};} keys %{$$bli{4}{0};})
Truth table0%0/4
A and B and C
A= exists $bli->{4}B= exists $bli->{4}{0}C= my($visbid) = grep({exists $bli->{4}{0}{$_}{"data"}{203};} keys %{$$bli{4}{0};})
ABCresult
0XX0
10X0
1100
1111
132 0 $session->{blinternal_visbid} = $visbid;
133 0 my $typedata = $bli->{4}->{0}->{$visbid}->{data};
134 0 ▶ if($bli->{4}->{0}->{$visbid}->{__BLI_DIRTY}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($bli->{4}{0}{$visbid}{"__BLI_DIRTY"}) 0 0 0
135 0 ▶ ($session->{visibility}) = unpack("C", $typedata->{0xCA}) if $typedata->{0xCA};
Branch: 1 branch
BranchTrueFalseTotal
if $typedata->{202} 0 0 0
136  
137 0 my $groupperms = $typedata->{0xCB};
138 0 ▶ ($session->{groupperms}) = unpack("N", $groupperms) if $groupperms;
Branch: 1 branch
BranchTrueFalseTotal
if $groupperms 0 0 0
139 0 ▶ $session->{profile} = $typedata->{0x0100} if exists($typedata->{0x0100});
Branch: 1 branch
BranchTrueFalseTotal
if exists $typedata->{256} 0 0 0
140 0 ▶ ($session->{icon_checksum}) = unpack("n", $typedata->{0x0101}) if exists($typedata->{0x0101});
Branch: 1 branch
BranchTrueFalseTotal
if exists $typedata->{257} 0 0 0
141 0 ▶ ($session->{icon_timestamp}) = unpack("N", $typedata->{0x0102}) if exists($typedata->{0x0102});
Branch: 1 branch
BranchTrueFalseTotal
if exists $typedata->{258} 0 0 0
142 0 ▶ ($session->{icon_length}) = unpack("N", $typedata->{0x0103}) if exists($typedata->{0x0103});
Branch: 1 branch
BranchTrueFalseTotal
if exists $typedata->{259} 0 0 0
143  
144 0 $session->{appdata} = $typedata;
145  
146 0 ▶ $session->set_info($session->{profile}) if exists($session->{profile});
Branch: 1 branch
BranchTrueFalseTotal
if exists $session->{"profile"} 0 0 0
147  
148 0 $bli->{4}->{0}->{$visbid}->{__BLI_DIRTY} = 0;
149 }
150 } else {
151 # No permit info - we permit everyone
152 0 $session->{visibility} = VISMODE_PERMITALL;
153 0 $session->{groupperms} = 0xFFFFFFFF;
154 }
155  
156 0 ▶ if(exists $bli->{0x14} and exists $bli->{0x14}->{0} and (my($iconbid) = grep {exists($bli->{0x14}->{0}->{$_}->{data}->{0xD5})} keys %{$bli->{0x14}->{0}})) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $bli->{20} and exists $bli->{20}{0} and my($iconbid) = grep({exists $bli->{20}{0}{$_}{"data"}{213};} keys %{$$bli{20}{0};})) 0 0 0
Condition0%0/6
exists $bli->{20} and exists $bli->{20}{0} and my($iconbid) = grep({exists $bli->{20}{0}{$_}{"data"}{213};} keys %{$$bli{20}{0};})
!ll&&!rl&&r
000
exists $bli->{20} and exists $bli->{20}{0}
!ll&&!rl&&r
000
MC/DC0%0/3
exists $bli->{20} and exists $bli->{20}{0} and my($iconbid) = grep({exists $bli->{20}{0}{$_}{"data"}{213};} keys %{$$bli{20}{0};})
exists $bli->{20} exists $bli->{20}{0} my($iconbid) = grep({exists $bli->{20}{0}{$_}{"data"}{213};} keys %{$$bli{20}{0};})
Truth table0%0/4
A and B and C
A= exists $bli->{20}B= exists $bli->{20}{0}C= my($iconbid) = grep({exists $bli->{20}{0}{$_}{"data"}{213};} keys %{$$bli{20}{0};})
ABCresult
0XX0
10X0
1100
1111
157 0 $session->{blinternal_iconbid} = $iconbid;
158 0 my $typedata = $bli->{0x14}->{0}->{$iconbid}->{data};
159 0 $session->{icon_md5sum} = $typedata->{0xD5};
160 }
161  
162  
163 0 my @ret;
164  
165 0 foreach my $gid (keys %{$bli->{1}}) {
166 0 ▶ next unless exists $bli->{1}->{$gid}->{0};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $bli->{1}{$gid}{0} 0 0 0
167 0 my $item = $bli->{1}->{$gid}->{0};
168  
169 0 ▶ if($item->{__BLI_DELETED}) {
Branch: 2 branches
BranchTrueFalseTotal
if ($item->{'__BLI_DELETED'}) { } 0 0 0
elsif ($item->{'__BLI_DIRTY'}) { } 0 0 0
170 0 delete $bli->{1}->{$gid}->{0};
171 0 ▶ next if $gid == 0 or !$item->{name};
Branch: 1 branch
BranchTrueFalseTotal
if $gid == 0 or not $item->{"name"} 0 0 0
Condition0%0/3
$gid == 0 or not $item->{"name"}
l!l&&r!l&&!r
000
MC/DC0%0/2
$gid == 0 or not $item->{"name"}
$gid == 0 not $item->{"name"}
Truth table0%0/3
A or not(B)
A= $gid == 0B= not $item->{"name"}
ABresult
1X1
011
000
172  
173 0 delete $session->{buddies}->{$item->{name}};
174 0 push @ret, {type => MODBL_WHAT_GROUP, action => MODBL_ACTION_DEL, group => $item->{name}};
175 } elsif($item->{__BLI_DIRTY}) {
176 0 $item->{__BLI_DIRTY} = 0;
177 0 ▶ next if $gid == 0 or !$item->{name};
Branch: 1 branch
BranchTrueFalseTotal
if $gid == 0 or not $item->{"name"} 0 0 0
Condition0%0/3
$gid == 0 or not $item->{"name"}
l!l&&r!l&&!r
000
MC/DC0%0/2
$gid == 0 or not $item->{"name"}
$gid == 0 not $item->{"name"}
Truth table0%0/3
A or not(B)
A= $gid == 0B= not $item->{"name"}
ABresult
1X1
011
000
178  
179 0 ▶ $session->{buddies}->{$item->{name}} ||= {};
Condition0%0/2
$session->{"buddies"}{$item->{"name"}} ||= {}
l!l
00
MC/DC0%0/1
$session->{"buddies"}{$item->{"name"}} ||= {}
$session->{"buddies"}{$item->{"name"}}
Truth table0%0/2
A
A= $session->{"buddies"}{$item->{"name"}}
Aresult
11
00
180 0 my $entry = $session->{buddies}->{$item->{name}};
181  
182 0 $entry->{__BLI_DIRTY} = 0;
183 0 $entry->{__BLI_DELETED} = 0;
184 0 $entry->{groupid} = $gid;
185 0 ▶ $entry->{members} = bltie unless $entry->{members};
Branch: 1 branch
BranchTrueFalseTotal
unless $entry->{"members"} 0 0 0
186 0 $entry->{data} = $item->{data};
187  
188 0 push @ret, {type => MODBL_WHAT_GROUP, action => MODBL_ACTION_ADD, group => $item->{name}};
189 }
190 }
191  
192 0 foreach my $gid (keys %{$bli->{0}}) {
193 0 foreach my $bid (keys %{$bli->{0}->{$gid}}) {
194 0 my $item = $bli->{0}->{$gid}->{$bid};
195 0 my $group = "";
196 0 ▶ $group = $bli->{1}->{$gid}->{0}->{name} if chain_exists($bli, 1, $gid, 0);
Branch: 1 branch
BranchTrueFalseTotal
if &chain_exists($bli, 1, $gid, 0) 0 0 0
197  
198 0 ▶ if($item->{__BLI_DELETED}) {
Branch: 2 branches
BranchTrueFalseTotal
if ($item->{'__BLI_DELETED'}) { } 0 0 0
elsif ($item->{'__BLI_DIRTY'}) { } 0 0 0
199 0 delete $bli->{0}->{$gid}->{$bid};
200 0 ▶ next if $gid == 0 or !$group;
Branch: 1 branch
BranchTrueFalseTotal
if $gid == 0 or not $group 0 0 0
Condition0%0/3
$gid == 0 or not $group
l!l&&r!l&&!r
000
MC/DC0%0/2
$gid == 0 or not $group
$gid == 0 not $group
Truth table0%0/3
A or not(B)
A= $gid == 0B= not $group
ABresult
1X1
011
000
201  
202 0 ▶ delete $session->{buddies}->{$group}->{members}->{$item->{name}} if $group;
Branch: 1 branch
BranchTrueFalseTotal
if $group 0 0 0
203 0 push @ret, {type => MODBL_WHAT_BUDDY, action => MODBL_ACTION_DEL, group => $group, buddy => $item->{name}};
204 } elsif($item->{__BLI_DIRTY}) {
205 0 $item->{__BLI_DIRTY} = 0;
206 0 ▶ next if $gid == 0 or !$group;
Branch: 1 branch
BranchTrueFalseTotal
if $gid == 0 or not $group 0 0 0
Condition0%0/3
$gid == 0 or not $group
l!l&&r!l&&!r
000
MC/DC0%0/2
$gid == 0 or not $group
$gid == 0 not $group
Truth table0%0/3
A or not(B)
A= $gid == 0B= not $group
ABresult
1X1
011
000
207  
208 0 my $comment = undef;
209 0 ▶ $comment = $item->{data}->{0x13C} if exists($item->{data}->{0x13C});
Branch: 1 branch
BranchTrueFalseTotal
if exists $item->{"data"}{316} 0 0 0
210  
211 0 my $alias = undef;
212 0 ▶ $alias = $item->{data}->{0x131} if exists($item->{data}->{0x131});
Branch: 1 branch
BranchTrueFalseTotal
if exists $item->{"data"}{305} 0 0 0
213  
214 0 ▶ $session->{buddies}->{$group}->{members}->{$item->{name}} ||= {};
Condition0%0/2
$session->{"buddies"}{$group}{"members"}{$item->{"name"}} ||= {}
l!l
00
MC/DC0%0/1
$session->{"buddies"}{$group}{"members"}{$item->{"name"}} ||= {}
$session->{"buddies"}{$group}{"members"}{$item->{"name"}}
Truth table0%0/2
A
A= $session->{"buddies"}{$group}{"members"}{$item->{"name"}}
Aresult
11
00
215 0 my $entry = $session->{buddies}->{$group}->{members}->{$item->{name}};
216 0 $entry->{__BLI_DIRTY} = 0;
217 0 $entry->{__BLI_DELETED} = 0;
218 0 $entry->{buddyid} = $bid;
219 0 ▶ $entry->{online} = 0 unless exists($entry->{online});
Branch: 1 branch
BranchTrueFalseTotal
unless exists $entry->{"online"} 0 0 0
220 0 $entry->{comment} = $comment;
221 0 $entry->{alias} = $alias;
222 0 $entry->{data} = $item->{data};
223 0 $entry->{screenname} = Net::OSCAR::Screenname->new($item->{name});
224  
225 0 push @ret, {type => MODBL_WHAT_BUDDY, action => MODBL_ACTION_ADD, group => $group, buddy => $item->{name}};
226 }
227 }
228 }
229  
230 0 return @ret;
231 }
232  
233 # Gee, guess what this does? Hint: see sub BLI_to_NO.
234 0 ▶sub NO_to_BLI($) {
Subroutine NO_to_BLI: not called CC=43 SCAR=75.5
Pod undocumented
235 0 my $session = shift;
236  
237 0 my $bli = tlv();
238 0 my $oldbli = $session->{blinternal};
239  
240 # Copy old data
241 0 ▶ my $visbid = $session->{blinternal_visbid} || int(rand(30000)) + 1;
Condition0%0/3
$session->{'blinternal_visbid'} || int(rand 30000) + 1
l!l&&r!l&&!r
000
MC/DC0%0/2
$session->{'blinternal_visbid'} || int(rand 30000) + 1
$session->{'blinternal_visbid'} int(rand 30000) + 1
Truth table0%0/3
A || B
A= $session->{'blinternal_visbid'}B= int(rand 30000) + 1
ABresult
1X1
011
000
242 0 ▶ my $iconbid = $session->{blinternal_iconbid} || 0x51F4;
Condition0%0/2
$session->{'blinternal_iconbid'} || 20980
l!l
00
MC/DC0%0/1
$session->{'blinternal_iconbid'} || 20980
$session->{'blinternal_iconbid'}
Truth table0%0/2
A
A= $session->{'blinternal_iconbid'}
Aresult
11
00
243 0 foreach my $type (keys %$oldbli) {
244 0 ▶ next if $type == 2 or $type == 3;
Branch: 1 branch
BranchTrueFalseTotal
if $type == 2 or $type == 3 0 0 0
Condition0%0/3
$type == 2 or $type == 3
l!l&&r!l&&!r
000
MC/DC0%0/2
$type == 2 or $type == 3
$type == 2 $type == 3
Truth table0%0/3
A or B
A= $type == 2B= $type == 3
ABresult
1X1
011
000
245 0 foreach my $gid (keys %{$oldbli->{$type}}) {
246 0 foreach my $bid (keys %{$oldbli->{$type}->{$gid}}) {
247 0 ▶ next if $type == 4 and $bid == $visbid;
Branch: 1 branch
BranchTrueFalseTotal
if $type == 4 and $bid == $visbid 0 0 0
Condition0%0/3
$type == 4 and $bid == $visbid
!ll&&!rl&&r
000
MC/DC0%0/2
$type == 4 and $bid == $visbid
$type == 4 $bid == $visbid
Truth table0%0/3
A and B
A= $type == 4B= $bid == $visbid
ABresult
0X0
100
111
248 0 ▶ next if $type == 0x14 and $bid == $iconbid;
Branch: 1 branch
BranchTrueFalseTotal
if $type == 20 and $bid == $iconbid 0 0 0
Condition0%0/3
$type == 20 and $bid == $iconbid
!ll&&!rl&&r
000
MC/DC0%0/2
$type == 20 and $bid == $iconbid
$type == 20 $bid == $iconbid
Truth table0%0/3
A and B
A= $type == 20B= $bid == $iconbid
ABresult
0X0
100
111
249  
250 0 init_entry($bli, $type, $gid, $bid);
251 0 $bli->{$type}->{$gid}->{$bid}->{name} = $oldbli->{$type}->{$gid}->{$bid}->{name};
252 0 foreach my $data (keys %{$oldbli->{$type}->{$gid}->{$bid}->{data}}) {
253 0 $bli->{$type}->{$gid}->{$bid}->{data}->{$data} = $oldbli->{$type}->{$gid}->{$bid}->{data}->{$data};
254 }
255 }
256 }
257 }
258  
259  
260 0 foreach my $permit (keys %{$session->{permit}}) {
261 0 init_entry($bli, 2, 0, $session->{permit}->{$permit}->{buddyid});
262 0 $bli->{2}->{0}->{$session->{permit}->{$permit}->{buddyid}}->{name} = $permit;
263 }
264  
265 0 foreach my $deny (keys %{$session->{deny}}) {
266 0 init_entry($bli, 3, 0, $session->{deny}->{$deny}->{buddyid});
267 0 $bli->{3}->{0}->{$session->{deny}->{$deny}->{buddyid}}->{name} = $deny;
268 }
269  
270 0 init_entry($bli, 4, 0, $visbid);
271 0 ▶ $bli->{4}->{0}->{$visbid}->{data}->{0xCA} = pack("C", $session->{visibility} || VISMODE_PERMITALL);
Condition0%0/2
$session->{'visibility'} || 1
l!l
00
MC/DC0%0/1
$session->{'visibility'} || 1
$session->{'visibility'}
Truth table0%0/2
A
A= $session->{'visibility'}
Aresult
11
00
272 0 ▶ $bli->{4}->{0}->{$visbid}->{data}->{0xCB} = pack("N", $session->{groupperms} || 0xFFFFFFFF);
Condition0%0/2
$session->{'groupperms'} || 4294967295
l!l
00
MC/DC0%0/1
$session->{'groupperms'} || 4294967295
$session->{'groupperms'}
Truth table0%0/2
A
A= $session->{'groupperms'}
Aresult
11
00
273  
274 #Net::OSCAR protocol extensions
275 0 ▶ $bli->{4}->{0}->{$visbid}->{data}->{0x0100} = $session->{profile} if $session->{profile};
Branch: 1 branch
BranchTrueFalseTotal
if $session->{"profile"} 0 0 0
276 0 ▶ $bli->{4}->{0}->{$visbid}->{data}->{0x0101} = pack("n", $session->{icon_checksum}) if $session->{icon_checksum};
Branch: 1 branch
BranchTrueFalseTotal
if $session->{"icon_checksum"} 0 0 0
277 0 ▶ $bli->{4}->{0}->{$visbid}->{data}->{0x0102} = pack("N", $session->{icon_timestamp}) if $session->{icon_timestamp};
Branch: 1 branch
BranchTrueFalseTotal
if $session->{"icon_timestamp"} 0 0 0
278 0 ▶ $bli->{4}->{0}->{$visbid}->{data}->{0x0103} = pack("N", $session->{icon_length}) if $session->{icon_length};
Branch: 1 branch
BranchTrueFalseTotal
if $session->{"icon_length"} 0 0 0
279  
280 0 foreach my $appdata(keys %{$session->{appdata}}) {
281 0 $bli->{4}->{0}->{$visbid}->{data}->{$appdata} = $session->{appdata}->{$appdata};
282 }
283  
284 0 ▶ if(exists($session->{icon_md5sum}) || chain_exists($oldbli, 0x14, 0, $iconbid)) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $session->{"icon_md5sum"} or &chain_exists($oldbli, 20, 0, $iconbid)) 0 0 0
Condition0%0/3
exists $session->{"icon_md5sum"} or &chain_exists($oldbli, 20, 0, $iconbid)
l!l&&r!l&&!r
000
MC/DC0%0/2
exists $session->{"icon_md5sum"} or &chain_exists($oldbli, 20, 0, $iconbid)
exists $session->{"icon_md5sum"} &chain_exists($oldbli, 20, 0, $iconbid)
Truth table0%0/3
A or B
A= exists $session->{"icon_md5sum"}B= &chain_exists($oldbli, 20, 0, $iconbid)
ABresult
1X1
011
000
285 0 init_entry($bli, 0x14, 0, $iconbid);
286  
287 0 ▶ if(chain_exists($oldbli, 0x14, 0, $iconbid)) {
Branch: 1 branch
BranchTrueFalseTotal
if (&chain_exists($oldbli, 20, 0, $iconbid)) { } 0 0 0
288 0 $bli->{0x14}->{0}->{$iconbid}->{name} = $oldbli->{0x14}->{0}->{$iconbid}->{name};
289  
290 $bli->{0x14}->{0}->{$iconbid}->{data}->{$_} = $oldbli->{0x14}->{0}->{$iconbid}->{data}->{$_}
291 0 foreach grep { $_ != 0xD5 } keys %{$oldbli->{0x14}->{0}->{$iconbid}->{data}};
292 } else {
293 0 $bli->{0x14}->{0}->{$iconbid}->{name} = "1";
294 }
295  
296 0 ▶ if(exists($session->{icon_md5sum})) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $session->{"icon_md5sum"}) 0 0 0
297 0 $bli->{0x14}->{0}->{$iconbid}->{data}->{0xD5} = $session->{icon_md5sum};
298 }
299 }
300  
301 0 init_entry($bli, 1, 0, 0);
302 0 ▶ if($session->{buddies}->{__BLI_DIRTY}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($session->{'buddies'}{'__BLI_DIRTY'}) { } 0 0 0
303 0 $bli->{1}->{0}->{0}->{data}->{0xC8} = pack("n*", map { $_->{groupid} } grep { ref($_) } values %{$session->{buddies}});
304 0 $session->{buddies}->{__BLI_DIRTY} = 0;
305 } else {
306 0 $bli->{1}->{0}->{0}->{__BLI_SKIP} = 1;
307 0 $oldbli->{1}->{0}->{0}->{__BLI_SKIP} = 1;
308 }
309  
310 0 ▶ while(my($grpname, $grp) = each(%{$session->{buddies}})) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = each %{$$session{"buddies"};}) 0 0 0
311 0 ▶ next if $grpname eq "__BLI_DIRTY";
Branch: 1 branch
BranchTrueFalseTotal
if $grpname eq "__BLI_DIRTY" 0 0 0
312  
313 0 my $gid = $grp->{groupid};
314  
315 0 ▶ if($grp->{__BLI_DELETED}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($grp->{"__BLI_DELETED"}) 0 0 0
316 0 delete $session->{buddies}->{$grpname};
317 0 delete $bli->{1}->{$gid}->{0};
318 0 next;
319 }
320  
321 0 ▶ if(not $grp->{__BLI_DIRTY}) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $grp->{'__BLI_DIRTY'}) { } 0 0 0
322 0 $bli->{1}->{$gid}->{0}->{__BLI_SKIP} = 1;
323 0 $oldbli->{1}->{$gid}->{0}->{__BLI_SKIP} = 1;
324 0 next;
325 } else {
326 0 $grp->{__BLI_DIRTY} = 0;
327 }
328  
329 0 init_entry($bli, 1, $gid, 0);
330 0 my $bligrp = $bli->{1}->{$gid}->{0};
331 0 $bligrp->{name} = $grpname;
332  
333  
334 # Clear out data, since the user may have deleted keys.
335 0 $bli->{1}->{$gid}->{0}->{data} = tlv();
336  
337 # It seems that WinAIM can now have groups without 0xC8 data, and gets pissed if we create such data where it doesn't exist.
338 0 ▶ if(!exists($oldbli->{1}->{$gid}) or chain_exists($oldbli, 1, $gid, 0, "data", 0xC8)) {
Branch: 1 branch
BranchTrueFalseTotal
if (not exists $oldbli->{1}{$gid} or &chain_exists($oldbli, 1, $gid, 0, "data", 200)) 0 0 0
Condition0%0/3
not exists $oldbli->{1}{$gid} or &chain_exists($oldbli, 1, $gid, 0, "data", 200)
l!l&&r!l&&!r
000
MC/DC0%0/2
not exists $oldbli->{1}{$gid} or &chain_exists($oldbli, 1, $gid, 0, "data", 200)
not exists $oldbli->{1}{$gid} &chain_exists($oldbli, 1, $gid, 0, "data", 200)
Truth table0%0/3
not(A) or B
A= not exists $oldbli->{1}{$gid}B= &chain_exists($oldbli, 1, $gid, 0, "data", 200)
ABresult
1X1
011
000
339 $bligrp->{data}->{0xC8} = pack("n*",
340 0 map { $_->{buddyid} }
341 0 grep { not $_->{__BLI_DELETED} }
342 0 values %{$grp->{members}});
343 }
344  
345 0 ▶ if(chain_exists($oldbli, 1, $gid, 0)) {
Branch: 1 branch
BranchTrueFalseTotal
if (&chain_exists($oldbli, 1, $gid, 0)) 0 0 0
346 $bli->{1}->{$gid}->{0}->{data}->{$_} = $oldbli->{1}->{$gid}->{0}->{data}->{$_}
347 0 foreach grep { $_ != 0xC8 } keys %{$oldbli->{1}->{$gid}->{0}->{data}};
348 }
349  
350  
351 0 ▶ while(my($buddy, $bud) = each(%{$grp->{members}})) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = each %{$$grp{"members"};}) 0 0 0
352 0 my $bid = $bud->{buddyid};
353  
354 0 ▶ if($bud->{__BLI_DELETED}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($bud->{"__BLI_DELETED"}) 0 0 0
355 0 delete $grp->{members}->{$buddy};
356 0 delete $bli->{0}->{$gid}->{$bid};
357 0 next;
358 }
359  
360 0 ▶ if(not $bud->{__BLI_DIRTY}) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $bud->{'__BLI_DIRTY'}) { } 0 0 0
361 0 $bli->{0}->{$gid}->{$bid}->{__BLI_SKIP} = 1;
362 0 $oldbli->{0}->{$gid}->{$bid}->{__BLI_SKIP} = 1;
363 0 next;
364 } else {
365 0 $bud->{__BLI_DIRTY} = 0;
366 }
367  
368 0 ▶ next unless $bid;
Branch: 1 branch
BranchTrueFalseTotal
unless $bid 0 0 0
369 0 init_entry($bli, 0, $gid, $bid);
370 0 my $blibud = $bli->{0}->{$gid}->{$bid};
371 0 $blibud->{name} = "$buddy"; # Make sure to get strinfied version of Screenname
372  
373 0 $blibud->{data} = tlv();
374 0 ▶ while(my ($key, $value) = each(%{$bud->{data}})) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = each %{$$bud{"data"};}) 0 0 0
375 0 $blibud->{data}->{$key} = $value;
376 }
377 0 ▶ $blibud->{data}->{0x13C} = $bud->{comment} if defined $bud->{comment};
Branch: 1 branch
BranchTrueFalseTotal
if defined $bud->{"comment"} 0 0 0
378 0 ▶ $blibud->{data}->{0x131} = $bud->{alias} if defined $bud->{alias};
Branch: 1 branch
BranchTrueFalseTotal
if defined $bud->{"alias"} 0 0 0
379 }
380 }
381  
382 0 BLI_to_OSCAR($session, $bli);
383 }
384  
385 # Send changes to BLI over to OSCAR
386 0 ▶sub BLI_to_OSCAR($$) {
Subroutine BLI_to_OSCAR: not called CC=28 SCAR=67.0
Pod undocumented
387 0 my($session, $newbli) = @_;
388 0 my $oldbli = $session->{blinternal};
389 0 my (@adds, @modifies, @deletes);
390 0 ▶ $session->crapout($session->{services}->{0+CONNTYPE_BOS}, "You must wait for a buddylist_ok or buddylist_error callback before calling commit_buddylist again.") if $session->{budmods};
Branch: 1 branch
BranchTrueFalseTotal
if $session->{"budmods"} 0 0 0
391 0 $session->{budmods} = [];
392  
393 0 my %budmods;
394 0 $budmods{add} = [];
395 0 $budmods{modify} = [];
396 0 $budmods{delete} = [];
397  
398 # First, delete stuff that we no longer use and modify everything else
399 0 foreach my $type(keys %$oldbli) {
400  
401 0 ▶ my $budtype = (BUDTYPES)[$type] || "unknown type $type";
Condition0%0/2
('buddy', 'group', 'permit entry', 'deny entry', 'visibility/misc. data', 'presence', undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, 'buddy icon data')[$type] || "unknown type $type"
l!l
00
MC/DC0%0/1
('buddy', 'group', 'permit entry', 'deny entry', 'visibility/misc. data', 'presence', undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, 'buddy icon data')[$type] || "unknown type $type"
('buddy', 'group', 'permit entry', 'deny entry', 'visibility/misc. data', 'presence', undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, 'buddy icon data')[$type]
Truth table0%0/2
A
A= ('buddy', 'group', 'permit entry', 'deny entry', 'visibility/misc. data', 'presence', undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, 'buddy icon data')[$type]
Aresult
11
00
402  
403 0 foreach my $gid(keys %{$oldbli->{$type}}) {
404 0 foreach my $bid(keys %{$oldbli->{$type}->{$gid}}) {
405 0 my $oldentry = $oldbli->{$type}->{$gid}->{$bid};
406 0 ▶ if($oldentry->{__BLI_SKIP}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($oldentry->{"__BLI_SKIP"}) 0 0 0
407 0 delete $oldentry->{__BLI_SKIP};
408 0 next;
409 }
410  
411 0 my $olddata = tlv_encode($oldentry->{data});
412 0 ▶ $session->log_printf_cond(OSCAR_DBG_DEBUG, sub { "Old BLI entry %s 0x%04X/0x%04X/0x%04X with %d bytes of data:%s", $oldentry->{name}, $type, $gid, $bid, length($olddata), hexdump($olddata) });
Subroutine __ANON__: not called CC=1 SCAR=6.9
413 0 my $delete = 0;
414 0 ▶ if(exists($newbli->{$type}) and exists($newbli->{$type}->{$gid}) and exists($newbli->{$type}->{$gid}->{$bid})) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $newbli->{$type} and exists $newbli->{$type}{$gid} and exists $newbli->{$type}{$gid}{$bid}) { } 0 0 0
Condition0%0/6
exists $newbli->{$type} and exists $newbli->{$type}{$gid} and exists $newbli->{$type}{$gid}{$bid}
!ll&&!rl&&r
000
exists $newbli->{$type} and exists $newbli->{$type}{$gid}
!ll&&!rl&&r
000
MC/DC0%0/3
exists $newbli->{$type} and exists $newbli->{$type}{$gid} and exists $newbli->{$type}{$gid}{$bid}
exists $newbli->{$type} exists $newbli->{$type}{$gid} exists $newbli->{$type}{$gid}{$bid}
Truth table0%0/4
A and B and C
A= exists $newbli->{$type}B= exists $newbli->{$type}{$gid}C= exists $newbli->{$type}{$gid}{$bid}
ABCresult
0XX0
10X0
1100
1111
415 0 my $newentry = $newbli->{$type}->{$gid}->{$bid};
416 0 my $newdata = tlv_encode($newentry->{data});
417 0 ▶ $session->log_printf_cond(OSCAR_DBG_DEBUG, sub { "New BLI entry %s 0x%04X/0x%04X/0x%04X with %d bytes of data:%s", $newentry->{name}, $type, $gid, $bid, length($newdata), hexdump($newdata) });
Subroutine __ANON__: not called CC=1 SCAR=6.9
418  
419 next if
420 $newentry->{name} eq $oldentry->{name}
421 0 ▶ and $newdata eq $olddata;
Branch: 1 branch
BranchTrueFalseTotal
if $newentry->{"name"} eq $oldentry->{"name"} and $newdata eq $olddata 0 0 0
Condition0%0/3
$newentry->{"name"} eq $oldentry->{"name"} and $newdata eq $olddata
!ll&&!rl&&r
000
MC/DC0%0/2
$newentry->{"name"} eq $oldentry->{"name"} and $newdata eq $olddata
$newentry->{"name"} eq $oldentry->{"name"} $newdata eq $olddata
Truth table0%0/3
A and B
A= $newentry->{"name"} eq $oldentry->{"name"}B= $newdata eq $olddata
ABresult
0X0
100
111
422  
423 # Apparently, we can't modify the name of a buddylist entry?
424 0 ▶ if($newentry->{name} ne $oldentry->{name}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($newentry->{'name'} ne $oldentry->{'name'}) { } 0 0 0
425 0 $delete = 1;
426 } else {
427 0 $session->log_print(OSCAR_DBG_DEBUG, "Modifying.");
428  
429 0 push @{$budmods{modify}}, {
430 reqdata => {desc => "modifying $budtype $newentry->{name}", type => $type, gid => $gid, bid => $bid},
431 protodata => {
432 entry_name => $newentry->{name},
433 0 group_id => $gid,
434 buddy_id => $bid,
435 entry_type => $type,
436 entry_data => $newdata
437 }
438 };
439 }
440 } else {
441 0 $delete = 1;
442 }
443  
444 0 ▶ if($delete) {
Branch: 1 branch
BranchTrueFalseTotal
if ($delete) 0 0 0
445 0 $session->log_print(OSCAR_DBG_DEBUG, "Deleting.");
446  
447 0 push @{$budmods{delete}}, {
448 reqdata => {desc => "deleting $budtype $oldentry->{name}", type => $type, gid => $gid, bid => $bid},
449 protodata => {
450 entry_name => $oldentry->{name},
451 0 group_id => $gid,
452 buddy_id => $bid,
453 entry_type => $type,
454 entry_data => $olddata
455 }
456 };
457 }
458 }
459 }
460 }
461  
462 # Now, add the new stuff
463 0 foreach my $type(keys %$newbli) {
464  
465 0 ▶ my $budtype = (BUDTYPES)[$type] || "unknown type $type";
Condition0%0/2
('buddy', 'group', 'permit entry', 'deny entry', 'visibility/misc. data', 'presence', undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, 'buddy icon data')[$type] || "unknown type $type"
l!l
00
MC/DC0%0/1
('buddy', 'group', 'permit entry', 'deny entry', 'visibility/misc. data', 'presence', undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, 'buddy icon data')[$type] || "unknown type $type"
('buddy', 'group', 'permit entry', 'deny entry', 'visibility/misc. data', 'presence', undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, 'buddy icon data')[$type]
Truth table0%0/2
A
A= ('buddy', 'group', 'permit entry', 'deny entry', 'visibility/misc. data', 'presence', undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, 'buddy icon data')[$type]
Aresult
11
00
466  
467 0 foreach my $gid(keys %{$newbli->{$type}}) {
468 0 foreach my $bid(keys %{$newbli->{$type}->{$gid}}) {
469 0 my $entry = $newbli->{$type}->{$gid}->{$bid};
470 0 ▶ if($entry->{__BLI_SKIP}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($entry->{"__BLI_SKIP"}) 0 0 0
471 0 delete $entry->{__BLI_SKIP};
472 0 next;
473 }
474  
475 0 ▶ next if exists($oldbli->{$type}) and exists($oldbli->{$type}->{$gid}) and exists($oldbli->{$type}->{$gid}->{$bid}) and $oldbli->{$type}->{$gid}->{$bid}->{name} eq $newbli->{$type}->{$gid}->{$bid}->{name};
Branch: 1 branch
BranchTrueFalseTotal
if exists $oldbli->{$type} and exists $oldbli->{$type}{$gid} and exists $oldbli->{$type}{$gid}{$bid} and $oldbli->{$type}{$gid}{$bid}{"name"} eq $newbli->{$type}{$gid}{$bid}{"name"} 0 0 0
Condition0%0/9
exists $oldbli->{$type} and exists $oldbli->{$type}{$gid} and exists $oldbli->{$type}{$gid}{$bid} and $oldbli->{$type}{$gid}{$bid}{"name"} eq $newbli->{$type}{$gid}{$bid}{"name"}
!ll&&!rl&&r
000
exists $oldbli->{$type} and exists $oldbli->{$type}{$gid} and exists $oldbli->{$type}{$gid}{$bid}
!ll&&!rl&&r
000
exists $oldbli->{$type} and exists $oldbli->{$type}{$gid}
!ll&&!rl&&r
000
MC/DC0%0/4
exists $oldbli->{$type} and exists $oldbli->{$type}{$gid} and exists $oldbli->{$type}{$gid}{$bid} and $oldbli->{$type}{$gid}{$bid}{"name"} eq $newbli->{$type}{$gid}{$bid}{"name"}
exists $oldbli->{$type} exists $oldbli->{$type}{$gid} exists $oldbli->{$type}{$gid}{$bid} $oldbli->{$type}{$gid}{$bid}{"name"} eq $newbli->{$type}{$gid}{$bid}{"name"}
Truth table0%0/5
A and B and C and D
A= exists $oldbli->{$type}B= exists $oldbli->{$type}{$gid}C= exists $oldbli->{$type}{$gid}{$bid}D= $oldbli->{$type}{$gid}{$bid}{"name"} eq $newbli->{$type}{$gid}{$bid}{"name"}
ABCDresult
0XXX0
10XX0
110X0
11100
11111
476  
477 0 my $data = tlv_encode($entry->{data});
478  
479 0 ▶ $session->log_printf_cond(OSCAR_DBG_DEBUG, sub { "New BLI entry %s 0x%04X/0x%04X/0x%04X with %d bytes of data:%s", $entry->{name}, $type, $gid, $bid, length($data), hexdump($data) });
Subroutine __ANON__: not called CC=1 SCAR=6.9
480  
481 0 push @{$budmods{add}}, {
482 reqdata => {desc => "adding $budtype $entry->{name}", type => $type, gid => $gid, bid => $bid},
483 protodata => {
484 entry_name => $entry->{name},
485 0 group_id => $gid,
486 buddy_id => $bid,
487 entry_type => $type,
488 entry_data => $data
489 }
490 };
491 }
492 }
493 }
494  
495 # Actually send the changes. Don't send more than 7K in a single SNAC.
496 # FLAP size limit is 8K, but that includes headers - good to have a safety margin
497 0 foreach my $type (qw(add modify delete)) {
498 0 my $changelist = $budmods{$type};
499  
500 0 my(@reqdata, @packets);
501 0 my $packet = "";
502 0 foreach my $change(@$changelist) {
503 0 $packet .= protoparse($session, "buddylist_modification")->pack(%{$change->{protodata}});
504 0 push @reqdata, $change->{reqdata};
505  
506 0 ▶ if(length($packet) > 7*1024) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $packet > 7168) 0 0 0
507 #$session->log_print(OSCAR_DBG_INFO, "Adding to blmod queue (max packet size reached): type $type, payload size ", scalar(@reqdata));
508 0 push @packets, {
509 type => $type,
510 data => $packet,
511 reqdata => [@reqdata],
512 };
513 0 $packet = "";
514 0 @reqdata = ();
515 }
516 }
517 0 ▶ if($packet) {
Branch: 1 branch
BranchTrueFalseTotal
if ($packet) 0 0 0
518 #$session->log_print(OSCAR_DBG_INFO, "Adding to blmod queue (no more changes): type $type, payload size ", scalar(@reqdata));
519 0 push @packets, {
520 type => $type,
521 data => $packet,
522 reqdata => [@reqdata],
523 };
524 }
525  
526 0 push @{$session->{budmods}}, map {
527 0 {
528 protobit => "buddylist_" . $_->{type},
529 reqdata => $_->{reqdata},
530 protodata => {mods => $_->{data}}
531 0 };
532 } @packets;
533 }
534  
535 0 push @{$session->{budmods}}, {protobit => "end_buddylist_modifications"}; # End BL mods
536 #$session->log_print(OSCAR_DBG_INFO, "Adding terminator to blmod queue.");
537  
538 0 $session->{blold} = $oldbli;
539 0 $session->{blinternal} = $newbli;
540  
541 0 ▶ if(@{$session->{budmods}} <= 1) { # We only have the start/end modification packets, no actual changes
Branch: 1 branch
BranchTrueFalseTotal
if (@{$session->{'budmods'};} <= 1) { } 0 0 0
542 #$session->log_print(OSCAR_DBG_INFO, "Empty blmod queue - calling buddylist_ok.");
543 0 delete $session->{budmods};
544 0 $session->callback_buddylist_ok();
545 } else {
546 #$session->log_print(OSCAR_DBG_INFO, "Non-empty blmod queue - sending initiator and first change packet.");
547 0 $session->svcdo(CONNTYPE_BOS, protobit => "start_buddylist_modifications");
548 0 $session->svcdo(CONNTYPE_BOS, %{shift @{$session->{budmods}}}); # Send the first modification
549 }
550 }
551  
552 0 ▶sub chain_exists($@) {
Subroutine chain_exists: not called CC=4 SCAR=30.0
Pod undocumented
553 0 my($tlv, @refs) = @_;
554  
555 0 ▶ while(@refs) {
Branch: 1 branch
BranchTrueFalseTotal
if (@refs) 0 0 0
556 0 my $ref = shift @refs;
557 0 ▶ if(exists($tlv->{$ref})) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $tlv->{$ref}) { } 0 0 0
558 0 $tlv = $tlv->{$ref};
559 } else {
560 0 return 0;
561 }
562 }
563  
564 0 ▶ return defined($tlv) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
defined $tlv ? : 0 0 0
565 }
566  
567 4 1;
« blib/lib/Net/OSCAR/Connection/Direct.pm ↑ Summary blib/lib/Net/OSCAR/XML.pm »