Permalink
Browse files

Limit to one message per second

  • Loading branch information...
1 parent 4edbc39 commit 168b08b16d13cfe5650624dc7e2137148887b3ae @mxey mxey committed Feb 1, 2010
Showing with 7 additions and 2 deletions.
  1. +7 −2 happyman
View
@@ -16,6 +16,7 @@
use strict;
use warnings;
use 5.10.0;
+use AnyEvent;
use AnyEvent::Handle;
use AnyEvent::IRC::Client;
use AnyEvent::Socket;
@@ -69,8 +70,12 @@ sub announce {
$irc->send_chan($Config->{channel}, 'PRIVMSG', $Config->{channel}, "$line
[$host]");
log_info("$host - Message: $line");
- $handle->push_read(line => sub {
- announce($host, @_);
+ my $w;
+ $w = AE::timer(1, 0, sub {
+ $handle->push_read(line => sub {
+ announce($host, @_);
+ });
+ undef $w;
});
}

0 comments on commit 168b08b

Please sign in to comment.