mIRC Home    About    Download    Register    News    Help

Print Thread
Closing Link - try next server in group #268399 21/01/21 12:14 AM
Joined: Dec 2002
Posts: 480
Deep3D Offline OP
Pan-dimensional mouse
OP Offline
Pan-dimensional mouse
Joined: Dec 2002
Posts: 480
I'm trying to make a script that changes server if you get diconnected by "Closing Link" upon connection.

mIRC hammers the server over and over without trying next server in group. Yes, "Try next server in group" is enabled under options.

Message I got: Closing Link: 213.***.**.*** (This server is not accepting new connections. Please connect to chat.freenode.net instead.)

I tought I hade to use on DISCONNECT. But $1- only gives me server-address, when I need to find Closing and Link: to trigger the script.

I'm trying to do something like this:

Code
on 1:disconnect:{
  if freenode isin $server && $1 == Closing && $2 == Link: { server freenode }
  if freenode isin $server { echo -a Disconnect reason: $1- }
}

Re: Closing Link - try next server in group [Re: Deep3D] #268401 21/01/21 07:05 AM
Joined: Jan 2004
Posts: 1,509
maroon Offline
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 1,509
I can't test because I don't know of an address displaying this message, but is that message coming in the ON SNOTICE event or something besides ON DISCONNECT? If not, i'd see what kind of message is shown by a @debug window. /help /debug

The purpose of the "try next server" is when the attempt to connect fails, but if it allows you to connect but then immediately disconnects you, then it will keep connecting to the server it successfully connected to in the first place.

Re: Closing Link - try next server in group [Re: maroon] #268402 21/01/21 10:35 AM
Joined: Dec 2002
Posts: 480
Deep3D Offline OP
Pan-dimensional mouse
OP Offline
Pan-dimensional mouse
Joined: Dec 2002
Posts: 480
I tryed on disconnect, on snotice and on connectfail. But I still dont get the output I need to make this work.

My code:
Code
on 1:disconnect:{
  echo -a DISCONNECT: $1-
}

on 1:SNOTICE:*:{
  echo -a SNOTICE: $1-
}

on 1:connectfail:{
  echo -a FAIL: $1-
}


@debug:
Quote
<- ERROR :Closing Link: ***.***.**.*** (This server is not accepting new connections. Please connect to chat.freenode.net instead.)


Status window:
Quote
[11:26] * Connecting to sinisalo.freenode.net (6665)
-
[11:26] -sinisalo.freenode.net- *** Looking up your hostname...
-
SNOTICE: *** Looking up your hostname...
-
[11:26] -sinisalo.freenode.net- *** Checking Ident
-
SNOTICE: *** Checking Ident
-
[11:26] -sinisalo.freenode.net- *** Found your hostname
-
SNOTICE: *** Found your hostname
-
[11:26] -sinisalo.freenode.net- *** No Ident response
-
SNOTICE: *** No Ident response
[11:26] Caps supported: account-notify away-notify cap-notify chghost extended-join identify-msg multi-prefix sasl tls
[11:26] Caps set: account-notify away-notify cap-notify chghost extended-join multi-prefix
-
[11:26] Closing Link: ***.***.**.*** (This server is not accepting new connections. Please connect to chat.freenode.net instead.)
-
[11:26] * Disconnected
DISCONNECT: sinisalo.freenode.net

Re: Closing Link - try next server in group [Re: Deep3D] #268403 21/01/21 10:59 AM
Joined: Jan 2004
Posts: 1,509
maroon Offline
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 1,509
on *:ERROR:*:{ echo -s $chr(22) scriptline $scriptline event $event server $server serverip $serverip }

Re: Closing Link - try next server in group [Re: maroon] #268405 21/01/21 01:03 PM
Joined: Dec 2002
Posts: 480
Deep3D Offline OP
Pan-dimensional mouse
OP Offline
Pan-dimensional mouse
Joined: Dec 2002
Posts: 480
Thank you.

This is my final code:
Code
on *:error:*This server is not accepting new connections*:{
  echo.info Ok, trying new connection to: $strip($15)
  server $strip($15)
}

Re: Closing Link - try next server in group [Re: Deep3D] #268406 21/01/21 04:37 PM
Joined: Jan 2004
Posts: 1,509
maroon Offline
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 1,509
A suggestion that you add a little bit of verification to this, to avoid or lessen the possibility that you don't end up connecting to a rogue server. Usually this isn't a problem, but someone could try to mess up your client by SAJOIN'ing you to hundreds of channels or doing something else to make your client slow way down.

This ERROR event isn't a standard message, so it's possible for this to change in the future. If you manually used the /server command to join that server, then $network will be null because the connection hasn't gotten far enough to see how the network identifies itself. If that first server was in your servers list, then it returns the name of the serverlist "group", which is why it's a good idea to always have your groups be named the same way as the network identifies itself. If you ever see $network being "Freenode instead of "freenode", that's because it's using the group name from:

//echo -a $server(chat.freenode.net).group

Perhaps you can add a verification that the server you're being sent to is somewhere in your serverlist. $server($15) will be null if that string isn't in your serverlist.