mIRC Home    About    Download    Register    News    Help

Print Thread
#11440 16/02/03 04:40 AM
Joined: Dec 2002
Posts: 1,541
L
Hoopy frood
OP Offline
Hoopy frood
L
Joined: Dec 2002
Posts: 1,541
Ok, this one's kind of weird. What Im looking for is an alias to do this:

Basically I want to combine the server list from 2 sources (servers.ini & @links) into the servers.ini file. If a server in the INI file is NOT in the @links window to change the GROUP name to old while keeping any numeric server entries in the server.ini file UNLESS the "named server" has been changed to OLD in which case I want to change the numeric entry for that server to "old" (sans quotes) as well

Ive tried posting this a few times and havent found the 100% best way to phrase this so please bear with me. If you need further info, I can provide it


Those who fail history are doomed to repeat it
#11441 16/02/03 05:03 PM
Joined: Feb 2003
Posts: 76
G
Babel fish
Offline
Babel fish
G
Joined: Feb 2003
Posts: 76
Well... What your looking for is a bit complex. Maybe try thinking about it and putting it in words more clearly. What do you mean by:"If a server in the INI file is NOT in the @links window to change the GROUP name to old while keeping any numeric server entries in the server.ini file" What old and what numeric server entries?
Wise words: Programming is clearer than speaking!

#11442 17/02/03 04:01 AM
Joined: Dec 2002
Posts: 1,541
L
Hoopy frood
OP Offline
Hoopy frood
L
Joined: Dec 2002
Posts: 1,541
Ok, let's see if this clears anything up. When I do a /links I store the info in a custom @links window. It will list all servers currently linked. In my servers.ini file I have a list of servers that not always matches the custom @links window. When I join a server I put the numeric version of the server in my server list (sometimes I can only connect via the numeric addrress of the server). So in my servers.ini file I have a list of servers including some numeric server addresses that would never appear in my @links window. Now, when I manually update my server.ini file list (using the ALT + O menu), I compare what's in my INI vs the @links window. If the server is in the links window and my ini file, I leave it alone cause it's supposed to be there. If the server is NOT in my INI file I add it. If the server in the INI file is NOT in the @links window, I change the group name (in the ALT + O --> Connect --> Servers list)from the "network specific" to old (example: from dalnet to old or from efnet to old). This way, I have 2 groups in my servers.ini file; current servers (denoted by network name in the group field) and servers not linked at the time of /links (where I use the group name of old to show that while they WERE linked at one time, they're not currently linked to my chat network). I dont want to get rid of the old servers just because they're currently not linked.

Does this clear things up?


Those who fail history are doomed to repeat it
#11443 17/02/03 02:23 PM
Joined: Dec 2002
Posts: 699
N
Fjord artisan
Offline
Fjord artisan
N
Joined: Dec 2002
Posts: 699
Code:
alias parse.servers {
  var %i = 1
  while $server(%i) {
    [color:green]; loop through servers.ini[/color]
    var %a = $ifmatch
    [color:green]; check network, and if IP address[/color]
    if $server(%a).group != $network || $regex(%a,/^(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})$/) {
      inc %i | continue
    }
    [color:green]; check if in @Links, if not:- remove, and re-add as "old network"[/color]
    if !$fline(@Links,$+(*,%a,*),1) {
      .server -r %a
      .server -a %a -g old
      continue
    }
    inc %i
  }
  var %i = 1
  while $line(@Links,%i) {
    [color:green]; loop through @Links[/color]
    tokenize 32 $ifmatch
    [color:green]; check for and skip hub servers[/color]
    if $istok($2-,HUB,32) || $istok($1,hub,46) { inc %i | continue }
    [color:green]; check and add to servers.ini if needed[/color]
    [color:blue]; Here you could add -p <ports to use> if you wish[/color]
    if !$server($1) { .server -a $1 -g $network -d $gettok($1,1,46) }
    inc %i
  }
  [color:green]; sort servers.ini[/color]
  server -s
}

edit--
This is assuming that @links contains the servers in the same format that 'Links list' would
irc.server.net (2) Somewhere, MX HUB Server
Although, the only thing required is the servers address

Last edited by Nimue; 17/02/03 02:44 PM.
#11444 17/02/03 10:05 PM
Joined: Dec 2002
Posts: 699
N
Fjord artisan
Offline
Fjord artisan
N
Joined: Dec 2002
Posts: 699
Changed remove/re-add of old servers to add, which updates the existing entry.
Code:
alias parse.servers {
  var %i = 1
  while $server(%i) {
    [color:green]; loop through servers.ini[/color]
    var %a = $ifmatch
    [color:green]; check network, and if IP address[/color]
    if $server(%a).group != $network || $regex(%a,/^(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})$/) {
      inc %i | continue
    }
    [color:green]; check if in @Links, if not re-add as "old network"[/color]
    [color:blue]if !$fline(@Links,$+(*,%a,*),1) { .server -a %a -g old }[/color]
    inc %i
  }
  var %i = 1
  while $line(@Links,%i) {
    [color:green]; loop through @Links[/color]
    tokenize 32 $ifmatch
    [color:green]; check for and skip hub servers[/color]
    if $istok($2-,HUB,32) || $istok($1,hub,46) { inc %i | continue }
    [color:green]; check and add to servers.ini if needed[/color]
    [color:blue]; Here you could add -p <ports to use> if you wish[/color]
    if !$server($1) { .server -a $1 -g $network -d $gettok($1,1,46) }
    inc %i
  }
  [color:green]; sort servers.ini[/color]
  server -s
}

#11445 18/02/03 02:38 AM
Joined: Dec 2002
Posts: 1,541
L
Hoopy frood
OP Offline
Hoopy frood
L
Joined: Dec 2002
Posts: 1,541
Thanks a lot! I REALLY appreciate it.


Those who fail history are doomed to repeat it

Link Copied to Clipboard