# include "cipher.h"
#endif
-#if QT_VERSION < 0x050000
-// QChar::LineFeed is Qt 5
-static const QChar QCharLF = QChar('\n');
-#else
-static const QChar QCharLF = QChar::LineFeed;
-#endif
-
CoreUserInputHandler::CoreUserInputHandler(CoreNetwork *parent)
: CoreBasicHandler(parent)
{
// 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(QCharLF);
+ QStringList messages = msg.split(QChar::LineFeed);
foreach (auto message, messages) {
// Handle each separated message independently
Q_UNUSED(bufferInfo)
QStringList params = msg.split(' ', QString::SkipEmptyParts);
- // 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 (!params.isEmpty()) {
- if (!network()->isChannelName(params[0]) && !network()->isMyNick(params[0]))
- params.prepend(bufferInfo.bufferName());
- if (network()->isMyNick(params[0]) && params.count() == 2)
- network()->updateIssuedModes(params[1]);
if (params[0] == "-reset" && params.count() == 1) {
- // FIXME: give feedback to the user (I don't want to add new strings right now)
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())
QList<QByteArray> params;
// 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);
+ QStringList messages = msg.section(' ', 1).split(QChar::LineFeed);
foreach (auto message, messages) {
// Handle each separated message independently
QString target = msg.section(' ', 0, 0);
// 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);
+ QStringList messages = msg.section(' ', 1).split(QChar::LineFeed);
foreach (auto message, messages) {
// Handle each separated message independently
// 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(QCharLF, QString::SkipEmptyParts);
+ QStringList messages = msg.split(QChar::LineFeed, QString::SkipEmptyParts);
foreach (auto message, messages) {
// Handle each separated message independently