summaryrefslogtreecommitdiff
path: root/indra/newview/llimview.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llimview.cpp')
-rw-r--r--indra/newview/llimview.cpp155
1 files changed, 80 insertions, 75 deletions
diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp
index c9c70c95fe..75d96cbe26 100644
--- a/indra/newview/llimview.cpp
+++ b/indra/newview/llimview.cpp
@@ -117,16 +117,16 @@ const LLUUID LLOutgoingCallDialog::OCD_KEY = LLUUID("7CF78E11-0CFE-498D-ADB9-141
LLIMMgr* gIMMgr = NULL;
-BOOL LLSessionTimeoutTimer::tick()
+bool LLSessionTimeoutTimer::tick()
{
- if (mSessionId.isNull()) return TRUE;
+ if (mSessionId.isNull()) return true;
LLIMModel::LLIMSession* session = LLIMModel::getInstance()->findIMSession(mSessionId);
if (session && !session->mSessionInitialized)
{
gIMMgr->showSessionStartError("session_initialization_timed_out_error", mSessionId);
}
- return TRUE;
+ return true;
}
@@ -224,26 +224,26 @@ void notify_of_message(const LLSD& msg, bool is_dnd_msg)
if (msg["source_type"].asInteger() == CHAT_SOURCE_OBJECT)
{
user_preferences = gSavedSettings.getString("NotificationObjectIMOptions");
- if (!gAgent.isDoNotDisturb() && (gSavedSettings.getBOOL("PlaySoundObjectIM") == TRUE))
+ if (!gAgent.isDoNotDisturb() && (gSavedSettings.getBOOL("PlaySoundObjectIM")))
{
make_ui_sound("UISndNewIncomingIMSession");
}
}
else
{
- user_preferences = gSavedSettings.getString("NotificationNearbyChatOptions");
- if (!gAgent.isDoNotDisturb() && (gSavedSettings.getBOOL("PlaySoundNearbyChatIM") == TRUE))
+ user_preferences = gSavedSettings.getString("NotificationNearbyChatOptions");
+ if (!gAgent.isDoNotDisturb() && (gSavedSettings.getBOOL("PlaySoundNearbyChatIM")))
{
make_ui_sound("UISndNewIncomingIMSession");
- }
+ }
}
}
- else if(session->isP2PSessionType())
+ else if (session->isP2PSessionType())
{
if (LLAvatarTracker::instance().isBuddy(participant_id))
{
user_preferences = gSavedSettings.getString("NotificationFriendIMOptions");
- if (!gAgent.isDoNotDisturb() && (gSavedSettings.getBOOL("PlaySoundFriendIM") == TRUE))
+ if (!gAgent.isDoNotDisturb() && (gSavedSettings.getBOOL("PlaySoundFriendIM")))
{
make_ui_sound("UISndNewIncomingIMSession");
}
@@ -251,24 +251,24 @@ void notify_of_message(const LLSD& msg, bool is_dnd_msg)
else
{
user_preferences = gSavedSettings.getString("NotificationNonFriendIMOptions");
- if (!gAgent.isDoNotDisturb() && (gSavedSettings.getBOOL("PlaySoundNonFriendIM") == TRUE))
+ if (!gAgent.isDoNotDisturb() && (gSavedSettings.getBOOL("PlaySoundNonFriendIM")))
{
make_ui_sound("UISndNewIncomingIMSession");
+ }
}
}
- }
- else if(session->isAdHocSessionType())
+ else if (session->isAdHocSessionType())
{
user_preferences = gSavedSettings.getString("NotificationConferenceIMOptions");
- if (!gAgent.isDoNotDisturb() && (gSavedSettings.getBOOL("PlaySoundConferenceIM") == TRUE))
+ if (!gAgent.isDoNotDisturb() && (gSavedSettings.getBOOL("PlaySoundConferenceIM")))
{
make_ui_sound("UISndNewIncomingIMSession");
- }
+ }
}
else if(session->isGroupSessionType())
{
user_preferences = gSavedSettings.getString("NotificationGroupChatOptions");
- if (!gAgent.isDoNotDisturb() && (gSavedSettings.getBOOL("PlaySoundGroupChatIM") == TRUE))
+ if (!gAgent.isDoNotDisturb() && (gSavedSettings.getBOOL("PlaySoundGroupChatIM")))
{
make_ui_sound("UISndNewIncomingIMSession");
}
@@ -318,8 +318,7 @@ void notify_of_message(const LLSD& msg, bool is_dnd_msg)
else
{
store_dnd_message = true;
- }
-
+ }
}
// 2. Flash line item
@@ -773,7 +772,7 @@ LLIMModel::LLIMSession::LLIMSession(const LLUUID& session_id,
}
else
{
- //tick returns TRUE - timer will be deleted after the tick
+ //tick returns true - timer will be deleted after the tick
new LLSessionTimeoutTimer(mSessionID, SESSION_INITIALIZATION_TIMEOUT);
}
@@ -868,7 +867,7 @@ void LLIMModel::LLIMSession::onAdHocNameCache(const LLAvatarName& av_name)
if (!av_name.isValidName())
{
- S32 separator_index = mName.rfind(" ");
+ auto separator_index = mName.rfind(" ");
std::string name = mName.substr(0, separator_index);
++separator_index;
std::string conference_word = mName.substr(separator_index, mName.length());
@@ -1044,7 +1043,7 @@ void LLIMModel::LLIMSession::addMessage(const std::string& from,
if (mSpeakers && from_id.notNull())
{
mSpeakers->speakerChatted(from_id);
- mSpeakers->setSpeakerTyping(from_id, FALSE);
+ mSpeakers->setSpeakerTyping(from_id, false);
}
}
@@ -1302,7 +1301,7 @@ void LLIMModel::LLIMSession::addMessagesFromServerHistory(const LLSD& history,
}
}
- S32 shifted_size = shift_msgs.size();
+ auto shifted_size = shift_msgs.size();
while (shift_msgs.size() > 0)
{ // Finally add back any new messages, and tweak the index value to be correct.
LLSD newer_message = shift_msgs.front();
@@ -1364,7 +1363,7 @@ LLIMModel::LLIMSession* LLIMModel::findIMSession(const LLUUID& session_id) const
//*TODO consider switching to using std::set instead of std::list for holding LLUUIDs across the whole code
LLIMModel::LLIMSession* LLIMModel::findAdHocIMSession(const uuid_vec_t& ids)
{
- S32 num = ids.size();
+ auto num = ids.size();
if (!num) return NULL;
if (mId2SessionMap.empty()) return NULL;
@@ -1407,7 +1406,7 @@ bool LLIMModel::LLIMSession::isOutgoingAdHoc() const
bool LLIMModel::LLIMSession::isAdHoc()
{
- return IM_SESSION_CONFERENCE_START == mType || (IM_SESSION_INVITE == mType && !gAgent.isInGroup(mSessionID, TRUE));
+ return IM_SESSION_CONFERENCE_START == mType || (IM_SESSION_INVITE == mType && !gAgent.isInGroup(mSessionID, true));
}
bool LLIMModel::LLIMSession::isP2P()
@@ -1417,7 +1416,7 @@ bool LLIMModel::LLIMSession::isP2P()
bool LLIMModel::LLIMSession::isGroupChat()
{
- return IM_SESSION_GROUP_START == mType || (IM_SESSION_INVITE == mType && gAgent.isInGroup(mSessionID, TRUE));
+ return IM_SESSION_GROUP_START == mType || (IM_SESSION_INVITE == mType && gAgent.isInGroup(mSessionID, true));
}
LLUUID LLIMModel::LLIMSession::generateOutgoingAdHocHash() const
@@ -1618,7 +1617,7 @@ void LLIMModel::getMessagesSilently(const LLUUID& session_id, chat_message_list_
return;
}
- int i = session->mMsgs.size() - start_index;
+ int i = static_cast<int>(session->mMsgs.size()) - start_index;
for (chat_message_list_t::iterator iter = session->mMsgs.begin();
iter != session->mMsgs.end() && i > 0;
@@ -1874,7 +1873,7 @@ const std::string& LLIMModel::getHistoryFileName(const LLUUID& session_id) const
// TODO get rid of other participant ID
-void LLIMModel::sendTypingState(LLUUID session_id, LLUUID other_participant_id, BOOL typing)
+void LLIMModel::sendTypingState(LLUUID session_id, LLUUID other_participant_id, bool typing)
{
std::string name;
LLAgentUI::buildFullname(name);
@@ -1882,7 +1881,7 @@ void LLIMModel::sendTypingState(LLUUID session_id, LLUUID other_participant_id,
pack_instant_message(
gMessageSystem,
gAgent.getID(),
- FALSE,
+ false,
gAgent.getSessionID(),
other_participant_id,
name,
@@ -1902,7 +1901,7 @@ void LLIMModel::sendLeaveSession(const LLUUID& session_id, const LLUUID& other_p
pack_instant_message(
gMessageSystem,
gAgent.getID(),
- FALSE,
+ false,
gAgent.getSessionID(),
other_participant_id,
name,
@@ -1950,7 +1949,7 @@ void LLIMModel::sendMessage(const std::string& utf8_text,
pack_instant_message(
gMessageSystem,
gAgent.getID(),
- FALSE,
+ false,
gAgent.getSessionID(),
other_participant_id,
name.c_str(),
@@ -2009,7 +2008,7 @@ void LLIMModel::sendMessage(const std::string& utf8_text,
if (speaker_mgr)
{
speaker_mgr->speakerChatted(gAgentID);
- speaker_mgr->setSpeakerTyping(gAgentID, FALSE);
+ speaker_mgr->setSpeakerTyping(gAgentID, false);
}
}
@@ -2074,7 +2073,7 @@ void session_starter_helper(
msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
msg->nextBlockFast(_PREHASH_MessageBlock);
- msg->addBOOLFast(_PREHASH_FromGroup, FALSE);
+ msg->addBOOLFast(_PREHASH_FromGroup, false);
msg->addUUIDFast(_PREHASH_ToAgentID, other_participant_id);
msg->addU8Fast(_PREHASH_Offline, IM_ONLINE);
msg->addU8Fast(_PREHASH_Dialog, im_type);
@@ -2099,12 +2098,12 @@ void start_deprecated_conference_chat(
{
U8* bucket;
U8* pos;
- S32 count;
+ size_t count;
S32 bucket_size;
// *FIX: this could suffer from endian issues
count = agents_to_invite.size();
- bucket_size = UUID_BYTES * count;
+ bucket_size = UUID_BYTES * static_cast<S32>(count);
bucket = new U8[bucket_size];
pos = bucket;
@@ -2238,7 +2237,7 @@ LLUUID LLIMMgr::computeSessionID(
}
}
- if (gAgent.isInGroup(session_id, TRUE) && (session_id != other_participant_id))
+ if (gAgent.isInGroup(session_id, true) && (session_id != other_participant_id))
{
LL_WARNS() << "Group session id different from group id: IM type = " << dialog << ", session id = " << session_id << ", group id = " << other_participant_id << LL_ENDL;
}
@@ -2321,7 +2320,7 @@ LLIMMgr::onConfirmForceCloseError(
LLFloater* floater = LLFloaterIMSession::findInstance(session_id);
if ( floater )
{
- floater->closeFloater(FALSE);
+ floater->closeFloater(false);
}
return false;
}
@@ -2476,7 +2475,7 @@ LLCallDialog::LLCallDialog(const LLSD& payload)
mPayload(payload),
mLifetime(DEFAULT_LIFETIME)
{
- setAutoFocus(FALSE);
+ setAutoFocus(false);
// force docked state since this floater doesn't save it between recreations
setDocked(true);
}
@@ -2486,14 +2485,14 @@ LLCallDialog::~LLCallDialog()
LLUI::getInstance()->removePopup(this);
}
-BOOL LLCallDialog::postBuild()
+bool LLCallDialog::postBuild()
{
if (!LLDockableFloater::postBuild() || !gToolBarView)
- return FALSE;
+ return false;
dockToToolbarButton("speak");
- return TRUE;
+ return true;
}
void LLCallDialog::dockToToolbarButton(const std::string& toolbarButtonName)
@@ -2567,7 +2566,7 @@ void LLCallDialog::setIcon(const LLSD& session_id, const LLSD& participant_id)
{
bool participant_is_avatar = LLVoiceClient::getInstance()->isParticipantAvatar(session_id);
- bool is_group = participant_is_avatar && gAgent.isInGroup(session_id, TRUE);
+ bool is_group = participant_is_avatar && gAgent.isInGroup(session_id, true);
LLAvatarIconCtrl* avatar_icon = getChild<LLAvatarIconCtrl>("avatar_icon");
LLGroupIconCtrl* group_icon = getChild<LLGroupIconCtrl>("group_icon");
@@ -2756,13 +2755,13 @@ void LLOutgoingCallDialog::onCancel(void* user_data)
}
-BOOL LLOutgoingCallDialog::postBuild()
+bool LLOutgoingCallDialog::postBuild()
{
- BOOL success = LLCallDialog::postBuild();
+ bool success = LLCallDialog::postBuild();
childSetAction("Cancel", onCancel, this);
- setCanDrag(FALSE);
+ setCanDrag(false);
return success;
}
@@ -2810,14 +2809,14 @@ void LLIncomingCallDialog::onLifetimeExpired()
}
}
-BOOL LLIncomingCallDialog::postBuild()
+bool LLIncomingCallDialog::postBuild()
{
LLCallDialog::postBuild();
if (!mPayload.isMap() || mPayload.size() == 0)
{
LL_INFOS("IMVIEW") << "IncomingCall: invalid argument" << LL_ENDL;
- return TRUE;
+ return true;
}
LLUUID session_id = mPayload["session_id"].asUUID();
@@ -2827,14 +2826,14 @@ BOOL LLIncomingCallDialog::postBuild()
if (session_id.isNull() && caller_id.asUUID().isNull())
{
LL_INFOS("IMVIEW") << "IncomingCall: invalid ids" << LL_ENDL;
- return TRUE;
+ return true;
}
std::string notify_box_type = mPayload["notify_box_type"].asString();
if (!is_voice_call_type(notify_box_type))
{
LL_INFOS("IMVIEW") << "IncomingCall: notify_box_type was not provided" << LL_ENDL;
- return TRUE;
+ return true;
}
// init notification's lifetime
@@ -2845,7 +2844,7 @@ BOOL LLIncomingCallDialog::postBuild()
}
std::string call_type;
- if (gAgent.isInGroup(session_id, TRUE))
+ if (gAgent.isInGroup(session_id, true))
{
LLStringUtil::format_map_t args;
LLGroupData data;
@@ -2896,8 +2895,8 @@ BOOL LLIncomingCallDialog::postBuild()
bool is_avatar = LLVoiceClient::getInstance()->isParticipantAvatar(session_id);
getChildView("Start IM")->setVisible( is_avatar && notify_box_type != "VoiceInviteAdHoc" && notify_box_type != "VoiceInviteGroup");
- setCanDrag(FALSE);
- return TRUE;
+ setCanDrag(false);
+ return true;
}
void LLIncomingCallDialog::setCallerName(const std::string& ui_title,
@@ -3017,7 +3016,7 @@ void LLIncomingCallDialog::processCallResponse(S32 response, const LLSD &payload
case IM_SESSION_CONFERENCE_START:
case IM_SESSION_GROUP_START:
case IM_SESSION_INVITE:
- if (gAgent.isInGroup(session_id, TRUE))
+ if (gAgent.isInGroup(session_id, true))
{
LLGroupData data;
if (!gAgent.getGroupData(session_id, data)) break;
@@ -3043,13 +3042,16 @@ void LLIncomingCallDialog::processCallResponse(S32 response, const LLSD &payload
gIMMgr->addSession(correct_session_name, type, session_id, payload["voice_channel_info"]);
- std::string url = gAgent.getRegion()->getCapability(
+ std::string url = gAgent.getRegionCapability(
"ChatSessionRequest");
if (voice)
{
- LLCoros::instance().launch("chatterBoxInvitationCoro",
- boost::bind(&chatterBoxInvitationCoro, url, session_id, inv_type, payload["voice_channel_info"]));
+ if(!url.empty())
+ {
+ LLCoros::instance().launch("chatterBoxInvitationCoro",
+ boost::bind(&chatterBoxInvitationCoro, url, session_id, inv_type, payload["voice_channel_info"]));
+ }
// send notification message to the corresponding chat
if (payload["notify_box_type"].asString() == "VoiceInviteGroup" || payload["notify_box_type"].asString() == "VoiceInviteAdHoc")
@@ -3125,7 +3127,7 @@ LLIMMgr::LLIMMgr()
LLIMModel::getInstance()->addNewMsgCallback(boost::bind(&LLFloaterIMSession::sRemoveTypingIndicator, _1));
- gSavedPerAccountSettings.declareBOOL("FetchGroupChatHistory", TRUE, "Fetch recent messages from group chat servers when a group window opens", LLControlVariable::PERSIST_ALWAYS);
+ gSavedPerAccountSettings.declareBOOL("FetchGroupChatHistory", true, "Fetch recent messages from group chat servers when a group window opens", LLControlVariable::PERSIST_ALWAYS);
}
// Add a message to a session.
@@ -3239,7 +3241,7 @@ void LLIMMgr::addMessage(
}
//Play sound for new conversations
- if (!skip_message & !gAgent.isDoNotDisturb() && (gSavedSettings.getBOOL("PlaySoundNewConversation") == TRUE))
+ if (!skip_message & !gAgent.isDoNotDisturb() && (gSavedSettings.getBOOL("PlaySoundNewConversation")))
{
make_ui_sound("UISndNewIncomingIMSession");
}
@@ -3501,7 +3503,7 @@ void LLIMMgr::inviteToSession(
// voice invite question is different from default only for group call (EXT-7118)
std::string question_type = "VoiceInviteQuestionDefault";
- BOOL voice_invite = FALSE;
+ bool voice_invite = false;
bool is_linden = LLMuteList::isLinden(caller_name);
@@ -3509,21 +3511,21 @@ void LLIMMgr::inviteToSession(
{
//P2P is different...they only have voice invitations
notify_box_type = "VoiceInviteP2P";
- voice_invite = TRUE;
+ voice_invite = true;
}
- else if ( gAgent.isInGroup(session_id, TRUE) )
+ else if ( gAgent.isInGroup(session_id, true) )
{
//only really old school groups have voice invitations
notify_box_type = "VoiceInviteGroup";
question_type = "VoiceInviteQuestionGroup";
- voice_invite = TRUE;
+ voice_invite = true;
}
else if ( inv_type == INVITATION_TYPE_VOICE )
{
//else it's an ad-hoc
//and a voice ad-hoc
notify_box_type = "VoiceInviteAdHoc";
- voice_invite = TRUE;
+ voice_invite = true;
}
else if ( inv_type == INVITATION_TYPE_IMMEDIATE )
{
@@ -3614,7 +3616,7 @@ void LLIMMgr::inviteToSession(
}
else
{
- LLFloaterReg::showInstance("incoming_call", payload, FALSE);
+ LLFloaterReg::showInstance("incoming_call", payload, false);
}
// Add the caller to the Recent List here (at this point
@@ -3636,7 +3638,7 @@ void LLIMMgr::onInviteNameLookup(LLSD payload, const LLUUID& id, const LLAvatarN
std::string notify_box_type = payload["notify_box_type"].asString();
- LLFloaterReg::showInstance("incoming_call", payload, FALSE);
+ LLFloaterReg::showInstance("incoming_call", payload, false);
}
//*TODO disconnects all sessions
@@ -3645,7 +3647,7 @@ void LLIMMgr::disconnectAllSessions()
//*TODO disconnects all IM sessions
}
-BOOL LLIMMgr::hasSession(const LLUUID& session_id)
+bool LLIMMgr::hasSession(const LLUUID& session_id)
{
return LLIMModel::getInstance()->findIMSession(session_id) != NULL;
}
@@ -3879,7 +3881,7 @@ bool LLIMMgr::endCall(const LLUUID& session_id)
if (im_session)
{
// need to update speakers' state
- im_session->mSpeakers->update(FALSE);
+ im_session->mSpeakers->update(false);
}
return true;
}
@@ -3939,7 +3941,7 @@ void LLIMMgr::noteOfflineUsers(
const LLUUID& session_id,
const std::vector<LLUUID>& ids)
{
- S32 count = ids.size();
+ auto count = ids.size();
if(count == 0)
{
const std::string& only_user = LLTrans::getString("only_user_message");
@@ -3977,7 +3979,7 @@ void LLIMMgr::noteMutedUsers(const LLUUID& session_id,
return;
}
- S32 count = ids.size();
+ auto count = ids.size();
if(count > 0)
{
LLIMModel* im_model = LLIMModel::getInstance();
@@ -3997,15 +3999,15 @@ void LLIMMgr::noteMutedUsers(const LLUUID& session_id,
void LLIMMgr::processIMTypingStart(const LLUUID& from_id, const EInstantMessage im_type)
{
- processIMTypingCore(from_id, im_type, TRUE);
+ processIMTypingCore(from_id, im_type, true);
}
void LLIMMgr::processIMTypingStop(const LLUUID& from_id, const EInstantMessage im_type)
{
- processIMTypingCore(from_id, im_type, FALSE);
+ processIMTypingCore(from_id, im_type, false);
}
-void LLIMMgr::processIMTypingCore(const LLUUID& from_id, const EInstantMessage im_type, BOOL typing)
+void LLIMMgr::processIMTypingCore(const LLUUID& from_id, const EInstantMessage im_type, bool typing)
{
LLUUID session_id = computeSessionID(im_type, from_id);
LLFloaterIMSession* im_floater = LLFloaterIMSession::findInstance(session_id);
@@ -4069,9 +4071,12 @@ public:
// Send request for chat history, if enabled.
if (gSavedPerAccountSettings.getBOOL("FetchGroupChatHistory"))
{
- std::string url = gAgent.getRegion()->getCapability("ChatSessionRequest");
- LLCoros::instance().launch("chatterBoxHistoryCoro",
- boost::bind(&chatterBoxHistoryCoro, url, session_id, "", "", 0));
+ std::string url = gAgent.getRegionCapability("ChatSessionRequest");
+ if (!url.empty())
+ {
+ LLCoros::instance().launch("chatterBoxHistoryCoro",
+ boost::bind(&chatterBoxHistoryCoro, url, session_id, "", "", 0));
+ }
}
}
}
@@ -4215,7 +4220,7 @@ public:
time_t timestamp =
(time_t) message_params["timestamp"].asInteger();
- BOOL is_do_not_disturb = gAgent.isDoNotDisturb();
+ bool is_do_not_disturb = gAgent.isDoNotDisturb();
//don't return if user is muted b/c proper way to ignore a muted user who
//initiated an adhoc/group conference is to create then leave the session (see STORM-1731)
@@ -4275,7 +4280,7 @@ public:
return;
}
- BOOL session_type_p2p = input["body"]["voice"].get("invitation_type").asInteger() == EMultiAgentChatSessionType::P2P_CHAT_SESSION;
+ bool session_type_p2p = input["body"]["voice"].get("invitation_type").asInteger() == EMultiAgentChatSessionType::P2P_CHAT_SESSION;
LL_DEBUGS("Voice") << "Received voice information from the server: " << input["body"]<< LL_ENDL;
gIMMgr->inviteToSession(
input["body"]["session_id"].asUUID(),