+#
+# create a generalised reply to a passed thing, if it isn't replyable
+# to then undef is returned
+#
+sub new_reply
+{
+ my $thing = shift;
+ my $out;
+
+ if ($thing->{group} eq $main::mycall) {
+ $out = $thing->new;
+ $out->{touser} = $thing->{user} if $thing->{user};
+ $out->{group} = $thing->{origin};
+ } elsif (DXChannel::get($thing->{group})) {
+ $out = $thing->new(user => $thing->{group});
+ $out->{touser} = $thing->{user} if $thing->{user};
+ $out->{group} = $thing->{origin};
+ } elsif ($thing->{touser} && DXChannel::get($thing->{touser})) {
+ $out = $thing->new(user => $thing->{touser});
+ $out->{group} = $thing->{group};
+ }
+ return $out;
+}