+void NetworksSettingsPage::setNetworkCapStates(NetworkId id)
+{
+ const Network *net = Client::network(id);
+ if ((Client::coreFeatures() & Quassel::CapNegotiation)
+ && net && net->connectionState() != Network::Disconnected) {
+ // If Capability Negotiation isn't supported by the core, no capabilities are active.
+ // If we're here, the network exists and is connected, check available capabilities...
+ // Don't use net->isConnected() as that won't be true during capability negotiation when
+ // capabilities are added and removed.
+
+ // [SASL]
+ if (net->saslMaybeSupports(IrcCap::SaslMech::PLAIN)) {
+ // The network advertises support for SASL PLAIN. Encourage using it! Unfortunately we
+ // don't know for sure if it's desired or functional.
+ ui.sasl->setTitle(QString("%1 (%2)").arg(tr("Use SASL Authentication"),
+ tr("preferred")));
+ } else {
+ // The network doesn't advertise support for SASL PLAIN. Here be dragons.
+ ui.sasl->setTitle(QString("%1 (%2)").arg(tr("Use SASL Authentication"),
+ tr("might not work")));
+ }
+ // Split up the messages to ease translation and re-use existing "Use SASL Authentication"
+ // translations. If some languages rearrange phrases such that this would not make sense,
+ // these strings can be merged into one.
+
+ // Add additional capability-dependent interface updates here
+ } else {
+ // We're not connected or the network doesn't yet exist. Don't assume anything and reset
+ // all capability-dependent interface elements to neutral.
+ // [SASL]
+ ui.sasl->setTitle(tr("Use SASL Authentication"));
+
+ // Add additional capability-dependent interface updates here
+ }
+}
+
+