fix message sending

This commit is contained in:
Rasmus Karlsson 2017-05-28 00:47:16 +02:00
parent a9a68add38
commit 5208e0f2fd

View file

@ -62,16 +62,15 @@ ChatWidgetInput::ChatWidgetInput(ChatWidget *widget)
_edit.keyPressed.connect([this/*, completer*/](QKeyEvent *event) { _edit.keyPressed.connect([this/*, completer*/](QKeyEvent *event) {
if (event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return) { if (event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return) {
auto ptr = _chatWidget->getChannel(); auto c = _chatWidget->getChannel();
Channel *c = ptr.get(); if (c == nullptr) {
return;
}
if (c != nullptr) { c->sendMessage(_edit.toPlainText());
IrcManager::getInstance().send("PRIVMSG #" + c->getName() + ": " +
_edit.toPlainText());
event->accept(); event->accept();
_edit.setText(QString()); _edit.setText(QString());
} }
}
// else { // else {
// completer->setCompletionPrefix("asdf"); // completer->setCompletionPrefix("asdf");
// completer->complete(); // completer->complete();