From ec58ac2059020bd613c3970494908a694b54a7db Mon Sep 17 00:00:00 2001 From: Shane Synan Date: Wed, 26 Aug 2020 18:28:56 -0400 Subject: [PATCH] settings: Add server-time to Network Features tab Add the IRCv3 "server-time" capability to the Features UI to make it simple to disable. Reasoning: IRC networks with improperly configured time may result in the wrong time showing in Quassel. This.. really shouldn't happen in Year 2020, but it's come up in the freenode/#kiwiirc support channel. (In the future, Quassel should add intelligent detection of time-sync issues, mimicking Kiwi IRC's timedelta feature.) --- .../settingspages/networkssettingspage.cpp | 13 ++++++++++++- .../settingspages/networkssettingspage.ui | 19 +++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/src/qtui/settingspages/networkssettingspage.cpp b/src/qtui/settingspages/networkssettingspage.cpp index c9de1acc..0f67de29 100644 --- a/src/qtui/settingspages/networkssettingspage.cpp +++ b/src/qtui/settingspages/networkssettingspage.cpp @@ -91,7 +91,8 @@ NetworksSettingsPage::NetworksSettingsPage(QWidget* parent) ui.sendEncoding, ui.recvEncoding, ui.serverEncoding, ui.autoReconnect, ui.reconnectInterval, ui.reconnectRetries, ui.unlimitedRetries, ui.rejoinOnReconnect, ui.useCustomMessageRate, - ui.messageRateBurstSize, ui.messageRateDelay, ui.unlimitedMessageRate}, + ui.messageRateBurstSize, ui.messageRateDelay, ui.unlimitedMessageRate, + ui.enableCapServerTime}, this, &NetworksSettingsPage::widgetHasChanged); @@ -641,6 +642,8 @@ void NetworksSettingsPage::displayNetwork(NetworkId id) ui.messageRateBurstSize->setValue(info.messageRateBurstSize); // Convert milliseconds (integer) into seconds (double) ui.messageRateDelay->setValue(info.messageRateDelay / 1000.0f); + // Skipped IRCv3 capabilities + ui.enableCapServerTime->setChecked(!info.skipCaps.contains(IrcCap::SERVER_TIME)); } else { // just clear widgets @@ -693,6 +696,14 @@ void NetworksSettingsPage::saveToNetworkInfo(NetworkInfo& info) // Convert seconds (double) into milliseconds (integer) info.messageRateDelay = static_cast((ui.messageRateDelay->value() * 1000)); info.unlimitedMessageRate = ui.unlimitedMessageRate->isChecked(); + // Skipped IRCv3 capabilities + if (ui.enableCapServerTime->isChecked()) { + // Capability enabled, remove it from the skip list + info.skipCaps.removeAll(IrcCap::SERVER_TIME); + } else if (!info.skipCaps.contains(IrcCap::SERVER_TIME)) { + // Capability disabled and not in the skip list, add it + info.skipCaps.append(IrcCap::SERVER_TIME); + } } void NetworksSettingsPage::clientNetworkCapsUpdated() diff --git a/src/qtui/settingspages/networkssettingspage.ui b/src/qtui/settingspages/networkssettingspage.ui index e56a7fc1..03a8321c 100644 --- a/src/qtui/settingspages/networkssettingspage.ui +++ b/src/qtui/settingspages/networkssettingspage.ui @@ -952,6 +952,24 @@ Note that Quassel IRC automatically rejoins channels, so /join will rarely be ne 0 + + + + + 0 + 0 + + + + <p>Let the IRC network control the timestamps for messages, such as when viewing messages from the past.</p> +<p>This is useful when connecting to bouncers, IRC bridges, or networks that send messages you've missed when reconnecting.</p> +<p><i>Toggles the IRCv3 'server-time' capability.</i></p> + + + Use network timestamps for messages + + + @@ -1170,6 +1188,7 @@ This setting defines the encoding for messages that are not UTF-8. autoIdentifyService autoIdentifyPassword enableCapsStatusDetails + enableCapServerTime enableCapsAdvanced useCustomEncodings sendEncoding -- 2.20.1