diff options
author | Timo Sirainen <cras@irssi.org> | 2001-09-22 08:15:30 +0000 |
---|---|---|
committer | cras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2001-09-22 08:15:30 +0000 |
commit | d246f862e89f088b914083e5e573e6194b9a0fd0 (patch) | |
tree | 0fcde9d4b3de70746a545099b40168d95f365c56 /docs | |
parent | 235402aa9f297942ea79a725bb3d3e5d1eb4c091 (diff) | |
download | irssi-d246f862e89f088b914083e5e573e6194b9a0fd0.zip |
/COMMAND creation example fixed/updated.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1809 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'docs')
-rw-r--r-- | docs/perl.txt | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/docs/perl.txt b/docs/perl.txt index ad20dff9..782cb452 100644 --- a/docs/perl.txt +++ b/docs/perl.txt @@ -74,10 +74,16 @@ A list of signals that irssi sends can be found from signals.txt file. You can create your own commands, or replace existing ones with Irssi::command_bind(). The command handling work internally pretty much the same as signal handlers, so if you replace existing command and don't -wish to let it run, call Irssi::signal_stop(). Here's an example: +wish to let it run, call Irssi::signal_stop(). + +Here's an example: # Usage: /HELLO [<nick>] sub cmd_hello { + # data - contains the parameters for /HELLO + # server - the active server in window + # witem - the active window item (eg. channel, query) + # or undef if the window is empty my ($data, $server, $witem) = @_; if (!$server || !$server->{connected}) { @@ -87,9 +93,10 @@ wish to let it run, call Irssi::signal_stop(). Here's an example: if ($data) { $server->command("/MSG $data Hello!"); - } elsif ($witem) { + } elsif ($witem && ($witem->{type} eq "CHANNEL" || + $witem->{type} eq "QUERY")) { # there's query/channel active in window - $server->command("/MSG * Hello!"); + $witem->command("/MSG ".$witem->{name}." Hello!"); } else { Irssi::print("Nick not given, and no active channel/query in window"); } @@ -97,6 +104,7 @@ wish to let it run, call Irssi::signal_stop(). Here's an example: Irssi::command_bind('hello', 'cmd_hello'); + Message levels -------------- |