diff --git a/indra/newview/fsfloaterim.cpp b/indra/newview/fsfloaterim.cpp
index d0875ee3da..823552eb10 100644
--- a/indra/newview/fsfloaterim.cpp
+++ b/indra/newview/fsfloaterim.cpp
@@ -1253,6 +1253,22 @@ FSFloaterIM* FSFloaterIM::show(const LLUUID& session_id)
if (!gIMMgr->hasSession(session_id))
return nullptr;
+ // [FIRE-34494] fixes unable to open an IM with someone who started a group chat
+ // Prevent showing non-IM sessions in FSFloaterIM::show()
+ LLIMModel::LLIMSession* session = LLIMModel::getInstance()->findIMSession(session_id);
+ if (!session || (
+ IM_NOTHING_SPECIAL != session->mType
+ && IM_SESSION_P2P_INVITE != session->mType
+ && IM_SESSION_INVITE != session->mType
+ && IM_SESSION_CONFERENCE_START != session->mType
+ && IM_SESSION_GROUP_START != session->mType))
+ {
+ LL_WARNS("IMVIEW") << "Attempted to show FSFloaterIM for non-IM session: "
+ << (session ? std::to_string(session->mType) : "null") << LL_ENDL;
+ return nullptr;
+ }
+ //
+
if (!isChatMultiTab())
{
//hide all
diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp
index a542a1b150..d1d8db32f5 100644
--- a/indra/newview/llimview.cpp
+++ b/indra/newview/llimview.cpp
@@ -3905,16 +3905,55 @@ LLUUID LLIMMgr::addSession(
//works only for outgoing ad-hoc sessions
if (new_session &&
((IM_NOTHING_SPECIAL == dialog) || (IM_SESSION_P2P_INVITE == dialog) || (IM_SESSION_CONFERENCE_START == dialog)) &&
- ids.size())
+ // [FIRE-34494] fix unable to open an IM with someone who started a group chat
+ //ids.size())
+ !ids.empty())
+ //
{
session = LLIMModel::getInstance()->findAdHocIMSession(ids);
if (session)
{
- new_session = false;
- session_id = session->mSessionID;
+// [FIRE-34494] fix unable to open an IM with someone who started a group chat
+ // new_session = false;
+ // session_id = session->mSessionID;
+
+ // Protect against wrong session type reuse (e.g., conference reused for IM)
+ if (session->mType != dialog)
+ {
+ LL_WARNS("IMVIEW") << "Discarding mismatched session type reuse: expected "
+ << dialog << " but found " << session->mType
+ << " for session " << session->mSessionID
+ << ". This may indicate improper reuse of a session object." << LL_ENDL;
+ session = nullptr;
+ new_session = true;
+ session_id = computeSessionID(dialog, other_participant_id);
+ }
+ else
+ {
+ new_session = false;
+ session_id = session->mSessionID;
+ }
}
}
+ if (session && session->mType != dialog)
+ {
+ // Prevent reusing a session of the wrong type
+ session = nullptr;
+ new_session = true;
+
+ // Recompute session ID depending on dialog type
+ if (dialog == IM_SESSION_CONFERENCE_START)
+ {
+ session_id.generate();
+ }
+ else
+ {
+ session_id = computeSessionID(dialog, other_participant_id);
+ }
+//
+ }
+
//Notify observers that a session was added
if (new_session)
{