Fix output for a bunch of numeric server replies
authorManuel Nickschas <sputnick@quassel-irc.org>
Mon, 19 Mar 2012 21:56:31 +0000 (22:56 +0100)
committerManuel Nickschas <sputnick@quassel-irc.org>
Mon, 19 Mar 2012 21:56:31 +0000 (22:56 +0100)
First of all, takeFirst() does not work on a const ref *cough*. And second, we should
not reorder the param in the message like we did before purely for prettyness;
some servers seem to send non-standard strings that then look awkward. Instead,
let's just add a colon after the first param.

src/core/eventstringifier.cpp

index 7166589..688886e 100644 (file)
@@ -92,13 +92,14 @@ void EventStringifier::processIrcEventNumeric(IrcEventNumeric *e) {
     displayMsg(e, Message::Error, e->params().join(" "), e->prefix());
     break;
 
-  // Server error messages, display them in red. First param will be appended.
+  // Server error messages, display them in red. Colon between first param and rest.
   case 401: {
     if(!checkParamCount(e, 1))
       return;
 
-    QString target = e->params().takeFirst();
-    displayMsg(e, Message::Error, e->params().join(" ") + " " + target, e->prefix(), target, Message::Redirected);
+    QStringList params = e->params();
+    QString target = params.takeFirst();
+    displayMsg(e, Message::Error, target + ": " + params.join(" "), e->prefix(), target, Message::Redirected);
     break;
   }
 
@@ -106,8 +107,9 @@ void EventStringifier::processIrcEventNumeric(IrcEventNumeric *e) {
     if(!checkParamCount(e, 1))
       return;
 
-    QString channelName = e->params().takeFirst();
-    displayMsg(e, Message::Error, e->params().join(" ") + " " + channelName, e->prefix());
+    QStringList params = e->params();
+    QString channelName = params.takeFirst();
+    displayMsg(e, Message::Error, channelName + ": " + params.join(" "), e->prefix());
     break;
   }
 
@@ -119,8 +121,9 @@ void EventStringifier::processIrcEventNumeric(IrcEventNumeric *e) {
     if(!checkParamCount(e, 1))
       return;
 
-    QString p = e->params().takeFirst();
-    displayMsg(e, Message::Error, p + ": " + e->params().join(" "));
+    QStringList params = e->params();
+    QString p = params.takeFirst();
+    displayMsg(e, Message::Error, p + ": " + params.join(" "));
     break;
   }