fix message sending

This commit is contained in:
Rasmus Karlsson
2017-05-28 00:47:16 +02:00
parent a9a68add38
commit 5208e0f2fd
+7 -8
View File
@@ -62,15 +62,14 @@ 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) {
IrcManager::getInstance().send("PRIVMSG #" + c->getName() + ": " +
_edit.toPlainText());
event->accept();
_edit.setText(QString());
} }
c->sendMessage(_edit.toPlainText());
event->accept();
_edit.setText(QString());
} }
// else { // else {
// completer->setCompletionPrefix("asdf"); // completer->setCompletionPrefix("asdf");