+
+void CoreUserInputHandler::handleKick(const BufferInfo &bufferInfo, const QString &msg)
+{
+ QString nick = msg.section(' ', 0, 0, QString::SectionSkipEmpty);
+ QString reason = msg.section(' ', 1, -1, QString::SectionSkipEmpty).trimmed();
+ if (reason.isEmpty())
+ reason = network()->identityPtr()->kickReason();
+
+ QList<QByteArray> params;
+ params << serverEncode(bufferInfo.bufferName()) << serverEncode(nick) << channelEncode(bufferInfo.bufferName(), reason);
+ emit putCmd("KICK", params);
+}
+
+
+void CoreUserInputHandler::handleKill(const BufferInfo &bufferInfo, const QString &msg)
+{
+ Q_UNUSED(bufferInfo)
+ QString nick = msg.section(' ', 0, 0, QString::SectionSkipEmpty);
+ QString pass = msg.section(' ', 1, -1, QString::SectionSkipEmpty);
+ QList<QByteArray> params;
+ params << serverEncode(nick) << serverEncode(pass);
+ emit putCmd("KILL", params);
+}
+
+
+void CoreUserInputHandler::handleList(const BufferInfo &bufferInfo, const QString &msg)
+{
+ Q_UNUSED(bufferInfo)
+ emit putCmd("LIST", serverEncode(msg.split(' ', QString::SkipEmptyParts)));
+}
+
+
+void CoreUserInputHandler::handleMe(const BufferInfo &bufferInfo, const QString &msg)
+{
+ if (bufferInfo.bufferName().isEmpty() || !bufferInfo.acceptsRegularMessages())
+ return; // server buffer
+ // FIXME make this a proper event
+
+ // 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.split(QChar::LineFeed);
+
+ foreach (auto message, messages) {
+ // Handle each separated message independently
+ coreNetwork()->coreSession()->ctcpParser()->query(coreNetwork(), bufferInfo.bufferName(),
+ "ACTION", message);
+ emit displayMsg(Message::Action, bufferInfo.type(), bufferInfo.bufferName(), message,
+ network()->myNick(), Message::Self);
+ }
+}
+
+
+void CoreUserInputHandler::handleMode(const BufferInfo &bufferInfo, const QString &msg)
+{
+ Q_UNUSED(bufferInfo)
+
+ QStringList params = msg.split(' ', QString::SkipEmptyParts);
+ if (!params.isEmpty()) {
+ if (params[0] == "-reset" && params.count() == 1) {
+ network()->resetPersistentModes();
+ emit displayMsg(Message::Info, BufferInfo::StatusBuffer, "",
+ tr("Your persistent modes have been reset."));
+ return;
+ }
+ if (!network()->isChannelName(params[0]) && !network()->isMyNick(params[0]))
+ // If the first argument is neither a channel nor us (user modes are only to oneself)
+ // the current buffer is assumed to be the target.
+ // If the current buffer returns no name (e.g. status buffer), assume target is us.
+ params.prepend(!bufferInfo.bufferName().isEmpty() ?
+ bufferInfo.bufferName() : network()->myNick());
+ if (network()->isMyNick(params[0]) && params.count() == 2)
+ network()->updateIssuedModes(params[1]);
+ }
+
+ // TODO handle correct encoding for buffer modes (channelEncode())
+ emit putCmd("MODE", serverEncode(params));
+}
+
+