2 # UserDCC.pl: User Commands, DCC CHAT.
4 # Version: v0.2 (20010119)
5 # Created: 20000707 (from UserExtra.pl)
8 if (&IsParam("useStrict")) { use strict; }
16 if ($message =~ /^(exit|quit)$/i) {
17 # do ircII clients support remote close? if so, cool!
18 &status("userDCC: quit called. FIXME");
20 &status("userDCC: after dcc_close!");
26 if ($message =~ /^who$/) {
27 my $count = scalar(keys %{ $dcc{'CHAT'} });
28 my $dccCHAT = $message;
30 &pSReply("Start of who ($count users).");
31 foreach (keys %{ $dcc{'CHAT'} }) {
34 &pSReply("End of who.");
39 ### for those users with enough flags.
41 if ($message =~ /^tellme(\s+(.*))?$/i) {
43 if ($args =~ /^\s*$/) {
48 my $result = &doQuestion($args);
55 if ($message =~ /^4op(\s+($mask{chan}))?$/i) {
56 return unless (&hasFlag("o"));
65 if (!$channels{$chan}{'o'}{$ident}) {
66 &msg($who, "i don't have ops on $chan to do that.");
70 # on non-4mode(<4) servers, this may be exploited.
71 if ($channels{$chan}{'o'}{$who}) {
72 rawout("MODE $chan -o+o-o+o". (" $who" x 4));
74 rawout("MODE $chan +o-o+o-o". (" $who" x 4));
81 if ($message =~ /^backlog(\s+(.*))?$/i) {
82 return unless (&hasFlag("o"));
83 return unless (&hasParam("backlog"));
85 my $max = $param{'backlog'};
90 } elsif ($num !~ /^\d+/) {
91 &msg($who, "error: argument is not positive integer.");
93 } elsif ($num > $max or $num < 0) {
94 &msg($who, "error: argument is out of range (max $max).");
98 &msg($who, "Start of backlog...");
100 sleep 1 if ($_ % 4 == 0 and $_ != 0);
101 $conn->privmsg($who, "[".($_+1)."]: $backlog[$max-$num+$_]");
103 &msg($who, "End of backlog.");
109 if ($message =~ /^dumpvars$/i) {
110 return unless (&hasFlag("o"));
111 return unless (&IsParam("dumpvars"));
113 &status("Dumping all variables...");
120 if ($message =~ /^kick(\s+(\S+)(\s+(\S+))?)?/) {
121 return unless (&hasFlag("o"));
122 my ($nick,$chan) = (lc $2,lc $4);
129 if (&validChan($chan) == 0) {
130 &msg($who,"error: invalid channel \002$chan\002");
134 if (&IsNickInChan($nick,$chan) == 0) {
135 &msg($who,"$nick is not in $chan.");
145 if ($message =~ /^mode(\s+(.*))?$/) {
146 return unless (&hasFlag("n"));
147 my ($chan,$mode) = split /\s+/,$2,2;
154 if (&validChan($chan) == 0) {
155 &msg($who,"error: invalid channel \002$chan\002");
159 if (!$channels{$chan}{o}{$ident}) {
160 &msg($who,"error: don't have ops on \002$chan\002");
170 if ($message =~ /^part(\s+(\S+))?$/i) {
171 return unless (&hasFlag("o"));
174 if ($jchan !~ /^$mask{chan}$/) {
175 &msg($who, "error, invalid chan.");
180 if (!&validChan($jchan)) {
181 &msg($who, "error, I'm not on that chan.");
185 &msg($jchan, "Leaving. (courtesy of $who).");
190 # lobotomy. sometimes we want the bot to be _QUIET_.
191 if ($message =~ /^(lobotomy|bequiet)$/i) {
192 return unless (&hasFlag("o"));
195 &performReply("i'm already lobotomized");
197 &performReply("i have been lobotomized");
205 if ($message =~ /^(unlobotomy|benoisy)$/i) {
206 return unless (&hasFlag("o"));
209 &performReply("i have been unlobotomized, woohoo");
211 delete $cache{lobotomy};
212 # undef $cache{lobotomy}; # ??
214 &performReply("i'm not lobotomized");
221 if ($message =~ /^op(\s+(.*))?$/i) {
222 return unless (&hasFlag("o"));
227 if ($opee =~ /^(\S+)\s+(\S+)$/) {
230 if (!&validChan($2)) {
231 &msg($who,"error: invalid chan ($2).");
235 &msg($who,"error: invalid params.");
239 @chans = keys %channels;
245 next unless (&IsNickInChan($opee,$_));
247 if ($channels{$_}{'o'}{$opee}) {
248 &pSReply("op: $opee already has ops on $_");
253 &pSReply("opping $opee on $_");
258 &pSReply("op: opped on all possible channels.");
260 &DEBUG("op: found => '$found'.");
261 &DEBUG("op: op => '$op'.");
268 if ($message =~ /^deop(\s+(.*))?$/i) {
269 return unless (&hasFlag("o"));
274 if ($opee =~ /^(\S+)\s+(\S+)$/) {
277 if (!&validChan($2)) {
278 &msg($who,"error: invalid chan ($2).");
282 &msg($who,"error: invalid params.");
286 @chans = keys %channels;
292 next unless (&IsNickInChan($opee,$_));
294 if (!exists $channels{$_}{'o'}{$opee}) {
295 &status("deop: $opee already has no ops on $_");
300 &status("deopping $opee on $_ at ${who}'s request");
305 &status("deop: deopped on all possible channels.");
307 &DEBUG("deop: found => '$found'.");
308 &DEBUG("deop: op => '$op'.");
315 if ($message =~ s/^say\s+(\S+)\s+(.*)//) {
316 return unless (&hasFlag("o"));
317 my ($chan,$msg) = (lc $1, $2);
318 &DEBUG("chan => '$1', msg => '$msg'.");
320 if (&validChan($chan)) {
323 &msg($who,"i'm not on \002$1\002, sorry.");
329 if ($message =~ /^die$/) {
330 return unless (&hasFlag("n"));
334 &status("Dying by $who\'s request");
338 # global factoid substitution.
339 if ($message =~ m|^s([/,#])(.+?)\1(.*?)\1;?\s*$|) {
340 my ($delim,$op,$np) = ($1, $2, $3);
341 return unless (&hasFlag("n"));
342 ### TODO: support flags to do full-on global.
345 if ($np =~ /$delim/) {
346 &performReply("looks like you used the delimiter too many times. You may want to use a different delimiter, like ':' or '#'.");
350 ### TODO: fix up $op to support mysql/pgsql/dbm(perl)
351 ### TODO: => add db/sql specific function to fix this.
352 my @list = &searchTable("factoids", "factoid_key",
353 "factoid_value", $op);
356 &performReply("Expression didn't match anything.");
360 if (scalar @list > 100) {
361 &performReply("regex found more than 100 matches... not doing.");
365 &status("gsubst: going to alter ".scalar(@list)." factoids.");
366 &performReply("going to alter ".scalar(@list)." factoids.");
372 next if (&IsLocked($faqtoid) == 1);
373 my $result = &getFactoid($faqtoid);
375 &DEBUG("was($faqtoid) => '$was'.");
378 # we could support global local (once off).
379 if ($result =~ s/\Q$op/$np/gi) {
380 if (length $result > $param{'maxDataSize'}) {
381 &performReply("that's too long (or was long)");
384 &setFactInfo($faqtoid, "factoid_value", $result);
385 &status("update: '$faqtoid' =is=> '$result'; was '$was'");
387 &WARN("subst: that's weird... thought we found the string ($op) in '$faqtoid'.");
393 &ERROR("Some warnings/errors?");
396 &performReply("Ok... did s/$op/$np/ for ".
397 (scalar(@list) - $error)." factoids");
403 if ($message =~ /^jump(\s+(\S+))?$/i) {
404 return unless (&hasFlag("n"));
412 if ($2 =~ /^(\S+)(:(\d+))?$/) {
416 &msg($who,"invalid format.");
420 &status("jumping servers... $server...");
421 &rawout("QUIT :jumping to $server");
423 if (&irc($server,$port) == 0) {
429 if ($message =~ /^reload$/i) {
430 return unless (&hasFlag("n"));
432 &status("USER reload $who");
433 &pSReply("reloading...");
435 &pSReply("reloaded.");
441 if ($message =~ /^reset$/i) {
442 return unless (&hasFlag("n"));
444 &msg($who,"resetting...");
446 foreach ( keys %channels, keys %chanconf ) {
447 next if (grep /^\Q$_\E$/i, @done);
457 &status("USER reset $who");
458 &msg($who,"resetted");
464 if ($message =~ /^rehash$/) {
465 return unless (&hasFlag("n"));
467 &msg($who,"rehashing...");
469 &status("USER rehash $who");
470 &msg($who,"rehashed");
476 ##### USER//CHAN SPECIFIC CONFIGURATION COMMANDS
479 if ($message =~ /^chaninfo(\s+(.*))?$/) {
480 my @args = split /[\s\t]+/, $2; # hrm.
482 if (scalar @args != 1) {
487 if (!exists $chanconf{$args[0]}) {
488 &pSReply("no such channel $args[0]");
492 &pSReply("showing channel conf.");
493 foreach (sort keys %{ $chanconf{$args[0]} }) {
494 &pSReply("$chan: $_ => $chanconf{$args[0]}{$_}");
496 &pSReply("End of chaninfo.");
502 if ($message =~ /^(chanset|\+chan)(\s+(.*?))?$/) {
507 if (!defined $args) {
513 while ($args =~ s/^($mask{chan})\s*//) {
517 if (!scalar @chans) {
518 push(@chans, "_default");
522 my($what,$val) = split /[\s\t]+/, $args, 2;
524 ### TODO: "cannot set values without +m".
525 return unless (&hasFlag("n"));
528 if (defined $what and $what !~ /^[-+]/ and !defined $val and $no_chan) {
529 &pSReply("Showing $what values on all channels...");
532 foreach (keys %chanconf) {
533 my $val = $chanconf{$_}{$what} || "NOT-SET";
537 foreach (keys %vals) {
538 &pSReply(" $what = $_: ".join(' ', keys %{ $vals{$_} } ) );
541 &pSReply("End of list.");
546 ### TODO: move to UserDCC again.
547 if ($cmd eq "chanset" and !defined $what) {
548 &DEBUG("showing channel conf.");
550 foreach $chan ($chan, "_default") {
551 &pSReply("chan: $chan");
552 ### TODO: merge 2 or 3 per line.
555 foreach (sort keys %{ $chanconf{$chan} }) {
556 my $newstr = join(', ', @items);
557 if (length $newstr > 60) {
562 push(@items, "$_ => $chanconf{$chan}{$_}");
564 &pSReply(" $str") if (@items);
570 &chanSet($cmd, $_, $what, $val);
576 if ($message =~ /^(chanunset|\-chan)(\s+(.*))?$/) {
577 return unless (&hasFlag("n"));
581 if (!defined $args) {
588 if ($args =~ s/^(\-)?($mask{chan})\s*//) {
590 $delete = ($1) ? 1 : 0;
591 &DEBUG("chan => $chan.");
593 &VERB("no chan arg; setting to default.",2);
598 if (!exists $chanconf{$chan}) {
599 &pSReply("no such channel $chan");
605 if (!&getChanConf($args,$chan)) {
606 &pSReply("$args does not exist for $chan");
610 my @chans = &ChanConfList($args);
611 &DEBUG("scalar chans => ".scalar(@chans) );
612 if (scalar @chans == 1 and $chans[0] eq "_default" and !$no_chan) {
613 &psReply("ok, $args was set only for _default; unsetting for _defaul but setting for other chans.");
615 my $val = $chanconf{$_}{_default};
616 foreach (keys %chanconf) {
617 $chanconf{$_}{$args} = $val;
619 delete $chanconf{_default}{$args};
624 if ($no_chan and !exists($chanconf{_default}{$args})) {
625 &pSReply("ok, $args for _default does not exist, removing from all chans.");
627 foreach (keys %chanconf) {
628 next unless (exists $chanconf{$_}{$args});
629 &DEBUG("delete chanconf{$_}{$args};");
630 delete $chanconf{$_}{$args};
636 &pSReply("Unsetting channel ($chan) option $args. (was $chanconf{$chan}{$args})");
637 delete $chanconf{$chan}{$args};
643 &pSReply("Deleting channel $chan for sure!");
644 $utime_chanfile = time();
648 &pSReply("Leaving $chan...");
650 delete $chanconf{$chan};
652 &pSReply("Prefix channel with '-' to delete for sure.");
658 if ($message =~ /^newpass(\s+(.*))?$/) {
659 my(@args) = split /[\s\t]+/, $2 || '';
661 if (scalar @args != 1) {
666 my $u = &getUser($who);
667 my $crypt = &mkcrypt($args[0]);
669 &pSReply("Set your passwd to '$crypt'");
670 $users{$u}{PASS} = $crypt;
672 $utime_userfile = time();
678 if ($message =~ /^chpass(\s+(.*))?$/) {
679 my(@args) = split /[\s\t]+/, $2 || '';
686 if (!&IsUser($args[0])) {
687 &pSReply("user $args[0] is not valid.");
691 my $u = &getUser($args[0]);
693 &pSReply("Internal error, u = NULL.");
697 if (scalar @args == 1) { # del pass.
698 if (!&IsFlag("n") and $who !~ /^\Q$verifyUser\E$/i) {
699 &pSReply("cannto remove passwd of others.");
703 if (!exists $users{$u}{PASS}) {
704 &pSReply("$u does not have pass set anyway.");
708 &pSReply("Deleted pass from $u.");
710 $utime_userfile = time();
713 delete $users{$u}{PASS};
718 my $crypt = &mkcrypt($args[1]);
719 &pSReply("Set $u's passwd to '$crypt'");
720 $users{$u}{PASS} = $crypt;
722 $utime_userfile = time();
728 if ($message =~ /^chattr(\s+(.*))?$/) {
729 my(@args) = split /[\s\t]+/, $2 || '';
737 if ($args[0] =~ /^$mask{nick}$/i) { # <nick>
738 $user = &getUser($args[0]);
741 $user = &getUser($who);
742 &DEBUG("user $who... nope.") unless (defined $user);
743 $user = &getUser($verifyUser);
747 if (!defined $user) {
748 &pSReply("user does not exist.");
752 my $flags = $users{$user}{FLAGS};
753 if (!defined $chflag) {
754 &pSReply("Flags for $user: $flags");
758 &DEBUG("who => $who");
759 &DEBUG("verifyUser => $verifyUser");
760 if (!&IsFlag("n") and $who !~ /^\Q$verifyUser\E$/i) {
761 &pSReply("cannto change attributes of others.");
767 foreach (split //, $chflag) {
768 if ($_ eq "+") { $state = 1; next; }
769 if ($_ eq "-") { $state = 0; next; }
771 if (!defined $state) {
772 &pSReply("no initial + or - was found in attr.");
777 next if ($flags =~ /\Q$_\E/);
780 if (&IsParam("owner")
781 and $param{owner} =~ /^\Q$user\E$/i
782 and $flags =~ /[nmo]/
784 &pSReply("not removing flag $_ for $user.");
787 next unless ($flags =~ s/\Q$_\E//);
794 $utime_userfile = time();
796 &pSReply("Current flags: $flags");
797 $users{$user}{FLAGS} = $flags;
799 &pSReply("No flags changed: $flags");
805 if ($message =~ /^chnick(\s+(.*))?$/) {
806 my(@args) = split /[\s\t]+/, $2 || '';
808 if ($who eq "_default") {
809 &WARN("$who or verifyuser tried to run chnick.");
813 if (!scalar @args or scalar @args > 2) {
818 if (scalar @args == 1) { # 1
819 $user = &getUser($who);
820 &DEBUG("nope, not $who.") unless (defined $user);
821 $user ||= &getUser($verifyUser);
824 $user = &getUser($args[0]);
828 if (!defined $user) {
829 &pSReply("user $who or $args[0] does not exist.");
833 if ($user =~ /^\Q$chnick\E$/i) {
834 &pSReply("user == chnick. why should I do that?");
838 if (&getUser($chnick)) {
839 &pSReply("user $chnick is already used!");
843 if (!&IsFlag("n") and $who !~ /^\Q$verifyUser\E$/i) {
844 &pSReply("cannto change nick of others.");
845 return "REPLY" if ($who eq "_default");
849 foreach (keys %{ $users{$user} }) {
850 $users{$chnick}{$_} = $users{$user}{$_};
851 delete $users{$user}{$_};
853 undef $users{$user}; # ???
855 $utime_userfile = time();
858 &pSReply("Changed '$user' to '$chnick' successfully.");
863 if ($message =~ /^([-+])host(\s+(.*))?$/) {
865 my(@args) = split /[\s\t]+/, $3 || '';
866 my $state = ($1 eq "+") ? 1 : 0;
873 if ($who eq "_default") {
874 &WARN("$who or verifyuser tried to run $cmd.");
879 if ($args[0] =~ /^$mask{nick}$/i) { # <nick>
880 return unless (&hasFlag("n"));
881 $user = &getUser($args[0]);
884 # who or verifyUser. FIXME!!!
885 $user = &getUser($who);
889 if (!defined $user) {
890 &pSReply("user $user does not exist.");
894 if (!defined $mask) {
896 &pSReply("Hostmasks for $user: $users{$user}{HOSTS}");
901 if (!&IsFlag("n") and $who !~ /^\Q$verifyUser\E$/i) {
902 &pSReply("cannto change masks of others.");
906 if ($mask !~ /^$mask{nuh}$/) {
907 &pSReply("error: mask ($mask) is not a real hostmask.");
911 my $count = scalar keys %{ $users{$user}{HOSTS} };
914 if (exists $users{$user}{HOSTS}{$mask}) {
915 &pSReply("mask $mask already exists.");
919 ### TODO: override support.
920 $users{$user}{HOSTS}{$mask} = 1;
922 &pSReply("Added $mask to list of masks.");
926 if (!exists $users{$user}{HOSTS}{$mask}) {
927 &pSReply("mask $mask does not exist.");
931 ### TODO: wildcard support. ?
932 delete $users{$user}{HOSTS}{$mask};
934 if (scalar keys %{ $users{$user}{HOSTS} } != $count) {
935 &pSReply("Removed $mask from list of masks.");
937 &pSReply("error: could not find $mask in list of masks.");
942 $utime_userfile = time();
948 if ($message =~ /^([-+])ban(\s+(.*))?$/) {
951 my(@args) = split /[\s\t]+/, $3 || '';
952 my $state = ($1 eq "+") ? 1 : 0;
959 my($mask,$chan,$time,$reason);
961 if ($flatarg =~ s/^($mask{nuh})\s*//) {
964 &DEBUG("arg does not contain nuh mask?");
967 if ($flatarg =~ s/^($mask{chan})\s*//) {
970 $chan = "*"; # _default instead?
973 if ($state == 0) { # delete.
974 my @c = &banDel($mask);
981 &pSReply("Removed $mask from chans: @c");
983 &pSReply("$mask was not found in ban list.");
994 if ($flatarg =~ s/^(\d+)\s*//) {
996 &DEBUG("time = $time.");
998 &pSReply("error: time cannot be negatime?");
1005 if ($flatarg =~ s/^(.*)$//) { # need length?
1009 if (!&IsFlag("n") and $who !~ /^\Q$verifyUser\E$/i) {
1010 &pSReply("cannto change masks of others.");
1014 if ($mask !~ /^$mask{nuh}$/) {
1015 &pSReply("error: mask ($mask) is not a real hostmask.");
1019 if ( &banAdd($mask,$chan,$time,$reason) == 2) {
1020 &pSReply("ban already exists; overwriting.");
1022 &pSReply("Added $mask for $chan (time => $time, reason => $reason)");
1027 if ($message =~ /^whois(\s+(.*))?$/) {
1030 if (!defined $arg) {
1035 my $user = &getUser($arg);
1036 if (!defined $user) {
1037 &pSReply("whois: user $user does not exist.");
1041 ### TODO: better (eggdrop-like) output.
1042 &pSReply("user: $user");
1043 foreach (keys %{ $users{$user} }) {
1044 my $ref = ref $users{$user}{$_};
1046 if ($ref eq "HASH") {
1048 ### DOES NOT WORK???
1049 foreach (keys %{ $users{$user}{$type} }) {
1050 &pSReply(" $type => $_");
1055 &pSReply(" $_ => $users{$user}{$_}");
1057 &pSReply("End of USER whois.");
1062 if ($message =~ /^bans(\s+(.*))?$/) {
1066 if ($arg ne "_default" and !&validChan($arg) ) {
1067 &pSReply("error: chan $chan is invalid.");
1072 if (!scalar keys %bans) {
1073 &pSReply("Ban list is empty.");
1078 &pSReply(" mask: expire, time-added, count, who-by, reason");
1079 foreach $c (keys %bans) {
1080 next unless (!defined $arg or $arg =~ /^\Q$c\E$/i);
1083 foreach (keys %{ $bans{$c} }) {
1084 my $val = $bans{$c}{$_};
1086 if (ref $val eq "ARRAY") {
1087 my @array = @{ $val };
1088 &pSReply(" $_: @array");
1090 &DEBUG("unknown ban: $val");
1094 &pSReply("END of bans.");
1099 if ($message =~ /^banlist(\s+(.*))?$/) {
1102 if (defined $arg and $arg !~ /^$mask_chan$/) {
1103 &pSReply("error: chan $chan is invalid.");
1107 &DEBUG("bans for global or arg => $arg.");
1108 foreach (keys %bans) { #CHANGE!!!
1109 &DEBUG(" $_ => $bans{$_}.");
1112 &DEBUG("End of bans.");
1113 &pSReply("END of bans.");
1118 if ($message =~ /^save$/) {
1119 return unless (&hasFlag("o"));
1123 &News::writeNews() if (&ChanConfList("news"));
1129 $message =~ s/^addignore/+ignore/;
1130 $message =~ s/^(del|un)ignore/-ignore/;
1133 if ($message =~ /^(\+|\-)ignore(\s+(.*))?$/i) {
1134 return unless (&hasFlag("o"));
1135 my $state = ($1 eq "+") ? 1 : 0;
1136 my $str = $1."ignore";
1144 my($mask,$chan,$time,$comment);
1147 if ($args =~ s/^($mask{nuh})\s*//) {
1150 &ERROR("no NUH mask?");
1154 if (!$state) { # delignore.
1155 if ( &ignoreDel($mask) ) {
1156 &pSReply("ok, deleted X ignores.");
1158 &pSReply("could not find $mask in ignore list.");
1168 if ($args =~ s/^($mask{chan}|\*)\s*//) {
1175 if ($args =~ s/^(\d+)\s*//) {
1185 $comment = "added by $who";
1188 if ( &ignoreAdd($mask, $chan, $time, $comment) > 1) {
1189 &pSReply("warn: $mask already in ignore list; written over anyway. FIXME");
1191 &pSReply("added $mask to ignore list.");
1197 if ($message =~ /^ignore(\s+(.*))?$/) {
1201 if ($arg !~ /^$mask{chan}$/) {
1202 &pSReply("error: chan $chan is invalid.");
1206 if (!&validChan($arg)) {
1207 &pSReply("error: chan $arg is invalid.");
1211 &pSReply("Showing bans for $arg only.");
1214 if (!scalar keys %ignore) {
1215 &pSReply("Ignore list is empty.");
1219 ### TODO: proper (eggdrop-like) formatting.
1221 &pSReply(" mask: expire, time-added, who, comment");
1222 foreach $c (keys %ignore) {
1223 next unless (!defined $arg or $arg =~ /^\Q$c\E$/i);
1226 foreach (keys %{ $ignore{$c} }) {
1227 my $ref = ref $ignore{$c}{$_};
1228 if ($ref eq "ARRAY") {
1229 my @array = @{ $ignore{$c}{$_} };
1230 &pSReply(" $_: @array");
1232 &DEBUG("unknown ignore line?");
1236 &pSReply("END of ignore.");
1242 if ($message =~ /^(\+|\-|add|del)user(\s+(.*))?$/i) {
1244 my $strstr = $1."user";
1245 my @args = split /\s+/, $3 || '';
1247 my $state = ($str =~ /^(\+|add)$/) ? 1 : 0;
1249 if (!scalar @args) {
1255 if (scalar @args != 2) {
1256 &pSReply(".+host requires hostmask argument.");
1259 } elsif (scalar @args != 1) {
1260 &pSReply("too many arguments.");
1264 if ($state) { # adduser.
1265 if (scalar @args == 1) {
1266 $args[1] = &getHostMask($args[0]);
1267 if (!defined $args[1]) {
1268 &ERROR("could not get hostmask?");
1273 if ( &userAdd(@args) ) { # success.
1274 &pSReply("Added $args[0]...");
1277 &pSReply("User $args[0] already exists");
1282 if ( &userDel($args[0]) ) { # success.
1283 &pSReply("Deleted $args[0] successfully.");
1286 &pSReply("User $args[0] does not exist.");
1293 if ($message =~ /^sched$/) {
1298 foreach (keys %sched) {
1299 next unless (exists $sched{$_}{TIME});
1300 $time{ $sched{$_}{TIME}-time() }{$_} = 1;
1303 next unless (exists $sched{$_}{RUNNING});
1308 foreach (sort { $a <=> $b } keys %time) {
1309 my $str = join(", ", sort keys %{ $time{$_} });
1310 &DEBUG("time => $_, str => $str");
1311 push(@time, "$str (".&Time2String($_).")");
1314 &pSReply( &formListReply(0, "Schedulers: ", @time ) );
1315 &pSReply( &formListReply(0, "Scheds to run: ", sort @list ) );
1316 &pSReply( &formListReply(0, "Scheds running(should not happen?) ", sort @run ) );