summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorPaul ProductEngine <pguslisty@productengine.com>2012-09-18 16:41:37 +0300
committerPaul ProductEngine <pguslisty@productengine.com>2012-09-18 16:41:37 +0300
commita3607a8d8c86b2c25bfa0abda1b0fc9b00f2c099 (patch)
tree720875694e3a71d3e30f1b851c74b9fdd45dffe6 /indra/newview
parent97cce3d34f21fea8eb6c259e04480c269e8ada28 (diff)
CHUI-339 FIXED (2 entries shown in conversation log for ad hoc conference for user that starts the conference)
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llconversationlog.cpp35
-rw-r--r--indra/newview/llconversationlog.h8
-rw-r--r--indra/newview/llimview.cpp21
-rw-r--r--indra/newview/llimview.h6
4 files changed, 47 insertions, 23 deletions
diff --git a/indra/newview/llconversationlog.cpp b/indra/newview/llconversationlog.cpp
index 27be2bc5ae..44bee70427 100644
--- a/indra/newview/llconversationlog.cpp
+++ b/indra/newview/llconversationlog.cpp
@@ -75,7 +75,7 @@ LLConversation::LLConversation(const LLIMModel::LLIMSession& session)
mConversationType(session.mSessionType),
mConversationName(session.mName),
mHistoryFileName(session.mHistoryFileName),
- mSessionID(session.mSessionID),
+ mSessionID(session.isOutgoingAdHoc() ? session.generateOutgouigAdHocHash() : session.mSessionID),
mParticipantID(session.mOtherParticipantID),
mIsVoice(session.mStartedAsIMCall),
mHasOfflineIMs(session.mHasOfflineMessage)
@@ -231,8 +231,8 @@ void LLConversationLog::enableLogging(bool enable)
void LLConversationLog::logConversation(const LLUUID& session_id)
{
- LLIMModel::LLIMSession* session = LLIMModel::instance().findIMSession(session_id);
- LLConversation* conversation = findConversation(session_id);
+ const LLIMModel::LLIMSession* session = LLIMModel::instance().findIMSession(session_id);
+ LLConversation* conversation = findConversation(session);
if (session && conversation)
{
@@ -240,14 +240,12 @@ void LLConversationLog::logConversation(const LLUUID& session_id)
}
else if (session && !conversation)
{
- createConversation(session_id);
+ createConversation(session);
}
}
-void LLConversationLog::createConversation(const LLUUID& session_id)
+void LLConversationLog::createConversation(const LLIMModel::LLIMSession* session)
{
- LLIMModel::LLIMSession* session = LLIMModel::instance().findIMSession(session_id);
-
if (session)
{
LLConversation conversation(*session);
@@ -262,14 +260,18 @@ void LLConversationLog::createConversation(const LLUUID& session_id)
}
}
-void LLConversationLog::updateConversationName(const LLUUID& session_id, const std::string& name)
+void LLConversationLog::updateConversationName(const LLIMModel::LLIMSession* session, const std::string& name)
{
- LLConversation* conversation = findConversation(session_id);
+ if (!session)
+ {
+ return;
+ }
+ LLConversation* conversation = findConversation(session);
if (conversation)
{
conversation->setConverstionName(name);
- notifyPrticularConversationObservers(session_id, LLConversationLogObserver::CHANGED_NAME);
+ notifyPrticularConversationObservers(conversation->getSessionID(), LLConversationLogObserver::CHANGED_NAME);
}
}
@@ -282,8 +284,15 @@ void LLConversationLog::updateConversationTimestamp(LLConversation* conversation
}
}
-LLConversation* LLConversationLog::findConversation(const LLUUID& session_id)
+LLConversation* LLConversationLog::findConversation(const LLIMModel::LLIMSession* session)
{
+ if (!session)
+ {
+ return NULL;
+ }
+
+ const LLUUID session_id = session->isOutgoingAdHoc() ? session->generateOutgouigAdHocHash() : session->mSessionID;
+
conversations_vec_t::iterator conv_it = mConversations.begin();
for(; conv_it != mConversations.end(); ++conv_it)
{
@@ -489,7 +498,7 @@ void LLConversationLog::onNewMessageReceived(const LLSD& data)
logConversation(session_id);
}
-void LLConversationLog::onAvatarNameCache(const LLUUID& participant_id, const LLAvatarName& av_name, LLIMModel::LLIMSession* session)
+void LLConversationLog::onAvatarNameCache(const LLUUID& participant_id, const LLAvatarName& av_name, const LLIMModel::LLIMSession* session)
{
- updateConversationName(session->mSessionID, av_name.getCompleteName());
+ updateConversationName(session, av_name.getCompleteName());
}
diff --git a/indra/newview/llconversationlog.h b/indra/newview/llconversationlog.h
index a458e975bb..6fff7d6772 100644
--- a/indra/newview/llconversationlog.h
+++ b/indra/newview/llconversationlog.h
@@ -162,13 +162,13 @@ private:
bool saveToFile(const std::string& filename);
bool loadFromFile(const std::string& filename);
- void onAvatarNameCache(const LLUUID& participant_id, const LLAvatarName& av_name, LLIMModel::LLIMSession* session);
+ void onAvatarNameCache(const LLUUID& participant_id, const LLAvatarName& av_name, const LLIMModel::LLIMSession* session);
- void createConversation(const LLUUID& session_id);
+ void createConversation(const LLIMModel::LLIMSession* session);
void updateConversationTimestamp(LLConversation* conversation);
- void updateConversationName(const LLUUID& session_id, const std::string& name);
+ void updateConversationName(const LLIMModel::LLIMSession* session, const std::string& name);
- LLConversation* findConversation(const LLUUID& session_id);
+ LLConversation* findConversation(const LLIMModel::LLIMSession* session);
typedef std::vector<LLConversation> conversations_vec_t;
std::vector<LLConversation> mConversations;
diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp
index f5392b442a..b45903835a 100644
--- a/indra/newview/llimview.cpp
+++ b/indra/newview/llimview.cpp
@@ -536,7 +536,7 @@ LLIMModel::LLIMSession* LLIMModel::findAdHocIMSession(const uuid_vec_t& ids)
return NULL;
}
-bool LLIMModel::LLIMSession::isOutgoingAdHoc()
+bool LLIMModel::LLIMSession::isOutgoingAdHoc() const
{
return IM_SESSION_CONFERENCE_START == mType;
}
@@ -556,6 +556,19 @@ bool LLIMModel::LLIMSession::isOtherParticipantAvaline()
return !mOtherParticipantIsAvatar;
}
+LLUUID LLIMModel::LLIMSession::generateOutgouigAdHocHash() const
+{
+ LLUUID hash = LLUUID::null;
+
+ if (mInitialTargetIDs.size())
+ {
+ std::set<LLUUID> sorted_uuids(mInitialTargetIDs.begin(), mInitialTargetIDs.end());
+ hash = generateHash(sorted_uuids);
+ }
+
+ return hash;
+}
+
void LLIMModel::LLIMSession::buildHistoryFileName()
{
mHistoryFileName = mName;
@@ -572,7 +585,7 @@ void LLIMModel::LLIMSession::buildHistoryFileName()
if (mInitialTargetIDs.size())
{
std::set<LLUUID> sorted_uuids(mInitialTargetIDs.begin(), mInitialTargetIDs.end());
- mHistoryFileName = mName + " hash" + generateHash(sorted_uuids);
+ mHistoryFileName = mName + " hash" + generateHash(sorted_uuids).asString();
}
else
{
@@ -606,7 +619,7 @@ void LLIMModel::LLIMSession::buildHistoryFileName()
}
//static
-std::string LLIMModel::LLIMSession::generateHash(const std::set<LLUUID>& sorted_uuids)
+LLUUID LLIMModel::LLIMSession::generateHash(const std::set<LLUUID>& sorted_uuids)
{
LLMD5 md5_uuid;
@@ -620,7 +633,7 @@ std::string LLIMModel::LLIMSession::generateHash(const std::set<LLUUID>& sorted_
LLUUID participants_md5_hash;
md5_uuid.raw_digest((unsigned char*) participants_md5_hash.mData);
- return participants_md5_hash.asString();
+ return participants_md5_hash;
}
void LLIMModel::processSessionInitializedReply(const LLUUID& old_session_id, const LLUUID& new_session_id)
diff --git a/indra/newview/llimview.h b/indra/newview/llimview.h
index fa9d20ca53..82cfa394a6 100644
--- a/indra/newview/llimview.h
+++ b/indra/newview/llimview.h
@@ -85,7 +85,7 @@ public:
/** @deprecated */
static void chatFromLogFile(LLLogChat::ELogLineType type, const LLSD& msg, void* userdata);
- bool isOutgoingAdHoc();
+ bool isOutgoingAdHoc() const;
bool isAdHoc();
bool isP2P();
bool isOtherParticipantAvaline();
@@ -95,6 +95,8 @@ public:
bool isGroupSessionType() const { return mSessionType == GROUP_SESSION;}
bool isAvalineSessionType() const { return mSessionType == AVALINE_SESSION;}
+ LLUUID generateOutgouigAdHocHash() const;
+
//*TODO make private
/** ad-hoc sessions involve sophisticated chat history file naming schemes */
void buildHistoryFileName();
@@ -139,7 +141,7 @@ public:
private:
void onAdHocNameCache(const LLAvatarName& av_name);
- static std::string generateHash(const std::set<LLUUID>& sorted_uuids);
+ static LLUUID generateHash(const std::set<LLUUID>& sorted_uuids);
};