add set/buddy.
[spider.git] / cmd / set / buddy.pl
diff --git a/cmd/set/buddy.pl b/cmd/set/buddy.pl
new file mode 100644 (file)
index 0000000..2d99ef5
--- /dev/null
@@ -0,0 +1,25 @@
+#
+# add a buddy 
+#
+# Copyright (c) 2006 - Dirk Koopman G1TLH
+#
+# $Id$
+#
+
+my ($self, $line) = @_;
+my @args = split /\s+/, uc $line;
+my $group;
+my @out;
+
+my $buddies = $self->user->buddies || [];
+
+foreach my $call (@args) {
+       push(@out, $self->msg('e22', $call)), next unless is_callsign($call);
+       next if $call eq $self->call;
+       push @$buddies, $call unless grep $_ eq $call, @$buddies; 
+       push @out, $self->msg('buddya', $call);
+}
+
+$self->user->put;
+
+return (1, @out);