[vhffs-dev] [791] Some fixes for modobot : throttling and working PING reply. |
[ Thread Index |
Date Index
| More vhffs.org/vhffs-dev Archives
]
Revision: 791
Author: florent
Date: 2007-08-28 21:13:35 +0000 (Tue, 28 Aug 2007)
Log Message:
-----------
Some fixes for modobot : throttling and working PING reply.
Modified Paths:
--------------
trunk/vhffs-irc/modobot.pl
Modified: trunk/vhffs-irc/modobot.pl
===================================================================
--- trunk/vhffs-irc/modobot.pl 2007-08-28 20:47:25 UTC (rev 790)
+++ trunk/vhffs-irc/modobot.pl 2007-08-28 21:13:35 UTC (rev 791)
@@ -54,6 +54,8 @@
my $irc=new Net::IRC;
+my $cmpt = 0;
+
# Connection
my $conn=$irc->newconn(Nick => $botname,
Server => $srv,
@@ -442,9 +444,10 @@
sub on_ping {
my ($self, $event) = @_;
my $nick = $event->nick;
+ my $timestamp = $event->{'args'}[0];
- $self->ctcp_reply($nick, join (' ', ($event->args)));
- print "[ping-from] : {$nick}\n";
+ $self->ctcp_reply($nick, 'PING ' . $timestamp);
+ print "[ping-from] : {$nick}\n"
} # on_ping
sub on_ping_reply {
@@ -572,9 +575,13 @@
$text = deletenl ($text);
my $wrapper = Text::Wrapper->new(columns => 300);
my @text = split (/\n/, $wrapper->wrap($text));
- for $a (@text)
+ while ($text = shift @text)
{
- $bot->privmsg($chan, $a);
+ $bot->privmsg($chan, $text);
+ sleep 2;
+ sleep 8 if (($cmpt%10) == 9);
+ $cmpt++;
+ $cmpt = 0 if ($cmpt == 30);
}
}