KVIrc icon indicating copy to clipboard operation
KVIrc copied to clipboard

Update local serverdb from global serverdb on kvirc updates (was: The KVIrc channel link in Help menu item doesn't work)

Open darkred opened this issue 5 months ago • 9 comments

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:

Image

Image

The working link is irc://irc.libera.chat/#kvirc

Using KVIrc 5.2.8 on win11.

Thank you

darkred avatar Jul 30 '25 20:07 darkred

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?

ctrlaltca avatar Jul 30 '25 21:07 ctrlaltca

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.

darkred avatar Jul 30 '25 21:07 darkred

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

ctrlaltca avatar Jul 30 '25 21:07 ctrlaltca

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-): Image

There's only 1 Libera.Chat server entry inside 'Standalone Servers' Network: Image

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 : Image 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.

darkred avatar Jul 31 '25 00:07 darkred

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:

  1. a menu entry can't rely on the presence of a network in serverdb
  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)

ctrlaltca avatar Jul 31 '25 06:07 ctrlaltca

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

DarthGandalf avatar Jul 31 '25 07:07 DarthGandalf

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..

ctrlaltca avatar Jul 31 '25 07:07 ctrlaltca

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.

darkred avatar Aug 02 '25 22:08 darkred

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.

ctrlaltca avatar Nov 09 '25 22:11 ctrlaltca