forked from paxed/Rodney
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnickidlist.pm
More file actions
51 lines (40 loc) · 768 Bytes
/
nickidlist.pm
File metadata and controls
51 lines (40 loc) · 768 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package NickIdList;
use strict;
use warnings;
use diagnostics;
use DBI;
sub new {
my $class = shift;
my %args = @_;
return bless \%args, $class;
}
sub is_identified {
my $self = shift;
my $nick = shift;
return 1 if ( grep {$_ eq $nick} @{$self->{'idlist'}} );
return 0;
}
sub get_identified_nicks {
my $self = shift;
return join(", ", @{$self->{'idlist'}} );
}
sub nick_identify {
my $self = shift;
my $nick = shift;
push(@{$self->{'idlist'}}, $nick);
}
sub nick_deidentify {
my $self = shift;
my $nick = shift;
my $a;
my $counter = 0;
foreach $a (@{$self->{'idlist'}}) {
if ($a eq $nick) {
splice(@{$self->{'idlist'}}, $counter, 1);
return;
}
$counter++;
}
}
1;
__END__