From 5208e0f2fdb5b88e2129d069aa032e211af196a7 Mon Sep 17 00:00:00 2001 From: Rasmus Karlsson Date: Sun, 28 May 2017 00:47:16 +0200 Subject: [PATCH] fix message sending --- widgets/chatwidgetinput.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/widgets/chatwidgetinput.cpp b/widgets/chatwidgetinput.cpp index 4cb883728..9a1aedd6f 100644 --- a/widgets/chatwidgetinput.cpp +++ b/widgets/chatwidgetinput.cpp @@ -62,15 +62,14 @@ ChatWidgetInput::ChatWidgetInput(ChatWidget *widget) _edit.keyPressed.connect([this/*, completer*/](QKeyEvent *event) { if (event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return) { - auto ptr = _chatWidget->getChannel(); - Channel *c = ptr.get(); - - if (c != nullptr) { - IrcManager::getInstance().send("PRIVMSG #" + c->getName() + ": " + - _edit.toPlainText()); - event->accept(); - _edit.setText(QString()); + auto c = _chatWidget->getChannel(); + if (c == nullptr) { + return; } + + c->sendMessage(_edit.toPlainText()); + event->accept(); + _edit.setText(QString()); } // else { // completer->setCompletionPrefix("asdf");