|
Joined: Aug 2004
Posts: 7,252
Hoopy frood
|
OP
Hoopy frood
Joined: Aug 2004
Posts: 7,252 |
Occasionally my client and/or my bot will get disconnected for a reason similar to [15:48:21] Closing Link: RusselB-afk[ACA6A36B.ipt.aol.com] (Z:lined (Possible spam bot attacker. 1 hour automatic ban --ID:1133297290lz25861l/EXP:2005-11-29@13:48/irc0.bondage.com)) What I'm looking for is a script that will automatically reconnect me/the bot at the time specified, allowing for the difference in time zones. My time zone is GMT -5, and the time zone referenced in the message is GMT -8. Right now, the client attempts to reconnect automatically, which is fine most of the time, but if the message is like that above, I want the client to wait until the ban time has expired before it tries to reconnect. Any suggestions?
|
|
|
|
Joined: Dec 2002
Posts: 3,547
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 3,547 |
I'm a little confused about what you mean sorry..
Can't you use a $gettok() in the error message? And a timer to trigger once and the duration $duration(1 hour). Just a suggestion.
-Andy
|
|
|
|
Joined: Aug 2005
Posts: 525
Fjord artisan
|
Fjord artisan
Joined: Aug 2005
Posts: 525 |
I don't see why the timezone matters. Why not just check the current time when you get disconnected and then set a timer to connect 1 hour from that time. Don't forget an if-else for when the hour is 23, then the reconnect hour is 00, else it's current hour + 1. Seems simple enough. Here's an example... I increased the minute by 1 since the timer could care less about the seconds. alias delayrec {
echo -a Message recieveved at: $asctime(HH:nn)
if ($gettok($asctime(HH:nn),1,58) == 23) {
echo -a Performing command at: $+(00,:,$calc($gettok($asctime(HH:nn),2,58)+1))
}
else {
echo -a Performing command at: $+($calc($gettok($asctime(HH:nn),1,58)+1),:,$calc($gettok($asctime(HH:nn),2,58)+1))
}
}
Last edited by schaefer31; 30/11/05 05:17 AM.
|
|
|
|
Joined: Oct 2005
Posts: 1,741
Hoopy frood
|
Hoopy frood
Joined: Oct 2005
Posts: 1,741 |
If you are just going to set a timer to go off (current time + 1h) then why not just set a timer for 1 hour? Assuming the length of the ban doesn't change, this code should work:
on *:ERROR:*Z*lined*1 hour*:.timer 1 3660 server
It should try to reconnect 61 minutes after being 'Z:lined' (banned) from the server. If the message changes, or the ban length is variable, there may need to be extra code added.
-genius_at_work
|
|
|
|
Joined: Aug 2004
Posts: 7,252
Hoopy frood
|
OP
Hoopy frood
Joined: Aug 2004
Posts: 7,252 |
Ban length is variable depending on the type of ban, but the ending time of the ban is always located in this section Now, I know I could use tokens and $ctime to get the time when I can reconnect, but I'm not sure how to send a command to reconnect at that time. If I can get this working the way I want, I'll be disabling the auto-reconnect on disconnection option. on *:error:*lined*:{
var %reconnect = $right($gettok($1-,2,47),-4)
var %reconnect.time = $right(%reconnect,5)
var %reconnect.date = $left(%reconnect,-5)
var %reconnect = $calc($ctime(%reconnect.date %reconnect.time) + 10860 - $ctime)
.timerreconnect -o $duration(%reconnect,3) server
}
The above, I think would work for these types of problems, please let me know if you spot any problems with it.
|
|
|
|
Joined: Oct 2005
Posts: 1,741
Hoopy frood
|
Hoopy frood
Joined: Oct 2005
Posts: 1,741 |
This might work for you:
on *:ERROR:*lined*:{
if (!$regex(error,$1-,/\/EXP:\d+-\d+-\d+@(\d\d?):(\d\d?)\//)) return
var %h = $calc(($regml(error,1) + 1) % 24)
var %m = $calc(($regml(error,2) + 5) % 60)
.timerreconnect -o $+(%h,:,%m) 1 1 server
}
It should work no matter where the time information is located, as long as it has the format /EXP:####-##-##@##-##/. It reads the 1-2 digits of the hour and 1-2 digits of the minutes (in case of weird formatting), adds 1 hour and 5 minutes, then sets a timer for that time. -genius_at_work
|
|
|
|
Joined: Aug 2004
Posts: 7,252
Hoopy frood
|
OP
Hoopy frood
Joined: Aug 2004
Posts: 7,252 |
Thanks. I'm trying to learn about regular expressions, but I'm also trying to learn about a few other things at the same time. Hopefully this code won't need to run, but if it does, and I find that there are problems, I'll let you know. Please note that it could be a while as these bans seem to run between 6 & 8 months between occurences.
|
|
|
|
Joined: Oct 2005
Posts: 1,741
Hoopy frood
|
Hoopy frood
Joined: Oct 2005
Posts: 1,741 |
If you want to learn about regular expressions, try this website: http://www.regular-expressions.info/ It gives very good descriptions of the basic regular expression usage, as well as thorough descriptions of the more advanced usage (look-ahead, look-behind, etc). -genius_at_work
|
|
|
|
|