-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathdoCommand.pl
More file actions
37 lines (29 loc) · 764 Bytes
/
doCommand.pl
File metadata and controls
37 lines (29 loc) · 764 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package doCommand;
#
# This plugin is licensed under the GNU GPL
# Copyright 2005 by kaliwanagan
# --------------------------------------------------
use strict;
use Plugins;
use Globals;
use Log qw(message warning error);
use Misc;
use Utils;
use Commands;
use Time::HiRes qw(time);
Plugins::register('doCommand', 'do a command on certain conditions', \&Unload);
my $hook = Plugins::addHook('AI_post', \&doCommand);
sub Unload {
Plugins::delHook('AI_post', $hook);
}
my $time;
sub doCommand {
my $prefix = "doCommand_";
for (my $i =0; (exists $config{$prefix.$i}); $i++) {
if ((main::checkSelfCondition($prefix.$i)) && main::timeOut($time, $config{$prefix.$i."_timeout"})) {
Commands::run($config{$prefix.$i});
$time = time;
}
}
}
return 1;