| 1 | ############################################################################## | ||||||||||||||||||||||||||||||||
| 2 | # | ||||||||||||||||||||||||||||||||
| 3 | # This library is free software; you can redistribute it and/or | ||||||||||||||||||||||||||||||||
| 4 | # modify it under the terms of the GNU Library General Public | ||||||||||||||||||||||||||||||||
| 5 | # License as published by the Free Software Foundation; either | ||||||||||||||||||||||||||||||||
| 6 | # version 2 of the License, or (at your option) any later version. | ||||||||||||||||||||||||||||||||
| 7 | # | ||||||||||||||||||||||||||||||||
| 8 | # This library is distributed in the hope that it will be useful, | ||||||||||||||||||||||||||||||||
| 9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||||||||||||||||||||||||||||||
| 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||||||||||||||||||||||||||||||||
| 11 | # Library General Public License for more details. | ||||||||||||||||||||||||||||||||
| 12 | # | ||||||||||||||||||||||||||||||||
| 13 | # You should have received a copy of the GNU Library General Public | ||||||||||||||||||||||||||||||||
| 14 | # License along with this library; if not, write to the | ||||||||||||||||||||||||||||||||
| 15 | # Free Software Foundation, Inc., 59 Temple Place - Suite 330, | ||||||||||||||||||||||||||||||||
| 16 | # Boston, MA 02111-1307, USA. | ||||||||||||||||||||||||||||||||
| 17 | # | ||||||||||||||||||||||||||||||||
| 18 | # Copyright (C) 1998-2004 Jabber Software Foundation http://jabber.org/ | ||||||||||||||||||||||||||||||||
| 19 | # | ||||||||||||||||||||||||||||||||
| 20 | ############################################################################## | ||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||
| 22 | package Net::XMPP3::PrivacyLists; | ||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||
| 24 | =head1 NAME | ||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||
| 26 | Net::XMPP3::PrivacyLists - XMPP Privacy Lists Object | ||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||
| 28 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||
| 30 | This module is not yet complete. Do not use. | ||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||
| 32 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||
| 34 | =head2 Basic Functions | ||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||
| 36 | =head2 Advanced Functions | ||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||
| 38 | =head1 METHODS | ||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||
| 40 | =head2 Basic Functions | ||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||
| 42 | =head2 Advanced Functions | ||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||
| 44 | =head1 AUTHOR | ||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||
| 46 | Ryan Eatmon | ||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||
| 48 | =head1 COPYRIGHT | ||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||
| 50 | This module is free software, you can redistribute it and/or modify it | ||||||||||||||||||||||||||||||||
| 51 | under the LGPL. | ||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||
| 53 | =cut | ||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||
| 55 | 11 | ▶ | use strict; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 56 | 11 | ▶ | use Carp; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||
| 58 | sub new | ||||||||||||||||||||||||||||||||
| 59 | 0 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
new: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 60 | 0 | my $proto = shift; | |||||||||||||||||||||||||||||||
| 61 | 0 | my $self = { }; | |||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||
| 63 | 0 | my %args; | |||||||||||||||||||||||||||||||
| 64 | 0 | ▶ | while($#_ >= 0) { $args{ lc(pop(@_)) } = pop(@_); } | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||
| 66 | 0 | $self->{CONNECTION} = $args{connection}; | |||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||
| 68 | 0 | bless($self, $proto); | |||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||
| 70 | 0 | $self->init(); | |||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||
| 72 | 0 | return $self; | |||||||||||||||||||||||||||||||
| 73 | } | ||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||
| 76 | ############################################################################## | ||||||||||||||||||||||||||||||||
| 77 | # | ||||||||||||||||||||||||||||||||
| 78 | # init - initialize the module to use the privacy lists. | ||||||||||||||||||||||||||||||||
| 79 | # | ||||||||||||||||||||||||||||||||
| 80 | ############################################################################## | ||||||||||||||||||||||||||||||||
| 81 | sub init | ||||||||||||||||||||||||||||||||
| 82 | 0 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
init: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 83 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||
| 85 | 0 | ▶ | $self->{CONNECTION}-> SetXPathCallBacks('/iq[@type="result" or @type="set"]/query[@xmlns="jabber:iq:privacy"]'=>sub{ $self->handler(@_) }); | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||
| 86 | } | ||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||||||
| 89 | ############################################################################## | ||||||||||||||||||||||||||||||||
| 90 | # | ||||||||||||||||||||||||||||||||
| 91 | # debug - print out a representation of the privacy lists. | ||||||||||||||||||||||||||||||||
| 92 | # | ||||||||||||||||||||||||||||||||
| 93 | ############################################################################## | ||||||||||||||||||||||||||||||||
| 94 | sub debug | ||||||||||||||||||||||||||||||||
| 95 | 0 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
debug: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 96 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||||||
| 98 | 0 | &XML::Stream::printData("\$self->{LISTS}",$self->{LISTS}); | |||||||||||||||||||||||||||||||
| 99 | } | ||||||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||||||
| 102 | ############################################################################## | ||||||||||||||||||||||||||||||||
| 103 | # | ||||||||||||||||||||||||||||||||
| 104 | # addItem - add list item to a list. | ||||||||||||||||||||||||||||||||
| 105 | # | ||||||||||||||||||||||||||||||||
| 106 | ############################################################################## | ||||||||||||||||||||||||||||||||
| 107 | sub addItem | ||||||||||||||||||||||||||||||||
| 108 | 0 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
addItem: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 109 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||
| 110 | 0 | my ($list,%item) = @_; | |||||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||||||
| 112 | 0 | my $order = delete($item{order}); | |||||||||||||||||||||||||||||||
| 113 | 0 | $self->{LISTS}->{$list}->{$order} = \%item; | |||||||||||||||||||||||||||||||
| 114 | } | ||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||||||
| 117 | ############################################################################### | ||||||||||||||||||||||||||||||||
| 118 | # | ||||||||||||||||||||||||||||||||
| 119 | # clear - delete all of the JIDs from the DB completely. | ||||||||||||||||||||||||||||||||
| 120 | # | ||||||||||||||||||||||||||||||||
| 121 | ############################################################################### | ||||||||||||||||||||||||||||||||
| 122 | sub clear | ||||||||||||||||||||||||||||||||
| 123 | 0 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
clear: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 124 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||||||
| 126 | 0 | $self->{CONNECTION}->{DEBUG}->Log3("PrivacyLists::clear: clearing the database"); | |||||||||||||||||||||||||||||||
| 127 | 0 | foreach my $list ($self->lists()) | |||||||||||||||||||||||||||||||
| 128 | { | ||||||||||||||||||||||||||||||||
| 129 | 0 | $self->remove($list); | |||||||||||||||||||||||||||||||
| 130 | } | ||||||||||||||||||||||||||||||||
| 131 | 0 | $self->{CONNECTION}->{DEBUG}->Log3("PrivacyLists::clear: database is empty"); | |||||||||||||||||||||||||||||||
| 132 | } | ||||||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||||||
| 135 | ############################################################################## | ||||||||||||||||||||||||||||||||
| 136 | # | ||||||||||||||||||||||||||||||||
| 137 | # exists - allows you to query if the JID exists in the Roster DB. | ||||||||||||||||||||||||||||||||
| 138 | # | ||||||||||||||||||||||||||||||||
| 139 | ############################################################################## | ||||||||||||||||||||||||||||||||
| 140 | sub exists | ||||||||||||||||||||||||||||||||
| 141 | 0 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
exists: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 142 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||
| 143 | 0 | my $list = shift; | |||||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||||||
| 145 | 0 | ▶ | return unless exists($self->{LISTS}); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 146 | 0 | ▶ | return unless exists($self->{LISTS}->{$list}); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 147 | 0 | return 1; | |||||||||||||||||||||||||||||||
| 148 | } | ||||||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||||||
| 151 | ############################################################################## | ||||||||||||||||||||||||||||||||
| 152 | # | ||||||||||||||||||||||||||||||||
| 153 | # fetch - fetch the privacy lists from the server and populate the database. | ||||||||||||||||||||||||||||||||
| 154 | # | ||||||||||||||||||||||||||||||||
| 155 | ############################################################################## | ||||||||||||||||||||||||||||||||
| 156 | sub fetch | ||||||||||||||||||||||||||||||||
| 157 | 0 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
fetch: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 158 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||||||
| 160 | 0 | my $iq = $self->{CONNECTION}->PrivacyListsGet(); | |||||||||||||||||||||||||||||||
| 161 | 0 | $self->handleIQ($iq); | |||||||||||||||||||||||||||||||
| 162 | } | ||||||||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||||||
| 165 | ############################################################################## | ||||||||||||||||||||||||||||||||
| 166 | # | ||||||||||||||||||||||||||||||||
| 167 | # fetchList - fetch the privacy list from the server and populate the database. | ||||||||||||||||||||||||||||||||
| 168 | # | ||||||||||||||||||||||||||||||||
| 169 | ############################################################################## | ||||||||||||||||||||||||||||||||
| 170 | sub fetchList | ||||||||||||||||||||||||||||||||
| 171 | 0 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
fetchList: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 172 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||
| 173 | 0 | my $list = shift; | |||||||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||||||
| 175 | 0 | my $iq = $self->{CONNECTION}->PrivacyListsGet(list=>$list); | |||||||||||||||||||||||||||||||
| 176 | 0 | $self->handleIQ($iq); | |||||||||||||||||||||||||||||||
| 177 | } | ||||||||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||||||
| 179 | |||||||||||||||||||||||||||||||||
| 180 | ############################################################################## | ||||||||||||||||||||||||||||||||
| 181 | # | ||||||||||||||||||||||||||||||||
| 182 | # lists - returns a list of the current privacy lists. | ||||||||||||||||||||||||||||||||
| 183 | # | ||||||||||||||||||||||||||||||||
| 184 | ############################################################################## | ||||||||||||||||||||||||||||||||
| 185 | sub lists | ||||||||||||||||||||||||||||||||
| 186 | 0 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
lists: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 187 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||
| 188 | |||||||||||||||||||||||||||||||||
| 189 | 0 | ▶ | return () unless exists($self->{LISTS}); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 190 | 0 | ▶ | return () if (scalar(keys(%{$self->{LISTS}})) == 0); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 191 | 0 | return keys(%{$self->{LISTS}}); | |||||||||||||||||||||||||||||||
| 192 | } | ||||||||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||||||
| 194 | |||||||||||||||||||||||||||||||||
| 195 | ############################################################################## | ||||||||||||||||||||||||||||||||
| 196 | # | ||||||||||||||||||||||||||||||||
| 197 | # items - returns a list of all of the items in the specified privacy list. | ||||||||||||||||||||||||||||||||
| 198 | # | ||||||||||||||||||||||||||||||||
| 199 | ############################################################################## | ||||||||||||||||||||||||||||||||
| 200 | sub items | ||||||||||||||||||||||||||||||||
| 201 | 0 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
items: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 202 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||
| 203 | 0 | my $list = shift; | |||||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||||||
| 205 | 0 | my @items; | |||||||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||||||
| 207 | 0 | ▶ | return () unless $self->exists($list); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 208 | 0 | foreach my $order (sort{ $a <=> $b } keys(%{$self->{LISTS}->{$list}})) | |||||||||||||||||||||||||||||||
| 209 | { | ||||||||||||||||||||||||||||||||
| 210 | 0 | my %item = %{$self->{LISTS}->{$list}->{$order}}; | |||||||||||||||||||||||||||||||
| 211 | 0 | $item{order} = $order; | |||||||||||||||||||||||||||||||
| 212 | 0 | push(@items,\%item); | |||||||||||||||||||||||||||||||
| 213 | } | ||||||||||||||||||||||||||||||||
| 214 | |||||||||||||||||||||||||||||||||
| 215 | 0 | return @items; | |||||||||||||||||||||||||||||||
| 216 | } | ||||||||||||||||||||||||||||||||
| 217 | |||||||||||||||||||||||||||||||||
| 218 | |||||||||||||||||||||||||||||||||
| 219 | ############################################################################## | ||||||||||||||||||||||||||||||||
| 220 | # | ||||||||||||||||||||||||||||||||
| 221 | # handler - takes a packet and calls the correct handler. | ||||||||||||||||||||||||||||||||
| 222 | # | ||||||||||||||||||||||||||||||||
| 223 | ############################################################################## | ||||||||||||||||||||||||||||||||
| 224 | sub handler | ||||||||||||||||||||||||||||||||
| 225 | 0 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
handler: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 226 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||
| 227 | 0 | my $sid = shift; | |||||||||||||||||||||||||||||||
| 228 | 0 | my $packet = shift; | |||||||||||||||||||||||||||||||
| 229 | |||||||||||||||||||||||||||||||||
| 230 | 0 | ▶ | $self->handleIQ($packet) if ($packet->GetTag() eq "iq"); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 231 | } | ||||||||||||||||||||||||||||||||
| 232 | |||||||||||||||||||||||||||||||||
| 233 | |||||||||||||||||||||||||||||||||
| 234 | ############################################################################## | ||||||||||||||||||||||||||||||||
| 235 | # | ||||||||||||||||||||||||||||||||
| 236 | # handleIQ - takes an iq packet that contains roster, parses it, and puts | ||||||||||||||||||||||||||||||||
| 237 | # the roster into the Roster DB. | ||||||||||||||||||||||||||||||||
| 238 | # | ||||||||||||||||||||||||||||||||
| 239 | ############################################################################## | ||||||||||||||||||||||||||||||||
| 240 | sub handleIQ | ||||||||||||||||||||||||||||||||
| 241 | 0 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
handleIQ: not called CC=8 SCAR=42.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 242 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||
| 243 | 0 | my $iq = shift; | |||||||||||||||||||||||||||||||
| 244 | |||||||||||||||||||||||||||||||||
| 245 | 0 | print "handleIQ: iq(",$iq->GetXML(),")\n"; | |||||||||||||||||||||||||||||||
| 246 | |||||||||||||||||||||||||||||||||
| 247 | 0 | my $type = $iq->GetType(); | |||||||||||||||||||||||||||||||
| 248 | 0 | ▶ | return unless (($type eq "set") || ($type eq "result")); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$type eq "set" or $type eq "result"
MC/DC0%0/2
$type eq "set" or $type eq "result"
$type eq "set"
$type eq "result"
Truth table0%0/3
A or B
A= $type eq "set"B= $type eq "result"
| |||||||||||||||||||||||||||||||||
| 249 | |||||||||||||||||||||||||||||||||
| 250 | 0 | ▶ | if ($type eq "result") | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 251 | { | ||||||||||||||||||||||||||||||||
| 252 | 0 | my $query = $iq->GetChild("jabber:iq:privacy"); | |||||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||||||
| 254 | 0 | my @lists = $query->GetLists(); | |||||||||||||||||||||||||||||||
| 255 | |||||||||||||||||||||||||||||||||
| 256 | 0 | ▶ | return unless ($#lists > -1); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||||||
| 258 | 0 | my @items = $lists[0]->GetItems(); | |||||||||||||||||||||||||||||||
| 259 | |||||||||||||||||||||||||||||||||
| 260 | 0 | ▶ | if (($#lists == 0) && ($#items > -1)) | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/3
$#lists == 0 and $#items > -1
MC/DC0%0/2
$#lists == 0 and $#items > -1
$#lists == 0
$#items > -1
Truth table0%0/3
A and B
A= $#lists == 0B= $#items > -1
| |||||||||||||||||||||||||||||||||
| 261 | { | ||||||||||||||||||||||||||||||||
| 262 | 0 | $self->parseList($lists[0]); | |||||||||||||||||||||||||||||||
| 263 | } | ||||||||||||||||||||||||||||||||
| 264 | elsif ($#lists >= -1) | ||||||||||||||||||||||||||||||||
| 265 | { | ||||||||||||||||||||||||||||||||
| 266 | 0 | $self->parseLists(\@lists); | |||||||||||||||||||||||||||||||
| 267 | } | ||||||||||||||||||||||||||||||||
| 268 | } | ||||||||||||||||||||||||||||||||
| 269 | } | ||||||||||||||||||||||||||||||||
| 270 | |||||||||||||||||||||||||||||||||
| 271 | |||||||||||||||||||||||||||||||||
| 272 | sub parseList | ||||||||||||||||||||||||||||||||
| 273 | 0 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
parseList: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 274 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||
| 275 | 0 | my $list = shift; | |||||||||||||||||||||||||||||||
| 276 | |||||||||||||||||||||||||||||||||
| 277 | 0 | my $name = $list->GetName(); | |||||||||||||||||||||||||||||||
| 278 | |||||||||||||||||||||||||||||||||
| 279 | 0 | foreach my $item ($list->GetItems()) | |||||||||||||||||||||||||||||||
| 280 | { | ||||||||||||||||||||||||||||||||
| 281 | 0 | my %item = $item->GetItem(); | |||||||||||||||||||||||||||||||
| 282 | |||||||||||||||||||||||||||||||||
| 283 | 0 | $self->addItem($name,%item); | |||||||||||||||||||||||||||||||
| 284 | } | ||||||||||||||||||||||||||||||||
| 285 | } | ||||||||||||||||||||||||||||||||
| 286 | |||||||||||||||||||||||||||||||||
| 287 | |||||||||||||||||||||||||||||||||
| 288 | sub parseLists | ||||||||||||||||||||||||||||||||
| 289 | 0 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
parseLists: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 290 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||
| 291 | 0 | my $lists = shift; | |||||||||||||||||||||||||||||||
| 292 | |||||||||||||||||||||||||||||||||
| 293 | 0 | foreach my $list (@{$lists}) | |||||||||||||||||||||||||||||||
| 294 | { | ||||||||||||||||||||||||||||||||
| 295 | 0 | my $name = $list->GetName(); | |||||||||||||||||||||||||||||||
| 296 | 0 | $self->fetchList($name); | |||||||||||||||||||||||||||||||
| 297 | } | ||||||||||||||||||||||||||||||||
| 298 | } | ||||||||||||||||||||||||||||||||
| 299 | |||||||||||||||||||||||||||||||||
| 300 | |||||||||||||||||||||||||||||||||
| 301 | ############################################################################## | ||||||||||||||||||||||||||||||||
| 302 | # | ||||||||||||||||||||||||||||||||
| 303 | # reload - clear and refetch the privacy lists. | ||||||||||||||||||||||||||||||||
| 304 | # | ||||||||||||||||||||||||||||||||
| 305 | ############################################################################## | ||||||||||||||||||||||||||||||||
| 306 | sub reload | ||||||||||||||||||||||||||||||||
| 307 | 0 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
reload: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 308 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||
| 309 | |||||||||||||||||||||||||||||||||
| 310 | 0 | $self->clear(); | |||||||||||||||||||||||||||||||
| 311 | 0 | $self->fetch(); | |||||||||||||||||||||||||||||||
| 312 | } | ||||||||||||||||||||||||||||||||
| 313 | |||||||||||||||||||||||||||||||||
| 314 | |||||||||||||||||||||||||||||||||
| 315 | ############################################################################## | ||||||||||||||||||||||||||||||||
| 316 | # | ||||||||||||||||||||||||||||||||
| 317 | # remove - removes the list from the database. | ||||||||||||||||||||||||||||||||
| 318 | # | ||||||||||||||||||||||||||||||||
| 319 | ############################################################################## | ||||||||||||||||||||||||||||||||
| 320 | sub remove | ||||||||||||||||||||||||||||||||
| 321 | 0 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
remove: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 322 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||
| 323 | 0 | my $list = shift; | |||||||||||||||||||||||||||||||
| 324 | |||||||||||||||||||||||||||||||||
| 325 | 0 | ▶ | if ($self->exists($list)) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 326 | { | ||||||||||||||||||||||||||||||||
| 327 | 0 | $self->{CONNECTION}->{DEBUG}->Log3("PrivacyLists::remove: deleting $list from the DB"); | |||||||||||||||||||||||||||||||
| 328 | |||||||||||||||||||||||||||||||||
| 329 | 0 | delete($self->{LISTS}->{$list}); | |||||||||||||||||||||||||||||||
| 330 | 0 | ▶ | delete($self->{LISTS}) if (scalar(keys(%{$self->{LISTS}})) == 0); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 331 | } | ||||||||||||||||||||||||||||||||
| 332 | } | ||||||||||||||||||||||||||||||||
| 333 | |||||||||||||||||||||||||||||||||
| 334 | |||||||||||||||||||||||||||||||||
| 335 | sub save | ||||||||||||||||||||||||||||||||
| 336 | 0 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
save: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 337 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||
| 338 | |||||||||||||||||||||||||||||||||
| 339 | 0 | foreach my $list ($self->lists()) | |||||||||||||||||||||||||||||||
| 340 | { | ||||||||||||||||||||||||||||||||
| 341 | 0 | $self->saveList($list); | |||||||||||||||||||||||||||||||
| 342 | } | ||||||||||||||||||||||||||||||||
| 343 | } | ||||||||||||||||||||||||||||||||
| 344 | |||||||||||||||||||||||||||||||||
| 345 | |||||||||||||||||||||||||||||||||
| 346 | sub saveList | ||||||||||||||||||||||||||||||||
| 347 | 0 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
saveList: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 348 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||
| 349 | 0 | my $list = shift; | |||||||||||||||||||||||||||||||
| 350 | |||||||||||||||||||||||||||||||||
| 351 | 0 | my @items = $self->items($list); | |||||||||||||||||||||||||||||||
| 352 | 0 | $self->{CONNECTION}->PrivacyListsSet(list=>$list, | |||||||||||||||||||||||||||||||
| 353 | items=>\@items); | ||||||||||||||||||||||||||||||||
| 354 | } | ||||||||||||||||||||||||||||||||
| 355 | |||||||||||||||||||||||||||||||||
| 356 | |||||||||||||||||||||||||||||||||
| 357 | 11 | 1; | |||||||||||||||||||||||||||||||
| 358 | |||||||||||||||||||||||||||||||||