X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcommon%2Fircdecoder.cpp;fp=src%2Fcommon%2Fircdecoder.cpp;h=5eb0e6d1f4417ba577aa4634abfb6a036323e7a4;hp=cadefbf71d9e31d77f1def07af7a085f9a91d21b;hb=c33c05dbcb7c0c9a51dc3d9d85334e2482d5e18e;hpb=61219bb0ca15a6356fde510fd114fd3b6628f08b diff --git a/src/common/ircdecoder.cpp b/src/common/ircdecoder.cpp index cadefbf7..5eb0e6d1 100644 --- a/src/common/ircdecoder.cpp +++ b/src/common/ircdecoder.cpp @@ -54,9 +54,11 @@ QString IrcDecoder::parseTagValue(const QString& value) result.append(*it); } escaped = false; - } else if (it->unicode() == '\\') { + } + else if (it->unicode() == '\\') { escaped = true; - } else { + } + else { result.append(*it); } } @@ -125,9 +127,15 @@ QHash IrcDecoder::parseTags(const std::function splitByVendorAndKey = rawKey.split('/'); - if (!splitByVendorAndKey.isEmpty()) key.key = splitByVendorAndKey.takeLast(); - if (!splitByVendorAndKey.isEmpty()) key.vendor = splitByVendorAndKey.takeLast(); + + int splitIndex = rawKey.lastIndexOf('/'); + if (splitIndex > 0 && splitIndex + 1 < rawKey.length()) { + key.key = rawKey.mid(splitIndex + 1); + key.vendor = rawKey.left(splitIndex); + } + else { + key.key = rawKey; + } tags[key] = parseTagValue(rawValue); } return tags; @@ -155,7 +163,12 @@ QByteArray IrcDecoder::parseParameter(const QByteArray& raw, int& start) } } -void IrcDecoder::parseMessage(const std::function& decode, const QByteArray& rawMsg, QHash& tags, QString& prefix, QString& command, QList& parameters) +void IrcDecoder::parseMessage(const std::function& decode, + const QByteArray& rawMsg, + QHash& tags, + QString& prefix, + QString& command, + QList& parameters) { int start = 0; skipEmptyParts(rawMsg, start); @@ -170,7 +183,6 @@ void IrcDecoder::parseMessage(const std::function& d QByteArray param = parseParameter(rawMsg, start); skipEmptyParts(rawMsg, start); params.append(param); - } parameters = params; }