return 1;
} elsif ($command eq 'status') {
return 1;
+ } elsif ($command eq 'wallchan') {
+ return 1;
}
return 0;
}
case('wallchan') {
$main::statistics{'command_counter_wallchan'}++;
+ return handle_command_wallchan($command, $string, $mode, $kernel, $heap, $who, $nick, $where, $msg, $sender, $irc, $channel);
}
}
}
+# handle_command_wallchan()
+#
+# command handler for the 'wallchan' command
+#
+# 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 message itself
+# - POE sender
+# - session irc handle
+# - the channel name
+# return:
+# - text to send back to the sender
+sub handle_command_wallchan {
+ 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 $msg = shift;
+ my $sender = shift;
+ my $irc = shift;
+ my $channel = shift;
+
+
+ if (length($string) < 1) {
+ my $answer = 'The "wallchan" command requires a parameter';
+ $answer = translate_text_for_channel($channel, 'error_wallchan_command_parameter', $answer);
+ return $answer;
+ }
+
+ print_msg("wallchan: '$string', by $nick", DEBUG);
+ send_to_commandchannel("wallchan: '$string', by $nick");
+
+
+ my @channels = ();
+ foreach my $tmp_session (keys(%main::sessions)) {
+ push(@channels, @{$main::sessions{$tmp_session}{'joined_channels'}});
+ }
+ foreach my $tmp_channel (@channels) {
+ my $answer = 'Operator message';
+ $answer = translate_text_for_channel($tmp_channel, 'wallchan_command_message', $answer);
+ send_to_channel($tmp_channel, $answer . ': ' . $string);
+ }
+
+
+ return '';
+}
+
+
# handle_command_search()
#
# command handler for the 'search' command