Merge pull request #126 from AyaneStorm/pr-fix-unable-to-im-starter-of-groupchat

[FIRE-34494] fixes unable to open an IM with someone who started a group chat
master
Beq Janus 2025-05-23 03:52:46 +01:00 committed by GitHub
commit 35902b0e57
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 58 additions and 3 deletions

View File

@ -1253,6 +1253,22 @@ FSFloaterIM* FSFloaterIM::show(const LLUUID& session_id)
if (!gIMMgr->hasSession(session_id))
return nullptr;
// <AS:chanayane> [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;
}
// </AS:chanayane>
if (!isChatMultiTab())
{
//hide all

View File

@ -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())
// <AS:chanayane> [FIRE-34494] fix unable to open an IM with someone who started a group chat
//ids.size())
!ids.empty())
// </AS:chanayane>
{
session = LLIMModel::getInstance()->findAdHocIMSession(ids);
if (session)
{
new_session = false;
session_id = session->mSessionID;
// <AS:chanayane> [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);
}
// </AS:chanayane>
}
//Notify observers that a session was added
if (new_session)
{