Disable empty-string sending

Fixes #191
This commit is contained in:
Rasmus Karlsson 2018-01-04 02:32:24 +01:00
parent 96fa242e65
commit 27dacdde36

View file

@ -200,14 +200,19 @@ void IrcManager::disconnect()
void IrcManager::sendMessage(const QString &channelName, QString message)
{
QString trimmedMessage = message.trimmed();
if (trimmedMessage.isEmpty()) {
return;
}
this->connectionMutex.lock();
static int i = 0;
if (this->writeConnection) {
if (singletons::SettingManager::getInstance().allowDuplicateMessages && (++i % 2) == 0) {
message.append(this->messageSuffix);
trimmedMessage.append(this->messageSuffix);
}
this->writeConnection->sendRaw("PRIVMSG #" + channelName + " :" + message);
this->writeConnection->sendRaw("PRIVMSG #" + channelName + " :" + trimmedMessage);
}
this->connectionMutex.unlock();
@ -399,5 +404,5 @@ Communi::IrcConnection *IrcManager::getReadConnection()
return this->readConnection.get();
}
} // namespace singletons
} // namespace chatterino
}