- QString message = msg.section(' ', 1);
- if (message.isEmpty())
- emit displayMsg(Message::Server, BufferInfo::QueryBuffer, target, tr("Starting query with %1").arg(target), network()->myNick(), Message::Self);
- else
- emit displayMsg(Message::Plain, BufferInfo::QueryBuffer, target, message, network()->myNick(), Message::Self);
- handleMsg(bufferInfo, msg);
+ // Split apart messages at line feeds. The IRC protocol uses those to separate commands, so
+ // they need to be split into multiple messages.
+ QStringList messages = msg.section(' ', 1).split(QCharLF);
+
+ foreach (auto message, messages) {
+ // Handle each separated message independently, ignoring any carriage returns
+ message = message.trimmed();
+ if (message.isEmpty()) {
+ emit displayMsg(Message::Server, BufferInfo::QueryBuffer, target,
+ tr("Starting query with %1").arg(target), network()->myNick(),
+ Message::Self);
+ // handleMsg is a no-op if message is empty
+ } else {
+ emit displayMsg(Message::Plain, BufferInfo::QueryBuffer, target, message,
+ network()->myNick(), Message::Self);
+ // handleMsg needs the target specified at the beginning of the message
+ handleMsg(bufferInfo, target + " " + message);
+ }
+ }