summaryrefslogtreecommitdiff
path: root/examples/privmsg.pl
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2000-02-25 17:03:17 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2000-02-25 17:03:17 +0000
commitf5fc6247811c782c5ae42d14a15b7d714f564958 (patch)
treeee629ade0e7485d003db0a4fab108bf5c72a0b6b /examples/privmsg.pl
parent3d513eebfad1c55c76da5b7a26c59d7b20eabd50 (diff)
downloadirssi-f5fc6247811c782c5ae42d14a15b7d714f564958.zip
Irssi 0.7.27 released.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@130 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'examples/privmsg.pl')
-rw-r--r--examples/privmsg.pl19
1 files changed, 19 insertions, 0 deletions
diff --git a/examples/privmsg.pl b/examples/privmsg.pl
new file mode 100644
index 00000000..97842f4b
--- /dev/null
+++ b/examples/privmsg.pl
@@ -0,0 +1,19 @@
+# listen PRIVMSGs - send a notice to yourself when your nick is meantioned
+
+use Irssi;
+
+sub event_privmsg {
+ my ($data, $server, $nick, $address) = @_;
+ my ($target, $text) = $data =~ /^(\S*)\s:(.*)/;
+
+ return if (!Irssi::is_channel($target));
+
+ %sinfo = %{$server->values()};
+ $mynick = $sinfo{'nick'};
+
+ return if ($text !~ /\b$mynick\b/);
+
+ $server->command("/notice $mynick In channel $target, $nick!$address said: $text");
+}
+
+Irssi::signal_add("event privmsg", "event_privmsg");