Replace {from,to}Ascii with {from,to}Latin1
[quassel.git] / src / core / corenetwork.cpp
index 954565c..b7d496a 100644 (file)
@@ -18,6 +18,8 @@
  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.         *
  ***************************************************************************/
 
+#include <QHostInfo>
+
 #include "corenetwork.h"
 
 #include "core.h"
@@ -184,6 +186,10 @@ void CoreNetwork::connectToIrc(bool reconnecting)
 
     enablePingTimeout();
 
+    // 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);
+
 #ifdef HAVE_SSL
     if (server.useSsl) {
         CoreIdentity *identity = identityPtr();
@@ -262,7 +268,7 @@ void CoreNetwork::putCmd(const QString &cmd, const QList<QByteArray> &params, co
 
     if (!prefix.isEmpty())
         msg += ":" + prefix + " ";
-    msg += cmd.toUpper().toAscii();
+    msg += cmd.toUpper().toLatin1();
 
     for (int i = 0; i < params.size(); i++) {
         msg += " ";