/***************************************************************************
- * Copyright (C) 2005-2016 by the Quassel Project *
+ * Copyright (C) 2005-2018 by the Quassel Project *
* devel@quassel-irc.org *
* *
* This program is free software; you can redistribute it and/or modify *
}
else if (_previousConnectionAttemptFailed) {
// cycle to next server if previous connection attempt failed
+ _previousConnectionAttemptFailed = false;
displayMsg(Message::Server, BufferInfo::StatusBuffer, "", tr("Connection failed. Cycling to next Server"));
if (++_lastUsedServerIndex >= serverList().size()) {
_lastUsedServerIndex = 0;
}
}
- _previousConnectionAttemptFailed = false;
+ else {
+ // Start out with the top server in the list
+ _lastUsedServerIndex = 0;
+ }
Server server = usedServer();
displayStatusMsg(tr("Connecting to %1:%2...").arg(server.host).arg(server.port));
// Qt caches DNS entries for a minute, resulting in round-robin (e.g. for chat.freenode.net) not working if several users
// connect at a similar time. QHostInfo::fromName(), however, always performs a fresh lookup, overwriting the cache entry.
- QHostInfo::fromName(server.host);
-
+ if (! server.useProxy) {
+ //Avoid hostname lookups when a proxy is specified. The lookups won't use the proxy and may therefore leak the DNS
+ //hostname of the server. Qt's DNS cache also isn't used by the proxy so we don't need to refresh the entry.
+ QHostInfo::fromName(server.host);
+ }
#ifdef HAVE_SSL
if (server.useSsl) {
CoreIdentity *identity = identityPtr();
// restore away state
QString awayMsg = Core::awayMessage(userId(), networkId());
- if (!awayMsg.isEmpty())
- userInputHandler()->handleAway(BufferInfo(), Core::awayMessage(userId(), networkId()));
+ if (!awayMsg.isEmpty()) {
+ // Don't re-apply any timestamp formatting in order to preserve escaped percent signs, e.g.
+ // '%%%%%%%%' -> '%%%%' If processed again, it'd result in '%%'.
+ userInputHandler()->handleAway(BufferInfo(), awayMsg, true);
+ }
sendPerform();
// FIXME use event
#ifdef HAVE_SSL
if (!identityPtr()->sslCert().isNull()) {
- if (IrcCap::SaslMech::maybeSupported(capValue(IrcCap::SASL), IrcCap::SaslMech::EXTERNAL)) {
+ if (saslMaybeSupports(IrcCap::SaslMech::EXTERNAL)) {
// EXTERNAL authentication supported, send request
putRawLine(serverEncode("AUTHENTICATE EXTERNAL"));
} else {
}
} else {
#endif
- if (IrcCap::SaslMech::maybeSupported(capValue(IrcCap::SASL), IrcCap::SaslMech::PLAIN)) {
+ if (saslMaybeSupports(IrcCap::SaslMech::PLAIN)) {
// PLAIN authentication supported, send request
// Only working with PLAIN atm, blowfish later
putRawLine(serverEncode("AUTHENTICATE PLAIN"));
tr("Ready to negotiate (found: %1)").arg(caps().join(", ")));
// Build a list of queued capabilities, starting with individual, then bundled, only adding the
- // comma separator between the two if needed.
+ // comma separator between the two if needed (both individual and bundled caps exist).
QString queuedCapsDisplay =
- (!_capsQueuedIndividual.empty() ? _capsQueuedIndividual.join(", ") + ", " : "")
+ _capsQueuedIndividual.join(", ")
+ + ((!_capsQueuedIndividual.empty() && !_capsQueuedBundled.empty()) ? ", " : "")
+ _capsQueuedBundled.join(", ");
displayMsg(Message::Server, BufferInfo::StatusBuffer, "",
tr("Negotiating capabilities (requesting: %1)...").arg(queuedCapsDisplay));