diff --git a/indra/llmessage/llinstantmessage.cpp b/indra/llmessage/llinstantmessage.cpp index 794ce3adbd..b71db52720 100644 --- a/indra/llmessage/llinstantmessage.cpp +++ b/indra/llmessage/llinstantmessage.cpp @@ -54,98 +54,6 @@ const std::string INTERACTIVE_SYSTEM_FROM("F387446C-37C4-45f2-A438-D99CBDBB563B" const S32 IM_TTL = 1; -/** - * LLIMInfo - */ -LLIMInfo::LLIMInfo() : - mFromGroup(FALSE), - mParentEstateID(0), - mOffline(0), - mViewerThinksToIsOnline(false), - mIMType(IM_NOTHING_SPECIAL), - mTimeStamp(0), - mTTL(IM_TTL) -{ -} - -LLIMInfo::LLIMInfo( - const LLUUID& from_id, - BOOL from_group, - const LLUUID& to_id, - EInstantMessage im_type, - const std::string& name, - const std::string& message, - const LLUUID& id, - U32 parent_estate_id, - const LLUUID& region_id, - const LLVector3& position, - LLSD data, - U8 offline, - U32 timestamp, - S32 ttl) : - mFromID(from_id), - mFromGroup(from_group), - mToID(to_id), - mParentEstateID(0), - mRegionID(region_id), - mPosition(position), - mOffline(offline), - mViewerThinksToIsOnline(false), - mIMType(im_type), - mID(id), - mTimeStamp(timestamp), - mName(name), - mMessage(message), - mData(data), - mTTL(ttl) -{ -} - -LLIMInfo::LLIMInfo(LLMessageSystem* msg, S32 ttl) : - mViewerThinksToIsOnline(false), - mTTL(ttl) -{ - unpackMessageBlock(msg); -} - -LLIMInfo::~LLIMInfo() -{ -} - -void LLIMInfo::packInstantMessage(LLMessageSystem* msg) const -{ - LL_DEBUGS() << "LLIMInfo::packInstantMessage()" << LL_ENDL; - msg->newMessageFast(_PREHASH_ImprovedInstantMessage); - packMessageBlock(msg); -} - -void LLIMInfo::packMessageBlock(LLMessageSystem* msg) const -{ - // Construct binary bucket - std::vector bucket; - if (mData.has("binary_bucket")) - { - bucket = mData["binary_bucket"].asBinary(); - } - pack_instant_message_block( - msg, - mFromID, - mFromGroup, - LLUUID::null, - mToID, - mName, - mMessage, - mOffline, - mIMType, - mID, - mParentEstateID, - mRegionID, - mPosition, - mTimeStamp, - &bucket[0], - bucket.size()); -} - void pack_instant_message( LLMessageSystem* msg, const LLUUID& from_id, @@ -256,120 +164,4 @@ void pack_instant_message_block( msg->addBinaryDataFast(_PREHASH_BinaryBucket, bb, binary_bucket_size); } -void LLIMInfo::unpackMessageBlock(LLMessageSystem* msg) -{ - msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, mFromID); - msg->getBOOLFast(_PREHASH_MessageBlock, _PREHASH_FromGroup, mFromGroup); - msg->getUUIDFast(_PREHASH_MessageBlock, _PREHASH_ToAgentID, mToID); - msg->getU32Fast(_PREHASH_MessageBlock, _PREHASH_ParentEstateID, mParentEstateID); - msg->getUUIDFast(_PREHASH_MessageBlock, _PREHASH_RegionID, mRegionID); - msg->getVector3Fast(_PREHASH_MessageBlock, _PREHASH_Position, mPosition); - msg->getU8Fast(_PREHASH_MessageBlock, _PREHASH_Offline, mOffline); - U8 dialog; - msg->getU8Fast(_PREHASH_MessageBlock, _PREHASH_Dialog, dialog); - mIMType = (EInstantMessage) dialog; - msg->getUUIDFast(_PREHASH_MessageBlock, _PREHASH_ID, mID); - msg->getU32Fast(_PREHASH_MessageBlock, _PREHASH_Timestamp, mTimeStamp); - msg->getStringFast(_PREHASH_MessageBlock, _PREHASH_FromAgentName, mName); - - msg->getStringFast(_PREHASH_MessageBlock, _PREHASH_Message, mMessage); - - S32 binary_bucket_size = llmin( - MTUBYTES, - msg->getSizeFast( - _PREHASH_MessageBlock, - _PREHASH_BinaryBucket)); - if(binary_bucket_size > 0) - { - std::vector bucket; - bucket.resize(binary_bucket_size); - - msg->getBinaryDataFast( - _PREHASH_MessageBlock, - _PREHASH_BinaryBucket, - &bucket[0], - 0, - 0, - binary_bucket_size); - mData["binary_bucket"] = bucket; - } - else - { - mData.clear(); - } -} - -LLSD im_info_to_llsd(LLPointer im_info) -{ - LLSD param_version; - param_version["version"] = 1; - LLSD param_message; - param_message["from_id"] = im_info->mFromID; - param_message["from_group"] = im_info->mFromGroup; - param_message["to_id"] = im_info->mToID; - param_message["from_name"] = im_info->mName; - param_message["message"] = im_info->mMessage; - param_message["type"] = (S32)im_info->mIMType; - param_message["id"] = im_info->mID; - param_message["timestamp"] = (S32)im_info->mTimeStamp; - param_message["offline"] = (S32)im_info->mOffline; - param_message["parent_estate_id"] = (S32)im_info->mParentEstateID; - param_message["region_id"] = im_info->mRegionID; - param_message["position"] = ll_sd_from_vector3(im_info->mPosition); - param_message["data"] = im_info->mData; - param_message["ttl"] = im_info->mTTL; - - LLSD param_agent; - param_agent["agent_id"] = im_info->mFromID; - - LLSD params; - params["version_params"] = param_version; - params["message_params"] = param_message; - params["agent_params"] = param_agent; - - return params; -} - -LLPointer llsd_to_im_info(const LLSD& im_info_sd) -{ - LLSD param_message = im_info_sd["message_params"]; - LLSD param_agent = im_info_sd["agent_params"]; - - LLPointer im_info = new LLIMInfo( - param_message["from_id"].asUUID(), - param_message["from_group"].asBoolean(), - param_message["to_id"].asUUID(), - (EInstantMessage) param_message["type"].asInteger(), - param_message["from_name"].asString(), - param_message["message"].asString(), - param_message["id"].asUUID(), - (U32) param_message["parent_estate_id"].asInteger(), - param_message["region_id"].asUUID(), - ll_vector3_from_sd(param_message["position"]), - param_message["data"], - (U8) param_message["offline"].asInteger(), - (U32) param_message["timestamp"].asInteger(), - param_message["ttl"].asInteger()); - - return im_info; -} - -LLPointer LLIMInfo::clone() -{ - return new LLIMInfo( - mFromID, - mFromGroup, - mToID, - mIMType, - mName, - mMessage, - mID, - mParentEstateID, - mRegionID, - mPosition, - mData, - mOffline, - mTimeStamp, - mTTL); -} diff --git a/indra/llmessage/llinstantmessage.h b/indra/llmessage/llinstantmessage.h index 87f6c32d0f..b6a49580b6 100644 --- a/indra/llmessage/llinstantmessage.h +++ b/indra/llmessage/llinstantmessage.h @@ -180,59 +180,6 @@ extern const std::string INTERACTIVE_SYSTEM_FROM; // Number of retry attempts on sending the im. extern const S32 IM_TTL; - -class LLIMInfo : public LLRefCount -{ -protected: - LLIMInfo(); - ~LLIMInfo(); - -public: - LLIMInfo(LLMessageSystem* msg, - S32 ttl = IM_TTL); - - LLIMInfo( - const LLUUID& from_id, - BOOL from_group, - const LLUUID& to_id, - EInstantMessage im_type, - const std::string& name, - const std::string& message, - const LLUUID& id, - U32 parent_estate_id, - const LLUUID& region_id, - const LLVector3& position, - LLSD data, - U8 offline, - U32 timestamp, - S32 ttl = IM_TTL); - - void packInstantMessage(LLMessageSystem* msg) const; - void packMessageBlock(LLMessageSystem* msg) const; - void unpackMessageBlock(LLMessageSystem* msg); - LLPointer clone(); -public: - LLUUID mFromID; - BOOL mFromGroup; - LLUUID mToID; - U32 mParentEstateID; - LLUUID mRegionID; - LLVector3 mPosition; - U8 mOffline; - bool mViewerThinksToIsOnline; - EInstantMessage mIMType; - LLUUID mID; - U32 mTimeStamp; - std::string mName; - std::string mMessage; - LLSD mData; - - S32 mTTL; -}; - -LLPointer llsd_to_im_info(const LLSD& im_info_sd); -LLSD im_info_to_llsd(LLPointer im_info); - void pack_instant_message( LLMessageSystem* msgsystem, const LLUUID& from_id, diff --git a/indra/newview/fsfloaterim.cpp b/indra/newview/fsfloaterim.cpp index f70c364791..b2bb4f22b1 100644 --- a/indra/newview/fsfloaterim.cpp +++ b/indra/newview/fsfloaterim.cpp @@ -1555,18 +1555,18 @@ void FSFloaterIM::setTyping(bool typing) } -void FSFloaterIM::processIMTyping(const LLIMInfo* im_info, BOOL typing) +void FSFloaterIM::processIMTyping(const LLUUID& from_id, BOOL typing) { if ( typing ) { // other user started typing - addTypingIndicator(im_info); + addTypingIndicator(from_id); mOtherTypingTimer.reset(); } else { // other user stopped typing - removeTypingIndicator(im_info); + removeTypingIndicator(from_id); } } @@ -1943,10 +1943,10 @@ BOOL FSFloaterIM::inviteToSession(const uuid_vec_t& ids) return is_region_exist; } -void FSFloaterIM::addTypingIndicator(const LLIMInfo* im_info) +void FSFloaterIM::addTypingIndicator(const LLUUID& from_id) { // We may have lost a "stop-typing" packet, don't add it twice - if ( im_info && !mOtherTyping ) + if (from_id.notNull() && !mOtherTyping) { mOtherTyping = true; @@ -1958,12 +1958,12 @@ void FSFloaterIM::addTypingIndicator(const LLIMInfo* im_info) LLIMSpeakerMgr* speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(mSessionID); if ( speaker_mgr ) { - speaker_mgr->setSpeakerTyping(im_info->mFromID, TRUE); + speaker_mgr->setSpeakerTyping(from_id, TRUE); } } } -void FSFloaterIM::removeTypingIndicator(const LLIMInfo* im_info) +void FSFloaterIM::removeTypingIndicator(const LLUUID& from_id) { if ( mOtherTyping ) { @@ -1972,13 +1972,13 @@ void FSFloaterIM::removeTypingIndicator(const LLIMInfo* im_info) // Revert the title to saved one setTitle(mSavedTitle); - if ( im_info ) + if (from_id.notNull()) { // Update speaker LLIMSpeakerMgr* speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(mSessionID); if ( speaker_mgr ) { - speaker_mgr->setSpeakerTyping(im_info->mFromID, FALSE); + speaker_mgr->setSpeakerTyping(from_id, FALSE); } } // Ansariel: Transplant of STORM-1975; Typing notifications are only sent in P2P sessions, diff --git a/indra/newview/fsfloaterim.h b/indra/newview/fsfloaterim.h index cfe6a9ffcc..9fd23e8bf3 100644 --- a/indra/newview/fsfloaterim.h +++ b/indra/newview/fsfloaterim.h @@ -111,7 +111,7 @@ public: BOOL focusFirstItem(BOOL prefer_text_fields = FALSE, BOOL focus_flash = TRUE ); void onVisibilityChange(BOOL new_visibility); - void processIMTyping(const LLIMInfo* im_info, BOOL typing); + void processIMTyping(const LLUUID& from_id, BOOL typing); void processAgentListUpdates(const LLSD& body); void processSessionUpdate(const LLSD& session_update); @@ -212,10 +212,10 @@ private: static void* createPanelAdHocControl(void* userdata); // Add the "User is typing..." indicator. - void addTypingIndicator(const LLIMInfo* im_info); + void addTypingIndicator(const LLUUID& from_id); // Remove the "User is typing..." indicator. - void removeTypingIndicator(const LLIMInfo* im_info = NULL); + void removeTypingIndicator(const LLUUID& from_id = LLUUID::null); static void closeHiddenIMToasts(); diff --git a/indra/newview/llfloaterimsession.cpp b/indra/newview/llfloaterimsession.cpp index 540a1cb9c9..1d1c57489f 100644 --- a/indra/newview/llfloaterimsession.cpp +++ b/indra/newview/llfloaterimsession.cpp @@ -87,8 +87,7 @@ LLFloaterIMSession::LLFloaterIMSession(const LLUUID& session_id) mPositioned(false), mSessionInitialized(false), mMeTypingTimer(), - mOtherTypingTimer(), - mImInfo() + mOtherTypingTimer() { mIsNearbyChat = false; @@ -130,7 +129,7 @@ void LLFloaterIMSession::refresh() if (mOtherTyping && mOtherTypingTimer.getElapsedTimeF32() > OTHER_TYPING_TIMEOUT) { LL_DEBUGS("TypingMsgs") << "Received: is typing cleared due to timeout" << LL_ENDL; - removeTypingIndicator(mImInfo); + removeTypingIndicator(mImFromId); mOtherTyping = false; } @@ -1064,19 +1063,19 @@ void LLFloaterIMSession::setTyping(bool typing) } } -void LLFloaterIMSession::processIMTyping(const LLIMInfo* im_info, BOOL typing) +void LLFloaterIMSession::processIMTyping(const LLUUID& from_id, BOOL typing) { LL_DEBUGS("TypingMsgs") << "typing=" << typing << LL_ENDL; if ( typing ) { // other user started typing - addTypingIndicator(im_info); + addTypingIndicator(from_id); mOtherTypingTimer.reset(); } else { // other user stopped typing - removeTypingIndicator(im_info); + removeTypingIndicator(from_id); } } @@ -1276,7 +1275,7 @@ BOOL LLFloaterIMSession::inviteToSession(const uuid_vec_t& ids) return is_region_exist; } -void LLFloaterIMSession::addTypingIndicator(const LLIMInfo* im_info) +void LLFloaterIMSession::addTypingIndicator(const LLUUID& from_id) { /* Operation of " is typing" state machine: Not Typing state: @@ -1306,35 +1305,35 @@ Note: OTHER_TYPING_TIMEOUT must be > ME_TYPING_TIMEOUT for proper operation of t */ // We may have lost a "stop-typing" packet, don't add it twice - if (im_info && !mOtherTyping) + if (from_id.notNull() && !mOtherTyping) { mOtherTyping = true; mOtherTypingTimer.reset(); // Save im_info so that removeTypingIndicator can be properly called because a timeout has occurred - mImInfo = im_info; + mImFromId = from_id; // Update speaker LLIMSpeakerMgr* speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(mSessionID); if ( speaker_mgr ) { - speaker_mgr->setSpeakerTyping(im_info->mFromID, TRUE); + speaker_mgr->setSpeakerTyping(from_id, TRUE); } } } -void LLFloaterIMSession::removeTypingIndicator(const LLIMInfo* im_info) +void LLFloaterIMSession::removeTypingIndicator(const LLUUID& from_id) { if (mOtherTyping) { mOtherTyping = false; - if (im_info) + if (from_id.notNull()) { // Update speaker LLIMSpeakerMgr* speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(mSessionID); if (speaker_mgr) { - speaker_mgr->setSpeakerTyping(im_info->mFromID, FALSE); + speaker_mgr->setSpeakerTyping(from_id, FALSE); } } } diff --git a/indra/newview/llfloaterimsession.h b/indra/newview/llfloaterimsession.h index 4672d6547d..a649653f73 100644 --- a/indra/newview/llfloaterimsession.h +++ b/indra/newview/llfloaterimsession.h @@ -124,7 +124,7 @@ public: const LLVoiceChannel::EState& old_state, const LLVoiceChannel::EState& new_state); - void processIMTyping(const LLIMInfo* im_info, BOOL typing); + void processIMTyping(const LLUUID& from_id, BOOL typing); void processAgentListUpdates(const LLSD& body); void processSessionUpdate(const LLSD& session_update); @@ -167,10 +167,10 @@ private: void boundVoiceChannel(); // Add the "User is typing..." indicator. - void addTypingIndicator(const LLIMInfo* im_info); + void addTypingIndicator(const LLUUID& from_id); // Remove the "User is typing..." indicator. - void removeTypingIndicator(const LLIMInfo* im_info = NULL); + void removeTypingIndicator(const LLUUID& from_id = LLUUID::null); static void closeHiddenIMToasts(); @@ -201,7 +201,7 @@ private: // connection to voice channel state change signal boost::signals2::connection mVoiceChannelStateChangeConnection; - const LLIMInfo* mImInfo; + LLUUID mImFromId; }; #endif // LL_FLOATERIMSESSION_H diff --git a/indra/newview/llimprocessing.cpp b/indra/newview/llimprocessing.cpp index 8305d24000..865cfa3a96 100644 --- a/indra/newview/llimprocessing.cpp +++ b/indra/newview/llimprocessing.cpp @@ -1036,45 +1036,13 @@ void LLIMProcessing::processNewMessage(LLUUID from_id, case IM_TYPING_START: { - std::vector bucket(binary_bucket[0], binary_bucket_size); - LLSD data; - data["binary_bucket"] = bucket; - LLPointer im_info = new LLIMInfo(from_id, - from_group, - to_id, - dialog, - agentName, - message, - session_id, - parent_estate_id, - region_id, - position, - data, - offline, - timestamp); - gIMMgr->processIMTypingStart(im_info); + gIMMgr->processIMTypingStart(from_id, dialog); } break; case IM_TYPING_STOP: { - std::vector bucket(binary_bucket[0], binary_bucket_size); - LLSD data; - data["binary_bucket"] = bucket; - LLPointer im_info = new LLIMInfo(from_id, - from_group, - to_id, - dialog, - agentName, - message, - session_id, - parent_estate_id, - region_id, - position, - data, - offline, - timestamp); - gIMMgr->processIMTypingStop(im_info); + gIMMgr->processIMTypingStop(from_id, dialog); } break; diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index 1125e8bb07..88550c0150 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -3981,147 +3981,151 @@ void LLIMMgr::noteMutedUsers(const LLUUID& session_id, } } -void LLIMMgr::processIMTypingStart(const LLIMInfo* im_info) +void LLIMMgr::processIMTypingStart(const LLUUID& from_id, const EInstantMessage im_type) { - processIMTypingCore(im_info, TRUE); + processIMTypingCore(from_id, im_type, TRUE); } -void LLIMMgr::processIMTypingStop(const LLIMInfo* im_info) +void LLIMMgr::processIMTypingStop(const LLUUID& from_id, const EInstantMessage im_type) { - processIMTypingCore(im_info, FALSE); + processIMTypingCore(from_id, im_type, FALSE); } -void LLIMMgr::processIMTypingCore(const LLIMInfo* im_info, BOOL typing) +// Announce incoming IMs +void typingNameCallback(const LLUUID& av_id, const LLAvatarName& av_name, const LLUUID& session_id) { - LLUUID session_id = computeSessionID(im_info->mIMType, im_info->mFromID); + LLStringUtil::format_map_t args; + args["[NAME]"] = av_name.getCompleteName(); + + BOOL is_muted = LLMuteList::getInstance()->isMuted(av_id, av_name.getCompleteName(), LLMute::flagTextChat); + bool is_friend = (LLAvatarTracker::instance().getBuddyInfo(av_id) == NULL) ? false : true; + static LLCachedControl VoiceCallsFriendsOnly(gSavedSettings, "VoiceCallsFriendsOnly"); + + if (!is_muted && ( (VoiceCallsFriendsOnly && is_friend) || !VoiceCallsFriendsOnly )) + { + gIMMgr->addMessage( + session_id, + av_id, + SYSTEM_FROM, // Use system name instead of NULL Growl notifier acts funny with NULL here. + LLTrans::getString("IM_announce_incoming", args), + false, + LLStringUtil::null, + IM_NOTHING_SPECIAL, + 0, + LLUUID::null, + LLVector3::zero, + false, + true + ); + } + + // Send busy and auto-response messages now or they won't be send + // later because a session has already been created by showing the + // incoming IM announcement. + // The logic was originally copied from process_improved_im() in llviewermessage.cpp + bool is_busy = gAgent.isDoNotDisturb(); + BOOL is_autorespond = gAgent.getAutorespond(); + BOOL is_autorespond_nonfriends = gAgent.getAutorespondNonFriends(); + BOOL is_autorespond_muted = gSavedPerAccountSettings.getBOOL("FSSendMutedAvatarResponse"); + BOOL is_linden = LLMuteList::getInstance()->isLinden(av_name.getAccountName()); + static LLCachedControl FSSendAwayAvatarResponse(gSavedPerAccountSettings, "FSSendAwayAvatarResponse"); + BOOL is_afk = gAgent.getAFK(); + + if (RlvActions::canReceiveIM(av_id) && !is_linden && + (!VoiceCallsFriendsOnly || is_friend) && + ((is_busy && (!is_muted || (is_muted && !is_autorespond_muted))) || + (is_autorespond && !is_muted) || (is_autorespond_nonfriends && !is_friend && !is_muted) || (FSSendAwayAvatarResponse && is_afk && !is_muted)) ) + { + std::string my_name; + std::string response; + LLAgentUI::buildFullname(my_name); + if (is_busy) + { + response = gSavedPerAccountSettings.getString("DoNotDisturbModeResponse"); + } + else if (is_autorespond_nonfriends && !is_friend) + { + response = gSavedPerAccountSettings.getString("FSAutorespondNonFriendsResponse"); + } + else if (is_autorespond) + { + response = gSavedPerAccountSettings.getString("FSAutorespondModeResponse"); + } + 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(), + av_id, + my_name, + response, + IM_ONLINE, + IM_DO_NOT_DISTURB_AUTO_RESPONSE, + session_id); + gAgent.sendReliableMessage(); + + 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, + LLStringUtil::null, + IM_NOTHING_SPECIAL, + 0, + LLUUID::null, + LLVector3::zero, + 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, + LLStringUtil::null, + IM_NOTHING_SPECIAL, + 0, + LLUUID::null, + LLVector3::zero, + false, + true); + LLGiveInventory::doGiveInventoryItem(av_id, item, session_id); + } + } + } +} +// + +void LLIMMgr::processIMTypingCore(const LLUUID& from_id, const EInstantMessage im_type, BOOL typing) +{ + LLUUID session_id = computeSessionID(im_type, from_id); // Announce incoming IMs static LLCachedControl announceIncomingIM(gSavedSettings, "FSAnnounceIncomingIM"); if (typing && !gIMMgr->hasSession(session_id) && announceIncomingIM) { - LLStringUtil::format_map_t args; - args["[NAME]"] = im_info->mName; - - BOOL is_muted = LLMuteList::getInstance()->isMuted(im_info->mFromID, im_info->mName, LLMute::flagTextChat); - bool is_friend = (LLAvatarTracker::instance().getBuddyInfo(im_info->mFromID) == NULL) ? false : true; - static LLCachedControl VoiceCallsFriendsOnly(gSavedSettings, "VoiceCallsFriendsOnly"); - - if(!is_muted && ( (VoiceCallsFriendsOnly && is_friend) || !VoiceCallsFriendsOnly )) - { - gIMMgr->addMessage( - session_id, - im_info->mFromID, - // FIRE-8601: Use system name instead of NULL - // Growl notifier acts funny with NULL here. - SYSTEM_FROM, - LLTrans::getString("IM_announce_incoming", args), - false, - im_info->mName, - IM_NOTHING_SPECIAL, - im_info->mParentEstateID, - im_info->mRegionID, - im_info->mPosition, - false, - true - ); - } - - // Send busy and auto-response messages now or they won't be send - // later because a session has already been created by showing the - // incoming IM announcement. - // The logic was originally copied from process_improved_im() in llviewermessage.cpp - BOOL is_busy = gAgent.isDoNotDisturb(); - BOOL is_autorespond = gAgent.getAutorespond(); - BOOL is_autorespond_nonfriends = gAgent.getAutorespondNonFriends(); - BOOL is_autorespond_muted = gSavedPerAccountSettings.getBOOL("FSSendMutedAvatarResponse"); - BOOL is_linden = LLMuteList::getInstance()->isLinden(im_info->mName); - static LLCachedControl FSSendAwayAvatarResponse(gSavedPerAccountSettings, "FSSendAwayAvatarResponse"); - BOOL is_afk = gAgent.getAFK(); - - if (RlvActions::canReceiveIM(im_info->mFromID) && !is_linden && - (!VoiceCallsFriendsOnly || is_friend) && - ((is_busy && (!is_muted || (is_muted && !is_autorespond_muted))) || - (is_autorespond && !is_muted) || (is_autorespond_nonfriends && !is_friend && !is_muted) || (FSSendAwayAvatarResponse && is_afk && !is_muted)) ) - { - std::string my_name; - std::string response; - LLAgentUI::buildFullname(my_name); - if (is_busy) - { - response = gSavedPerAccountSettings.getString("DoNotDisturbModeResponse"); - } - else if (is_autorespond_nonfriends && !is_friend) - { - response = gSavedPerAccountSettings.getString("FSAutorespondNonFriendsResponse"); - } - else if (is_autorespond) - { - response = gSavedPerAccountSettings.getString("FSAutorespondModeResponse"); - } - 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(), - im_info->mFromID, - my_name, - response, - IM_ONLINE, - IM_DO_NOT_DISTURB_AUTO_RESPONSE, - session_id); - gAgent.sendReliableMessage(); - - 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, - im_info->mName, - IM_NOTHING_SPECIAL, - im_info->mParentEstateID, - im_info->mRegionID, - im_info->mPosition, - 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, - im_info->mName, - IM_NOTHING_SPECIAL, - im_info->mParentEstateID, - im_info->mRegionID, - im_info->mPosition, - false, - true); - LLGiveInventory::doGiveInventoryItem(im_info->mFromID, item, session_id); - } - } - // - } + LLAvatarNameCache::get(from_id, boost::bind(&typingNameCallback, _1, _2, session_id)); } // @@ -4132,7 +4136,7 @@ void LLIMMgr::processIMTypingCore(const LLIMInfo* im_info, BOOL typing) if ( im_floater ) { - im_floater->processIMTyping(im_info, typing); + im_floater->processIMTyping(from_id, typing); } } diff --git a/indra/newview/llimview.h b/indra/newview/llimview.h index f39e449333..6c0e09f851 100644 --- a/indra/newview/llimview.h +++ b/indra/newview/llimview.h @@ -433,8 +433,8 @@ public: const std::string& session_handle = LLStringUtil::null, const std::string& session_uri = LLStringUtil::null); - void processIMTypingStart(const LLIMInfo* im_info); - void processIMTypingStop(const LLIMInfo* im_info); + void processIMTypingStart(const LLUUID& from_id, const EInstantMessage im_type); + void processIMTypingStop(const LLUUID& from_id, const EInstantMessage im_type); // automatically start a call once the session has initialized void autoStartCallOnStartup(const LLUUID& session_id); @@ -519,7 +519,7 @@ private: void noteOfflineUsers(const LLUUID& session_id, const std::vector& ids); void noteMutedUsers(const LLUUID& session_id, const std::vector& ids); - void processIMTypingCore(const LLIMInfo* im_info, BOOL typing); + void processIMTypingCore(const LLUUID& from_id, const EInstantMessage im_type, BOOL typing); static void onInviteNameLookup(LLSD payload, const LLUUID& id, const LLAvatarName& name); diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp index 6897544dba..8bebcb058d 100644 --- a/indra/newview/llvoicevivox.cpp +++ b/indra/newview/llvoicevivox.cpp @@ -4139,13 +4139,13 @@ void LLVivoxVoiceClient::sessionNotificationEvent(std::string &sessionHandle, st { // Other end started typing // TODO: The proper way to add a typing notification seems to be LLIMMgr::processIMTypingStart(). - // It requires an LLIMInfo for the message, which we don't have here. + // It requires some info for the message, which we don't have here. } else if (!stricmp(notificationType.c_str(), "NotTyping")) { // Other end stopped typing // TODO: The proper way to remove a typing notification seems to be LLIMMgr::processIMTypingStop(). - // It requires an LLIMInfo for the message, which we don't have here. + // It requires some info for the message, which we don't have here. } else { diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index 0ca9d678f8..4fa89b08f6 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -12227,7 +12227,7 @@ An internal error prevented us from properly updating your viewer. The L$ balan name="LargePrimAgentIntersect" type="notify"> fail -Cannot create large prims that intersect other players. Please re-try when other players have moved. +Cannot create large prims that intersect other residents. Please re-try when other residents have moved. gString; typedef std::pair< std::string, int > count_string_t; std::map< count_string_t, std::string > gCountString; -std::string LLTrans::getString(const std::string &xml_desc, const LLStringUtil::format_map_t& args) +std::string LLTrans::getString(const std::string &xml_desc, const LLStringUtil::format_map_t& args, bool def_string) { std::string text = gString[xml_desc]; LLStringUtil::format(text, args); diff --git a/indra/newview/tests/llslurl_test.cpp b/indra/newview/tests/llslurl_test.cpp index a6883f6e37..5fd61c5a89 100644 --- a/indra/newview/tests/llslurl_test.cpp +++ b/indra/newview/tests/llslurl_test.cpp @@ -46,10 +46,10 @@ static const char * const TEST_FILENAME("llslurl_test.xml"); class LLTrans { public: - static std::string getString(const std::string &xml_desc, const LLStringUtil::format_map_t& args); + static std::string getString(const std::string &xml_desc, const LLStringUtil::format_map_t& args, bool def_string = false); }; -std::string LLTrans::getString(const std::string &xml_desc, const LLStringUtil::format_map_t& args) +std::string LLTrans::getString(const std::string &xml_desc, const LLStringUtil::format_map_t& args, bool def_string) { return std::string(); } diff --git a/indra/newview/tests/llviewernetwork_test.cpp b/indra/newview/tests/llviewernetwork_test.cpp index e68da14fe9..3dd327591e 100644 --- a/indra/newview/tests/llviewernetwork_test.cpp +++ b/indra/newview/tests/llviewernetwork_test.cpp @@ -45,10 +45,10 @@ static const char * const TEST_FILENAME("llviewernetwork_test.xml"); class LLTrans { public: - static std::string getString(const std::string &xml_desc, const LLStringUtil::format_map_t& args); + static std::string getString(const std::string &xml_desc, const LLStringUtil::format_map_t& args, bool def_string = false); }; -std::string LLTrans::getString(const std::string &xml_desc, const LLStringUtil::format_map_t& args) +std::string LLTrans::getString(const std::string &xml_desc, const LLStringUtil::format_map_t& args, bool def_string) { std::string grid_label = std::string(); if(xml_desc == "AgniGridLabel") diff --git a/indra/newview/tests/llworldmap_test.cpp b/indra/newview/tests/llworldmap_test.cpp index 84194adb5d..f1dd8acccf 100644 --- a/indra/newview/tests/llworldmap_test.cpp +++ b/indra/newview/tests/llworldmap_test.cpp @@ -66,7 +66,7 @@ void LLWorldMipmap::equalizeBoostLevels() { } LLPointer LLWorldMipmap::getObjectsTile(U32 grid_x, U32 grid_y, S32 level, bool load) { return NULL; } // Stub other stuff -std::string LLTrans::getString(const std::string &, const LLStringUtil::format_map_t& ) { return std::string("test_trans"); } +std::string LLTrans::getString(const std::string &, const LLStringUtil::format_map_t&, bool def_string) { return std::string("test_trans"); } void LLUIString::updateResult() const { } void LLUIString::setArg(const std::string& , const std::string& ) { } void LLUIString::assign(const std::string& ) { }