Update local serverdb from global serverdb on kvirc updates (was: The KVIrc channel link in Help menu item doesn't work)
The Join KVIrc's Channel on Libera.Chat chat link in the Help menu item doesn't work. It results in the following error instead:
The server specification seems to be in the net:
but the network couldn't be found in the database
Screenshots:
The working link is irc://irc.libera.chat/#kvirc
Using KVIrc 5.2.8 on win11.
Thank you
Just tested on both win11 and linux, both on an old and clean profile. It seems to work here. Can you test on a clean profile?
How can I run KVIrc on a clean profile? (I'm on Windows). Is there a direct way? I'd prefer not having to fully uninstall+reinstall KVIrc.
You can run kvirc -f -n test.rc to create a new temp profile.
Under windows it's probably easier to go into %APPDATA% (usually c:\users\<your name>\AppData\Roaming) and temporarily rename the KVIrc4 directory to something else.
One you end up testing, restore the original name for that folder
Thanks. So I tried renaming the KVIrc4 directory in %APPDATA% and it works ok.
So, I tried troubleshooting it and found the following:
I checked servers list in Settings|'Configure Servers' and found that there are various differences compared to my old profile.
Mostly, there is no Libera.Chat Network at all (it should exist containing 2 servers -see 3rd screenshot-):
There's only 1 Libera.Chat server entry inside 'Standalone Servers' Network:
So then I tried manualy deleting that single Libera.Chat entry inside Standalone Servers
and then clicked the Import from https://www.mirc.co.uk/servers.ini button, it completed but didn't fix the issue.
Then for testing, I deleted that newly created Libera.Chat network, and recreated it together with these 2 servers (exactly, based on screenshots from my temp profile), making inside :
It also didn't fix the issue.
How I finally fixed it: I copied %APPATA%\KVIrc4\config\serverdb.kvc from my temp profile to the old one (overwriting it) and it's finally fixed.
To recreate the issue yourself, go to Settings|'Configure Servers' and delete the Libera.Chat network: the issue will surely occur.
The really awful peace of code™ that's executed when you click the menu entry is this: https://github.com/kvirc/KVIrc/blob/master/src/kvirc/kernel/KviInternalCommand.cpp#L52
If you are not already connected to LiberaChat, it basically executes some KVS scripting code:
/server -u -c="join #KVIrc" net:LiberaChat
The original error message:
The server specification seems to be in the net:
but the network couldn't be found in the database
comes from https://github.com/kvirc/KVIrc/blob/master/src/kvilib/irc/KviIrcServerDataBase.cpp#L163 and it just means that there were no network called exactly LiberaChat in your server database.
This is the original server database https://github.com/kvirc/KVIrc/blob/master/data/config/serverdb.kvc#L434 for reference.
Looking at your first server database screenshot no Libera.Chat network exists. So, the error was correct even if I agree that really awful.
I see a couple of things to be improved here:
- a menu entry can't rely on the presence of a network in serverdb
- when kvirc updates it should pick up serverdb updates (really hard: what if a network is missing because the user voluntarily deleted it? we don't want to overwrite user edits)
really hard: what if a network is missing because the user voluntarily deleted it? we don't want to overwrite user edits
serverdb could store the deletion marker instead, in theory
Yep, there are even more complicated cases, eg. a server has been modified both locally and remote. We are looking at implementing a sync mechanism, so each entry should be timestamped for creation, edit and deletion. This is probably overkill..
1 . a menu entry can't rely on the presence of a network in serverdb
I totally agree with that.
2 . when kvirc updates it should pick up serverdb updates (really hard: what if a network is missing because the user voluntarily deleted it? we don't want to overwrite user edits)
To clarify: I'm certain that I didn't delete the Libera.Chat network, or any other networks. What happened is that, when Libera.Chat was added to serverdb back in 2021, the user profile's serverdb was not updated to include the new network. So, I'd like to suggest that when there's a new/updated serverdb avalable, the installer to merge the new serverdb with the existing one (in the user profile), keeping the user edits. There are various complicated cases to cover, as you described, but I find that it's most important is that when kvirc updates, it should pick up serverdb updates.
A fallback has been added to the menu entry, that will use the hardcoded server name if the network doesn't exist. Keeping this bug open to track the "merge serverdb" functionality, editing the issue title accordingly.