Change DXUser->get* to DXUser::get*
[spider.git] / cmd / set / qth.pl
index 93407a2a76899d2680119b6a4b409da404e8e75e..84462f0c3a58a3d363be66753aac395bc21b4d0c 100644 (file)
@@ -1,8 +1,31 @@
 #
-# set the qth field
+# set the name of the user
 #
-# $Id$
+# Copyright (c) 1998 - Dirk Koopman
 #
-my ($self, $args)  = @_;
-my $user = $self->user;
-return (1, "qth is now ", $user->qth($args));
+#
+#
+
+my ($self, $line) = @_;
+my $call = $self->call;
+my $user;
+
+# remove leading and trailing spaces
+$line =~ s/^\s+//;
+$line =~ s/\s+$//;
+$line =~ s/[{}]//g;   # no braces allowed
+
+return (1, $self->msg('qthe1')) if !$line;
+
+$user = DXUser::get_current($call);
+if ($user) {
+       $user->qth($line);
+       $user->put();
+       my $s = DXProt::pc41($call, 2, $line);
+       DXProt::eph_dup($s);
+       DXChannel::broadcast_all_nodes($s, $main::me) ;
+       return (1, $self->msg('qth', $line));
+} else {
+       return (1, $self->msg('namee2', $call));
+}
+