diff --git a/examples/.cvsignore b/examples/.cvsignore new file mode 100644 index 00000000..282522db --- /dev/null +++ b/examples/.cvsignore @@ -0,0 +1,2 @@ +Makefile +Makefile.in diff --git a/examples/Makefile.am b/examples/Makefile.am new file mode 100644 index 00000000..409ff8dd --- /dev/null +++ b/examples/Makefile.am @@ -0,0 +1,6 @@ +EXTRA_DIST = \ + autorejoin.pl \ + hello.pl \ + privmsg.pl \ + realname.pl \ + quitmsg.pl diff --git a/examples/autorejoin.pl b/examples/autorejoin.pl index 34f6cfe3..1dc4979a 100644 --- a/examples/autorejoin.pl +++ b/examples/autorejoin.pl @@ -2,7 +2,7 @@ # NOTE: I personally don't like this feature, in most channels I'm in it # will just result as ban. You've probably misunderstood the idea of /KICK -# wrong if you kick/get kicked all the time "just for fun" ... +# if you kick/get kicked all the time "just for fun" ... use Irssi; diff --git a/examples/quitmsg.pl b/examples/quitmsg.pl new file mode 100644 index 00000000..99c36247 --- /dev/null +++ b/examples/quitmsg.pl @@ -0,0 +1,32 @@ +# Quit with a random quit message read from ~/.irssi/irssi.quit + +use Irssi; + +$quitfile = "$ENV{HOME}/.irssi/irssi.quit"; + +sub cmd_quit { + my ($data, $server, $channel) = @_; + + open (f, $quitfile) || return; + $lines = 0; while() { $lines++; }; + + $line = int(rand($lines))+1; + + seek(f, 0, 0); $. = 0; + while() { + next if ($. != $line); + + chomp; + $quitmsg = $_; + last; + } + close(f); + + @servers = Irssi::servers; + foreach $server (@servers) { + %svals = %{$server->values()}; + $server->command("/disconnect ".$svals{'tag'}." $quitmsg"); + } +} + +Irssi::command_bind('quit', '', 'cmd_quit');