[eggheads-patches] TCL variable $server - patch
darko at onvol.net
Sat Jan 11 12:38:01 CST 2003
Included is the patch that changes behaviour of $server TCL variable in
a way that it now contains real server name which is much more
convinient for scripting purposes (There was a lot of gymnstics needed
to get it before). Obviously, got001() now *allways* stores server's
real name and the server address (ip/host), whereas it earlier oddly
used 'name' filed of the server_list structure to keep one of the
name/real name depending on the strict-servernames setting. That setting
is now obsolete and has been removed (this led to some marginal
improvement in whoispenalty(), and removal of some code in got001). New
traced_serveraddress() and Tcl_Trace/UntraceVar are added to provide new
TCL variable $serveraddress (suggested by Wcc) to provide a replacement
for old style $server. Both variables are in format:
Also, note that old scripts should not break since if:
a) script looks up a real name, it checks $servers (returns a list of
servers) , finds the element in question, splits it on whitespace and if
resulting list's length is 1, get rid of the :port, which leaves us with
result being the server's realname. This was due to the
strict-servernames setting which made eggdrop eliminate 'realname' filed
in the list of servers. If however resulting list was 2 elements long,
then script just takes the second element as a real name.
With this patch second element *always* exists and thus, no
incompatibilities can be forseen there.
b) script looks for server host/ip, and again looks for the length of
resulting list (same as above). If size is 2, take the first element and
split on ":". Again, result will now *allways* be 2 elements long, so no
problems should arise.
Also, in scripts/compat.tcl i have added a line defining
strict-servernames just to provide for scripts that might be looking for
it. It's value has been set to 0 to simulate old style behaviour.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
More information about the Patches