From 4fb22939a08cc361cbe250a8de9001a92e3d5b64 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 8 Nov 2015 00:18:36 +0300 Subject: Dont try to show empty notifications. Only play sound if present. --- src/notifymanager.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/notifymanager.cpp b/src/notifymanager.cpp index 719912f12..4876bb982 100644 --- a/src/notifymanager.cpp +++ b/src/notifymanager.cpp @@ -62,6 +62,8 @@ namespace NotifyManager static void chatLog(ChatTab *const tab, const std::string &str) { + if (str.empty()) + return; if (tab) tab->chatLog(str, ChatMsgType::BY_SERVER); else if (debugChatTab) @@ -73,6 +75,12 @@ namespace NotifyManager if (message >= NotifyTypes::TYPE_END || !localChatTab) return; const NotificationInfo &info = notifications[message]; + if (!*info.text) + { + soundManager.playSfx(SoundDB::getSound(message)); + return; + } + switch (info.flags) { case NotifyFlags::EMPTY: @@ -118,7 +126,7 @@ namespace NotifyManager if (message >= NotifyTypes::TYPE_END || !localChatTab) return; const NotificationInfo &info = notifications[message]; - if (info.flags == NotifyFlags::INT) + if (info.flags == NotifyFlags::INT && *info.text) { localChatTab->chatLog(strprintf(gettext(info.text), num), ChatMsgType::BY_SERVER); @@ -131,6 +139,11 @@ namespace NotifyManager if (message >= NotifyTypes::TYPE_END || !localChatTab) return; const NotificationInfo &info = notifications[message]; + if (!*info.text) + { + soundManager.playSfx(SoundDB::getSound(message)); + return; + } switch (info.flags) { case NotifyFlags::STRING: -- cgit v1.2.3-60-g2f50