Improve M$ Windows compatibility
[spider.git] / cmd / show / chat.pl
1 #
2 # print out the general log file for chat only
3 #
4 # Copyright (c) 1998-2023 - Dirk Koopman G1TLH
5 #
6 #
7 #
8 my $self = shift;
9
10 # this appears to be a reasonable thing for users to do (thank you JE1SGH)
11 # return (1, $self->msg('e5')) if $self->priv < 9;
12
13 my $cmdline = shift;
14 my @f = split /\s+/, $cmdline;
15 my $f;
16 my @out;
17 my ($from, $to, $who); 
18
19 $from = 0;
20 while ($f = shift @f) {                 # next field
21         #  print "f: $f list: ", join(',', @list), "\n";
22         if (!$from && !$to) {
23                 ($from, $to) = $f =~ /^(\d+)-(\d+)$/o;         # is it a from -> to count?
24                 next if $from && $to > $from;
25         }
26         if (!$to) {
27                 ($to) = $f =~ /^(\d+)$/o if !$to;              # is it a to count?
28                 next if $to;
29         }
30         next if $who;
31         if ($f !~ /^\d+$/) {
32                 ($who) = $f;
33         }
34 #       ($who) = $f =~ /^(\w+)/o;
35 }
36
37 $to = 20 unless $to;
38 $from = 0 unless $from;
39
40 if ($self->{_nospawn} || $main::is_win == 1) {
41         @out = DXLog::print($from, $to, $main::systime, 'chat', $who);
42 } else {
43         @out = $self->spawn_cmd("show/chat $cmdline", \&DXLog::print, args => [$from, $to, $main::systime, 'chat', $who]);
44 }
45 return (1, @out);