]> dxcluster.org Git - spider.git/blob - cmd/unset/buddy.pl
force disconnect on attempt 2
[spider.git] / cmd / unset / buddy.pl
1 #
2 # remove a buddy from the list
3 #
4 # Copyright (c) 2006 - Dirk Koopman G1TLH
5 #
6 #
7 #
8
9 my ($self, $line) = @_;
10 my @args = split /\s+/, uc $line;
11 my $buddies;
12 my @out;
13
14 my @buddies = @{$self->user->buddies};
15
16 foreach my $call (@args) {
17         push(@out, $self->msg('e22', $call)), next unless is_callsign($call);
18         next if $call eq $self->call;
19         @buddies = grep $_ ne $call, @buddies; 
20         push @out, $self->msg('buddyu', $call);
21 }
22
23 $self->user->buddies(\@buddies);
24 $self->user->put;
25
26 return (1, @out);