/server -a
maroon
24/05/23 11:32 AM
For the /server -a command, the current defaults can have unwanted behavior, which might be improved by either changing the default -a behavior, or having an -A switch or changing the -a to be an -aN switch that defaults to the existing behavior.
The default behavior of -a is to ignore the -g switch and use the -d switch to try as hard as possible to update an existing serverlist entry instead adding a new entry to that -g GROUP. Due to the current behavior of trying to match description, there's no way to add a new serverlist entry - or edit an existing serverlist entry - to give it a description matching 'Random Server' or matching any other existing description in the serverlist.
This next example assumes the following -g GROUP and $servertarget do not yet exist in the serverlist:
/server -a irc.chat.twitch.tv -g Twitch -d "Random Server" -w oauth:myoathtoken -p 6667
Luckily I had the serverlist backed up. Instead of adding a new entry for this servertarget, it instead finds the first match against description 'Random Server' and changes these defined fields for that entry, even though the serverlist item's server-address and GROUP are different.
If I instead do the following 3 commands, the 2nd one does add a new serverlist entry with the description field being blank. But then the 3rd command ignores that there's a already a matching serveraddress/GROUP combo and instead does the above behavior of updating whichever is the first match against description 'Random Server'.
/server -r irc.chat.twitch.tv
/server -a irc.chat.twitch.tv -g Twitch -w oauth:myoathtoken -p 6667
/server -a irc.chat.twitch.tv -g Twitch -d "Random Server" -w oauth:myoathtoken -p 6667
Fortunately /server -r doesn't use -d to find a match for removal.
- -
It seems preferable that default behavior is different, but I know there can be problems from having behavior change without a new switch, even if it's preferred.
It seems reasonable that /server -a should instead try to match against the server name/address parameter *first* before trying to find a match against the -d description.
And, if using the -g switch, then this syntax should instead pretend that only items with that groupname exist, and it would only -r remove items if there's a GROUPNAME match, but if -g is not used then it's free to make a match against the entire serverlist. And likewise if using '-a -g GROUP' it would add a new serverlist entry if it couldn't find an update-match within that groupname