summaryrefslogtreecommitdiff
path: root/indra/newview/llfloaterimsession.cpp
diff options
context:
space:
mode:
authornat-goodspeed <nat@lindenlab.com>2024-09-05 08:37:16 -0400
committerGitHub <noreply@github.com>2024-09-05 08:37:16 -0400
commit7ac4c3b56e5246fceaa73e7c9c665d3c04827d6c (patch)
treee96334bd9299102ebdaf229eec9cf4c2165f8c2f /indra/newview/llfloaterimsession.cpp
parent487973d3f0ee9b8583b3d977ca6a405cba5fe518 (diff)
parent6a747e1ce027700a3609f4c377179bfa29c3ce31 (diff)
Merge pull request #2450 from secondlife/lua-merge
Merge updated 'main' branch into release/luau-scripting
Diffstat (limited to 'indra/newview/llfloaterimsession.cpp')
-rw-r--r--indra/newview/llfloaterimsession.cpp86
1 files changed, 51 insertions, 35 deletions
diff --git a/indra/newview/llfloaterimsession.cpp b/indra/newview/llfloaterimsession.cpp
index 85d55575be..f0028441d9 100644
--- a/indra/newview/llfloaterimsession.cpp
+++ b/indra/newview/llfloaterimsession.cpp
@@ -94,6 +94,7 @@ LLFloaterIMSession::LLFloaterIMSession(const LLUUID& session_id)
mEnableCallbackRegistrar.add("Avatar.EnableGearItem", boost::bind(&LLFloaterIMSession::enableGearMenuItem, this, _2));
mCommitCallbackRegistrar.add("Avatar.GearDoToSelected", { boost::bind(&LLFloaterIMSession::GearDoToSelected, this, _2), cb_info::UNTRUSTED_BLOCK });
mEnableCallbackRegistrar.add("Avatar.CheckGearItem", boost::bind(&LLFloaterIMSession::checkGearMenuItem, this, _2));
+ mVoiceChannelChanged = LLVoiceChannel::setCurrentVoiceChannelChangedCallback(boost::bind(&LLFloaterIMSession::onVoiceChannelChanged, this, _1));
setDocked(true);
}
@@ -108,7 +109,7 @@ void LLFloaterIMSession::refresh()
if (mMeTypingTimer.getElapsedTimeF32() > ME_TYPING_TIMEOUT && false == mShouldSendTypingState)
{
LL_DEBUGS("TypingMsgs") << "Send additional Start Typing packet" << LL_ENDL;
- LLIMModel::instance().sendTypingState(mSessionID, mOtherParticipantUUID, TRUE);
+ LLIMModel::instance().sendTypingState(mSessionID, mOtherParticipantUUID, true);
mMeTypingTimer.reset();
}
@@ -137,8 +138,14 @@ void LLFloaterIMSession::onTearOffClicked()
}
// virtual
-void LLFloaterIMSession::onClickCloseBtn(bool)
+void LLFloaterIMSession::onClickCloseBtn(bool app_qutting)
{
+ if (app_qutting)
+ {
+ LLFloaterIMSessionTab::onClickCloseBtn();
+ return;
+ }
+
LLIMModel::LLIMSession* session = LLIMModel::instance().findIMSession(mSessionID);
if (session != NULL)
@@ -286,12 +293,12 @@ void LLFloaterIMSession::sendMsg(const std::string& msg)
LLFloaterIMSession::~LLFloaterIMSession()
{
mVoiceChannelStateChangeConnection.disconnect();
- if(LLVoiceClient::instanceExists())
- {
- LLVoiceClient::getInstance()->removeObserver(this);
- }
+
+ LLVoiceClient::removeObserver(this);
LLTransientFloaterMgr::getInstance()->removeControlView(LLTransientFloaterMgr::IM, this);
+
+ mVoiceChannelChanged.disconnect();
}
@@ -330,7 +337,7 @@ void LLFloaterIMSession::initIMFloater()
// Disable input editor if session cannot accept text
if ( mSession && !mSession->mTextIMPossible )
{
- mInputEditor->setEnabled(FALSE);
+ mInputEditor->setEnabled(false);
mInputEditor->setLabel(LLTrans::getString("IM_unavailable_text_label"));
}
@@ -342,9 +349,9 @@ void LLFloaterIMSession::initIMFloater()
}
//virtual
-BOOL LLFloaterIMSession::postBuild()
+bool LLFloaterIMSession::postBuild()
{
- BOOL result = LLFloaterIMSessionTab::postBuild();
+ bool result = LLFloaterIMSessionTab::postBuild();
mInputEditor->setMaxTextLength(1023);
mInputEditor->setAutoreplaceCallback(boost::bind(&LLAutoReplace::autoreplaceCallback, LLAutoReplace::getInstance(), _1, _2, _3, _4, _5));
@@ -363,7 +370,7 @@ BOOL LLFloaterIMSession::postBuild()
childSetAction("voice_call_btn", boost::bind(&LLFloaterIMSession::onCallButtonClicked, this));
- LLVoiceClient::getInstance()->addObserver(this);
+ LLVoiceClient::addObserver(this);
//*TODO if session is not initialized yet, add some sort of a warning message like "starting session...blablabla"
//see LLFloaterIMPanel for how it is done (IB)
@@ -377,7 +384,7 @@ void LLFloaterIMSession::onAddButtonClicked()
{
LLView * button = findChild<LLView>("toolbar_panel")->findChild<LLButton>("add_btn");
LLFloater* root_floater = gFloaterView->getParentFloater(this);
- LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(boost::bind(&LLFloaterIMSession::addSessionParticipants, this, _1), TRUE, TRUE, FALSE, root_floater->getName(), button);
+ LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(boost::bind(&LLFloaterIMSession::addSessionParticipants, this, _1), true, true, false, root_floater->getName(), button);
if (!picker)
{
return;
@@ -521,11 +528,20 @@ void LLFloaterIMSession::sendParticipantsAddedNotification(const uuid_vec_t& uui
sendMsg(getString(uuids.size() > 1 ? "multiple_participants_added" : "participant_added", args));
}
+void LLFloaterIMSession::onVoiceChannelChanged(const LLUUID &session_id)
+{
+ if (session_id == mSessionID)
+ {
+ boundVoiceChannel();
+ }
+}
+
void LLFloaterIMSession::boundVoiceChannel()
{
LLVoiceChannel* voice_channel = LLIMModel::getInstance()->getVoiceChannel(mSessionID);
if(voice_channel)
{
+ mVoiceChannelStateChangeConnection.disconnect();
mVoiceChannelStateChangeConnection = voice_channel->setStateChangedCallback(
boost::bind(&LLFloaterIMSession::onVoiceChannelStateChanged, this, _1, _2));
@@ -552,7 +568,7 @@ void LLFloaterIMSession::onCallButtonClicked()
}
}
-void LLFloaterIMSession::onChange(EStatusType status, const std::string &channelURI, bool proximal)
+void LLFloaterIMSession::onChange(EStatusType status, const LLSD& channelInfo, bool proximal)
{
if(status != STATUS_JOINING && status != STATUS_LEFT_CHANNEL)
{
@@ -604,13 +620,13 @@ LLFloaterIMSession* LLFloaterIMSession::show(const LLUUID& session_id)
LLTabContainer::eInsertionPoint i_pt = LLTabContainer::END;
if (floater_container)
{
- floater_container->addFloater(floater, TRUE, i_pt);
+ floater_container->addFloater(floater, true, i_pt);
}
}
floater->openFloater(floater->getKey());
- floater->setVisible(TRUE);
+ floater->setVisible(true);
return floater;
}
@@ -668,7 +684,7 @@ void LLFloaterIMSession::setDocked(bool docked, bool pop_on_undock)
}
}
-void LLFloaterIMSession::setMinimized(BOOL b)
+void LLFloaterIMSession::setMinimized(bool b)
{
bool wasMinimized = isMinimized();
LLFloaterIMSessionTab::setMinimized(b);
@@ -685,7 +701,7 @@ void LLFloaterIMSession::setMinimized(BOOL b)
}
}
-void LLFloaterIMSession::setVisible(BOOL visible)
+void LLFloaterIMSession::setVisible(bool visible)
{
LLNotificationsUI::LLScreenChannel* channel = static_cast<LLNotificationsUI::LLScreenChannel*>
(LLNotificationsUI::LLChannelManager::getInstance()->
@@ -721,7 +737,7 @@ void LLFloaterIMSession::setVisible(BOOL visible)
}
-BOOL LLFloaterIMSession::getVisible()
+bool LLFloaterIMSession::getVisible()
{
bool visible;
@@ -740,7 +756,7 @@ BOOL LLFloaterIMSession::getVisible()
}
else
{
- // getVisible() returns TRUE when Tabbed IM window is minimized.
+ // getVisible() returns true when Tabbed IM window is minimized.
visible = is_active && !im_container->isMinimized()
&& im_container->getVisible();
}
@@ -753,7 +769,7 @@ BOOL LLFloaterIMSession::getVisible()
return visible;
}
-void LLFloaterIMSession::setFocus(BOOL focus)
+void LLFloaterIMSession::setFocus(bool focus)
{
LLFloaterIMSessionTab::setFocus(focus);
@@ -781,8 +797,8 @@ bool LLFloaterIMSession::toggle(const LLUUID& session_id)
}
else if(floater && ((!floater->isDocked() || floater->getVisible()) && !floater->hasFocus()))
{
- floater->setVisible(TRUE);
- floater->setFocus(TRUE);
+ floater->setVisible(true);
+ floater->setFocus(true);
return true;
}
}
@@ -988,7 +1004,7 @@ void LLFloaterIMSession::setTyping(bool typing)
if ( mTypingTimer.getElapsedTimeF32() > 1.f )
{
// Still typing, send 'start typing' notification
- LLIMModel::instance().sendTypingState(mSessionID, mOtherParticipantUUID, TRUE);
+ LLIMModel::instance().sendTypingState(mSessionID, mOtherParticipantUUID, true);
mShouldSendTypingState = false;
mMeTypingTimer.reset();
}
@@ -996,7 +1012,7 @@ void LLFloaterIMSession::setTyping(bool typing)
else
{
// Send 'stop typing' notification immediately
- LLIMModel::instance().sendTypingState(mSessionID, mOtherParticipantUUID, FALSE);
+ LLIMModel::instance().sendTypingState(mSessionID, mOtherParticipantUUID, false);
mShouldSendTypingState = false;
}
}
@@ -1006,12 +1022,12 @@ void LLFloaterIMSession::setTyping(bool typing)
LLIMSpeakerMgr* speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(mSessionID);
if (speaker_mgr)
{
- speaker_mgr->setSpeakerTyping(gAgent.getID(), FALSE);
+ speaker_mgr->setSpeakerTyping(gAgent.getID(), false);
}
}
}
-void LLFloaterIMSession::processIMTyping(const LLUUID& from_id, BOOL typing)
+void LLFloaterIMSession::processIMTyping(const LLUUID& from_id, bool typing)
{
LL_DEBUGS("TypingMsgs") << "typing=" << typing << LL_ENDL;
if ( typing )
@@ -1052,7 +1068,7 @@ void LLFloaterIMSession::processAgentListUpdates(const LLSD& body)
// process the moderator mutes
if (agent_id == gAgentID && agent_data.has("info") && agent_data["info"].has("mutes"))
{
- BOOL moderator_muted_text = agent_data["info"]["mutes"]["text"].asBoolean();
+ bool moderator_muted_text = agent_data["info"]["mutes"]["text"].asBoolean();
mInputEditor->setEnabled(!moderator_muted_text);
std::string label;
if (moderator_muted_text)
@@ -1097,7 +1113,7 @@ void LLFloaterIMSession::processSessionUpdate(const LLSD& session_update)
if ( false && session_update.has("moderated_mode") &&
session_update["moderated_mode"].has("voice") )
{
- BOOL voice_moderated = session_update["moderated_mode"]["voice"];
+ bool voice_moderated = session_update["moderated_mode"]["voice"];
const std::string session_label = LLIMModel::instance().getName(mSessionID);
if (voice_moderated)
@@ -1130,7 +1146,7 @@ void LLFloaterIMSession::draw()
}
// virtual
-BOOL LLFloaterIMSession::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
+bool LLFloaterIMSession::handleDragAndDrop(S32 x, S32 y, MASK mask, bool drop,
EDragAndDropType cargo_type,
void* cargo_data,
EAcceptance* accept,
@@ -1153,7 +1169,7 @@ BOOL LLFloaterIMSession::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
cargo_type, cargo_data, accept);
}
- return TRUE;
+ return true;
}
bool LLFloaterIMSession::dropPerson(LLUUID* person_id, bool drop)
@@ -1176,21 +1192,21 @@ bool LLFloaterIMSession::dropPerson(LLUUID* person_id, bool drop)
return res;
}
-BOOL LLFloaterIMSession::isInviteAllowed() const
+bool LLFloaterIMSession::isInviteAllowed() const
{
return ( (IM_SESSION_CONFERENCE_START == mDialog)
|| (IM_SESSION_INVITE == mDialog && !gAgent.isInGroup(mSessionID))
|| mIsP2PChat);
}
-BOOL LLFloaterIMSession::inviteToSession(const uuid_vec_t& ids)
+bool LLFloaterIMSession::inviteToSession(const uuid_vec_t& ids)
{
LLViewerRegion* region = gAgent.getRegion();
bool is_region_exist = region != NULL;
if (is_region_exist)
{
- S32 count = ids.size();
+ auto count = ids.size();
if( isInviteAllowed() && (count > 0) )
{
@@ -1200,7 +1216,7 @@ BOOL LLFloaterIMSession::inviteToSession(const uuid_vec_t& ids)
LLSD data;
data["params"] = LLSD::emptyArray();
- for (int i = 0; i < count; i++)
+ for (size_t i = 0; i < count; i++)
{
data["params"].append(ids[i]);
}
@@ -1264,7 +1280,7 @@ Note: OTHER_TYPING_TIMEOUT must be > ME_TYPING_TIMEOUT for proper operation of t
LLIMSpeakerMgr* speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(mSessionID);
if ( speaker_mgr )
{
- speaker_mgr->setSpeakerTyping(from_id, TRUE);
+ speaker_mgr->setSpeakerTyping(from_id, true);
}
}
}
@@ -1281,7 +1297,7 @@ void LLFloaterIMSession::removeTypingIndicator(const LLUUID& from_id)
LLIMSpeakerMgr* speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(mSessionID);
if (speaker_mgr)
{
- speaker_mgr->setSpeakerTyping(from_id, FALSE);
+ speaker_mgr->setSpeakerTyping(from_id, false);
}
}
}