From e6ffcf875bb33aaa7ded5a34245ada66a9ac66bd Mon Sep 17 00:00:00 2001 From: Ansariel Date: Wed, 4 Apr 2018 21:19:17 +0200 Subject: [PATCH] Fix indention in llimprocessing.cpp --- indra/newview/llimprocessing.cpp | 1058 +++++++++++++++--------------- 1 file changed, 524 insertions(+), 534 deletions(-) diff --git a/indra/newview/llimprocessing.cpp b/indra/newview/llimprocessing.cpp index 167cd21170..8db619e758 100644 --- a/indra/newview/llimprocessing.cpp +++ b/indra/newview/llimprocessing.cpp @@ -232,12 +232,12 @@ void inventory_offer_handler(LLOfferInfo* info) // Strip any SLURL from the message display. (DEV-2754) std::string msg = info->mDesc; int indx = msg.find(" ( http://slurl.com/secondlife/"); - if(indx == std::string::npos) + if (indx == std::string::npos) { // try to find new slurl host indx = msg.find(" ( http://maps.secondlife.com/secondlife/"); } - if(indx >= 0) + if (indx >= 0) { LLStringUtil::truncate(msg, indx); } @@ -684,7 +684,7 @@ void LLIMProcessing::processNewMessage(LLUUID from_id, chat.mFromID = from_id; chat.mFromName = name; chat.mSourceType = (from_id.isNull() || (name == std::string(SYSTEM_FROM))) ? CHAT_SOURCE_SYSTEM : CHAT_SOURCE_AGENT; - + if (chat.mSourceType == CHAT_SOURCE_SYSTEM) { // Translate server message if required (MAINT-6109) translate_if_needed(message); @@ -722,262 +722,122 @@ void LLIMProcessing::processNewMessage(LLUUID from_id, LLSD payload; LLNotification::Params params; - switch(dialog) - { - case IM_CONSOLE_AND_CHAT_HISTORY: - args["MESSAGE"] = message; - payload["from_id"] = from_id; + switch (dialog) + { + case IM_CONSOLE_AND_CHAT_HISTORY: + args["MESSAGE"] = message; + payload["from_id"] = from_id; - params.name = "IMSystemMessageTip"; - params.substitutions = args; - params.payload = payload; - LLPostponedNotification::add(params, from_id, false); - break; + params.name = "IMSystemMessageTip"; + params.substitutions = args; + params.payload = payload; + LLPostponedNotification::add(params, from_id, false); + break; - case IM_NOTHING_SPECIAL: // p2p IM - // Don't show dialog, just do IM - if (!gAgent.isGodlike() - && gAgent.getRegion()->isPrelude() - && to_id.isNull() ) - { - // do nothing -- don't distract newbies in - // Prelude with global IMs - } + case IM_NOTHING_SPECIAL: // p2p IM + // Don't show dialog, just do IM + if (!gAgent.isGodlike() + && gAgent.getRegion()->isPrelude() + && to_id.isNull()) + { + // do nothing -- don't distract newbies in + // Prelude with global IMs + } // [RLVa:KB] - Checked: RLVa-2.1.0 - else if ( (RlvActions::isRlvEnabled()) && (offline == IM_ONLINE) && (!is_muted) && ((!accept_im_from_only_friend) || (is_friend)) && - (message.length() > 3) && (RLV_CMD_PREFIX == message[0]) && (RlvHandler::instance().processIMQuery(from_id, message)) ) - { - // Eat the message and do nothing - return; - } + else if ( (RlvActions::isRlvEnabled()) && (offline == IM_ONLINE) && (!is_muted) && ((!accept_im_from_only_friend) || (is_friend)) && + (message.length() > 3) && (RLV_CMD_PREFIX == message[0]) && (RlvHandler::instance().processIMQuery(from_id, message)) ) + { + // Eat the message and do nothing + return; + } // [/RLVa:KB] -// else if (offline == IM_ONLINE -// && is_do_not_disturb -// && from_id.notNull() //not a system message -// && to_id.notNull()) //not global message +// else if (offline == IM_ONLINE +// && is_do_not_disturb +// && from_id.notNull() //not a system message +// && to_id.notNull()) //not global message // [RLVa:KB] - Checked: 2010-11-30 (RLVa-1.3.0) - // Only send the busy reponse if either the sender is not - // muted OR the sender is muted and we explicitely want - // to inform him about that fact. - else if (offline == IM_ONLINE - && (!accept_im_from_only_friend || is_friend) // is friend or accept IMs from friend only disabled - && ((is_do_not_disturb && (!is_muted || (is_muted && !is_autorespond_muted))) || // do not disturb - (is_autorespond && !is_muted) || // autorespond everyone - (is_autorespond_nonfriends && !is_friend && !is_muted) || // autorespond friends only - (is_afk && FSSendAwayAvatarResponse && !is_muted)) // away - && from_id.notNull() //not a system message - && to_id.notNull() //not global message - && RlvActions::canReceiveIM(from_id)) -// [/RLVa:KB] - { - // Log autoresponse notification after initial message - bool has_session = true; - - // Old "do not disturb" message behavior: only send once if session not open - // Session id will be null if avatar answers from offline IM via email - std::string response; - if (!gIMMgr->hasSession(session_id) && session_id.notNull()) + // Only send the busy reponse if either the sender is not + // muted OR the sender is muted and we explicitely want + // to inform him about that fact. + else if (offline == IM_ONLINE + && (!accept_im_from_only_friend || is_friend) // is friend or accept IMs from friend only disabled + && ((is_do_not_disturb && (!is_muted || (is_muted && !is_autorespond_muted))) || // do not disturb + (is_autorespond && !is_muted) || // autorespond everyone + (is_autorespond_nonfriends && !is_friend && !is_muted) || // autorespond friends only + (is_afk && FSSendAwayAvatarResponse && !is_muted)) // away + && from_id.notNull() //not a system message + && to_id.notNull() //not global message + && RlvActions::canReceiveIM(from_id)) + // [/RLVa:KB] { - // // Log autoresponse notification after initial message - has_session = false; - // FS autoresponse feature - std::string my_name; - LLAgentUI::buildFullname(my_name); - if (is_do_not_disturb) + bool has_session = true; + + // Old "do not disturb" message behavior: only send once if session not open + // Session id will be null if avatar answers from offline IM via email + std::string response; + if (!gIMMgr->hasSession(session_id) && session_id.notNull()) { - response = gSavedPerAccountSettings.getString("DoNotDisturbModeResponse"); - } - else if (is_autorespond_nonfriends && !is_friend) - { - response = gSavedPerAccountSettings.getString("FSAutorespondNonFriendsResponse"); - } - else if (is_autorespond) - { - response = gSavedPerAccountSettings.getString("FSAutorespondModeResponse"); - } - // FIRE-10500: Autoresponse for (Away) - else if (is_afk && FSSendAwayAvatarResponse) - { - response = gSavedPerAccountSettings.getString("FSAwayAvatarResponse"); - } - // - else - { - LL_WARNS() << "Unknown auto-response mode" << LL_ENDL; - } - pack_instant_message( - gMessageSystem, - gAgent.getID(), - FALSE, - gAgent.getSessionID(), - from_id, - my_name, - response, - IM_ONLINE, - IM_DO_NOT_DISTURB_AUTO_RESPONSE, - session_id); - gAgent.sendReliableMessage(); - // FS autoresponse feature - // Old "do not disturb" message behavior: only send once if session not open - } - // - - // checkfor and process reqinfo - if (has_session) - { - message = FSData::getInstance()->processRequestForInfo(from_id,message,name,session_id); - } - // - - // now store incoming IM in chat history - - buffer = message; - - LL_DEBUGS("Messaging") << "session_id( " << session_id << " ), from_id( " << from_id << " )" << LL_ENDL; - - // 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_performed = false; - if (FSKeywords::getInstance()->chatContainsKeyword(chat, false)) - { - FSKeywords::notify(chat); - keyword_alert_performed = true; - } - // - - // add to IM panel, but do not bother the user - gIMMgr->addMessage( - session_id, - from_id, - name, - buffer, - IM_OFFLINE == offline, - LLStringUtil::null, - dialog, - parent_estate_id, - region_id, - position, - true, - false, - keyword_alert_performed); - - // Old "do not disturb" message behavior: only send once if session not open - //if (!gIMMgr->isDNDMessageSend(session_id)) - //{ - // // return a standard "do not disturb" message, but only do it to online IM - // // (i.e. not other auto responses and not store-and-forward IM) - // send_do_not_disturb_message(msg, from_id, session_id); - // gIMMgr->setDNDMessageSent(session_id, true); - //} - // - - if (!has_session) - { - // Fire-5389 - "Autoresponse Sent" message added to Firestorm as was in Phoenix - LLStringUtil::format_map_t args; - args["MESSAGE"] = response; - - gIMMgr->addMessage( - session_id, - gAgentID, - LLStringUtil::null, // Pass null value so no name gets prepended - LLTrans::getString("IM_autoresponse_sent", args), - false, - name, - IM_NOTHING_SPECIAL, - parent_estate_id, - region_id, - position, - false, - true - ); - // - - // Send inventory item on autoresponse - LLUUID item_id(gSavedPerAccountSettings.getString("FSAutoresponseItemUUID")); - if (item_id.notNull()) - { - LLInventoryItem* item = dynamic_cast(gInventory.getItem(item_id)); - if (item) + // + // Log autoresponse notification after initial message + has_session = false; + // FS autoresponse feature + std::string my_name; + LLAgentUI::buildFullname(my_name); + if (is_do_not_disturb) { - gIMMgr->addMessage( - session_id, - gAgentID, - LLStringUtil::null, // Pass null value so no name gets prepended - LLTrans::getString("IM_autoresponse_item_sent", LLSD().with("[ITEM_NAME]", item->getName())), - false, - name, - IM_NOTHING_SPECIAL, - parent_estate_id, - region_id, - position, - false, - true); - LLGiveInventory::doGiveInventoryItem(from_id, item, session_id); + response = gSavedPerAccountSettings.getString("DoNotDisturbModeResponse"); } + else if (is_autorespond_nonfriends && !is_friend) + { + response = gSavedPerAccountSettings.getString("FSAutorespondNonFriendsResponse"); + } + else if (is_autorespond) + { + response = gSavedPerAccountSettings.getString("FSAutorespondModeResponse"); + } + // FIRE-10500: Autoresponse for (Away) + else if (is_afk && FSSendAwayAvatarResponse) + { + response = gSavedPerAccountSettings.getString("FSAwayAvatarResponse"); + } + // + else + { + LL_WARNS() << "Unknown auto-response mode" << LL_ENDL; + } + pack_instant_message( + gMessageSystem, + gAgent.getID(), + FALSE, + gAgent.getSessionID(), + from_id, + my_name, + response, + IM_ONLINE, + IM_DO_NOT_DISTURB_AUTO_RESPONSE, + session_id); + gAgent.sendReliableMessage(); + // FS autoresponse feature + // Old "do not disturb" message behavior: only send once if session not open } // - } - } - else if (from_id.isNull()) - { - LLSD args; - args["MESSAGE"] = message; - LLNotificationsUtil::add("SystemMessage", args); - } - else if (to_id.isNull()) - { - // Message to everyone from GOD, look up the fullname since - // server always slams name to legacy names - LLAvatarNameCache::get(from_id, boost::bind(god_message_name_cb, _2, chat, message)); - } - else - { - // standard message, not from system - std::string saved; - if(offline == IM_OFFLINE) - { - LLStringUtil::format_map_t args; - args["[LONG_TIMESTAMP]"] = formatted_time(timestamp); - saved = LLTrans::getString("Saved_message", args); - } - buffer = saved + message; - LL_DEBUGS("Messaging") << "session_id( " << session_id << " ), from_id( " << from_id << " )" << LL_ENDL; - - bool mute_im = is_muted; - if (accept_im_from_only_friend && !is_friend) - { - if (!gIMMgr->isNonFriendSessionNotified(session_id)) + // checkfor and process reqinfo + if (has_session) { - // Disable this - doesn't make sense it will be skipped by LLIMMgr::addMessage() anyway - //std::string message = LLTrans::getString("IM_unblock_only_groups_friends"); - //gIMMgr->addMessage(session_id, from_id, name, message, IM_OFFLINE == offline); - // - gIMMgr->addNotifiedNonFriendSessionID(session_id); + message = FSData::getInstance()->processRequestForInfo(from_id,message,name,session_id); } + // - mute_im = true; - } + // now store incoming IM in chat history -// [RLVa:KB] - Checked: 2010-11-30 (RLVa-1.3.0) - // Don't block offline IMs, or IMs from Lindens - if ( (rlv_handler_t::isEnabled()) && (offline != IM_OFFLINE) && (!RlvActions::canReceiveIM(from_id)) && (!LLMuteList::getInstance()->isLinden(original_name) )) - { - if (!mute_im) - RlvUtil::sendBusyMessage(from_id, RlvStrings::getString(RLV_STRING_BLOCKED_RECVIM_REMOTE), session_id); - message = RlvStrings::getString(RLV_STRING_BLOCKED_RECVIM); - } -// [/RLVa:KB] + buffer = message; - if (!mute_im) - { - // checkfor and process reqinfo - message = FSData::getInstance()->processRequestForInfo(from_id, message, name, session_id); + LL_DEBUGS("Messaging") << "session_id( " << session_id << " ), from_id( " << from_id << " )" << LL_ENDL; // 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; + chat.mText = buffer; bool keyword_alert_performed = false; if (FSKeywords::getInstance()->chatContainsKeyword(chat, false)) { @@ -986,8 +846,7 @@ void LLIMProcessing::processNewMessage(LLUUID from_id, } // - buffer = saved + message; - + // add to IM panel, but do not bother the user gIMMgr->addMessage( session_id, from_id, @@ -1002,71 +861,202 @@ void LLIMProcessing::processNewMessage(LLUUID from_id, true, false, keyword_alert_performed); + + // Old "do not disturb" message behavior: only send once if session not open + //if (!gIMMgr->isDNDMessageSend(session_id)) + //{ + // // return a standard "do not disturb" message, but only do it to online IM + // // (i.e. not other auto responses and not store-and-forward IM) + // send_do_not_disturb_message(msg, from_id, session_id); + // gIMMgr->setDNDMessageSent(session_id, true); + //} + // + + if (!has_session) + { + // Fire-5389 - "Autoresponse Sent" message added to Firestorm as was in Phoenix + LLStringUtil::format_map_t args; + args["MESSAGE"] = response; + + gIMMgr->addMessage( + session_id, + gAgentID, + LLStringUtil::null, // Pass null value so no name gets prepended + LLTrans::getString("IM_autoresponse_sent", args), + false, + name, + IM_NOTHING_SPECIAL, + parent_estate_id, + region_id, + position, + false, + true + ); + // + + // Send inventory item on autoresponse + LLUUID item_id(gSavedPerAccountSettings.getString("FSAutoresponseItemUUID")); + if (item_id.notNull()) + { + LLInventoryItem* item = dynamic_cast(gInventory.getItem(item_id)); + if (item) + { + gIMMgr->addMessage( + session_id, + gAgentID, + LLStringUtil::null, // Pass null value so no name gets prepended + LLTrans::getString("IM_autoresponse_item_sent", LLSD().with("[ITEM_NAME]", item->getName())), + false, + name, + IM_NOTHING_SPECIAL, + parent_estate_id, + region_id, + position, + false, + true); + LLGiveInventory::doGiveInventoryItem(from_id, item, session_id); + } + } + // + } + } + else if (from_id.isNull()) + { + LLSD args; + args["MESSAGE"] = message; + LLNotificationsUtil::add("SystemMessage", args); + } + else if (to_id.isNull()) + { + // Message to everyone from GOD, look up the fullname since + // server always slams name to legacy names + LLAvatarNameCache::get(from_id, boost::bind(god_message_name_cb, _2, chat, message)); } else { - /* - EXT-5099 - currently there is no way to store in history only... - using LLNotificationsUtil::add will add message to Nearby Chat - - // muted user, so don't start an IM session, just record line in chat - // history. Pretend the chat is from a local agent, - // so it will go into the history but not be shown on screen. - - LLSD args; - args["MESSAGE"] = buffer; - LLNotificationsUtil::add("SystemMessageTip", args); - */ - static LLCachedControl fsSendMutedAvatarResponse(gSavedPerAccountSettings, "FSSendMutedAvatarResponse"); - if (fsSendMutedAvatarResponse && (!accept_im_from_only_friend || is_friend)) + // standard message, not from system + std::string saved; + if (offline == IM_OFFLINE) { - std::string my_name; - LLAgentUI::buildFullname(my_name); - std::string response = gSavedPerAccountSettings.getString("FSMutedAvatarResponse"); - pack_instant_message( - gMessageSystem, - gAgent.getID(), - FALSE, - gAgent.getSessionID(), - from_id, - my_name, - response, - IM_ONLINE, - IM_DO_NOT_DISTURB_AUTO_RESPONSE, - session_id); - gAgent.sendReliableMessage(); + LLStringUtil::format_map_t args; + args["[LONG_TIMESTAMP]"] = formatted_time(timestamp); + saved = LLTrans::getString("Saved_message", args); + } + buffer = saved + message; + + LL_DEBUGS("Messaging") << "session_id( " << session_id << " ), from_id( " << from_id << " )" << LL_ENDL; + + bool mute_im = is_muted; + if (accept_im_from_only_friend && !is_friend) + { + if (!gIMMgr->isNonFriendSessionNotified(session_id)) + { + // Disable this - doesn't make sense it will be skipped by LLIMMgr::addMessage() anyway + //std::string message = LLTrans::getString("IM_unblock_only_groups_friends"); + //gIMMgr->addMessage(session_id, from_id, name, message, IM_OFFLINE == offline); + // + gIMMgr->addNotifiedNonFriendSessionID(session_id); + } + + mute_im = true; } - // Don't flash for muted IMs - return; - } - } - break; +// [RLVa:KB] - Checked: 2010-11-30 (RLVa-1.3.0) + // Don't block offline IMs, or IMs from Lindens + if ( (rlv_handler_t::isEnabled()) && (offline != IM_OFFLINE) && (!RlvActions::canReceiveIM(from_id)) && (!LLMuteList::getInstance()->isLinden(original_name) )) + { + if (!mute_im) + RlvUtil::sendBusyMessage(from_id, RlvStrings::getString(RLV_STRING_BLOCKED_RECVIM_REMOTE), session_id); + message = RlvStrings::getString(RLV_STRING_BLOCKED_RECVIM); + } +// [/RLVa:KB] - case IM_TYPING_START: + if (!mute_im) + { + // checkfor and process reqinfo + message = FSData::getInstance()->processRequestForInfo(from_id, message, name, session_id); + + // 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_performed = false; + if (FSKeywords::getInstance()->chatContainsKeyword(chat, false)) + { + FSKeywords::notify(chat); + keyword_alert_performed = true; + } + // + + buffer = saved + message; + + gIMMgr->addMessage( + session_id, + from_id, + name, + buffer, + IM_OFFLINE == offline, + LLStringUtil::null, + dialog, + parent_estate_id, + region_id, + position, + true, + false, + keyword_alert_performed); + } + else + { + /* + EXT-5099 + */ + static LLCachedControl fsSendMutedAvatarResponse(gSavedPerAccountSettings, "FSSendMutedAvatarResponse"); + if (fsSendMutedAvatarResponse && (!accept_im_from_only_friend || is_friend)) + { + std::string my_name; + LLAgentUI::buildFullname(my_name); + std::string response = gSavedPerAccountSettings.getString("FSMutedAvatarResponse"); + pack_instant_message( + gMessageSystem, + gAgent.getID(), + FALSE, + gAgent.getSessionID(), + from_id, + my_name, + response, + IM_ONLINE, + IM_DO_NOT_DISTURB_AUTO_RESPONSE, + session_id); + gAgent.sendReliableMessage(); + } + + // Don't flash for muted IMs + return; + } + } + break; + + case IM_TYPING_START: { LLPointer im_info = new LLIMInfo(gMessageSystem); gIMMgr->processIMTypingStart(im_info); } break; - case IM_TYPING_STOP: + case IM_TYPING_STOP: { LLPointer im_info = new LLIMInfo(gMessageSystem); gIMMgr->processIMTypingStop(im_info); } break; - case IM_MESSAGEBOX: + case IM_MESSAGEBOX: { // This is a block, modeless dialog. args["MESSAGE"] = message; LLNotificationsUtil::add("SystemMessageTip", args); } break; - case IM_GROUP_NOTICE: - case IM_GROUP_NOTICE_REQUESTED: + case IM_GROUP_NOTICE: + case IM_GROUP_NOTICE_REQUESTED: { LL_INFOS("Messaging") << "Received IM_GROUP_NOTICE message." << LL_ENDL; @@ -1150,7 +1140,7 @@ void LLIMProcessing::processNewMessage(LLUUID from_id, if (has_inventory) { info = new LLOfferInfo(); - + info->mIM = IM_GROUP_NOTICE; info->mFromID = from_id; info->mFromGroup = from_group; @@ -1171,7 +1161,7 @@ void LLIMProcessing::processNewMessage(LLUUID from_id, info->mDesc = item_name; info->mHost = sender; } - + std::string str(message); // Tokenize the string. @@ -1195,7 +1185,7 @@ void LLIMProcessing::processNewMessage(LLUUID from_id, payload["group_id"] = group_id; payload["inventory_name"] = item_name; payload["received_time"] = LLDate::now(); - if(info && info->asLLSD()) + if (info && info->asLLSD()) { payload["inventory_offer"] = info->asLLSD(); } @@ -1218,8 +1208,8 @@ void LLIMProcessing::processNewMessage(LLUUID from_id, // Also send down the old path for now. if (IM_GROUP_NOTICE_REQUESTED == dialog) { - - LLPanelGroup::showNotice(subj,mes,group_id,has_inventory,item_name,info); + + LLPanelGroup::showNotice(subj, mes, group_id, has_inventory, item_name, info); } else { @@ -1227,7 +1217,7 @@ void LLIMProcessing::processNewMessage(LLUUID from_id, } } break; - case IM_GROUP_INVITATION: + case IM_GROUP_INVITATION: { // FIRE-20385: Don't show group invitation for groups agent is already a member of if (gAgent.isInGroup(from_id) && !gSavedSettings.getBOOL("FSShowJoinedGroupInvitations")) @@ -1248,7 +1238,7 @@ void LLIMProcessing::processNewMessage(LLUUID from_id, { send_do_not_disturb_message(gMessageSystem, from_id); } - + if (!is_muted) { LL_INFOS("Messaging") << "Received IM_GROUP_INVITATION message." << LL_ENDL; @@ -1257,7 +1247,7 @@ void LLIMProcessing::processNewMessage(LLUUID from_id, { S32 membership_fee; LLUUID role_id; - }* invite_bucket; + }*invite_bucket; // Make sure the binary bucket is the correct size. if (binary_bucket_size != sizeof(invite_bucket_t)) @@ -1305,9 +1295,9 @@ void LLIMProcessing::processNewMessage(LLUUID from_id, } break; - case IM_INVENTORY_OFFERED: - case IM_TASK_INVENTORY_OFFERED: - // Someone has offered us some inventory. + case IM_INVENTORY_OFFERED: + case IM_TASK_INVENTORY_OFFERED: + // Someone has offered us some inventory. { LLOfferInfo* info = new LLOfferInfo; if (IM_INVENTORY_OFFERED == dialog) @@ -1316,7 +1306,7 @@ void LLIMProcessing::processNewMessage(LLUUID from_id, { S8 asset_type; LLUUID object_id; - }* bucketp; + }*bucketp; if (sizeof(offer_agent_bucket_t) != binary_bucket_size) { @@ -1381,54 +1371,54 @@ void LLIMProcessing::processNewMessage(LLUUID from_id, } break; - case IM_INVENTORY_ACCEPTED: - { -// args["NAME"] = LLSLURL("agent", from_id, "completename").getSLURLString();; -// args["ORIGINAL_NAME"] = original_name; + case IM_INVENTORY_ACCEPTED: + { +// args["NAME"] = LLSLURL("agent", from_id, "completename").getSLURLString();; +// args["ORIGINAL_NAME"] = original_name; // [RLVa:KB] - Checked: RLVa-1.2.2 - // Only anonymize the name if the agent is nearby, there isn't an open IM session to them and their profile isn't open - LLAvatarName av_name; - bool fRlvCanShowName = (!RlvActions::isRlvEnabled()) || - (RlvActions::canShowName(RlvActions::SNC_DEFAULT, from_id)) || (!RlvUtil::isNearbyAgent(from_id)) || (RlvUIEnabler::hasOpenProfile(from_id)) || (RlvUIEnabler::hasOpenIM(from_id)); - args["NAME"] = LLSLURL("agent", from_id, (fRlvCanShowName) ? "completename" : "rlvanonym").getSLURLString();; - args["ORIGINAL_NAME"] = fRlvCanShowName ? original_name : (LLAvatarNameCache::get(from_id, &av_name) ? RlvStrings::getAnonym(av_name) : RlvStrings::getAnonym(original_name)); + // Only anonymize the name if the agent is nearby, there isn't an open IM session to them and their profile isn't open + LLAvatarName av_name; + bool fRlvCanShowName = (!RlvActions::isRlvEnabled()) || + (RlvActions::canShowName(RlvActions::SNC_DEFAULT, from_id)) || (!RlvUtil::isNearbyAgent(from_id)) || (RlvUIEnabler::hasOpenProfile(from_id)) || (RlvUIEnabler::hasOpenIM(from_id)); + args["NAME"] = LLSLURL("agent", from_id, (fRlvCanShowName) ? "completename" : "rlvanonym").getSLURLString();; + args["ORIGINAL_NAME"] = fRlvCanShowName ? original_name : (LLAvatarNameCache::get(from_id, &av_name) ? RlvStrings::getAnonym(av_name) : RlvStrings::getAnonym(original_name)); // [/RLVa:KB] - LLSD payload; - payload["from_id"] = from_id; - // Passing the "SESSION_NAME" to use it for IM notification logging - // in LLTipHandler::processNotification(). See STORM-941. - payload["SESSION_NAME"] = name; - LLNotificationsUtil::add("InventoryAccepted", args, payload); - break; - } - case IM_INVENTORY_DECLINED: - { -// args["NAME"] = LLSLURL("agent", from_id, "completename").getSLURLString();; + LLSD payload; + payload["from_id"] = from_id; + // Passing the "SESSION_NAME" to use it for IM notification logging + // in LLTipHandler::processNotification(). See STORM-941. + payload["SESSION_NAME"] = name; + LLNotificationsUtil::add("InventoryAccepted", args, payload); + break; + } + case IM_INVENTORY_DECLINED: + { +// args["NAME"] = LLSLURL("agent", from_id, "completename").getSLURLString();; // [RLVa:KB] - Checked: RLVa-1.2.2 - // Only anonymize the name if the agent is nearby, there isn't an open IM session to them and their profile isn't open - bool fRlvCanShowName = (!RlvActions::isRlvEnabled()) || - (RlvActions::canShowName(RlvActions::SNC_DEFAULT, from_id)) || (!RlvUtil::isNearbyAgent(from_id)) || (RlvUIEnabler::hasOpenProfile(from_id)) || (RlvUIEnabler::hasOpenIM(from_id)); - args["NAME"] = LLSLURL("agent", from_id, (fRlvCanShowName) ? "completename" : "rlvanonym").getSLURLString();; + // Only anonymize the name if the agent is nearby, there isn't an open IM session to them and their profile isn't open + bool fRlvCanShowName = (!RlvActions::isRlvEnabled()) || + (RlvActions::canShowName(RlvActions::SNC_DEFAULT, from_id)) || (!RlvUtil::isNearbyAgent(from_id)) || (RlvUIEnabler::hasOpenProfile(from_id)) || (RlvUIEnabler::hasOpenIM(from_id)); + args["NAME"] = LLSLURL("agent", from_id, (fRlvCanShowName) ? "completename" : "rlvanonym").getSLURLString();; // [/RLVa:KB] - LLSD payload; - payload["from_id"] = from_id; - LLNotificationsUtil::add("InventoryDeclined", args, payload); - break; - } - // TODO: _DEPRECATED suffix as part of vote removal - DEV-24856 - case IM_GROUP_VOTE: + LLSD payload; + payload["from_id"] = from_id; + LLNotificationsUtil::add("InventoryDeclined", args, payload); + break; + } + // TODO: _DEPRECATED suffix as part of vote removal - DEV-24856 + case IM_GROUP_VOTE: { LL_WARNS("Messaging") << "Received IM: IM_GROUP_VOTE_DEPRECATED" << LL_ENDL; } break; - case IM_GROUP_ELECTION_DEPRECATED: - { - LL_WARNS("Messaging") << "Received IM: IM_GROUP_ELECTION_DEPRECATED" << LL_ENDL; - } - break; - - case IM_FROM_TASK: + case IM_GROUP_ELECTION_DEPRECATED: + { + LL_WARNS("Messaging") << "Received IM: IM_GROUP_ELECTION_DEPRECATED" << LL_ENDL; + } + break; + + case IM_FROM_TASK: { if (is_do_not_disturb && !is_owned_by_me) @@ -1471,7 +1461,7 @@ void LLIMProcessing::processNewMessage(LLUUID from_id, // enough to check only from name (i.e. fromName = "Second Life"). For example // source type of messages from objects called "Second Life" should not be CHAT_SOURCE_SYSTEM. bool chat_from_system = (SYSTEM_FROM == name) && region_id.isNull() && position.isNull(); - if(chat_from_system) + if (chat_from_system) { // System's UUID is NULL (fixes EXT-4766) chat.mFromID = LLUUID::null; @@ -1507,9 +1497,9 @@ void LLIMProcessing::processNewMessage(LLUUID from_id, if (from_group) { query_string["groupowned"] = "true"; - } + } -// chat.mURL = LLSLURL("objectim", session_id, "").getSLURLString(); +// chat.mURL = LLSLURL("objectim", session_id, "").getSLURLString(); // [SL:KB] - Checked: 2010-11-02 (RLVa-1.2.2a) | Added: RLVa-1.2.2a chat.mURL = LLSLURL("objectim", session_id, LLURI::mapToQueryString(query_string)).getSLURLString(); // [/SL:KB] @@ -1528,7 +1518,7 @@ void LLIMProcessing::processNewMessage(LLUUID from_id, //LLFloaterIMNearbyChat* nearby_chat = LLFloaterReg::getTypedInstance("nearby_chat"); FSFloaterNearbyChat* nearby_chat = FSFloaterNearbyChat::getInstance(); // [FS communication UI] - if(!chat_from_system && nearby_chat) + if (!chat_from_system && nearby_chat) { chat.mOwnerID = from_id; LLSD args; @@ -1550,7 +1540,7 @@ void LLIMProcessing::processNewMessage(LLUUID from_id, //Object IMs send with from name: 'Second Life' need to be displayed also in notification toasts (EXT-1590) if (!chat_from_system) break; - + LLSD substitutions; substitutions["NAME"] = name; substitutions["MSG"] = message; @@ -1571,128 +1561,128 @@ void LLIMProcessing::processNewMessage(LLUUID from_id, } break; - case IM_SESSION_SEND: // ad-hoc or group IMs + case IM_SESSION_SEND: // ad-hoc or group IMs - // Only show messages if we have a session open (which - // should happen after you get an "invitation" + // Only show messages if we have a session open (which + // should happen after you get an "invitation" // [SL:KB] - Patch: Chat-GroupSnooze | Checked: 2012-06-16 (Catznip-3.3) - //if ( !gIMMgr->hasSession(session_id) ) - if ( (!gIMMgr->hasSession(session_id)) && - ( (!gAgent.isInGroup(session_id)) || (!gIMMgr->checkSnoozeExpiration(session_id)) || LLAvatarActions::isBlocked(from_id) || (!gIMMgr->restoreSnoozedSession(session_id)) ) ) + //if ( !gIMMgr->hasSession(session_id) ) + if ( (!gIMMgr->hasSession(session_id)) && + ( (!gAgent.isInGroup(session_id)) || (!gIMMgr->checkSnoozeExpiration(session_id)) || LLAvatarActions::isBlocked(from_id) || (!gIMMgr->restoreSnoozedSession(session_id)) ) ) // [/SL:KB] - { - return; - } - - else if (offline == IM_ONLINE && is_do_not_disturb) - { - - // return a standard "do not disturb" message, but only do it to online IM - // (i.e. not other auto responses and not store-and-forward IM) - if (!gIMMgr->hasSession(session_id)) { - // if there is not a panel for this conversation (i.e. it is a new IM conversation - // initiated by the other party) then... - send_do_not_disturb_message(gMessageSystem, from_id, session_id); + return; } - // now store incoming IM in chat history - - buffer = message; - - LL_DEBUGS("Messaging") << "message in dnd; session_id( " << session_id << " ), from_id( " << from_id << " )" << LL_ENDL; - - // add to IM panel, but do not bother the user - gIMMgr->addMessage( - session_id, - from_id, - name, - buffer, - IM_OFFLINE == offline, - ll_safe_string((char*)binary_bucket), - IM_SESSION_INVITE, - parent_estate_id, - region_id, - position, - true); - } - else - { - - // 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_performed = false; - if (FSKeywords::getInstance()->chatContainsKeyword(chat, false)) + else if (offline == IM_ONLINE && is_do_not_disturb) { - FSKeywords::notify(chat); - keyword_alert_performed = true; - } - // - // standard message, not from system - std::string saved; - if(offline == IM_OFFLINE) + // return a standard "do not disturb" message, but only do it to online IM + // (i.e. not other auto responses and not store-and-forward IM) + if (!gIMMgr->hasSession(session_id)) + { + // if there is not a panel for this conversation (i.e. it is a new IM conversation + // initiated by the other party) then... + send_do_not_disturb_message(gMessageSystem, from_id, session_id); + } + + // now store incoming IM in chat history + + buffer = message; + + LL_DEBUGS("Messaging") << "message in dnd; session_id( " << session_id << " ), from_id( " << from_id << " )" << LL_ENDL; + + // add to IM panel, but do not bother the user + gIMMgr->addMessage( + session_id, + from_id, + name, + buffer, + IM_OFFLINE == offline, + ll_safe_string((char*)binary_bucket), + IM_SESSION_INVITE, + parent_estate_id, + region_id, + position, + true); + } + else { - saved = llformat("(Saved %s) ", formatted_time(timestamp).c_str()); + + // 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_performed = false; + if (FSKeywords::getInstance()->chatContainsKeyword(chat, false)) + { + FSKeywords::notify(chat); + keyword_alert_performed = true; + } + // + + // standard message, not from system + std::string saved; + if (offline == IM_OFFLINE) + { + saved = llformat("(Saved %s) ", formatted_time(timestamp).c_str()); + } + + buffer = saved + message; + + LL_DEBUGS("Messaging") << "standard message session_id( " << session_id << " ), from_id( " << from_id << " )" << LL_ENDL; + + gIMMgr->addMessage( + session_id, + from_id, + name, + buffer, + IM_OFFLINE == offline, + ll_safe_string((char*)binary_bucket), + IM_SESSION_INVITE, + parent_estate_id, + region_id, + position, + true, + false, + keyword_alert_performed); } + break; - buffer = saved + message; + case IM_FROM_TASK_AS_ALERT: + if (is_do_not_disturb && !is_owned_by_me) + { + return; + } + { + // Construct a viewer alert for this message. + args["NAME"] = name; + args["MESSAGE"] = message; + LLNotificationsUtil::add("ObjectMessage", args); + } + break; + case IM_DO_NOT_DISTURB_AUTO_RESPONSE: + if (is_muted) + { + LL_DEBUGS("Messaging") << "Ignoring do-not-disturb response from " << from_id << LL_ENDL; + return; + } + else + { + // FIRE-12908: Add busy response indicator back to busy messages + //gIMMgr->addMessage(session_id, from_id, name, message); + buffer = llformat("(%s): %s", LLTrans::getString("BusyResponse").c_str(), message.c_str()); + gIMMgr->addMessage(session_id, from_id, name, buffer); + // + } + break; - LL_DEBUGS("Messaging") << "standard message session_id( " << session_id << " ), from_id( " << from_id << " )" << LL_ENDL; - - gIMMgr->addMessage( - session_id, - from_id, - name, - buffer, - IM_OFFLINE == offline, - ll_safe_string((char*)binary_bucket), - IM_SESSION_INVITE, - parent_estate_id, - region_id, - position, - true, - false, - keyword_alert_performed); - } - break; - - case IM_FROM_TASK_AS_ALERT: - if (is_do_not_disturb && !is_owned_by_me) - { - return; - } - { - // Construct a viewer alert for this message. - args["NAME"] = name; - args["MESSAGE"] = message; - LLNotificationsUtil::add("ObjectMessage", args); - } - break; - case IM_DO_NOT_DISTURB_AUTO_RESPONSE: - if (is_muted) - { - LL_DEBUGS("Messaging") << "Ignoring do-not-disturb response from " << from_id << LL_ENDL; - return; - } - else - { - // FIRE-12908: Add busy response indicator back to busy messages - //gIMMgr->addMessage(session_id, from_id, name, message); - buffer = llformat("(%s): %s", LLTrans::getString("BusyResponse").c_str(), message.c_str()); - gIMMgr->addMessage(session_id, from_id, name, buffer); - // - } - break; - - case IM_LURE_USER: - case IM_TELEPORT_REQUEST: + case IM_LURE_USER: + case IM_TELEPORT_REQUEST: { // [RLVa:KB] - Checked: RLVa-1.4.9 // If we auto-accept the offer/request then this will override DnD status (but we'll still let the other party know later) bool fRlvAutoAccept = (rlv_handler_t::isEnabled()) && ( ((IM_LURE_USER == dialog) && (RlvActions::autoAcceptTeleportOffer(from_id))) || - ((IM_TELEPORT_REQUEST == dialog) && (RlvActions::autoAcceptTeleportRequest(from_id))) ); + ((IM_TELEPORT_REQUEST == dialog) && (RlvActions::autoAcceptTeleportRequest(from_id))) ); // [/RLVa:KB] if (is_muted) @@ -1712,7 +1702,7 @@ void LLIMProcessing::processNewMessage(LLUUID from_id, // else { -// if (is_do_not_disturb) +// if (is_do_not_disturb) // [RLVa:KB] - Checked: RLVa-1.4.9 if ( (is_do_not_disturb) && (!fRlvAutoAccept) ) // [/RLVa:KB] @@ -1726,7 +1716,7 @@ void LLIMProcessing::processNewMessage(LLUUID from_id, std::string region_info = ll_safe_string((char*)binary_bucket, binary_bucket_size); std::string region_access_str = LLStringUtil::null; std::string region_access_icn = LLStringUtil::null; - std::string region_access_lc = LLStringUtil::null; + std::string region_access_lc = LLStringUtil::null; bool canUserAccessDstRegion = true; bool doesUserRequireMaturityIncrease = false; @@ -1736,39 +1726,39 @@ void LLIMProcessing::processNewMessage(LLUUID from_id, { region_access_str = LLViewerRegion::accessToString(region_access); region_access_icn = LLViewerRegion::getAccessIcon(region_access); - region_access_lc = region_access_str; + region_access_lc = region_access_str; LLStringUtil::toLower(region_access_lc); if (!gAgent.isGodlike()) { switch (region_access) { - case SIM_ACCESS_MIN : - case SIM_ACCESS_PG : - break; - case SIM_ACCESS_MATURE : - if (gAgent.isTeen()) - { - canUserAccessDstRegion = false; - } - else if (gAgent.prefersPG()) - { - doesUserRequireMaturityIncrease = true; - } - break; - case SIM_ACCESS_ADULT : - if (!gAgent.isAdult()) - { - canUserAccessDstRegion = false; - } - else if (!gAgent.prefersAdult()) - { - doesUserRequireMaturityIncrease = true; - } - break; - default : - llassert(0); - break; + case SIM_ACCESS_MIN: + case SIM_ACCESS_PG: + break; + case SIM_ACCESS_MATURE: + if (gAgent.isTeen()) + { + canUserAccessDstRegion = false; + } + else if (gAgent.prefersPG()) + { + doesUserRequireMaturityIncrease = true; + } + break; + case SIM_ACCESS_ADULT: + if (!gAgent.isAdult()) + { + canUserAccessDstRegion = false; + } + else if (!gAgent.prefersAdult()) + { + doesUserRequireMaturityIncrease = true; + } + break; + default: + llassert(0); + break; } } } @@ -1777,7 +1767,7 @@ void LLIMProcessing::processNewMessage(LLUUID from_id, if (rlv_handler_t::isEnabled()) { if ( ((IM_LURE_USER == dialog) && (!RlvActions::canAcceptTpOffer(from_id))) || - ((IM_TELEPORT_REQUEST == dialog) && (!RlvActions::canAcceptTpRequest(from_id))) ) + ((IM_TELEPORT_REQUEST == dialog) && (!RlvActions::canAcceptTpRequest(from_id))) ) { RlvUtil::sendBusyMessage(from_id, RlvStrings::getString(RLV_STRING_BLOCKED_TPLUREREQ_REMOTE)); if (is_do_not_disturb) @@ -1787,7 +1777,7 @@ void LLIMProcessing::processNewMessage(LLUUID from_id, // Censor message if: 1) restricted from receiving IMs from the sender, or 2) teleport offer/request and @showloc=n restricted if ( (!RlvActions::canReceiveIM(from_id)) || - ((gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) && (IM_LURE_USER == dialog || IM_TELEPORT_REQUEST == dialog)) ) + ((gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) && (IM_LURE_USER == dialog || IM_TELEPORT_REQUEST == dialog)) ) { message = RlvStrings::getString(RLV_STRING_HIDDEN); } @@ -1825,7 +1815,7 @@ void LLIMProcessing::processNewMessage(LLUUID from_id, LLNotification::Params params("TeleportOffered_MaturityBlocked"); params.substitutions = args; params.payload = payload; - LLPostponedNotification::add( params, from_id, false); + LLPostponedNotification::add(params, from_id, false); send_simple_im(from_id, LLTrans::getString("TeleportMaturityExceeded"), IM_NOTHING_SPECIAL, session_id); send_simple_im(from_id, LLStringUtil::null, IM_LURE_DECLINED, session_id); } @@ -1834,7 +1824,7 @@ void LLIMProcessing::processNewMessage(LLUUID from_id, LLNotification::Params params("TeleportOffered_MaturityExceeded"); params.substitutions = args; params.payload = payload; - LLPostponedNotification::add( params, from_id, false); + LLPostponedNotification::add(params, from_id, false); } else { @@ -1867,13 +1857,13 @@ void LLIMProcessing::processNewMessage(LLUUID from_id, LLPostponedNotification::add(params, from_id, false); } // [/RLVa:KB] -// LLPostponedNotification::add(params, from_id, false); +// LLPostponedNotification::add(params, from_id, false); } } } break; - case IM_GODLIKE_LURE_USER: + case IM_GODLIKE_LURE_USER: { LLVector3 pos, look_at; U64 region_handle(0); @@ -1881,7 +1871,7 @@ void LLIMProcessing::processNewMessage(LLUUID from_id, std::string region_info = ll_safe_string((char*)binary_bucket, binary_bucket_size); std::string region_access_str = LLStringUtil::null; std::string region_access_icn = LLStringUtil::null; - std::string region_access_lc = LLStringUtil::null; + std::string region_access_lc = LLStringUtil::null; bool canUserAccessDstRegion = true; bool doesUserRequireMaturityIncrease = false; @@ -1890,39 +1880,39 @@ void LLIMProcessing::processNewMessage(LLUUID from_id, { region_access_str = LLViewerRegion::accessToString(region_access); region_access_icn = LLViewerRegion::getAccessIcon(region_access); - region_access_lc = region_access_str; + region_access_lc = region_access_str; LLStringUtil::toLower(region_access_lc); if (!gAgent.isGodlike()) { switch (region_access) { - case SIM_ACCESS_MIN : - case SIM_ACCESS_PG : - break; - case SIM_ACCESS_MATURE : - if (gAgent.isTeen()) - { - canUserAccessDstRegion = false; - } - else if (gAgent.prefersPG()) - { - doesUserRequireMaturityIncrease = true; - } - break; - case SIM_ACCESS_ADULT : - if (!gAgent.isAdult()) - { - canUserAccessDstRegion = false; - } - else if (!gAgent.prefersAdult()) - { - doesUserRequireMaturityIncrease = true; - } - break; - default : - llassert(0); - break; + case SIM_ACCESS_MIN: + case SIM_ACCESS_PG: + break; + case SIM_ACCESS_MATURE: + if (gAgent.isTeen()) + { + canUserAccessDstRegion = false; + } + else if (gAgent.prefersPG()) + { + doesUserRequireMaturityIncrease = true; + } + break; + case SIM_ACCESS_ADULT: + if (!gAgent.isAdult()) + { + canUserAccessDstRegion = false; + } + else if (!gAgent.prefersAdult()) + { + doesUserRequireMaturityIncrease = true; + } + break; + default: + llassert(0); + break; } } } @@ -1945,7 +1935,7 @@ void LLIMProcessing::processNewMessage(LLUUID from_id, LLNotification::Params params("TeleportOffered_MaturityBlocked"); params.substitutions = args; params.payload = payload; - LLPostponedNotification::add( params, from_id, false); + LLPostponedNotification::add(params, from_id, false); send_simple_im(from_id, LLTrans::getString("TeleportMaturityExceeded"), IM_NOTHING_SPECIAL, session_id); send_simple_im(from_id, LLStringUtil::null, IM_LURE_DECLINED, session_id); } @@ -1954,18 +1944,18 @@ void LLIMProcessing::processNewMessage(LLUUID from_id, LLNotification::Params params("TeleportOffered_MaturityExceeded"); params.substitutions = args; params.payload = payload; - LLPostponedNotification::add( params, from_id, false); + LLPostponedNotification::add(params, from_id, false); } else { - // do not show a message box, because you're about to be - // teleported. - LLNotifications::instance().forceResponse(LLNotification::Params("TeleportOffered").payload(payload), 0); - } + // do not show a message box, because you're about to be + // teleported. + LLNotifications::instance().forceResponse(LLNotification::Params("TeleportOffered").payload(payload), 0); + } } break; - case IM_GOTO_URL: + case IM_GOTO_URL: { LLSD args; // n.b. this is for URLs sent by the system, not for @@ -1985,11 +1975,11 @@ void LLIMProcessing::processNewMessage(LLUUID from_id, args["URL"] = url; LLSD payload; payload["url"] = url; - LLNotificationsUtil::add("GotoURL", args, payload ); + LLNotificationsUtil::add("GotoURL", args, payload); } break; - case IM_FRIENDSHIP_OFFERED: + case IM_FRIENDSHIP_OFFERED: { // FIRE-15233: Automatic friendship request refusal @@ -2036,37 +2026,37 @@ void LLIMProcessing::processNewMessage(LLUUID from_id, if (add_notification) { - if(message.empty()) - { - //support for frienship offers from clients before July 2008 + if (message.empty()) + { + //support for frienship offers from clients before July 2008 LLNotificationsUtil::add("OfferFriendshipNoMessage", args, payload); make_ui_sound("UISndFriendshipOffer"); // Friendship offer sound - } - else - { - args["[MESSAGE]"] = message; - LLNotification::Params params("OfferFriendship"); - params.substitutions = args; - params.payload = payload; - LLPostponedNotification::add( params, from_id, false); - make_ui_sound("UISndFriendshipOffer"); // Friendship offer sound + } + else + { + args["[MESSAGE]"] = message; + LLNotification::Params params("OfferFriendship"); + params.substitutions = args; + params.payload = payload; + LLPostponedNotification::add(params, from_id, false); + make_ui_sound("UISndFriendshipOffer"); // Friendship offer sound + } } } } - } break; - case IM_FRIENDSHIP_ACCEPTED: + case IM_FRIENDSHIP_ACCEPTED: { // In the case of an offline IM, the formFriendship() may be extraneous // as the database should already include the relationship. But it // doesn't hurt for dupes. LLAvatarTracker::formFriendship(from_id); - + std::vector strings; strings.push_back(from_id.asString()); send_generic_message("requestonlinenotification", strings); - + args["NAME"] = name; LLSD payload; payload["from_id"] = from_id; @@ -2074,11 +2064,11 @@ void LLIMProcessing::processNewMessage(LLUUID from_id, } break; - case IM_FRIENDSHIP_DECLINED_DEPRECATED: - default: - LL_WARNS("Messaging") << "Instant message calling for unknown dialog " + case IM_FRIENDSHIP_DECLINED_DEPRECATED: + default: + LL_WARNS("Messaging") << "Instant message calling for unknown dialog " << (S32)dialog << LL_ENDL; - break; + break; } LLWindow* viewer_window = gViewerWindow->getWindow();