summaryrefslogtreecommitdiff
path: root/src/notifymanager.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-11-08 00:18:36 +0300
committerAndrei Karas <akaras@inbox.ru>2015-11-08 00:18:36 +0300
commit4fb22939a08cc361cbe250a8de9001a92e3d5b64 (patch)
tree18e504127c47f7a52c1d533baf946780a90d7ae2 /src/notifymanager.cpp
parent38fb1671bbcdbb7e206ca1e33d6392ecfea51cc6 (diff)
downloadmv-4fb22939a08cc361cbe250a8de9001a92e3d5b64.tar.gz
mv-4fb22939a08cc361cbe250a8de9001a92e3d5b64.tar.bz2
mv-4fb22939a08cc361cbe250a8de9001a92e3d5b64.tar.xz
mv-4fb22939a08cc361cbe250a8de9001a92e3d5b64.zip
Dont try to show empty notifications. Only play sound if present.
Diffstat (limited to 'src/notifymanager.cpp')
-rw-r--r--src/notifymanager.cpp15
1 files changed, 14 insertions, 1 deletions
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: