diff --git a/src/desktop/dbus_notification.cpp b/src/desktop/dbus_notification.cpp index 014c29f6857c..3bd8fe49a14e 100644 --- a/src/desktop/dbus_notification.cpp +++ b/src/desktop/dbus_notification.cpp @@ -193,7 +193,7 @@ namespace dbus { const int MAX_MSG_LINES = 5; -void send_notification(const std::string & owner, const std::string & message) +void send_notification(const std::string & owner, const std::string & message, bool with_history) { DBusConnection *connection = get_dbus_connection(); if (!connection) return; @@ -203,17 +203,21 @@ void send_notification(const std::string & owner, const std::string & message) wnotify_owner_it i = noticias.find(owner); if (i != noticias.end()) { - i->message = message + "\n" + i->message; + if (with_history) { + i->message = message + "\n" + i->message; - size_t endl_pos = i->message.find('\n'); - size_t ctr = 1; + size_t endl_pos = i->message.find('\n'); + size_t ctr = 1; - while (ctr < MAX_MSG_LINES && endl_pos != std::string::npos) { - endl_pos = i->message.find('\n', endl_pos+1); - ctr++; - } + while (ctr < MAX_MSG_LINES && endl_pos != std::string::npos) { + endl_pos = i->message.find('\n', endl_pos+1); + ctr++; + } - i->message = i->message.substr(0,endl_pos); + i->message = i->message.substr(0,endl_pos); + } else { + i->message = message; + } send_dbus_notification(connection, i->id, owner, i->message); return; diff --git a/src/desktop/dbus_notification.hpp b/src/desktop/dbus_notification.hpp index 9b7b46d64915..67729fba28e1 100644 --- a/src/desktop/dbus_notification.hpp +++ b/src/desktop/dbus_notification.hpp @@ -18,7 +18,7 @@ #include namespace dbus { - void send_notification(const std::string& owner, const std::string& message); + void send_notification(const std::string& owner, const std::string& message, bool with_history); } #endif diff --git a/src/desktop/notifications.cpp b/src/desktop/notifications.cpp index 4f44c3aead37..215facc048dd 100644 --- a/src/desktop/notifications.cpp +++ b/src/desktop/notifications.cpp @@ -70,8 +70,7 @@ void send(const std::string& owner, const std::string& message, type t) } #ifdef HAVE_LIBDBUS - (void)t; - dbus::send_notification(owner, message); + dbus::send_notification(owner, message, t == CHAT); #endif #ifdef HAVE_GROWL