diff --git a/indra/llui/lltexteditor.h b/indra/llui/lltexteditor.h index 4eba4842b..1bac9702c 100644 --- a/indra/llui/lltexteditor.h +++ b/indra/llui/lltexteditor.h @@ -295,6 +295,7 @@ public: llwchar getWChar(S32 pos) const { return mWText[pos]; } LLWString getWSubString(S32 pos, S32 len) const { return mWText.substr(pos, len); } + const LLTextSegment* getLastSegment() const { return mSegments.empty() ? nullptr : mSegments.back(); } const LLTextSegment* getCurrentSegment() const { return getSegmentAtOffset(mCursorPos); } const LLTextSegment* getPreviousSegment() const; void getSelectedSegments(std::vector& segments) const; diff --git a/indra/newview/llimpanel.cpp b/indra/newview/llimpanel.cpp index 2739d7c74..b80225d3e 100644 --- a/indra/newview/llimpanel.cpp +++ b/indra/newview/llimpanel.cpp @@ -1227,7 +1227,7 @@ void deliver_message(const std::string& utf8_text, if((offline == IM_OFFLINE) && (LLVoiceClient::getInstance()->isOnlineSIP(other_participant_id))) { // User is online through the OOW connector, but not with a regular viewer. Try to send the message via SLVoice. - sent = LLVoiceClient::getInstance()->sendTextMessage(other_participant_id, utf8_text); +// sent = LLVoiceClient::getInstance()->sendTextMessage(other_participant_id, utf8_text); } if(!sent) diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index ac3dea484..6dba5b453 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -1097,31 +1097,39 @@ bool LLIMMgr::isNonFriendSessionNotified(const LLUUID& session_id) return mNotifiedNonFriendSessions.end() != mNotifiedNonFriendSessions.find(session_id); } +std::string LLIMMgr::getOfflineMessage(const LLUUID& id) +{ + std::string full_name; + if (LLAvatarNameCache::getNSName(id, full_name)) + { + LLUIString offline = LLTrans::getString("offline_message"); + offline.setArg("[NAME]", full_name); + return offline; + } + return LLStringUtil::null; +} + void LLIMMgr::noteOfflineUsers( LLFloaterIMPanel* floater, const std::vector& ids) { - S32 count = ids.size(); - if(count == 0) + if(ids.empty()) { const std::string& only_user = LLTrans::getString("only_user_message"); floater->addHistoryLine(only_user, gSavedSettings.getColor4("SystemChatColor")); } else { - const LLRelationship* info = NULL; + const LLRelationship* info = nullptr; LLAvatarTracker& at = LLAvatarTracker::instance(); - for(S32 i = 0; i < count; ++i) + for(const auto& id : ids) { - info = at.getBuddyInfo(ids.at(i)); - std::string full_name; - if (info - && !info->isOnline() - && LLAvatarNameCache::getNSName(ids.at(i), full_name)) + info = at.getBuddyInfo(id); + if (info && !info->isOnline()) { - LLUIString offline = LLTrans::getString("offline_message"); - offline.setArg("[NAME]", full_name); - floater->addHistoryLine(offline, gSavedSettings.getColor4("SystemChatColor")); + auto offline(getOfflineMessage(id)); + if (!offline.empty()) + floater->addHistoryLine(offline, gSavedSettings.getColor4("SystemChatColor")); } } } diff --git a/indra/newview/llimview.h b/indra/newview/llimview.h index b5a0f56e4..12aa856bd 100644 --- a/indra/newview/llimview.h +++ b/indra/newview/llimview.h @@ -188,6 +188,8 @@ public: bool isNonFriendSessionNotified(const LLUUID& session_id); + static std::string getOfflineMessage(const LLUUID& id); + private: // create a panel and update internal representation for // consistency. Returns the pointer, caller (the class instance