Prepare LLIMModel and LLIMMgr to pass through info if we already performed a keyword alert so we can filter out basically duplicate notifications in Growl if it will be requested

Ansariel 2015-03-06 23:53:20 +01:00
parent fd2773aad4
commit 2e0a7fd873
4 changed files with 25 additions and 10 deletions

View File

@ -317,7 +317,7 @@ bool GrowlManager::filterOldNotifications(LLNotificationPtr pNotification)
void GrowlManager::onInstantMessage(const LLSD& im)
{
LLIMModel::LLIMSession* session = LLIMModel::instance().findIMSession(im["session_id"].asUUID());
if (session->isP2PSessionType())
if (session->isP2PSessionType()/* && !im["keyword_alert"].asBoolean()*/) // Ansariel: Comment this out to filter IM duplication due to keyword alerts
{
// Don't show messages from ourselves or the system.
LLUUID from_id = im["from_id"].asUUID();

View File

@ -1263,7 +1263,7 @@ bool LLIMModel::proccessOnlineOfflineNotification(
//bool LLIMModel::addMessage(const LLUUID& session_id, const std::string& from, const LLUUID& from_id,
// const std::string& utf8_text, bool log2file /* = true */) {
bool LLIMModel::addMessage(const LLUUID& session_id, const std::string& from, const LLUUID& from_id,
const std::string& utf8_text, bool log2file /* = true */, bool is_announcement /* = false */) {
const std::string& utf8_text, bool log2file /* = true */, bool is_announcement /* = false */, bool keyword_alert /* = false */) {
LLIMSession* session = addMessageSilently(session_id, from, from_id, utf8_text, log2file, is_announcement);
if (!session) return false;
@ -1284,7 +1284,8 @@ bool LLIMModel::addMessage(const LLUUID& session_id, const std::string& from, co
arg["from_id"] = from_id;
arg["time"] = LLLogChat::timestamp(false);
arg["session_type"] = session->mSessionType;
arg["is_announcement"] = is_announcement; // Ansariel: Indicator if it's an announcement
arg["is_announcement"] = is_announcement; // <FS:Ansariel> Indicator if it's an announcement
arg["keyword_alert"] = keyword_alert; // <FS:Ansariel> Pass info if keyword alert has been performed
mNewMsgSignal(arg);
return true;
@ -2949,7 +2950,8 @@ void LLIMMgr::addMessage(
const LLUUID& region_id,
const LLVector3& position,
bool link_name, // If this is true, then we insert the name and link it to a profile
bool is_announcement) // <FS:Ansariel> Special parameter indicating announcements
bool is_announcement, // <FS:Ansariel> Special parameter indicating announcements
bool keyword_alert) // <FS:Ansariel> Pass info if keyword alert has been performed
{
LLUUID other_participant_id = target_id;
@ -3165,7 +3167,7 @@ void LLIMMgr::addMessage(
{
// <FS:Ansariel> Added is_announcement parameter
//LLIMModel::instance().addMessage(new_session_id, from, other_participant_id, msg);
LLIMModel::instance().addMessage(new_session_id, from, other_participant_id, msg, true, is_announcement);
LLIMModel::instance().addMessage(new_session_id, from, other_participant_id, msg, true, is_announcement, keyword_alert);
}
// Open conversation floater if offline messages are present

View File

@ -241,7 +241,7 @@ public:
*/
// <FS:Ansariel> Added is_announcement parameter
//bool addMessage(const LLUUID& session_id, const std::string& from, const LLUUID& other_participant_id, const std::string& utf8_text, bool log2file = true);
bool addMessage(const LLUUID& session_id, const std::string& from, const LLUUID& other_participant_id, const std::string& utf8_text, bool log2file = true, bool is_announcement = false);
bool addMessage(const LLUUID& session_id, const std::string& from, const LLUUID& other_participant_id, const std::string& utf8_text, bool log2file = true, bool is_announcement = false, bool keyword_alert = false);
/**
* Similar to addMessage(...) above but won't send a signal about a new message added
@ -375,7 +375,8 @@ public:
const LLUUID& region_id = LLUUID::null,
const LLVector3& position = LLVector3::zero,
bool link_name = false,
bool is_announcement = false // <FS:Ansariel> Special parameter indicating announcement
bool is_announcement = false, // <FS:Ansariel> Special parameter indicating announcement
bool keyword_alert = false // <FS:Ansariel> Pass info if keyword alert has been performed
);
void addSystemMessage(const LLUUID& session_id, const std::string& message_name, const LLSD& args);

View File

@ -2960,9 +2960,11 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
// <FS:PP> FIRE-10178: Keyword Alerts in group IM do not work unless the group is in the foreground (notification on receipt of IM)
chat.mText = buffer;
bool keyword_alert = false;
if (FSKeywords::getInstance()->chatContainsKeyword(chat, false))
{
FSKeywords::notify(chat);
keyword_alert = true;
}
// </FS:PP>
@ -2978,7 +2980,9 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
parent_estate_id,
region_id,
position,
true);
true,
false,
keyword_alert);
// <FS:Ansariel> Old "do not disturb" message behavior: only send once if session not open
//if (!gIMMgr->isDNDMessageSend(session_id))
@ -3093,9 +3097,11 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
// <FS:PP> FIRE-10178: Keyword Alerts in group IM do not work unless the group is in the foreground (notification on receipt of IM)
chat.mText = message;
bool keyword_alert = false;
if (FSKeywords::getInstance()->chatContainsKeyword(chat, false))
{
FSKeywords::notify(chat);
keyword_alert = true;
}
// </FS:PP>
@ -3112,7 +3118,9 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
parent_estate_id,
region_id,
position,
true);
true,
false,
keyword_alert);
}
else
{
@ -3666,9 +3674,11 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
// <FS:PP> FIRE-10178: Keyword Alerts in group IM do not work unless the group is in the foreground (notification on receipt of IM)
chat.mText = message;
bool keyword_alert = false;
if (FSKeywords::getInstance()->chatContainsKeyword(chat, false))
{
FSKeywords::notify(chat);
keyword_alert = true;
}
// </FS:PP>
@ -3694,7 +3704,9 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
parent_estate_id,
region_id,
position,
true);
true,
false,
keyword_alert);
}
break;