Skip to content
Snippets Groups Projects
Commit 47380543 authored by deuce's avatar deuce
Browse files

Incorporate DMs secret expnential delay thingie he's had hiding in his copy

of ircmsg.js, and improve it thusly:

1) Delay before sending the message, not after.
2) Do not delay before sending the first message.
3) Do no increase the delay if the message was not sent.

This long commit message will be a test to make sure the ircd doesn't hate
us now for being too fast... being too fast is bad.

Let's not do that.
parent e48b4897
No related branches found
No related tags found
No related merge requests found
......@@ -92,10 +92,17 @@ if(join) {
mylog(response);
}
var delay=0;
if(msg)
send(msg);
else while((msg=readln())!=undefined) /* read from stdin */
send(msg);
send(msg, delay);
else while((msg=readln())!=undefined) { /* read from stdin */
if (send(msg, delay)) {
if(delay < 2000)
delay*=2;
if (delay == 0)
delay = 500;
}
}
while(my_server.poll(0) && (response=my_server.recvline()))
mylog(response);
......@@ -104,20 +111,23 @@ IRC_quit(my_server);
mylog("Exiting");
exit();
function send(msg)
function send(msg, delay)
{
if(msg==undefined || msg.search(/^[\r\n]*$/)!=-1) {
mylog("Not sending blank message");
return;
return false;
}
for(i in exclude)
if(msg.search(exclude[i])>=0)
return;
return false;
if (delay)
mswait(delay); // Cyan: IRCd throttles clients that send text to the server too quickly
mylog("Sending: " + msg);
if(!my_server.send("PRIVMSG "+channel+" :"+expand_tabs(msg)+"\r\n"))
if(!my_server.send("PRIVMSG "+channel+" :"+expand_tabs(msg)+"\r\n")) {
alert("send failure");
else
mswait(2000); // Cyan: IRCd throttles clients that send text to the server too quickly
return false;
}
return true;
}
function expand_tabs(msg)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment