diff options
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llgiveinventory.cpp | 3 | ||||
-rw-r--r-- | indra/newview/llimview.cpp | 73 | ||||
-rw-r--r-- | indra/newview/llimview.h | 19 | ||||
-rw-r--r-- | indra/newview/llnotificationhandlerutil.cpp | 18 | ||||
-rw-r--r-- | indra/newview/llviewermessage.cpp | 3 |
5 files changed, 63 insertions, 53 deletions
diff --git a/indra/newview/llgiveinventory.cpp b/indra/newview/llgiveinventory.cpp index f990b9294d..30858871ec 100644 --- a/indra/newview/llgiveinventory.cpp +++ b/indra/newview/llgiveinventory.cpp @@ -311,6 +311,9 @@ void LLGiveInventory::logInventoryOffer(const LLUUID& to_agent, const LLUUID &im std::string full_name; if (gCacheName->getFullName(to_agent, full_name)) { + // Build a new format username or firstname_lastname for legacy names + // to use it for a history log filename. + full_name = LLCacheName::buildUsername(full_name); LLIMModel::instance().logToFile(full_name, LLTrans::getString("SECOND_LIFE"), im_session_id, LLTrans::getString("inventory_item_offered-im")); } } diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index ec3fe48151..a6563ae93e 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -195,7 +195,7 @@ LLIMModel::LLIMSession::LLIMSession(const LLUUID& session_id, const std::string& // set P2P type by default mSessionType = P2P_SESSION; - if (IM_NOTHING_SPECIAL == type || IM_SESSION_P2P_INVITE == type) + if (IM_NOTHING_SPECIAL == mType || IM_SESSION_P2P_INVITE == mType) { mVoiceChannel = new LLVoiceChannelP2P(session_id, name, other_participant_id); mOtherParticipantIsAvatar = LLVoiceClient::getInstance()->isParticipantAvatar(mSessionID); @@ -249,7 +249,7 @@ LLIMModel::LLIMSession::LLIMSession(const LLUUID& session_id, const std::string& new LLSessionTimeoutTimer(mSessionID, SESSION_INITIALIZATION_TIMEOUT); } - if (IM_NOTHING_SPECIAL == type) + if (IM_NOTHING_SPECIAL == mType) { mCallBackEnabled = LLVoiceClient::getInstance()->isSessionCallBackPossible(mSessionID); mTextIMPossible = LLVoiceClient::getInstance()->isSessionTextIMPossible(mSessionID); @@ -269,10 +269,10 @@ LLIMModel::LLIMSession::LLIMSession(const LLUUID& session_id, const std::string& // Localizing name of ad-hoc session. STORM-153 // Changing name should happen here- after the history file was created, so that // history files have consistent (English) names in different locales. - if (isAdHocSessionType() && IM_SESSION_INVITE == type) + if (isAdHocSessionType() && IM_SESSION_INVITE == mType) { - LLAvatarNameCache::get(mOtherParticipantID, - boost::bind(&LLIMModel::LLIMSession::onAdHocNameCache, + LLAvatarNameCache::get(mOtherParticipantID, + boost::bind(&LLIMModel::LLIMSession::onAdHocNameCache, this, _2)); } } @@ -553,23 +553,10 @@ bool LLIMModel::LLIMSession::isOtherParticipantAvaline() return !mOtherParticipantIsAvatar; } -void LLIMModel::LLIMSession::onAvatarNameCache(const LLUUID& avatar_id, const LLAvatarName& av_name) -{ - if (av_name.mUsername.empty()) - { - // display names is off, use mDisplayName which will be the legacy name - mHistoryFileName = LLCacheName::buildUsername(av_name.mDisplayName); - } - else - { - mHistoryFileName = av_name.mUsername; - } -} - void LLIMModel::LLIMSession::buildHistoryFileName() { mHistoryFileName = mName; - + //ad-hoc requires sophisticated chat history saving schemes if (isAdHoc()) { @@ -583,17 +570,35 @@ void LLIMModel::LLIMSession::buildHistoryFileName() { std::set<LLUUID> sorted_uuids(mInitialTargetIDs.begin(), mInitialTargetIDs.end()); mHistoryFileName = mName + " hash" + generateHash(sorted_uuids); - return; } - - //in case of incoming ad-hoc sessions - mHistoryFileName = mName + " " + LLLogChat::timestamp(true) + " " + mSessionID.asString().substr(0, 4); + else + { + //in case of incoming ad-hoc sessions + mHistoryFileName = mName + " " + LLLogChat::timestamp(true) + " " + mSessionID.asString().substr(0, 4); + } } - - // look up username to use as the log name - if (isP2P()) + else if (isP2P()) // look up username to use as the log name { - LLAvatarNameCache::get(mOtherParticipantID, boost::bind(&LLIMModel::LLIMSession::onAvatarNameCache, this, _1, _2)); + LLAvatarName av_name; + // For outgoing sessions we already have a cached name + // so no need for a callback in LLAvatarNameCache::get() + if (LLAvatarNameCache::get(mOtherParticipantID, &av_name)) + { + if (av_name.mUsername.empty()) + { + // Display names are off, use mDisplayName which will be the legacy name + mHistoryFileName = LLCacheName::buildUsername(av_name.mDisplayName); + } + else + { + mHistoryFileName = av_name.mUsername; + } + } + else + { + // Incoming P2P sessions include a name that we can use to build a history file name + mHistoryFileName = LLCacheName::buildUsername(mName); + } } } @@ -615,7 +620,6 @@ std::string LLIMModel::LLIMSession::generateHash(const std::set<LLUUID>& sorted_ return participants_md5_hash.asString(); } - void LLIMModel::processSessionInitializedReply(const LLUUID& old_session_id, const LLUUID& new_session_id) { LLIMSession* session = findIMSession(old_session_id); @@ -798,11 +802,6 @@ bool LLIMModel::logToFile(const std::string& file_name, const std::string& from, } } -bool LLIMModel::logToFile(const LLUUID& session_id, const std::string& from, const LLUUID& from_id, const std::string& utf8_text) -{ - return logToFile(LLIMModel::getInstance()->getHistoryFileName(session_id), from, from_id, utf8_text); -} - bool LLIMModel::proccessOnlineOfflineNotification( const LLUUID& session_id, const std::string& utf8_text) @@ -856,8 +855,11 @@ LLIMModel::LLIMSession* LLIMModel::addMessageSilently(const LLUUID& session_id, } addToHistory(session_id, from_name, from_id, utf8_text); - if (log2file) logToFile(session_id, from_name, from_id, utf8_text); - + if (log2file) + { + logToFile(getHistoryFileName(session_id), from_name, from_id, utf8_text); + } + session->mNumUnread++; //update count of unread messages from real participant @@ -2468,6 +2470,7 @@ void LLIMMgr::addSystemMessage(const LLUUID& session_id, const std::string& mess std::string session_name; // since we select user to share item with - his name is already in cache gCacheName->getFullName(args["user_id"], session_name); + session_name = LLCacheName::buildUsername(session_name); LLIMModel::instance().logToFile(session_name, SYSTEM_FROM, LLUUID::null, message.getString()); } } diff --git a/indra/newview/llimview.h b/indra/newview/llimview.h index a15776c207..0ee56c8070 100644 --- a/indra/newview/llimview.h +++ b/indra/newview/llimview.h @@ -98,13 +98,6 @@ public: /** ad-hoc sessions involve sophisticated chat history file naming schemes */ void buildHistoryFileName(); - void onAvatarNameCache(const LLUUID& avatar_id, const LLAvatarName& av_name); - - void onAdHocNameCache(const LLAvatarName& av_name); - - //*TODO make private - static std::string generateHash(const std::set<LLUUID>& sorted_uuids); - LLUUID mSessionID; std::string mName; EInstantMessage mType; @@ -139,6 +132,11 @@ public: //if IM session is created for a voice call bool mStartedAsIMCall; + + private: + void onAdHocNameCache(const LLAvatarName& av_name); + + static std::string generateHash(const std::set<LLUUID>& sorted_uuids); }; @@ -293,12 +291,7 @@ private: /** * Add message to a list of message associated with session specified by session_id */ - bool addToHistory(const LLUUID& session_id, const std::string& from, const LLUUID& from_id, const std::string& utf8_text); - - /** - * Save an IM message into a file - */ - bool logToFile(const LLUUID& session_id, const std::string& from, const LLUUID& from_id, const std::string& utf8_text); + bool addToHistory(const LLUUID& session_id, const std::string& from, const LLUUID& from_id, const std::string& utf8_text); }; class LLIMSessionObserver diff --git a/indra/newview/llnotificationhandlerutil.cpp b/indra/newview/llnotificationhandlerutil.cpp index 70d588db52..de90023f3b 100644 --- a/indra/newview/llnotificationhandlerutil.cpp +++ b/indra/newview/llnotificationhandlerutil.cpp @@ -27,13 +27,17 @@ #include "llviewerprecompiledheaders.h" // must be first include -#include "llnotificationhandler.h" +#include "llavatarnamecache.h" + +#include "llfloaterreg.h" #include "llnotifications.h" -#include "llimview.h" +#include "llurlaction.h" + #include "llagent.h" -#include "llfloaterreg.h" -#include "llnearbychat.h" #include "llimfloater.h" +#include "llimview.h" +#include "llnearbychat.h" +#include "llnotificationhandler.h" using namespace LLNotificationsUI; @@ -275,7 +279,11 @@ void LLHandlerUtil::logToIM(const EInstantMessage& session_type, { from = SYSTEM_FROM; } - LLIMModel::instance().logToFile(session_name, from, from_id, message); + + // Build a new format username or firstname_lastname for legacy names + // to use it for a history log filename. + std::string user_name = LLCacheName::buildUsername(session_name); + LLIMModel::instance().logToFile(user_name, from, from_id, message); } else { diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 9641a0901c..7907614f14 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -2595,6 +2595,9 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) 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; } |