X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=core%2Fserver.cpp;h=090431a64efd3e9866b27c4952c904e914d1e268;hb=9c31e7c7376132d9da3f0dda55706360c0725c90;hp=d9ebdc9339de492c1152095c23083f29c4693add;hpb=ddc5208315db8ca9ca19f6a59ee7caefe631ffc7;p=quassel.git diff --git a/core/server.cpp b/core/server.cpp index d9ebdc93..090431a6 100644 --- a/core/server.cpp +++ b/core/server.cpp @@ -162,36 +162,38 @@ void Server::handleServerMsg(QString msg) { QString prefix; QString cmd; QStringList params; - + // check for prefix by checking for a colon as the first char if(msg[0] == ':') { msg.remove(0,1); prefix = msg.section(' ', 0, 0); msg = msg.section(' ', 1); } - + // next string without a whitespace is the command cmd = msg.section(' ', 0, 0).toUpper(); - msg = msg.section(' ', 1); - + msg = msg.mid(cmd.length()); + // get the parameters - QString left, trailing; - left = msg.section(" :", 0, 0); - trailing = msg.section(" :", -1, -1); - if(!left.isEmpty()) { - params << left.split(' ', QString::SkipEmptyParts); + QString trailing = ""; + if(msg.contains(" :")) { + trailing = msg.section(" :", 1); + msg = msg.section(" :", 0, 0); + } + if(!msg.isEmpty()) { + params << msg.split(' ', QString::SkipEmptyParts); } if(!trailing.isEmpty()) { params << trailing; } - + // numeric replies have the target as first param (RFC 2812 - 2.4). this is usually our own nick. Remove this! uint num = cmd.toUInt(); if(num > 0) { Q_ASSERT(params.count() > 0); // Violation to RFC params.removeFirst(); } - + // Now we try to find a handler for this message. BTW, I do love the Trolltech guys ;-) QString hname = cmd.toLower(); hname[0] = hname[0].toUpper(); @@ -418,6 +420,7 @@ void Server::handleUserVoice(QString bufname, QString msg) { void Server::handleServerJoin(QString prefix, QStringList params) { Q_ASSERT(params.count() == 1); QString nick = updateNickFromMask(prefix); + emit displayMsg(Message::Join, params[0], params[0], prefix); if(nick == ownNick) { // Q_ASSERT(!buffers.contains(params[0])); // cannot join a buffer twice! // Buffer *buf = new Buffer(params[0]); @@ -443,7 +446,7 @@ void Server::handleServerJoin(QString prefix, QStringList params) { nicks[nick] = n; emit nickAdded(network, nick, n); } - emit displayMsg(Message::Join, params[0], params[0], prefix); + //emit displayMsg(Message::Join, params[0], params[0], prefix); //} }