Code: Select all
proc putnow { a } {
append a "\n"
putdccraw 0 [string length $a] $a
}
Code: Select all
/* Number of seconds to wait between transmitting queued lines to the server
* lower this value at your own risk. ircd is known to start flood control
* at 512 bytes/2 seconds.
*/
#define msgrate 2
Code: Select all
if (mq.head) {
burst++;
if (deq_kick(DP_SERVER))
return;
if (fast_deq(DP_SERVER))
return;
write_to_server(mq.head->msg, mq.head->len);
mq.tot--;
last_time += calc_penalty(mq.head->msg);
if (raw_log)
putlog(LOG_SRVOUT, "*", "[s->] %s", mq.head->msg);
q = mq.head->next;
nfree(mq.head->msg);
nfree(mq.head);
mq.head = q;
if (!mq.head)
mq.last = NULL;
return;
}
Code: Select all
if (mq.head) {
while (modeq.head && (burst < 11) && ((last_time - now) < MAXPENALTY)) {
burst++;
if (deq_kick(DP_SERVER))
return;
if (fast_deq(DP_SERVER))
return;
write_to_server(mq.head->msg, mq.head->len);
mq.tot--;
last_time += calc_penalty(mq.head->msg);
if (raw_log)
putlog(LOG_SRVOUT, "*", "[s->] %s", mq.head->msg);
q = mq.head->next;
nfree(mq.head->msg);
nfree(mq.head);
mq.head = q;
if (!mq.head)
mq.last = NULL;
return;
}
}
Code: Select all
# Copyright (C) 2003 BarkerJr
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
namespace eval put {
# Name the queues here. The further left, the higher priority queues.
set queues [list akill kill echo ctcp2 ctcp msg warn]
# Script begins here (nothing to do below here).
foreach q $queues {
if {![info exists queue($q)]} { set queue($q) {} }
}
unset q
proc serv {q text} {
variable queue
variable errorInfo
if {![info exists queue($q)]} {
set errorInfo "No such queue named: $q"
return 1
}
if {[lsearch -exact $queue($q) $text] != -1} {
set errorInfo "Already exists in queue ($q): $text"
return 2
}
lappend queue($q) $text
return 0
}
foreach timer [utimers] {
if {[lindex $timer 1] == {put::bisecondly}} { killutimer [lindex $timer 2] }
}
if {[info exists timer]} { unset timer }
utimer 2 put::bisecondly
proc bisecondly {} {
variable queues
variable queue
foreach q $queues {
if {[llength $queue($q)]} {
putserv [lindex $queue($q) 0]
set queue($q) [lreplace $queue($q) 0 0]
utimer 2 put::bisecondly
return
}
}
utimer 2 put::bisecondly
}
bind dcc - qstat put::queuestat
proc queuestat {hand idx text} {
variable queues
variable queue
putdcc $idx {Queue Lines}
putdcc $idx {=================}
foreach q $queues {
putdcc $idx "[format %-10s $q] [format %5i [llength $queue($q)]]"
}
putdcc $idx {=================}
}
proc uninstall {} {
unbind dcc - qstat put::queuestat
foreach timer [utimers] {
if {[lindex $timer 1] == {put::bisecondly}} { killutimer [lindex $timer 2] }
}
namespace delete [namespace current]
}
}
In that case, setting msgrate to 1 is the fastest I can advise for you... which will just dump 1 line every 1sec... which in normal cases will give the impression of "fluently" output (I doubt a normal person reads faster than 1 line per second )nacho wrote:Also, it IS important that the bot doesn't get disconnected for flooding..