sub is_nick_allowed_admin_command {
my $nick = shift;
- if ($nick eq 'ads2') {
+ if ($nick eq 'ads') {
return 1;
}
}
+# handle_command()
+#
+# wrapper to handle all commands
+#
+# parameter:
+# - the command (lower case)
+# - the parameter string (may be empty)
+# - the command mode (admin/operator/user)
+# - POE kernel
+# - POE heap
+# - the full who of the message sender, including the nick name
+# - the nick name of the message sender
+# - the full origin of the message
+# - the channel or nick name of the message origin
+# - POE sender
+# - session irc handle
+# - the channel name
+# return:
+# - text to send back to the sender
+sub handle_command {
+ my $command = shift;
+ my $string = shift;
+ my $mode = shift;
+ my $kernel = shift;
+ my $heap = shift;
+ my $who = shift;
+ my $nick = shift;
+ my $where = shift;
+ my $sender = shift;
+ my $irc = shift;
+ my $channel = shift;
+
+
+ switch ($command) {
+ case('search') {
+
+ }
+ case('help') {
+
+ }
+ case('info') {
+
+ }
+ case('learn') {
+
+ }
+ case('forget') {
+
+ }
+ case('config') {
+
+ }
+ case('status') {
+
+ }
+ }
+
+
+
+ return '';
+
+}
+
+
+
+
my $channel = $where->[0];
my $replyto = $channel;
my $full_msg = $msg;
- my $like = 0;
print_msg("on_message($msg)", DEBUG);
my $irc = $sender->get_heap();
#$answer = $admin_commands->{$command}($kernel, $nick, $channel, $string);
$answer = "Execute command: $command";
print_msg("Execute command: $command", INFO);
+ $answer = handle_command($command, $string, 'admin', $kernel, $heap, $who, $nick, $where, $msg, $sender, $irc, $channel);
} else {
# user is not allowed to execute admin commands
$answer = "Access denied";
#$answer = $admin_commands->{$command}($kernel, $nick, $channel, $string);
$answer = "Execute command: $command";
print_msg("Execute command: $command", INFO);
+ $answer = handle_command($command, $string, 'operator', $kernel, $heap, $who, $nick, $where, $msg, $sender, $irc, $channel);
} else {
# user is not allowed to execute admin commands
$answer = "Access denied";
#$answer = $admin_commands->{$command}($kernel, $nick, $channel, $string);
$answer = "Execute command: $command";
print_msg("Execute command: $command", INFO);
+ $answer = handle_command($command, $string, 'user', $kernel, $heap, $who, $nick, $where, $msg, $sender, $irc, $channel);
}