aboutsummaryrefslogtreecommitdiff
path: root/examples/GuiClient/mainDialog.cpp
diff options
context:
space:
mode:
authorJeremy Lainé <jeremy.laine@m4x.org>2012-09-13 10:26:39 +0200
committerJeremy Lainé <jeremy.laine@m4x.org>2012-09-13 10:26:39 +0200
commitb0fc7dca8d21e7f8e507299c860912799a41a308 (patch)
tree06a599498b672f6b564fbf3bcaa758ee22cf627e /examples/GuiClient/mainDialog.cpp
parent13794e15896df75fb013a300de976e7f4d23debe (diff)
downloadqxmpp-b0fc7dca8d21e7f8e507299c860912799a41a308.tar.gz
don't show empty messages
Diffstat (limited to 'examples/GuiClient/mainDialog.cpp')
-rw-r--r--examples/GuiClient/mainDialog.cpp11
1 files changed, 8 insertions, 3 deletions
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)