From b0fc7dca8d21e7f8e507299c860912799a41a308 Mon Sep 17 00:00:00 2001 From: Jeremy Lainé Date: Thu, 13 Sep 2012 10:26:39 +0200 Subject: don't show empty messages --- examples/GuiClient/mainDialog.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'examples/GuiClient/mainDialog.cpp') diff --git a/examples/GuiClient/mainDialog.cpp b/examples/GuiClient/mainDialog.cpp index 714a0331..07895a65 100644 --- a/examples/GuiClient/mainDialog.cpp +++ b/examples/GuiClient/mainDialog.cpp @@ -355,9 +355,14 @@ void mainDialog::showChatDialog(const QString& bareJid) void mainDialog::messageReceived(const QXmppMessage& msg) { - QString from = msg.from(); - getChatDialog(QXmppUtils::jidToBareJid(from))->show(); - getChatDialog(QXmppUtils::jidToBareJid(from))->messageReceived(msg.body()); + if (msg.body().isEmpty()) + return; + + chatDialog *dialog = getChatDialog(QXmppUtils::jidToBareJid(msg.from())); + if (dialog) { + dialog->show(); + dialog->messageReceived(msg.body()); + } } void mainDialog::statusTextChanged(const QString& status) -- cgit v1.2.3