diff options
Diffstat (limited to 'indra/newview/llimview.cpp')
-rw-r--r-- | indra/newview/llimview.cpp | 135 |
1 files changed, 67 insertions, 68 deletions
diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index 187dbdd3a2..7ed10b062c 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -99,16 +99,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; } @@ -206,26 +206,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"); } @@ -233,24 +233,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"); } @@ -300,8 +300,7 @@ void notify_of_message(const LLSD& msg, bool is_dnd_msg) else { store_dnd_message = true; - } - + } } // 2. Flash line item @@ -714,7 +713,7 @@ LLIMModel::LLIMSession::LLIMSession(const LLUUID& session_id, const std::string& } 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); } @@ -742,7 +741,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()); @@ -931,7 +930,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); } } @@ -1189,7 +1188,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(); @@ -1251,7 +1250,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; @@ -1294,7 +1293,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() @@ -1304,7 +1303,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 @@ -1505,7 +1504,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; @@ -1761,7 +1760,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); @@ -1769,7 +1768,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, @@ -1789,7 +1788,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, @@ -1837,7 +1836,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(), @@ -1896,7 +1895,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); } } @@ -1961,7 +1960,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); @@ -1986,12 +1985,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; @@ -2115,7 +2114,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; } @@ -2198,7 +2197,7 @@ LLIMMgr::onConfirmForceCloseError( LLFloater* floater = LLFloaterIMSession::findInstance(session_id); if ( floater ) { - floater->closeFloater(FALSE); + floater->closeFloater(false); } return false; } @@ -2347,7 +2346,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); } @@ -2357,14 +2356,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) @@ -2438,7 +2437,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"); @@ -2627,13 +2626,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; } @@ -2681,14 +2680,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(); @@ -2698,14 +2697,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 @@ -2716,7 +2715,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; @@ -2767,8 +2766,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, @@ -2887,7 +2886,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; @@ -3062,7 +3061,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. @@ -3176,7 +3175,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"); } @@ -3437,7 +3436,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); @@ -3445,21 +3444,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 ) { @@ -3548,7 +3547,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 @@ -3570,7 +3569,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 @@ -3579,7 +3578,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; } @@ -3771,7 +3770,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; } @@ -3831,7 +3830,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"); @@ -3869,7 +3868,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(); @@ -3889,15 +3888,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); @@ -4098,7 +4097,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) |