From 7b8251fd2f169136fc45e4c17104da676f75727b Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Mon, 7 May 2012 21:54:09 +0300 Subject: CHUI-103 WIP Added settings for switching text view mode --- indra/newview/llimfloater.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'indra/newview/llimfloater.cpp') diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index f67464078b..f743b5e2bf 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -630,6 +630,9 @@ void LLIMFloater::updateMessages() { LLSD chat_args; chat_args["use_plain_text_chat_history"] = use_plain_text_chat_history; + chat_args["show_time"] = gSavedSettings.getBOOL("IMShowTime"); + chat_args["show_names_for_p2p_conv"] = + gSavedSettings.getBOOL("IMShowNamesForP2PConv"); std::ostringstream message; std::list::const_reverse_iterator iter = messages.rbegin(); -- cgit v1.2.3 From fac210075f4c68db372ae0535e332ffe9765a5d1 Mon Sep 17 00:00:00 2001 From: Seth ProductEngine Date: Mon, 7 May 2012 22:40:56 +0300 Subject: CHUI-105 WIP Added tear-off and return behavior for IM floater. XUI changed for Converstions multifloater and IM floater. --- indra/newview/llimfloater.cpp | 46 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) (limited to 'indra/newview/llimfloater.cpp') diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index f743b5e2bf..df3521ecb0 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -28,6 +28,7 @@ #include "llimfloater.h" +#include "lldraghandle.h" #include "llnotificationsutil.h" #include "llagent.h" @@ -251,6 +252,12 @@ BOOL LLIMFloater::postBuild() slide_right->setVisible(!mControlPanel->getParent()->getVisible()); slide_right->setClickedCallback(boost::bind(&LLIMFloater::onSlide, this)); + LLButton* return_btn = getChild("return_btn"); + return_btn->setCommitCallback(boost::bind(&LLFloater::onClickTearOff, this)); + + LLButton* tear_off_btn = getChild("tear_off_btn"); + tear_off_btn->setCommitCallback(boost::bind(&LLFloater::onClickTearOff, this)); + mInputEditor = getChild("chat_editor"); mInputEditor->setMaxTextLength(1023); // enable line history support for instant message bar @@ -1194,3 +1201,42 @@ void LLIMFloater::onClickCloseBtn() LLFloater::onClickCloseBtn(); } + +// virtual +void LLIMFloater::updateTitleButtons() +{ + if (!mDragHandle) + { + return; + } + + LLMultiFloater* host_floater = getHost(); + + bool is_hosted = host_floater != NULL; + if (is_hosted) ///< floater is hosted + { + for (S32 i = 0; i < BUTTON_COUNT; i++) + { + if (!mButtons[i]) + { + continue; + } + + // Hide the standard header buttons in a docked IM floater. + mButtons[i]->setVisible(false); + } + } + else ///< floater is torn off + { + LLFloater::updateTitleButtons(); + } + + // toggle floater's drag handle and title visibility + mDragHandle->setVisible(!is_hosted); + + LLButton* return_btn = getChild("return_btn"); + return_btn->setVisible(!is_hosted); + + LLButton* tear_off_btn = getChild("tear_off_btn"); + tear_off_btn->setVisible(is_hosted); +} -- cgit v1.2.3 From 905e56f8823e7513b35b9de4e5c6f8b0b6cca539 Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Tue, 8 May 2012 23:30:34 +0300 Subject: CHUI-103 FIXED Implemented switching text view modes from pop-up menu --- indra/newview/llimfloater.cpp | 54 ++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 51 insertions(+), 3 deletions(-) (limited to 'indra/newview/llimfloater.cpp') diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index df3521ecb0..d02db458b4 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -94,7 +94,7 @@ LLIMFloater::LLIMFloater(const LLUUID& session_id) case IM_SESSION_GROUP_START: mFactoryMap["panel_im_control_panel"] = LLCallbackMap(createPanelGroupControl, this); break; - case IM_SESSION_INVITE: + case IM_SESSION_INVITE: if (gAgent.isInGroup(mSessionID)) { mFactoryMap["panel_im_control_panel"] = LLCallbackMap(createPanelGroupControl, this); @@ -104,7 +104,8 @@ LLIMFloater::LLIMFloater(const LLUUID& session_id) mFactoryMap["panel_im_control_panel"] = LLCallbackMap(createPanelAdHocControl, this); } break; - default: break; + default: + break; } } setOverlapsScreenChannel(true); @@ -112,6 +113,52 @@ LLIMFloater::LLIMFloater(const LLUUID& session_id) LLTransientFloaterMgr::getInstance()->addControlView(LLTransientFloaterMgr::IM, this); setDocked(true); + mCommitCallbackRegistrar.add("IMSession.Menu.Action", + boost::bind(&LLIMFloater::onIMSessionMenuItemClicked, this, _2)); + mEnableCallbackRegistrar.add("IMSession.Menu.CompactExpandedModes.CheckItem", + boost::bind(&LLIMFloater::onIMCompactExpandedMenuItemCheck, this, _2)); + mEnableCallbackRegistrar.add("IMSession.Menu.ShowModes.CheckItem", + boost::bind(&LLIMFloater::onIMShowModesMenuItemCheck, this, _2)); + mEnableCallbackRegistrar.add("IMSession.Menu.ShowModes.Enable", + boost::bind(&LLIMFloater::onIMShowModesMenuItemEnable, this, _2)); +} + +bool LLIMFloater::onIMCompactExpandedMenuItemCheck(const LLSD& userdata) +{ + std::string item = userdata.asString(); + bool is_plain_text_mode = gSavedSettings.getBOOL("PlainTextChatHistory"); + + return is_plain_text_mode? item == "compact_view" : item == "expanded_view"; +} + +bool LLIMFloater::onIMShowModesMenuItemCheck(const LLSD& userdata) +{ + return gSavedSettings.getBOOL(userdata.asString()); +} + +bool LLIMFloater::onIMShowModesMenuItemEnable(const LLSD& userdata) +{ + std::string item = userdata.asString(); + bool plain_text = gSavedSettings.getBOOL("PlainTextChatHistory"); + bool is_not_names = (item != "IMShowNamesForP2PConv"); + bool is_p2p_chat = (mDialog == IM_SESSION_P2P_INVITE || mDialog == IM_NOTHING_SPECIAL); + return (plain_text && (is_not_names || is_p2p_chat)); +} + +void LLIMFloater::onIMSessionMenuItemClicked(const LLSD& userdata) +{ + std::string item = userdata.asString(); + + if (item == "compact_view" || item == "expanded_view") + { + gSavedSettings.setBOOL("PlainTextChatHistory", item == "compact_view"); + } + else + { bool prev_value = gSavedSettings.getBOOL(item); + gSavedSettings.setBOOL(item, !prev_value); + } + + reloadMessages(); } void LLIMFloater::onFocusLost() @@ -635,11 +682,12 @@ void LLIMFloater::updateMessages() if (messages.size()) { + bool is_p2p_chat = (mDialog == IM_SESSION_P2P_INVITE || mDialog == IM_NOTHING_SPECIAL); LLSD chat_args; chat_args["use_plain_text_chat_history"] = use_plain_text_chat_history; chat_args["show_time"] = gSavedSettings.getBOOL("IMShowTime"); chat_args["show_names_for_p2p_conv"] = - gSavedSettings.getBOOL("IMShowNamesForP2PConv"); + (!is_p2p_chat) || gSavedSettings.getBOOL("IMShowNamesForP2PConv"); std::ostringstream message; std::list::const_reverse_iterator iter = messages.rbegin(); -- cgit v1.2.3 From 7eaeb88bc37a747ff82fd37df84592f54c88cdbf Mon Sep 17 00:00:00 2001 From: Seth ProductEngine Date: Thu, 10 May 2012 20:40:15 +0300 Subject: CHUI-105 WIP Added expand/collapse behavior for Conversations floater messages pane. --- indra/newview/llimfloater.cpp | 70 ++++++++++++++++++++++++++++--------------- 1 file changed, 46 insertions(+), 24 deletions(-) (limited to 'indra/newview/llimfloater.cpp') diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index d02db458b4..b2a5c4a64d 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -67,6 +67,8 @@ LLIMFloater::LLIMFloater(const LLUUID& session_id) mDialog(IM_NOTHING_SPECIAL), mChatHistory(NULL), mInputEditor(NULL), + mExpandCollapseBtn(NULL), + mTearOffBtn(NULL), mSavedTitle(), mTypingStart(), mShouldSendTypingState(false), @@ -180,6 +182,17 @@ void LLIMFloater::onFocusReceived() } } +/*virtual*/ +void LLIMFloater::onOpen(const LLSD& key) +{ + LLIMFloaterContainer* host_floater = dynamic_cast(getHost()); + if (host_floater) + { + // Show the messages pane when opening a floater hosted in the Conversations + host_floater->toggleMessagesPane(true); + } +} + // virtual void LLIMFloater::onClose(bool app_quitting) { @@ -291,19 +304,14 @@ BOOL LLIMFloater::postBuild() mControlPanel->setSessionId(mSessionID); mControlPanel->getParent()->setVisible(gSavedSettings.getBOOL("IMShowControlPanel")); - LLButton* slide_left = getChild("slide_left_btn"); - slide_left->setVisible(mControlPanel->getParent()->getVisible()); - slide_left->setClickedCallback(boost::bind(&LLIMFloater::onSlide, this)); - - LLButton* slide_right = getChild("slide_right_btn"); - slide_right->setVisible(!mControlPanel->getParent()->getVisible()); - slide_right->setClickedCallback(boost::bind(&LLIMFloater::onSlide, this)); + getChild("close_btn")->setCommitCallback(boost::bind(&LLFloater::onClickClose, this)); - LLButton* return_btn = getChild("return_btn"); - return_btn->setCommitCallback(boost::bind(&LLFloater::onClickTearOff, this)); + mExpandCollapseBtn = getChild("expand_collapse_btn"); + mExpandCollapseBtn->setImageOverlay(getString(mControlPanel->getParent()->getVisible() ? "collapse_icon" : "expand_icon")); + mExpandCollapseBtn->setClickedCallback(boost::bind(&LLIMFloater::onSlide, this)); - LLButton* tear_off_btn = getChild("tear_off_btn"); - tear_off_btn->setCommitCallback(boost::bind(&LLFloater::onClickTearOff, this)); + mTearOffBtn = getChild("tear_off_btn"); + mTearOffBtn->setCommitCallback(boost::bind(&LLFloater::onClickTearOff, this)); mInputEditor = getChild("chat_editor"); mInputEditor->setMaxTextLength(1023); @@ -427,12 +435,23 @@ void* LLIMFloater::createPanelAdHocControl(void* userdata) void LLIMFloater::onSlide() { - mControlPanel->getParent()->setVisible(!mControlPanel->getParent()->getVisible()); + LLIMFloaterContainer* host_floater = dynamic_cast(getHost()); + if (host_floater) + { + // Hide the messages pane if a floater is hosted in the Conversations + host_floater->toggleMessagesPane(false); + } + else ///< floater is torn off + { + bool expand = !mControlPanel->getParent()->getVisible(); - gSavedSettings.setBOOL("IMShowControlPanel", mControlPanel->getParent()->getVisible()); + // Expand/collapse the IM control panel + mControlPanel->getParent()->setVisible(expand); - getChild("slide_left_btn")->setVisible(mControlPanel->getParent()->getVisible()); - getChild("slide_right_btn")->setVisible(!mControlPanel->getParent()->getVisible()); + gSavedSettings.setBOOL("IMShowControlPanel", expand); + + mExpandCollapseBtn->setImageOverlay(getString(expand ? "collapse_icon" : "expand_icon")); + } } //static @@ -1253,14 +1272,16 @@ void LLIMFloater::onClickCloseBtn() // virtual void LLIMFloater::updateTitleButtons() { - if (!mDragHandle) + // This gets called before LLIMFloater::postBuild() while some LLIMFloater members are NULL + if ( !mDragHandle + || !mControlPanel + || !mExpandCollapseBtn + || !mTearOffBtn) { return; } - LLMultiFloater* host_floater = getHost(); - - bool is_hosted = host_floater != NULL; + bool is_hosted = getHost() != NULL; if (is_hosted) ///< floater is hosted { for (S32 i = 0; i < BUTTON_COUNT; i++) @@ -1273,18 +1294,19 @@ void LLIMFloater::updateTitleButtons() // Hide the standard header buttons in a docked IM floater. mButtons[i]->setVisible(false); } + + mExpandCollapseBtn->setImageOverlay(getString("collapse_icon")); } else ///< floater is torn off { LLFloater::updateTitleButtons(); + + bool is_expanded = mControlPanel->getParent()->getVisible(); + mExpandCollapseBtn->setImageOverlay(getString(is_expanded ? "collapse_icon" : "expand_icon")); } // toggle floater's drag handle and title visibility mDragHandle->setVisible(!is_hosted); - - LLButton* return_btn = getChild("return_btn"); - return_btn->setVisible(!is_hosted); - LLButton* tear_off_btn = getChild("tear_off_btn"); - tear_off_btn->setVisible(is_hosted); + mTearOffBtn->setImageOverlay(getString(is_hosted ? "tear_off_icon" : "return_icon")); } -- cgit v1.2.3 From df58153514f6b361c65efc5dd6d31d39f68603c0 Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Mon, 14 May 2012 15:44:57 +0300 Subject: CHUI-113 WIP all voice controls is moved from a IM-control panel to the IM floater; IMControlPanel is removed; simplified voice button's listener behavior --- indra/newview/llimfloater.cpp | 192 +++++++++++++++++++++++++++++++----------- 1 file changed, 145 insertions(+), 47 deletions(-) (limited to 'indra/newview/llimfloater.cpp') diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index b2a5c4a64d..248e50eefa 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -51,14 +51,12 @@ #include "llchathistory.h" #include "llnotifications.h" #include "llviewerwindow.h" -#include "llvoicechannel.h" #include "lltransientfloatermgr.h" #include "llinventorymodel.h" #include "llrootview.h" #include "llspeakers.h" #include "llviewerchat.h" - LLIMFloater::LLIMFloater(const LLUUID& session_id) : LLTransientDockableFloater(NULL, true, session_id), mControlPanel(NULL), @@ -85,11 +83,8 @@ LLIMFloater::LLIMFloater(const LLUUID& session_id) mSessionInitialized = im_session->mSessionInitialized; mDialog = im_session->mType; - switch(mDialog){ - case IM_NOTHING_SPECIAL: - case IM_SESSION_P2P_INVITE: - mFactoryMap["panel_im_control_panel"] = LLCallbackMap(createPanelIMControl, this); - break; + switch (mDialog) + { case IM_SESSION_CONFERENCE_START: mFactoryMap["panel_im_control_panel"] = LLCallbackMap(createPanelAdHocControl, this); break; @@ -106,6 +101,8 @@ LLIMFloater::LLIMFloater(const LLUUID& session_id) mFactoryMap["panel_im_control_panel"] = LLCallbackMap(createPanelAdHocControl, this); } break; + case IM_NOTHING_SPECIAL: + case IM_SESSION_P2P_INVITE: default: break; } @@ -143,7 +140,8 @@ bool LLIMFloater::onIMShowModesMenuItemEnable(const LLSD& userdata) std::string item = userdata.asString(); bool plain_text = gSavedSettings.getBOOL("PlainTextChatHistory"); bool is_not_names = (item != "IMShowNamesForP2PConv"); - bool is_p2p_chat = (mDialog == IM_SESSION_P2P_INVITE || mDialog == IM_NOTHING_SPECIAL); + LLIMModel::LLIMSession* im_session = LLIMModel::instance().findIMSession(mSessionID); + bool is_p2p_chat = im_session && im_session->isP2PSessionType(); return (plain_text && (is_not_names || is_p2p_chat)); } @@ -289,6 +287,12 @@ void LLIMFloater::sendMsg() LLIMFloater::~LLIMFloater() { + mVoiceChannelStateChangeConnection.disconnect(); + if(LLVoiceClient::instanceExists()) + { + LLVoiceClient::getInstance()->removeObserver(this); + } + LLTransientFloaterMgr::getInstance()->removeControlView(LLTransientFloaterMgr::IM, this); } @@ -301,15 +305,27 @@ BOOL LLIMFloater::postBuild() mOtherParticipantUUID = other_party_id; } - mControlPanel->setSessionId(mSessionID); - mControlPanel->getParent()->setVisible(gSavedSettings.getBOOL("IMShowControlPanel")); + boundVoiceChannel(); getChild("close_btn")->setCommitCallback(boost::bind(&LLFloater::onClickClose, this)); mExpandCollapseBtn = getChild("expand_collapse_btn"); - mExpandCollapseBtn->setImageOverlay(getString(mControlPanel->getParent()->getVisible() ? "collapse_icon" : "expand_icon")); mExpandCollapseBtn->setClickedCallback(boost::bind(&LLIMFloater::onSlide, this)); + if (mControlPanel) + { + mControlPanel->setSessionId(mSessionID); + mControlPanel->getParent()->setVisible(gSavedSettings.getBOOL("IMShowControlPanel")); + + mExpandCollapseBtn->setImageOverlay( + getString(mControlPanel->getParent()->getVisible() ? "collapse_icon" : "expand_icon")); + } + else + { + mExpandCollapseBtn->setEnabled(false); + getChild("im_control_panel_holder")->setVisible(false); + } + mTearOffBtn = getChild("tear_off_btn"); mTearOffBtn->setCommitCallback(boost::bind(&LLFloater::onClickTearOff, this)); @@ -358,6 +374,10 @@ BOOL LLIMFloater::postBuild() std::string session_name(LLIMModel::instance().getName(mSessionID)); updateSessionName(session_name, session_name); } + + childSetAction("voice_call_btn", boost::bind(&LLIMFloater::onCallButtonClicked, this)); + + LLVoiceClient::getInstance()->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) @@ -372,6 +392,89 @@ BOOL LLIMFloater::postBuild() } } +void LLIMFloater::boundVoiceChannel() +{ + LLVoiceChannel* voice_channel = LLIMModel::getInstance()->getVoiceChannel(mSessionID); + if(voice_channel) + { + mVoiceChannelStateChangeConnection = voice_channel->setStateChangedCallback( + boost::bind(&LLIMFloater::onVoiceChannelStateChanged, this, _1, _2)); + + //call (either p2p, group or ad-hoc) can be already in started state + updateCallState(voice_channel->getState()); + } +} + +void LLIMFloater::updateCallState(LLVoiceChannel::EState state) +{ + bool is_call_started = state >= LLVoiceChannel::STATE_CALL_STARTED; + getChild("voice_call_btn")->setImageOverlay( + is_call_started? getString("call_btn_stop") : getString("call_btn_start")); + enableDisableCallBtn(); + +} + +void LLIMFloater::enableDisableCallBtn() +{ + bool voice_enabled = LLVoiceClient::getInstance()->voiceEnabled() + && LLVoiceClient::getInstance()->isVoiceWorking(); + + LLIMModel::LLIMSession* session = LLIMModel::getInstance()->findIMSession(mSessionID); + + if (!session) + { + getChildView("voice_call_btn")->setEnabled(false); + return; + } + + bool session_initialized = session->mSessionInitialized; + bool callback_enabled = session->mCallBackEnabled; + + BOOL enable_connect = session_initialized + && voice_enabled + && callback_enabled; + getChildView("voice_call_btn")->setEnabled(enable_connect); +} + + +void LLIMFloater::onCallButtonClicked() +{ + LLVoiceChannel* voice_channel = LLIMModel::getInstance()->getVoiceChannel(mSessionID); + if (voice_channel) + { + bool is_call_active = voice_channel->getState() >= LLVoiceChannel::STATE_CALL_STARTED; + if (is_call_active) + { + gIMMgr->endCall(mSessionID); + } + else + { + gIMMgr->startCall(mSessionID); + } + } +} + +/*void LLIMFloater::onOpenVoiceControlsClicked() +{ + LLFloaterReg::showInstance("voice_controls"); +}*/ + +void LLIMFloater::onChange(EStatusType status, const std::string &channelURI, bool proximal) +{ + if(status == STATUS_JOINING || status == STATUS_LEFT_CHANNEL) + { + return; + } + + enableDisableCallBtn(); +} + +void LLIMFloater::onVoiceChannelStateChanged( + const LLVoiceChannel::EState& old_state, const LLVoiceChannel::EState& new_state) +{ + updateCallState(new_state); +} + void LLIMFloater::updateSessionName(const std::string& ui_title, const std::string& ui_label) { @@ -404,17 +507,6 @@ void LLIMFloater::draw() LLTransientDockableFloater::draw(); } - -// static -void* LLIMFloater::createPanelIMControl(void* userdata) -{ - LLIMFloater *self = (LLIMFloater*)userdata; - self->mControlPanel = new LLPanelIMControlPanel(); - self->mControlPanel->setXMLFilename("panel_im_control_panel.xml"); - return self->mControlPanel; -} - - // static void* LLIMFloater::createPanelGroupControl(void* userdata) { @@ -443,14 +535,17 @@ void LLIMFloater::onSlide() } else ///< floater is torn off { - bool expand = !mControlPanel->getParent()->getVisible(); + if (mControlPanel) + { + bool expand = !mControlPanel->getParent()->getVisible(); - // Expand/collapse the IM control panel - mControlPanel->getParent()->setVisible(expand); + // Expand/collapse the IM control panel + mControlPanel->getParent()->setVisible(expand); - gSavedSettings.setBOOL("IMShowControlPanel", expand); + gSavedSettings.setBOOL("IMShowControlPanel", expand); - mExpandCollapseBtn->setImageOverlay(getString(expand ? "collapse_icon" : "expand_icon")); + mExpandCollapseBtn->setImageOverlay(getString(expand ? "collapse_icon" : "expand_icon")); + } } } @@ -659,15 +754,13 @@ void LLIMFloater::sessionInitReplyReceived(const LLUUID& im_session_id) { mSessionID = im_session_id; setKey(im_session_id); - mControlPanel->setSessionId(im_session_id); + if (mControlPanel) + { + mControlPanel->setSessionId(im_session_id); + } + boundVoiceChannel(); } - // updating "Call" button from group control panel here to enable it without placing into draw() (EXT-4796) - if(gAgent.isInGroup(im_session_id)) - { - mControlPanel->updateCallButton(); - } - //*TODO here we should remove "starting session..." warning message if we added it in postBuild() (IB) @@ -910,13 +1003,6 @@ void LLIMFloater::processAgentListUpdates(const LLSD& body) } } -void LLIMFloater::updateChatHistoryStyle() -{ - mChatHistory->clear(); - mLastMessageIndex = -1; - updateMessages(); -} - void LLIMFloater::processChatHistoryStyleUpdate(const LLSD& newvalue) { LLFontGL* font = LLViewerChat::getChatFont(); @@ -927,11 +1013,10 @@ void LLIMFloater::processChatHistoryStyleUpdate(const LLSD& newvalue) LLIMFloater* floater = dynamic_cast(*iter); if (floater) { - floater->updateChatHistoryStyle(); + floater->reloadMessages(); floater->mInputEditor->setFont(font); } } - } void LLIMFloater::processSessionUpdate(const LLSD& session_update) @@ -1152,7 +1237,6 @@ void LLIMFloater::removeTypingIndicator(const LLIMInfo* im_info) speaker_mgr->setSpeakerTyping(im_info->mFromID, FALSE); } } - } } @@ -1274,7 +1358,7 @@ void LLIMFloater::updateTitleButtons() { // This gets called before LLIMFloater::postBuild() while some LLIMFloater members are NULL if ( !mDragHandle - || !mControlPanel + //|| !mControlPanel || !mExpandCollapseBtn || !mTearOffBtn) { @@ -1301,8 +1385,22 @@ void LLIMFloater::updateTitleButtons() { LLFloater::updateTitleButtons(); - bool is_expanded = mControlPanel->getParent()->getVisible(); - mExpandCollapseBtn->setImageOverlay(getString(is_expanded ? "collapse_icon" : "expand_icon")); + if (mControlPanel) + { + bool is_expanded = mControlPanel->getParent()->getVisible(); + mExpandCollapseBtn->setImageOverlay(getString(is_expanded ? "collapse_icon" : "expand_icon")); + } + } + + LLIMModel::LLIMSession* session = LLIMModel::instance().findIMSession(mSessionID); + if (session) + { + mExpandCollapseBtn->setEnabled(is_hosted || !session->isP2PSessionType()); + } + else + { + llwarns << "Empty session." << llendl; + return; } // toggle floater's drag handle and title visibility -- cgit v1.2.3 From 6cd68b321147136b2ad79fdbfeafdd2ffc39f1a3 Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Mon, 14 May 2012 16:03:39 +0300 Subject: Formatting fixes --- indra/newview/llimfloater.cpp | 299 ++++++++++++++++++++++-------------------- 1 file changed, 155 insertions(+), 144 deletions(-) (limited to 'indra/newview/llimfloater.cpp') diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index 248e50eefa..cb489627fb 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -115,11 +115,11 @@ LLIMFloater::LLIMFloater(const LLUUID& session_id) mCommitCallbackRegistrar.add("IMSession.Menu.Action", boost::bind(&LLIMFloater::onIMSessionMenuItemClicked, this, _2)); mEnableCallbackRegistrar.add("IMSession.Menu.CompactExpandedModes.CheckItem", - boost::bind(&LLIMFloater::onIMCompactExpandedMenuItemCheck, this, _2)); + boost::bind(&LLIMFloater::onIMCompactExpandedMenuItemCheck, this, _2)); mEnableCallbackRegistrar.add("IMSession.Menu.ShowModes.CheckItem", - boost::bind(&LLIMFloater::onIMShowModesMenuItemCheck, this, _2)); + boost::bind(&LLIMFloater::onIMShowModesMenuItemCheck, this, _2)); mEnableCallbackRegistrar.add("IMSession.Menu.ShowModes.Enable", - boost::bind(&LLIMFloater::onIMShowModesMenuItemEnable, this, _2)); + boost::bind(&LLIMFloater::onIMShowModesMenuItemEnable, this, _2)); } bool LLIMFloater::onIMCompactExpandedMenuItemCheck(const LLSD& userdata) @@ -154,7 +154,8 @@ void LLIMFloater::onIMSessionMenuItemClicked(const LLSD& userdata) gSavedSettings.setBOOL("PlainTextChatHistory", item == "compact_view"); } else - { bool prev_value = gSavedSettings.getBOOL(item); + { + bool prev_value = gSavedSettings.getBOOL(item); gSavedSettings.setBOOL(item, !prev_value); } @@ -164,7 +165,7 @@ void LLIMFloater::onIMSessionMenuItemClicked(const LLSD& userdata) void LLIMFloater::onFocusLost() { LLIMModel::getInstance()->resetActiveSessionID(); - + LLChicletBar::getInstance()->getChicletPanel()->setChicletToggleState(mSessionID, false); } @@ -205,8 +206,8 @@ void LLIMFloater::onClose(bool app_quitting) } /* static */ -void LLIMFloater::newIMCallback(const LLSD& data){ - +void LLIMFloater::newIMCallback(const LLSD& data) +{ if (data["num_unread"].asInteger() > 0 || data["from_id"].asUUID().isNull()) { LLUUID session_id = data["session_id"].asUUID(); @@ -214,7 +215,7 @@ void LLIMFloater::newIMCallback(const LLSD& data){ LLIMFloater* floater = LLFloaterReg::findTypedInstance("impanel", session_id); if (floater == NULL) return; - // update if visible, otherwise will be updated when opened + // update if visible, otherwise will be updated when opened if (floater->getVisible()) { floater->updateMessages(); @@ -229,7 +230,7 @@ void LLIMFloater::onVisibilityChange(const LLSD& new_visibility) LLVoiceChannel* voice_channel = LLIMModel::getInstance()->getVoiceChannel(mSessionID); if (visible && voice_channel && - voice_channel->getState() == LLVoiceChannel::STATE_CONNECTED) + voice_channel->getState() == LLVoiceChannel::STATE_CONNECTED) { LLFloaterReg::showInstance("voice_call", mSessionID); } @@ -248,9 +249,9 @@ void LLIMFloater::onSendMsg( LLUICtrl* ctrl, void* userdata ) void LLIMFloater::sendMsg() { - if (!gAgent.isGodlike() - && (mDialog == IM_NOTHING_SPECIAL) - && mOtherParticipantUUID.isNull()) + if (!gAgent.isGodlike() + && (mDialog == IM_NOTHING_SPECIAL) + && mOtherParticipantUUID.isNull()) { llinfos << "Cannot send IM to everyone unless you're a god." << llendl; return; @@ -259,16 +260,15 @@ void LLIMFloater::sendMsg() if (mInputEditor) { LLWString text = mInputEditor->getConvertedText(); - if(!text.empty()) + if (!text.empty()) { // Truncate and convert to UTF8 for transport std::string utf8_text = wstring_to_utf8str(text); utf8_text = utf8str_truncate(utf8_text, MAX_MSG_BUF_SIZE - 1); - + if (mSessionInitialized) { - LLIMModel::sendMessage(utf8_text, mSessionID, - mOtherParticipantUUID,mDialog); + LLIMModel::sendMessage(utf8_text, mSessionID, mOtherParticipantUUID, mDialog); } else { @@ -283,8 +283,6 @@ void LLIMFloater::sendMsg() } } - - LLIMFloater::~LLIMFloater() { mVoiceChannelStateChangeConnection.disconnect(); @@ -299,7 +297,8 @@ LLIMFloater::~LLIMFloater() //virtual BOOL LLIMFloater::postBuild() { - const LLUUID& other_party_id = LLIMModel::getInstance()->getOtherParticipantID(mSessionID); + const LLUUID& other_party_id = + LLIMModel::getInstance()->getOtherParticipantID(mSessionID); if (other_party_id.notNull()) { mOtherParticipantUUID = other_party_id; @@ -335,8 +334,8 @@ BOOL LLIMFloater::postBuild() mInputEditor->setEnableLineHistory(TRUE); LLFontGL* font = LLViewerChat::getChatFont(); - mInputEditor->setFont(font); - + mInputEditor->setFont(font); + mInputEditor->setFocusReceivedCallback( boost::bind(onInputEditorFocusReceived, _1, this) ); mInputEditor->setFocusLostCallback( boost::bind(onInputEditorFocusLost, _1, this) ); mInputEditor->setKeystrokeCallback( onInputEditorKeystroke, this ); @@ -346,7 +345,7 @@ BOOL LLIMFloater::postBuild() mInputEditor->setPassDelete( TRUE ); childSetCommitCallback("chat_editor", onSendMsg, this); - + mChatHistory = getChild("chat_history"); setDocked(true); @@ -355,19 +354,19 @@ BOOL LLIMFloater::postBuild() // Disable input editor if session cannot accept text LLIMModel::LLIMSession* im_session = - LLIMModel::instance().findIMSession(mSessionID); - if( im_session && !im_session->mTextIMPossible ) + LLIMModel::instance().findIMSession(mSessionID); + if ( im_session && !im_session->mTextIMPossible ) { mInputEditor->setEnabled(FALSE); mInputEditor->setLabel(LLTrans::getString("IM_unavailable_text_label")); } - if ( im_session && im_session->isP2PSessionType()) + if (im_session && im_session->isP2PSessionType()) { // look up display name for window title LLAvatarNameCache::get(im_session->mOtherParticipantID, - boost::bind(&LLIMFloater::onAvatarNameCache, - this, _1, _2)); + boost::bind(&LLIMFloater::onAvatarNameCache, + this, _1, _2)); } else { @@ -382,7 +381,7 @@ BOOL LLIMFloater::postBuild() //*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) - if(isChatMultiTab()) + if (isChatMultiTab()) { return LLFloater::postBuild(); } @@ -476,14 +475,14 @@ void LLIMFloater::onVoiceChannelStateChanged( } void LLIMFloater::updateSessionName(const std::string& ui_title, - const std::string& ui_label) + const std::string& ui_label) { mInputEditor->setLabel(LLTrans::getString("IM_to_label") + " " + ui_label); - setTitle(ui_title); + setTitle(ui_title); } void LLIMFloater::onAvatarNameCache(const LLUUID& agent_id, - const LLAvatarName& av_name) + const LLAvatarName& av_name) { // Use display name only for labels, as the extended name will be in the // floater title @@ -498,7 +497,7 @@ void LLIMFloater::draw() if ( mMeTyping ) { // Time out if user hasn't typed for a while. - if ( mTypingTimeoutTimer.getElapsedTimeF32() > LLAgent::TYPING_TIMEOUT_SECS ) + if (mTypingTimeoutTimer.getElapsedTimeF32() > LLAgent::TYPING_TIMEOUT_SECS) { setTyping(false); } @@ -510,7 +509,7 @@ void LLIMFloater::draw() // static void* LLIMFloater::createPanelGroupControl(void* userdata) { - LLIMFloater *self = (LLIMFloater*)userdata; + LLIMFloater *self = (LLIMFloater*) userdata; self->mControlPanel = new LLPanelGroupControlPanel(self->mSessionID); self->mControlPanel->setXMLFilename("panel_group_control_panel.xml"); return self->mControlPanel; @@ -519,7 +518,7 @@ void* LLIMFloater::createPanelGroupControl(void* userdata) // static void* LLIMFloater::createPanelAdHocControl(void* userdata) { - LLIMFloater *self = (LLIMFloater*)userdata; + LLIMFloater *self = (LLIMFloater*) userdata; self->mControlPanel = new LLPanelAdHocControlPanel(self->mSessionID); self->mControlPanel->setXMLFilename("panel_adhoc_control_panel.xml"); return self->mControlPanel; @@ -554,14 +553,15 @@ LLIMFloater* LLIMFloater::show(const LLUUID& session_id) { closeHiddenIMToasts(); - if (!gIMMgr->hasSession(session_id)) return NULL; + if (!gIMMgr->hasSession(session_id)) + return NULL; - if(!isChatMultiTab()) + if (!isChatMultiTab()) { //hide all LLFloaterReg::const_instance_list_t& inst_list = LLFloaterReg::getFloaterList("impanel"); for (LLFloaterReg::const_instance_list_t::const_iterator iter = inst_list.begin(); - iter != inst_list.end(); ++iter) + iter != inst_list.end(); ++iter) { LLIMFloater* floater = dynamic_cast(*iter); if (floater && floater->isDocked()) @@ -574,9 +574,10 @@ LLIMFloater* LLIMFloater::show(const LLUUID& session_id) bool exist = findInstance(session_id); LLIMFloater* floater = getInstance(session_id); - if (!floater) return NULL; + if (!floater) + return NULL; - if(isChatMultiTab()) + if (isChatMultiTab()) { LLIMFloaterContainer* floater_container = LLIMFloaterContainer::getInstance(); @@ -586,7 +587,7 @@ LLIMFloater* LLIMFloater::show(const LLUUID& session_id) // LLTabContainer::eInsertionPoint i_pt = user_initiated ? LLTabContainer::RIGHT_OF_CURRENT : LLTabContainer::END; // TODO: mantipov: use LLTabContainer::RIGHT_OF_CURRENT if it exists LLTabContainer::eInsertionPoint i_pt = LLTabContainer::END; - + if (floater_container) { floater_container->addFloater(floater, TRUE, i_pt); @@ -629,16 +630,16 @@ void LLIMFloater::setDocked(bool docked, bool pop_on_undock) { // update notification channel state LLNotificationsUI::LLScreenChannel* channel = static_cast - (LLNotificationsUI::LLChannelManager::getInstance()-> - findChannelByID(LLUUID(gSavedSettings.getString("NotificationChannelUUID")))); - - if(!isChatMultiTab()) + (LLNotificationsUI::LLChannelManager::getInstance()-> + findChannelByID(LLUUID(gSavedSettings.getString("NotificationChannelUUID")))); + + if (!isChatMultiTab()) { LLTransientDockableFloater::setDocked(docked, pop_on_undock); } // update notification channel state - if(channel) + if (channel) { channel->updateShowToastsState(); channel->redrawToasts(); @@ -648,12 +649,12 @@ void LLIMFloater::setDocked(bool docked, bool pop_on_undock) void LLIMFloater::setVisible(BOOL visible) { LLNotificationsUI::LLScreenChannel* channel = static_cast - (LLNotificationsUI::LLChannelManager::getInstance()-> - findChannelByID(LLUUID(gSavedSettings.getString("NotificationChannelUUID")))); + (LLNotificationsUI::LLChannelManager::getInstance()-> + findChannelByID(LLUUID(gSavedSettings.getString("NotificationChannelUUID")))); LLTransientDockableFloater::setVisible(visible); // update notification channel state - if(channel) + if (channel) { channel->updateShowToastsState(); channel->redrawToasts(); @@ -674,10 +675,10 @@ void LLIMFloater::setVisible(BOOL visible) } } - if(!visible) + if (!visible) { LLIMChiclet* chiclet = LLChicletBar::getInstance()->getChicletPanel()->findChiclet(mSessionID); - if(chiclet) + if (chiclet) { chiclet->setToggleState(false); } @@ -686,13 +687,14 @@ void LLIMFloater::setVisible(BOOL visible) BOOL LLIMFloater::getVisible() { - if(isChatMultiTab()) + if (isChatMultiTab()) { - LLIMFloaterContainer* im_container = LLIMFloaterContainer::getInstance(); - + LLIMFloaterContainer* im_container = + LLIMFloaterContainer::getInstance(); + // Treat inactive floater as invisible. bool is_active = im_container->getActiveFloater() == this; - + //torn off floater is always inactive if (!is_active && getHost() != im_container) { @@ -700,7 +702,8 @@ BOOL LLIMFloater::getVisible() } // getVisible() returns TRUE when Tabbed IM window is minimized. - return is_active && !im_container->isMinimized() && im_container->getVisible(); + return is_active && !im_container->isMinimized() + && im_container->getVisible(); } else { @@ -711,9 +714,10 @@ BOOL LLIMFloater::getVisible() //static bool LLIMFloater::toggle(const LLUUID& session_id) { - if(!isChatMultiTab()) + if (!isChatMultiTab()) { - LLIMFloater* floater = LLFloaterReg::findTypedInstance("impanel", session_id); + LLIMFloater* floater = LLFloaterReg::findTypedInstance( + "impanel", session_id); if (floater && floater->getVisible() && floater->hasFocus()) { // clicking on chiclet to close floater just hides it to maintain existing @@ -721,7 +725,7 @@ bool LLIMFloater::toggle(const LLUUID& session_id) floater->setVisible(false); return false; } - else if(floater && (!floater->isDocked() || floater->getVisible() && !floater->hasFocus())) + else if (floater && (!floater->isDocked() || floater->getVisible() && !floater->hasFocus())) { floater->setVisible(TRUE); floater->setFocus(TRUE); @@ -763,16 +767,15 @@ void LLIMFloater::sessionInitReplyReceived(const LLUUID& im_session_id) //*TODO here we should remove "starting session..." warning message if we added it in postBuild() (IB) - //need to send delayed messaged collected while waiting for session initialization - if (!mQueuedMsgsForInit.size()) return; + if (!mQueuedMsgsForInit.size()) + return; LLSD::array_iterator iter; - for ( iter = mQueuedMsgsForInit.beginArray(); - iter != mQueuedMsgsForInit.endArray(); - ++iter) + for (iter = mQueuedMsgsForInit.beginArray(); + iter != mQueuedMsgsForInit.endArray(); ++iter) { LLIMModel::sendMessage(iter->asString(), mSessionID, - mOtherParticipantUUID, mDialog); + mOtherParticipantUUID, mDialog); } } @@ -785,11 +788,11 @@ void LLIMFloater::updateMessages() // we shouldn't reset unread message counters if IM floater doesn't have focus if (hasFocus()) { - LLIMModel::instance().getMessages(mSessionID, messages, mLastMessageIndex+1); + LLIMModel::instance().getMessages(mSessionID, messages, mLastMessageIndex + 1); } else { - LLIMModel::instance().getMessagesSilently(mSessionID, messages, mLastMessageIndex+1); + LLIMModel::instance().getMessagesSilently(mSessionID, messages, mLastMessageIndex + 1); } if (messages.size()) @@ -798,8 +801,7 @@ void LLIMFloater::updateMessages() LLSD chat_args; chat_args["use_plain_text_chat_history"] = use_plain_text_chat_history; chat_args["show_time"] = gSavedSettings.getBOOL("IMShowTime"); - chat_args["show_names_for_p2p_conv"] = - (!is_p2p_chat) || gSavedSettings.getBOOL("IMShowNamesForP2PConv"); + chat_args["show_names_for_p2p_conv"] = (!is_p2p_chat) || gSavedSettings.getBOOL("IMShowNamesForP2PConv"); std::ostringstream message; std::list::const_reverse_iterator iter = messages.rbegin(); @@ -830,8 +832,8 @@ void LLIMFloater::updateMessages() { // remove embedded notification from channel LLNotificationsUI::LLScreenChannel* channel = static_cast - (LLNotificationsUI::LLChannelManager::getInstance()-> - findChannelByID(LLUUID(gSavedSettings.getString("NotificationChannelUUID")))); + (LLNotificationsUI::LLChannelManager::getInstance()-> + findChannelByID(LLUUID(gSavedSettings.getString("NotificationChannelUUID")))); if (getVisible()) { // toast will be automatically closed since it is not storable toast @@ -849,7 +851,7 @@ void LLIMFloater::updateMessages() { chat.mText = message; } - + mChatHistory->appendMessage(chat, chat_args); mLastMessageIndex = msg["index"].asInteger(); @@ -857,16 +859,16 @@ void LLIMFloater::updateMessages() if (chat.mNotifId.notNull() && LLNotificationsUtil::find(chat.mNotifId) != NULL) { if (++iter == iter_end) - { - break; - } - else - { - mLastMessageIndex++; - } - } - } - } + { + break; + } + else + { + mLastMessageIndex++; + } + } + } + } } void LLIMFloater::reloadMessages() @@ -877,15 +879,15 @@ void LLIMFloater::reloadMessages() } // static -void LLIMFloater::onInputEditorFocusReceived( LLFocusableElement* caller, void* userdata ) +void LLIMFloater::onInputEditorFocusReceived(LLFocusableElement* caller, void* userdata) { - LLIMFloater* self= (LLIMFloater*) userdata; + LLIMFloater* self = (LLIMFloater*) userdata; // Allow enabling the LLIMFloater input editor only if session can accept text LLIMModel::LLIMSession* im_session = - LLIMModel::instance().findIMSession(self->mSessionID); + LLIMModel::instance().findIMSession(self->mSessionID); //TODO: While disabled lllineeditor can receive focus we need to check if it is enabled (EK) - if( im_session && im_session->mTextIMPossible && self->mInputEditor->getEnabled()) + if (im_session && im_session->mTextIMPossible && self->mInputEditor->getEnabled()) { //in disconnected state IM input editor should be disabled self->mInputEditor->setEnabled(!gDisconnected); @@ -902,7 +904,7 @@ void LLIMFloater::onInputEditorFocusLost(LLFocusableElement* caller, void* userd // static void LLIMFloater::onInputEditorKeystroke(LLLineEditor* caller, void* userdata) { - LLIMFloater* self = (LLIMFloater*)userdata; + LLIMFloater* self = (LLIMFloater*) userdata; std::string text = self->mInputEditor->getText(); if (!text.empty()) { @@ -917,13 +919,13 @@ void LLIMFloater::onInputEditorKeystroke(LLLineEditor* caller, void* userdata) void LLIMFloater::setTyping(bool typing) { - if ( typing ) + if (typing) { // Started or proceeded typing, reset the typing timeout timer mTypingTimeoutTimer.reset(); } - if ( mMeTyping != typing ) + if (mMeTyping != typing) { // Typing state is changed mMeTyping = typing; @@ -935,21 +937,23 @@ void LLIMFloater::setTyping(bool typing) // Don't want to send typing indicators to multiple people, potentially too // much network traffic. Only send in person-to-person IMs. - if ( mShouldSendTypingState && mDialog == IM_NOTHING_SPECIAL ) + if (mShouldSendTypingState && mDialog == IM_NOTHING_SPECIAL) { - if ( mMeTyping ) + if (mMeTyping) { - if ( mTypingTimer.getElapsedTimeF32() > 1.f ) + 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; } } else { // Send 'stop typing' notification immediately - LLIMModel::instance().sendTypingState(mSessionID, mOtherParticipantUUID, FALSE); + LLIMModel::instance().sendTypingState(mSessionID, + mOtherParticipantUUID, FALSE); mShouldSendTypingState = false; } } @@ -962,7 +966,7 @@ void LLIMFloater::setTyping(bool typing) void LLIMFloater::processIMTyping(const LLIMInfo* im_info, BOOL typing) { - if ( typing ) + if (typing) { // other user started typing addTypingIndicator(im_info); @@ -976,9 +980,10 @@ void LLIMFloater::processIMTyping(const LLIMInfo* im_info, BOOL typing) void LLIMFloater::processAgentListUpdates(const LLSD& body) { - if ( !body.isMap() ) return; + if (!body.isMap()) + return; - if ( body.has("agent_updates") && body["agent_updates"].isMap() ) + if (body.has("agent_updates") && body["agent_updates"].isMap()) { LLSD agent_data = body["agent_updates"].get(gAgentID.asString()); if (agent_data.isMap() && agent_data.has("info")) @@ -987,7 +992,7 @@ void LLIMFloater::processAgentListUpdates(const LLSD& body) if (agent_info.has("mutes")) { - BOOL moderator_muted_text = agent_info["mutes"]["text"].asBoolean(); + BOOL moderator_muted_text = agent_info["mutes"]["text"].asBoolean(); mInputEditor->setEnabled(!moderator_muted_text); std::string label; if (moderator_muted_text) @@ -1008,7 +1013,7 @@ void LLIMFloater::processChatHistoryStyleUpdate(const LLSD& newvalue) LLFontGL* font = LLViewerChat::getChatFont(); LLFloaterReg::const_instance_list_t& inst_list = LLFloaterReg::getFloaterList("impanel"); for (LLFloaterReg::const_instance_list_t::const_iterator iter = inst_list.begin(); - iter != inst_list.end(); ++iter) + iter != inst_list.end(); ++iter) { LLIMFloater* floater = dynamic_cast(*iter); if (floater) @@ -1022,15 +1027,16 @@ void LLIMFloater::processChatHistoryStyleUpdate(const LLSD& newvalue) void LLIMFloater::processSessionUpdate(const LLSD& session_update) { // *TODO : verify following code when moderated mode will be implemented - if ( false && session_update.has("moderated_mode") && - session_update["moderated_mode"].has("voice") ) + if (false && session_update.has("moderated_mode") && + session_update["moderated_mode"].has("voice")) { BOOL voice_moderated = session_update["moderated_mode"]["voice"]; const std::string session_label = LLIMModel::instance().getName(mSessionID); if (voice_moderated) { - setTitle(session_label + std::string(" ") + LLTrans::getString("IM_moderated_chat_label")); + setTitle(session_label + std::string(" ") + + LLTrans::getString("IM_moderated_chat_label")); } else { @@ -1044,15 +1050,14 @@ void LLIMFloater::processSessionUpdate(const LLSD& session_update) } BOOL LLIMFloater::handleDragAndDrop(S32 x, S32 y, MASK mask, - BOOL drop, EDragAndDropType cargo_type, - void *cargo_data, EAcceptance *accept, - std::string& tooltip_msg) + BOOL drop, EDragAndDropType cargo_type, + void *cargo_data, EAcceptance *accept, + std::string& tooltip_msg) { - if (mDialog == IM_NOTHING_SPECIAL) { LLToolDragAndDrop::handleGiveDragAndDrop(mOtherParticipantUUID, mSessionID, drop, - cargo_type, cargo_data, accept); + cargo_type, cargo_data, accept); } // handle case for dropping calling cards (and folders of calling cards) onto invitation panel for invites @@ -1062,14 +1067,14 @@ BOOL LLIMFloater::handleDragAndDrop(S32 x, S32 y, MASK mask, if (cargo_type == DAD_CALLINGCARD) { - if (dropCallingCard((LLInventoryItem*)cargo_data, drop)) + if (dropCallingCard((LLInventoryItem*) cargo_data, drop)) { *accept = ACCEPT_YES_MULTI; } } else if (cargo_type == DAD_CATEGORY) { - if (dropCategory((LLInventoryCategory*)cargo_data, drop)) + if (dropCategory((LLInventoryCategory*) cargo_data, drop)) { *accept = ACCEPT_YES_MULTI; } @@ -1081,9 +1086,9 @@ BOOL LLIMFloater::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL LLIMFloater::dropCallingCard(LLInventoryItem* item, BOOL drop) { BOOL rv = isInviteAllowed(); - if(rv && item && item->getCreatorUUID().notNull()) + if (rv && item && item->getCreatorUUID().notNull()) { - if(drop) + if (drop) { uuid_vec_t ids; ids.push_back(item->getCreatorUUID()); @@ -1101,26 +1106,26 @@ BOOL LLIMFloater::dropCallingCard(LLInventoryItem* item, BOOL drop) BOOL LLIMFloater::dropCategory(LLInventoryCategory* category, BOOL drop) { BOOL rv = isInviteAllowed(); - if(rv && category) + if (rv && category) { LLInventoryModel::cat_array_t cats; LLInventoryModel::item_array_t items; LLUniqueBuddyCollector buddies; gInventory.collectDescendentsIf(category->getUUID(), - cats, - items, - LLInventoryModel::EXCLUDE_TRASH, - buddies); + cats, + items, + LLInventoryModel::EXCLUDE_TRASH, + buddies); S32 count = items.count(); - if(count == 0) + if (count == 0) { rv = FALSE; } - else if(drop) + else if (drop) { uuid_vec_t ids; ids.reserve(count); - for(S32 i = 0; i < count; ++i) + for (S32 i = 0; i < count; ++i) { ids.push_back(items.get(i)->getCreatorUUID()); } @@ -1132,12 +1137,11 @@ BOOL LLIMFloater::dropCategory(LLInventoryCategory* category, BOOL drop) BOOL LLIMFloater::isInviteAllowed() const { - - return ( (IM_SESSION_CONFERENCE_START == mDialog) - || (IM_SESSION_INVITE == mDialog) ); + return ((IM_SESSION_CONFERENCE_START == mDialog) + || (IM_SESSION_INVITE == mDialog)); } -class LLSessionInviteResponder : public LLHTTPClient::Responder +class LLSessionInviteResponder: public LLHTTPClient::Responder { public: LLSessionInviteResponder(const LLUUID& session_id) @@ -1165,7 +1169,7 @@ BOOL LLIMFloater::inviteToSession(const uuid_vec_t& ids) S32 count = ids.size(); - if( isInviteAllowed() && (count > 0) ) + if (isInviteAllowed() && (count > 0)) { llinfos << "LLIMFloater::inviteToSession() - inviting participants" << llendl; @@ -1182,10 +1186,9 @@ BOOL LLIMFloater::inviteToSession(const uuid_vec_t& ids) data["method"] = "invite"; data["session-id"] = mSessionID; LLHTTPClient::post( - url, - data, - new LLSessionInviteResponder( - mSessionID)); + url, + data, + new LLSessionInviteResponder(mSessionID)); } else { @@ -1202,17 +1205,17 @@ BOOL LLIMFloater::inviteToSession(const uuid_vec_t& ids) void LLIMFloater::addTypingIndicator(const LLIMInfo* im_info) { // We may have lost a "stop-typing" packet, don't add it twice - if ( im_info && !mOtherTyping ) + if (im_info && !mOtherTyping) { mOtherTyping = true; // Save and set new title mSavedTitle = getTitle(); - setTitle (mTypingStart); + setTitle(mTypingStart); // Update speaker LLIMSpeakerMgr* speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(mSessionID); - if ( speaker_mgr ) + if (speaker_mgr) { speaker_mgr->setSpeakerTyping(im_info->mFromID, TRUE); } @@ -1221,18 +1224,18 @@ void LLIMFloater::addTypingIndicator(const LLIMInfo* im_info) void LLIMFloater::removeTypingIndicator(const LLIMInfo* im_info) { - if ( mOtherTyping ) + if (mOtherTyping) { mOtherTyping = false; // Revert the title to saved one setTitle(mSavedTitle); - if ( im_info ) + if (im_info) { // Update speaker LLIMSpeakerMgr* speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(mSessionID); - if ( speaker_mgr ) + if (speaker_mgr) { speaker_mgr->setSpeakerTyping(im_info->mFromID, FALSE); } @@ -1253,7 +1256,8 @@ void LLIMFloater::closeHiddenIMToasts() } }; - LLNotificationsUI::LLScreenChannel* channel = LLNotificationsUI::LLChannelManager::getNotificationScreenChannel(); + LLNotificationsUI::LLScreenChannel* channel = + LLNotificationsUI::LLChannelManager::getNotificationScreenChannel(); if (channel != NULL) { channel->closeHiddenToasts(IMToastMatcher()); @@ -1295,28 +1299,34 @@ void LLIMFloater::initIMFloater() void LLIMFloater::sRemoveTypingIndicator(const LLSD& data) { LLUUID session_id = data["session_id"]; - if (session_id.isNull()) return; + if (session_id.isNull()) + return; LLUUID from_id = data["from_id"]; - if (gAgentID == from_id || LLUUID::null == from_id) return; + if (gAgentID == from_id || LLUUID::null == from_id) + return; LLIMFloater* floater = LLIMFloater::findInstance(session_id); - if (!floater) return; + if (!floater) + return; - if (IM_NOTHING_SPECIAL != floater->mDialog) return; + if (IM_NOTHING_SPECIAL != floater->mDialog) + return; floater->removeTypingIndicator(); } -void LLIMFloater::onIMChicletCreated( const LLUUID& session_id ) +void LLIMFloater::onIMChicletCreated(const LLUUID& session_id) { if (isChatMultiTab()) { LLIMFloaterContainer* im_box = LLIMFloaterContainer::getInstance(); - if (!im_box) return; + if (!im_box) + return; - if (LLIMFloater::findInstance(session_id)) return; + if (LLIMFloater::findInstance(session_id)) + return; LLIMFloater* new_tab = LLIMFloater::getInstance(session_id); @@ -1325,11 +1335,11 @@ void LLIMFloater::onIMChicletCreated( const LLUUID& session_id ) } -void LLIMFloater::onClickCloseBtn() +void LLIMFloater::onClickCloseBtn() { LLIMModel::LLIMSession* session = LLIMModel::instance().findIMSession( - mSessionID); + mSessionID); if (session == NULL) { @@ -1342,7 +1352,8 @@ void LLIMFloater::onClickCloseBtn() LLVoiceChannel* voice_channel = LLIMModel::getInstance()->getVoiceChannel(mSessionID); - if (is_call_with_chat && voice_channel != NULL && voice_channel->isActive()) + if (is_call_with_chat && voice_channel != NULL + && voice_channel->isActive()) { LLSD payload; payload["session_id"] = mSessionID; -- cgit v1.2.3 From e2824864590ded669eac3c53efbfc60d04107ee4 Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Tue, 15 May 2012 22:19:20 +0300 Subject: CHUI-105 WIP Hide an additional close button for undocked state of an IM floater --- indra/newview/llimfloater.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'indra/newview/llimfloater.cpp') diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index cb489627fb..1ca3545aae 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -391,6 +391,12 @@ BOOL LLIMFloater::postBuild() } } +void LLIMFloater::onTearOffClicked(LLIMFloater* self) +{ + onClickTearOff(self); + updateTitleButtons(); +} + void LLIMFloater::boundVoiceChannel() { LLVoiceChannel* voice_channel = LLIMModel::getInstance()->getVoiceChannel(mSessionID); @@ -1377,6 +1383,7 @@ void LLIMFloater::updateTitleButtons() } bool is_hosted = getHost() != NULL; + if (is_hosted) ///< floater is hosted { for (S32 i = 0; i < BUTTON_COUNT; i++) @@ -1391,6 +1398,7 @@ void LLIMFloater::updateTitleButtons() } mExpandCollapseBtn->setImageOverlay(getString("collapse_icon")); + } else ///< floater is torn off { @@ -1403,6 +1411,8 @@ void LLIMFloater::updateTitleButtons() } } + getChild("close_btn")->setVisible(is_hosted); + LLIMModel::LLIMSession* session = LLIMModel::instance().findIMSession(mSessionID); if (session) { -- cgit v1.2.3 From f59aa880395d4b744c89b0a375b21ee2bf429625 Mon Sep 17 00:00:00 2001 From: Seth ProductEngine Date: Thu, 17 May 2012 02:51:18 +0300 Subject: CHUI-105 WIP Implemented collapsed/expanded state transitions for messages and conversation panes. The states and dimensions of Conversations floater panes are saved in per account settings. --- indra/newview/llimfloater.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/llimfloater.cpp') diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index 1ca3545aae..051bb39540 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -188,7 +188,7 @@ void LLIMFloater::onOpen(const LLSD& key) if (host_floater) { // Show the messages pane when opening a floater hosted in the Conversations - host_floater->toggleMessagesPane(true); + host_floater->collapseMessagesPane(false); } } @@ -536,7 +536,7 @@ void LLIMFloater::onSlide() if (host_floater) { // Hide the messages pane if a floater is hosted in the Conversations - host_floater->toggleMessagesPane(false); + host_floater->collapseMessagesPane(true); } else ///< floater is torn off { -- cgit v1.2.3 From 4fc8000d6692290516eae1f865b6b41f1d56cc0b Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Thu, 17 May 2012 19:35:05 +0300 Subject: CHUI-105 ADD. FIX Implement changes to all open conversations and nearby chat --- indra/newview/llimfloater.cpp | 85 +++++++++++++++++++++++-------------------- 1 file changed, 46 insertions(+), 39 deletions(-) (limited to 'indra/newview/llimfloater.cpp') diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index 051bb39540..c6608337c8 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -44,6 +44,7 @@ #include "lllayoutstack.h" #include "lllineeditor.h" #include "lllogchat.h" +#include "llnearbychat.h" #include "llpanelimcontrolpanel.h" #include "llscreenchannel.h" #include "llsyswellwindow.h" @@ -63,13 +64,14 @@ LLIMFloater::LLIMFloater(const LLUUID& session_id) mSessionID(session_id), mLastMessageIndex(-1), mDialog(IM_NOTHING_SPECIAL), - mChatHistory(NULL), mInputEditor(NULL), mExpandCollapseBtn(NULL), mTearOffBtn(NULL), mSavedTitle(), mTypingStart(), + mIsP2PChat(false), mShouldSendTypingState(false), + mChatHistory(NULL), mMeTyping(false), mOtherTyping(false), mTypingTimer(), @@ -77,12 +79,14 @@ LLIMFloater::LLIMFloater(const LLUUID& session_id) mPositioned(false), mSessionInitialized(false) { - LLIMModel::LLIMSession* im_session = LLIMModel::getInstance()->findIMSession(mSessionID); - if (im_session) + mSession = LLIMModel::getInstance()->findIMSession(mSessionID); + + if (mSession) { - mSessionInitialized = im_session->mSessionInitialized; + mIsP2PChat = mSession->isP2PSessionType(); + mSessionInitialized = mSession->mSessionInitialized; - mDialog = im_session->mType; + mDialog = mSession->mType; switch (mDialog) { case IM_SESSION_CONFERENCE_START: @@ -101,8 +105,6 @@ LLIMFloater::LLIMFloater(const LLUUID& session_id) mFactoryMap["panel_im_control_panel"] = LLCallbackMap(createPanelAdHocControl, this); } break; - case IM_NOTHING_SPECIAL: - case IM_SESSION_P2P_INVITE: default: break; } @@ -135,14 +137,13 @@ bool LLIMFloater::onIMShowModesMenuItemCheck(const LLSD& userdata) return gSavedSettings.getBOOL(userdata.asString()); } +// enable/disable states for the "show time" and "show names" items of the show-modes menu bool LLIMFloater::onIMShowModesMenuItemEnable(const LLSD& userdata) { std::string item = userdata.asString(); bool plain_text = gSavedSettings.getBOOL("PlainTextChatHistory"); bool is_not_names = (item != "IMShowNamesForP2PConv"); - LLIMModel::LLIMSession* im_session = LLIMModel::instance().findIMSession(mSessionID); - bool is_p2p_chat = im_session && im_session->isP2PSessionType(); - return (plain_text && (is_not_names || is_p2p_chat)); + return (plain_text && (is_not_names || mIsP2PChat)); } void LLIMFloater::onIMSessionMenuItemClicked(const LLSD& userdata) @@ -159,7 +160,8 @@ void LLIMFloater::onIMSessionMenuItemClicked(const LLSD& userdata) gSavedSettings.setBOOL(item, !prev_value); } - reloadMessages(); + LLIMFloater::processChatHistoryStyleUpdate(); + LLNearbyChat::processChatHistoryStyleUpdate(); } void LLIMFloater::onFocusLost() @@ -353,18 +355,16 @@ BOOL LLIMFloater::postBuild() mTypingStart = LLTrans::getString("IM_typing_start_string"); // Disable input editor if session cannot accept text - LLIMModel::LLIMSession* im_session = - LLIMModel::instance().findIMSession(mSessionID); - if ( im_session && !im_session->mTextIMPossible ) + if ( mSession && !mSession->mTextIMPossible ) { mInputEditor->setEnabled(FALSE); mInputEditor->setLabel(LLTrans::getString("IM_unavailable_text_label")); } - if (im_session && im_session->isP2PSessionType()) + if (mIsP2PChat) { // look up display name for window title - LLAvatarNameCache::get(im_session->mOtherParticipantID, + LLAvatarNameCache::get(mSession->mOtherParticipantID, boost::bind(&LLIMFloater::onAvatarNameCache, this, _1, _2)); } @@ -424,16 +424,14 @@ void LLIMFloater::enableDisableCallBtn() bool voice_enabled = LLVoiceClient::getInstance()->voiceEnabled() && LLVoiceClient::getInstance()->isVoiceWorking(); - LLIMModel::LLIMSession* session = LLIMModel::getInstance()->findIMSession(mSessionID); - - if (!session) + if (!mSession) { getChildView("voice_call_btn")->setEnabled(false); return; } - bool session_initialized = session->mSessionInitialized; - bool callback_enabled = session->mCallBackEnabled; + bool session_initialized = mSession->mSessionInitialized; + bool callback_enabled = mSession->mCallBackEnabled; BOOL enable_connect = session_initialized && voice_enabled @@ -763,12 +761,16 @@ void LLIMFloater::sessionInitReplyReceived(const LLUUID& im_session_id) if (mSessionID != im_session_id) { mSessionID = im_session_id; + setKey(im_session_id); if (mControlPanel) { mControlPanel->setSessionId(im_session_id); } boundVoiceChannel(); + + mSession = LLIMModel::getInstance()->findIMSession(mSessionID); + mIsP2PChat = mSession && mSession->isP2PSessionType(); } //*TODO here we should remove "starting session..." warning message if we added it in postBuild() (IB) @@ -785,30 +787,35 @@ void LLIMFloater::sessionInitReplyReceived(const LLUUID& im_session_id) } } -void LLIMFloater::updateMessages() +void LLIMFloater::appendMessage(const LLChat& chat, const LLSD &args) { - bool use_plain_text_chat_history = gSavedSettings.getBOOL("PlainTextChatHistory"); + LLChat& tmp_chat = const_cast(chat); + + if (!chat.mMuted) + { + tmp_chat.mFromName = chat.mFromName; + LLSD chat_args; + if (args) chat_args = args; + chat_args["use_plain_text_chat_history"] = + gSavedSettings.getBOOL("PlainTextChatHistory"); + chat_args["show_time"] = gSavedSettings.getBOOL("IMShowTime"); + chat_args["show_names_for_p2p_conv"] = !mIsP2PChat + || gSavedSettings.getBOOL("IMShowNamesForP2PConv"); + mChatHistory->appendMessage(chat, chat_args); + } +} + +void LLIMFloater::updateMessages() +{ std::list messages; // we shouldn't reset unread message counters if IM floater doesn't have focus - if (hasFocus()) - { - LLIMModel::instance().getMessages(mSessionID, messages, mLastMessageIndex + 1); - } - else - { - LLIMModel::instance().getMessagesSilently(mSessionID, messages, mLastMessageIndex + 1); - } + LLIMModel::instance().getMessages( + mSessionID, messages, mLastMessageIndex + 1, hasFocus()); if (messages.size()) { - bool is_p2p_chat = (mDialog == IM_SESSION_P2P_INVITE || mDialog == IM_NOTHING_SPECIAL); - LLSD chat_args; - chat_args["use_plain_text_chat_history"] = use_plain_text_chat_history; - chat_args["show_time"] = gSavedSettings.getBOOL("IMShowTime"); - chat_args["show_names_for_p2p_conv"] = (!is_p2p_chat) || gSavedSettings.getBOOL("IMShowNamesForP2PConv"); - std::ostringstream message; std::list::const_reverse_iterator iter = messages.rbegin(); std::list::const_reverse_iterator iter_end = messages.rend(); @@ -858,7 +865,7 @@ void LLIMFloater::updateMessages() chat.mText = message; } - mChatHistory->appendMessage(chat, chat_args); + appendMessage(chat); mLastMessageIndex = msg["index"].asInteger(); // if it is a notification - next message is a notification history log, so skip it @@ -1014,7 +1021,7 @@ void LLIMFloater::processAgentListUpdates(const LLSD& body) } } -void LLIMFloater::processChatHistoryStyleUpdate(const LLSD& newvalue) +void LLIMFloater::processChatHistoryStyleUpdate() { LLFontGL* font = LLViewerChat::getChatFont(); LLFloaterReg::const_instance_list_t& inst_list = LLFloaterReg::getFloaterList("impanel"); -- cgit v1.2.3 From acbce3248987d7e71be0fa0a251879c4066d9042 Mon Sep 17 00:00:00 2001 From: Seth ProductEngine Date: Fri, 18 May 2012 02:04:22 +0300 Subject: CHUI-105 WIP Minor code clean up and optimization. Removed overloaded updateTitleButtons() and moved its functionality to a new method that should be called less frequently. --- indra/newview/llimfloater.cpp | 120 +++++++++++++++++++----------------------- 1 file changed, 55 insertions(+), 65 deletions(-) (limited to 'indra/newview/llimfloater.cpp') diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index c6608337c8..981250d223 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -65,6 +65,7 @@ LLIMFloater::LLIMFloater(const LLUUID& session_id) mLastMessageIndex(-1), mDialog(IM_NOTHING_SPECIAL), mInputEditor(NULL), + mCloseBtn(NULL), mExpandCollapseBtn(NULL), mTearOffBtn(NULL), mSavedTitle(), @@ -192,6 +193,8 @@ void LLIMFloater::onOpen(const LLSD& key) // Show the messages pane when opening a floater hosted in the Conversations host_floater->collapseMessagesPane(false); } + + updateHeaderAndToolbar(); } // virtual @@ -308,7 +311,8 @@ BOOL LLIMFloater::postBuild() boundVoiceChannel(); - getChild("close_btn")->setCommitCallback(boost::bind(&LLFloater::onClickClose, this)); + mCloseBtn = getChild("close_btn"); + mCloseBtn->setCommitCallback(boost::bind(&LLFloater::onClickClose, this)); mExpandCollapseBtn = getChild("expand_collapse_btn"); mExpandCollapseBtn->setClickedCallback(boost::bind(&LLIMFloater::onSlide, this)); @@ -328,7 +332,7 @@ BOOL LLIMFloater::postBuild() } mTearOffBtn = getChild("tear_off_btn"); - mTearOffBtn->setCommitCallback(boost::bind(&LLFloater::onClickTearOff, this)); + mTearOffBtn->setCommitCallback(boost::bind(&LLIMFloater::onTearOffClicked, this)); mInputEditor = getChild("chat_editor"); mInputEditor->setMaxTextLength(1023); @@ -391,10 +395,11 @@ BOOL LLIMFloater::postBuild() } } -void LLIMFloater::onTearOffClicked(LLIMFloater* self) +void LLIMFloater::onTearOffClicked() { - onClickTearOff(self); - updateTitleButtons(); + onClickTearOff(this); + + updateHeaderAndToolbar(); } void LLIMFloater::boundVoiceChannel() @@ -1256,6 +1261,51 @@ void LLIMFloater::removeTypingIndicator(const LLIMInfo* im_info) } } +void LLIMFloater::updateHeaderAndToolbar() +{ + bool is_hosted = getHost() != NULL; + + if (is_hosted) + { + for (S32 i = 0; i < BUTTON_COUNT; i++) + { + if (!mButtons[i]) + { + continue; + } + + // Hide the standard header buttons in a docked IM floater. + mButtons[i]->setVisible(false); + } + } + + // Display collapse image (<<) if the floater is hosted + // or if it is torn off but has an open control panel. + bool is_expanded = is_hosted || (mControlPanel && mControlPanel->getParent()->getVisible()); + mExpandCollapseBtn->setImageOverlay(getString(is_expanded ? "collapse_icon" : "expand_icon")); + + LLIMModel::LLIMSession* session = LLIMModel::instance().findIMSession(mSessionID); + if (session) + { + // The button (>>) should be disabled for torn off P2P conversations. + mExpandCollapseBtn->setEnabled(is_hosted || !session->isP2PSessionType()); + } + else + { + llwarns << "IM session not found." << llendl; + } + + if (mDragHandle) + { + // toggle floater's drag handle and title visibility + mDragHandle->setVisible(!is_hosted); + } + + mTearOffBtn->setImageOverlay(getString(is_hosted ? "tear_off_icon" : "return_icon")); + + mCloseBtn->setVisible(is_hosted); +} + // static void LLIMFloater::closeHiddenIMToasts() { @@ -1376,63 +1426,3 @@ void LLIMFloater::onClickCloseBtn() LLFloater::onClickCloseBtn(); } - -// virtual -void LLIMFloater::updateTitleButtons() -{ - // This gets called before LLIMFloater::postBuild() while some LLIMFloater members are NULL - if ( !mDragHandle - //|| !mControlPanel - || !mExpandCollapseBtn - || !mTearOffBtn) - { - return; - } - - bool is_hosted = getHost() != NULL; - - if (is_hosted) ///< floater is hosted - { - for (S32 i = 0; i < BUTTON_COUNT; i++) - { - if (!mButtons[i]) - { - continue; - } - - // Hide the standard header buttons in a docked IM floater. - mButtons[i]->setVisible(false); - } - - mExpandCollapseBtn->setImageOverlay(getString("collapse_icon")); - - } - else ///< floater is torn off - { - LLFloater::updateTitleButtons(); - - if (mControlPanel) - { - bool is_expanded = mControlPanel->getParent()->getVisible(); - mExpandCollapseBtn->setImageOverlay(getString(is_expanded ? "collapse_icon" : "expand_icon")); - } - } - - getChild("close_btn")->setVisible(is_hosted); - - LLIMModel::LLIMSession* session = LLIMModel::instance().findIMSession(mSessionID); - if (session) - { - mExpandCollapseBtn->setEnabled(is_hosted || !session->isP2PSessionType()); - } - else - { - llwarns << "Empty session." << llendl; - return; - } - - // toggle floater's drag handle and title visibility - mDragHandle->setVisible(!is_hosted); - - mTearOffBtn->setImageOverlay(getString(is_hosted ? "tear_off_icon" : "return_icon")); -} -- cgit v1.2.3 From a572f31ffb79ddfd61bcbb4b6fcb79bfa796d191 Mon Sep 17 00:00:00 2001 From: Seth ProductEngine Date: Fri, 18 May 2012 20:50:50 +0300 Subject: CHUI-121 FIXED showing chat participants list only in torn off IM floaters. --- indra/newview/llimfloater.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'indra/newview/llimfloater.cpp') diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index 981250d223..97f59f9a15 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -1279,9 +1279,17 @@ void LLIMFloater::updateHeaderAndToolbar() } } + bool is_control_panel_visible = false; + if (mControlPanel) + { + // Control panel should be visible only in torn off floaters. + is_control_panel_visible = !is_hosted && gSavedSettings.getBOOL("IMShowControlPanel"); + mControlPanel->getParent()->setVisible(is_control_panel_visible); + } + // Display collapse image (<<) if the floater is hosted // or if it is torn off but has an open control panel. - bool is_expanded = is_hosted || (mControlPanel && mControlPanel->getParent()->getVisible()); + bool is_expanded = is_hosted || is_control_panel_visible; mExpandCollapseBtn->setImageOverlay(getString(is_expanded ? "collapse_icon" : "expand_icon")); LLIMModel::LLIMSession* session = LLIMModel::instance().findIMSession(mSessionID); -- cgit v1.2.3 From 296e55c1b323c05b6544b69ace04afe19102396b Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Fri, 18 May 2012 13:20:32 -0700 Subject: CHUI-112 FIX Clicking Show or Discard in an inventory offer toast does not dismiss toast removed special case logic for dealing with user online/offline collisions added ability to cancel old duplicate notifications --- indra/newview/llimfloater.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/newview/llimfloater.cpp') diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index f67464078b..724ae3c25e 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -56,6 +56,7 @@ #include "llrootview.h" #include "llspeakers.h" #include "llviewerchat.h" +#include "llnotificationmanager.h" LLIMFloater::LLIMFloater(const LLUUID& session_id) -- cgit v1.2.3 From 47ec4faeb4dc67f9614e218a75d4957ccf6f794c Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Wed, 30 May 2012 19:58:20 +0300 Subject: CHUI-119 WIP Prepare the nearby chat for hosting it by the IM-container --- indra/newview/llimfloater.cpp | 600 ++++++++++++++---------------------------- 1 file changed, 194 insertions(+), 406 deletions(-) (limited to 'indra/newview/llimfloater.cpp') diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index cd795fcfc7..5339bcb936 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -41,10 +41,9 @@ #include "llfloaterreg.h" #include "llimfloatercontainer.h" // to replace separate IM Floaters with multifloater container #include "llinventoryfunctions.h" -#include "lllayoutstack.h" +//#include "lllayoutstack.h" #include "lllineeditor.h" #include "lllogchat.h" -#include "llnearbychat.h" #include "llpanelimcontrolpanel.h" #include "llscreenchannel.h" #include "llsyswellwindow.h" @@ -60,18 +59,12 @@ #include "llnotificationmanager.h" LLIMFloater::LLIMFloater(const LLUUID& session_id) - : LLTransientDockableFloater(NULL, true, session_id), - mControlPanel(NULL), - mSessionID(session_id), + : LLIMConversation(session_id), mLastMessageIndex(-1), mDialog(IM_NOTHING_SPECIAL), mInputEditor(NULL), - mCloseBtn(NULL), - mExpandCollapseBtn(NULL), - mTearOffBtn(NULL), mSavedTitle(), mTypingStart(), - mIsP2PChat(false), mShouldSendTypingState(false), mChatHistory(NULL), mMeTyping(false), @@ -81,6 +74,8 @@ LLIMFloater::LLIMFloater(const LLUUID& session_id) mPositioned(false), mSessionInitialized(false) { + mIsNearbyChat = false; + mSession = LLIMModel::getInstance()->findIMSession(mSessionID); if (mSession) @@ -97,7 +92,7 @@ LLIMFloater::LLIMFloater(const LLUUID& session_id) case IM_SESSION_GROUP_START: mFactoryMap["panel_im_control_panel"] = LLCallbackMap(createPanelGroupControl, this); break; - case IM_SESSION_INVITE: + case IM_SESSION_INVITE: if (gAgent.isInGroup(mSessionID)) { mFactoryMap["panel_im_control_panel"] = LLCallbackMap(createPanelGroupControl, this); @@ -116,60 +111,30 @@ LLIMFloater::LLIMFloater(const LLUUID& session_id) LLTransientFloaterMgr::getInstance()->addControlView(LLTransientFloaterMgr::IM, this); setDocked(true); - mCommitCallbackRegistrar.add("IMSession.Menu.Action", - boost::bind(&LLIMFloater::onIMSessionMenuItemClicked, this, _2)); - mEnableCallbackRegistrar.add("IMSession.Menu.CompactExpandedModes.CheckItem", - boost::bind(&LLIMFloater::onIMCompactExpandedMenuItemCheck, this, _2)); - mEnableCallbackRegistrar.add("IMSession.Menu.ShowModes.CheckItem", - boost::bind(&LLIMFloater::onIMShowModesMenuItemCheck, this, _2)); - mEnableCallbackRegistrar.add("IMSession.Menu.ShowModes.Enable", - boost::bind(&LLIMFloater::onIMShowModesMenuItemEnable, this, _2)); -} - -bool LLIMFloater::onIMCompactExpandedMenuItemCheck(const LLSD& userdata) -{ - std::string item = userdata.asString(); - bool is_plain_text_mode = gSavedSettings.getBOOL("PlainTextChatHistory"); - - return is_plain_text_mode? item == "compact_view" : item == "expanded_view"; -} - -bool LLIMFloater::onIMShowModesMenuItemCheck(const LLSD& userdata) -{ - return gSavedSettings.getBOOL(userdata.asString()); } -// enable/disable states for the "show time" and "show names" items of the show-modes menu -bool LLIMFloater::onIMShowModesMenuItemEnable(const LLSD& userdata) +// static +void* LLIMFloater::createPanelGroupControl(void* userdata) { - std::string item = userdata.asString(); - bool plain_text = gSavedSettings.getBOOL("PlainTextChatHistory"); - bool is_not_names = (item != "IMShowNamesForP2PConv"); - return (plain_text && (is_not_names || mIsP2PChat)); + LLIMFloater *self = (LLIMFloater*) userdata; + self->mControlPanel = new LLPanelGroupControlPanel(self->mSessionID); + self->mControlPanel->setXMLFilename("panel_group_control_panel.xml"); + return self->mControlPanel; } -void LLIMFloater::onIMSessionMenuItemClicked(const LLSD& userdata) +// static +void* LLIMFloater::createPanelAdHocControl(void* userdata) { - std::string item = userdata.asString(); - - if (item == "compact_view" || item == "expanded_view") - { - gSavedSettings.setBOOL("PlainTextChatHistory", item == "compact_view"); - } - else - { - bool prev_value = gSavedSettings.getBOOL(item); - gSavedSettings.setBOOL(item, !prev_value); - } - - LLIMFloater::processChatHistoryStyleUpdate(); - LLNearbyChat::processChatHistoryStyleUpdate(); + LLIMFloater *self = (LLIMFloater*) userdata; + self->mControlPanel = new LLPanelAdHocControlPanel(self->mSessionID); + self->mControlPanel->setXMLFilename("panel_adhoc_control_panel.xml"); + return self->mControlPanel; } void LLIMFloater::onFocusLost() { LLIMModel::getInstance()->resetActiveSessionID(); - + LLChicletBar::getInstance()->getChicletPanel()->setChicletToggleState(mSessionID, false); } @@ -185,19 +150,6 @@ void LLIMFloater::onFocusReceived() } } -/*virtual*/ -void LLIMFloater::onOpen(const LLSD& key) -{ - LLIMFloaterContainer* host_floater = dynamic_cast(getHost()); - if (host_floater) - { - // Show the messages pane when opening a floater hosted in the Conversations - host_floater->collapseMessagesPane(false); - } - - updateHeaderAndToolbar(); -} - // virtual void LLIMFloater::onClose(bool app_quitting) { @@ -219,10 +171,9 @@ void LLIMFloater::newIMCallback(const LLSD& data) LLUUID session_id = data["session_id"].asUUID(); LLIMFloater* floater = LLFloaterReg::findTypedInstance("impanel", session_id); - if (floater == NULL) return; // update if visible, otherwise will be updated when opened - if (floater->getVisible()) + if (floater && floater->getVisible()) { floater->updateMessages(); } @@ -255,38 +206,39 @@ void LLIMFloater::onSendMsg( LLUICtrl* ctrl, void* userdata ) void LLIMFloater::sendMsg() { - if (!gAgent.isGodlike() - && (mDialog == IM_NOTHING_SPECIAL) - && mOtherParticipantUUID.isNull()) - { - llinfos << "Cannot send IM to everyone unless you're a god." << llendl; - return; - } - - if (mInputEditor) + if (gAgent.isGodlike() + || (mDialog != IM_NOTHING_SPECIAL) + || !mOtherParticipantUUID.isNull()) { - LLWString text = mInputEditor->getConvertedText(); - if(!text.empty()) + if (mInputEditor) { - // Truncate and convert to UTF8 for transport - std::string utf8_text = wstring_to_utf8str(text); - utf8_text = utf8str_truncate(utf8_text, MAX_MSG_BUF_SIZE - 1); - - if (mSessionInitialized) + LLWString text = mInputEditor->getConvertedText(); + if(!text.empty()) { - LLIMModel::sendMessage(utf8_text, mSessionID, mOtherParticipantUUID, mDialog); - } - else - { - //queue up the message to send once the session is initialized - mQueuedMsgsForInit.append(utf8_text); - } + // Truncate and convert to UTF8 for transport + std::string utf8_text = wstring_to_utf8str(text); + utf8_text = utf8str_truncate(utf8_text, MAX_MSG_BUF_SIZE - 1); - mInputEditor->setText(LLStringUtil::null); + if (mSessionInitialized) + { + LLIMModel::sendMessage(utf8_text, mSessionID, mOtherParticipantUUID, mDialog); + } + else + { + //queue up the message to send once the session is initialized + mQueuedMsgsForInit.append(utf8_text); + } + + mInputEditor->setText(LLStringUtil::null); - updateMessages(); + updateMessages(); + } } } + else + { + llinfos << "Cannot send IM to everyone unless you're a god." << llendl; + } } LLIMFloater::~LLIMFloater() @@ -312,28 +264,6 @@ BOOL LLIMFloater::postBuild() boundVoiceChannel(); - mCloseBtn = getChild("close_btn"); - mCloseBtn->setCommitCallback(boost::bind(&LLFloater::onClickClose, this)); - - mExpandCollapseBtn = getChild("expand_collapse_btn"); - mExpandCollapseBtn->setClickedCallback(boost::bind(&LLIMFloater::onSlide, this)); - - if (mControlPanel) - { - mControlPanel->setSessionId(mSessionID); - mControlPanel->getParent()->setVisible(gSavedSettings.getBOOL("IMShowControlPanel")); - - mExpandCollapseBtn->setImageOverlay( - getString(mControlPanel->getParent()->getVisible() ? "collapse_icon" : "expand_icon")); - } - else - { - mExpandCollapseBtn->setEnabled(false); - getChild("im_control_panel_holder")->setVisible(false); - } - - mTearOffBtn = getChild("tear_off_btn"); - mTearOffBtn->setCommitCallback(boost::bind(&LLIMFloater::onTearOffClicked, this)); mInputEditor = getChild("chat_editor"); mInputEditor->setMaxTextLength(1023); @@ -386,21 +316,7 @@ BOOL LLIMFloater::postBuild() //*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) - if(isChatMultiTab()) - { - return LLFloater::postBuild(); - } - else - { - return LLDockableFloater::postBuild(); - } -} - -void LLIMFloater::onTearOffClicked() -{ - onClickTearOff(this); - - updateHeaderAndToolbar(); + return LLIMConversation::postBuild(); } void LLIMFloater::boundVoiceChannel() @@ -412,37 +328,29 @@ void LLIMFloater::boundVoiceChannel() boost::bind(&LLIMFloater::onVoiceChannelStateChanged, this, _1, _2)); //call (either p2p, group or ad-hoc) can be already in started state - updateCallState(voice_channel->getState()); + bool callIsActive = voice_channel->getState() >= LLVoiceChannel::STATE_CALL_STARTED; + updateCallBtnState(callIsActive); } } -void LLIMFloater::updateCallState(LLVoiceChannel::EState state) -{ - bool is_call_started = state >= LLVoiceChannel::STATE_CALL_STARTED; - getChild("voice_call_btn")->setImageOverlay( - is_call_started? getString("call_btn_stop") : getString("call_btn_start")); - enableDisableCallBtn(); - -} - void LLIMFloater::enableDisableCallBtn() { bool voice_enabled = LLVoiceClient::getInstance()->voiceEnabled() && LLVoiceClient::getInstance()->isVoiceWorking(); - if (!mSession) + if (mSession) + { + bool session_initialized = mSession->mSessionInitialized; + bool callback_enabled = mSession->mCallBackEnabled; + + BOOL enable_connect = + session_initialized && voice_enabled && callback_enabled; + getChildView("voice_call_btn")->setEnabled(enable_connect); + } + else { getChildView("voice_call_btn")->setEnabled(false); - return; } - - bool session_initialized = mSession->mSessionInitialized; - bool callback_enabled = mSession->mCallBackEnabled; - - BOOL enable_connect = session_initialized - && voice_enabled - && callback_enabled; - getChildView("voice_call_btn")->setEnabled(enable_connect); } @@ -470,18 +378,17 @@ void LLIMFloater::onCallButtonClicked() void LLIMFloater::onChange(EStatusType status, const std::string &channelURI, bool proximal) { - if(status == STATUS_JOINING || status == STATUS_LEFT_CHANNEL) + if(status != STATUS_JOINING && status != STATUS_LEFT_CHANNEL) { - return; + enableDisableCallBtn(); } - - enableDisableCallBtn(); } void LLIMFloater::onVoiceChannelStateChanged( const LLVoiceChannel::EState& old_state, const LLVoiceChannel::EState& new_state) { - updateCallState(new_state); + bool callIsActive = new_state >= LLVoiceChannel::STATE_CALL_STARTED; + updateCallBtnState(callIsActive); } void LLIMFloater::updateSessionName(const std::string& ui_title, @@ -516,48 +423,6 @@ void LLIMFloater::draw() LLTransientDockableFloater::draw(); } -// static -void* LLIMFloater::createPanelGroupControl(void* userdata) -{ - LLIMFloater *self = (LLIMFloater*)userdata; - self->mControlPanel = new LLPanelGroupControlPanel(self->mSessionID); - self->mControlPanel->setXMLFilename("panel_group_control_panel.xml"); - return self->mControlPanel; -} - -// static -void* LLIMFloater::createPanelAdHocControl(void* userdata) -{ - LLIMFloater *self = (LLIMFloater*)userdata; - self->mControlPanel = new LLPanelAdHocControlPanel(self->mSessionID); - self->mControlPanel->setXMLFilename("panel_adhoc_control_panel.xml"); - return self->mControlPanel; -} - -void LLIMFloater::onSlide() -{ - LLIMFloaterContainer* host_floater = dynamic_cast(getHost()); - if (host_floater) - { - // Hide the messages pane if a floater is hosted in the Conversations - host_floater->collapseMessagesPane(true); - } - else ///< floater is torn off - { - if (mControlPanel) - { - bool expand = !mControlPanel->getParent()->getVisible(); - - // Expand/collapse the IM control panel - mControlPanel->getParent()->setVisible(expand); - - gSavedSettings.setBOOL("IMShowControlPanel", expand); - - mExpandCollapseBtn->setImageOverlay(getString(expand ? "collapse_icon" : "expand_icon")); - } - } -} - //static LLIMFloater* LLIMFloater::show(const LLUUID& session_id) { @@ -635,6 +500,22 @@ LLIMFloater* LLIMFloater::show(const LLUUID& session_id) return floater; } +//static +LLIMFloater* LLIMFloater::findInstance(const LLUUID& session_id) +{ + LLIMFloater* conversation = + LLFloaterReg::findTypedInstance("impanel", session_id); + + return conversation; +} + +LLIMFloater* LLIMFloater::getInstance(const LLUUID& session_id) +{ + LLIMFloater* conversation = + LLFloaterReg::getTypedInstance("impanel", session_id); + + return conversation; +} void LLIMFloater::setDocked(bool docked, bool pop_on_undock) { @@ -697,6 +578,8 @@ void LLIMFloater::setVisible(BOOL visible) BOOL LLIMFloater::getVisible() { + bool visible; + if(isChatMultiTab()) { LLIMFloaterContainer* im_container = @@ -708,17 +591,21 @@ BOOL LLIMFloater::getVisible() //torn off floater is always inactive if (!is_active && getHost() != im_container) { - return LLTransientDockableFloater::getVisible(); + visible = LLTransientDockableFloater::getVisible(); + } + else + { + // getVisible() returns TRUE when Tabbed IM window is minimized. + visible = is_active && !im_container->isMinimized() + && im_container->getVisible(); } - - // getVisible() returns TRUE when Tabbed IM window is minimized. - return is_active && !im_container->isMinimized() - && im_container->getVisible(); } else { - return LLTransientDockableFloater::getVisible(); + visible = LLTransientDockableFloater::getVisible(); } + + return visible; } //static @@ -748,17 +635,6 @@ bool LLIMFloater::toggle(const LLUUID& session_id) return true; } -//static -LLIMFloater* LLIMFloater::findInstance(const LLUUID& session_id) -{ - return LLFloaterReg::findTypedInstance("impanel", session_id); -} - -LLIMFloater* LLIMFloater::getInstance(const LLUUID& session_id) -{ - return LLFloaterReg::getTypedInstance("impanel", session_id); -} - void LLIMFloater::sessionInitReplyReceived(const LLUUID& im_session_id) { mSessionInitialized = true; @@ -782,14 +658,15 @@ void LLIMFloater::sessionInitReplyReceived(const LLUUID& im_session_id) //*TODO here we should remove "starting session..." warning message if we added it in postBuild() (IB) //need to send delayed messaged collected while waiting for session initialization - if (!mQueuedMsgsForInit.size()) - return; - LLSD::array_iterator iter; - for ( iter = mQueuedMsgsForInit.beginArray(); - iter != mQueuedMsgsForInit.endArray(); ++iter) + if (mQueuedMsgsForInit.size()) { - LLIMModel::sendMessage(iter->asString(), mSessionID, - mOtherParticipantUUID, mDialog); + LLSD::array_iterator iter; + for ( iter = mQueuedMsgsForInit.beginArray(); + iter != mQueuedMsgsForInit.endArray(); ++iter) + { + LLIMModel::sendMessage(iter->asString(), mSessionID, + mOtherParticipantUUID, mDialog); + } } } @@ -878,16 +755,16 @@ void LLIMFloater::updateMessages() if (chat.mNotifId.notNull() && LLNotificationsUtil::find(chat.mNotifId) != NULL) { if (++iter == iter_end) - { - break; - } - else - { - mLastMessageIndex++; - } - } - } - } + { + break; + } + else + { + mLastMessageIndex++; + } + } + } + } } void LLIMFloater::reloadMessages() @@ -895,6 +772,7 @@ void LLIMFloater::reloadMessages() mChatHistory->clear(); mLastMessageIndex = -1; updateMessages(); + mInputEditor->setFont(LLViewerChat::getChatFont()); } // static @@ -923,28 +801,22 @@ void LLIMFloater::onInputEditorFocusLost(LLFocusableElement* caller, void* userd // static void LLIMFloater::onInputEditorKeystroke(LLLineEditor* caller, void* userdata) { - LLIMFloater* self = (LLIMFloater*)userdata; + LLIMFloater* self = (LLIMFloater*) userdata; std::string text = self->mInputEditor->getText(); - if (!text.empty()) - { - self->setTyping(true); - } - else - { - // Deleting all text counts as stopping typing. - self->setTyping(false); - } + + // Deleting all text counts as stopping typing. + self->setTyping(!text.empty()); } void LLIMFloater::setTyping(bool typing) { - if ( typing ) + if (typing) { // Started or proceeded typing, reset the typing timeout timer mTypingTimeoutTimer.reset(); } - if ( mMeTyping != typing ) + if (mMeTyping != typing) { // Typing state is changed mMeTyping = typing; @@ -956,24 +828,16 @@ void LLIMFloater::setTyping(bool typing) // Don't want to send typing indicators to multiple people, potentially too // much network traffic. Only send in person-to-person IMs. - if ( mShouldSendTypingState && mDialog == IM_NOTHING_SPECIAL ) + if (mShouldSendTypingState && mDialog == IM_NOTHING_SPECIAL) { - if ( mMeTyping ) - { - if ( mTypingTimer.getElapsedTimeF32() > 1.f ) - { - // Still typing, send 'start typing' notification - LLIMModel::instance().sendTypingState(mSessionID, - mOtherParticipantUUID, TRUE); - mShouldSendTypingState = false; - } - } - else + // Still typing, send 'start typing' notification or + // send 'stop typing' notification immediately + if (!mMeTyping || mTypingTimer.getElapsedTimeF32() > 1.f) { - // Send 'stop typing' notification immediately LLIMModel::instance().sendTypingState(mSessionID, - mOtherParticipantUUID, FALSE); + mOtherParticipantUUID, mMeTyping); mShouldSendTypingState = false; + } } @@ -985,7 +849,7 @@ void LLIMFloater::setTyping(bool typing) void LLIMFloater::processIMTyping(const LLIMInfo* im_info, BOOL typing) { - if ( typing ) + if (typing) { // other user started typing addTypingIndicator(im_info); @@ -999,10 +863,7 @@ void LLIMFloater::processIMTyping(const LLIMInfo* im_info, BOOL typing) void LLIMFloater::processAgentListUpdates(const LLSD& body) { - if (!body.isMap()) - return; - - if ( body.has("agent_updates") && body["agent_updates"].isMap() ) + if (body.isMap() && body.has("agent_updates") && body["agent_updates"].isMap()) { LLSD agent_data = body["agent_updates"].get(gAgentID.asString()); if (agent_data.isMap() && agent_data.has("info")) @@ -1011,7 +872,7 @@ void LLIMFloater::processAgentListUpdates(const LLSD& body) if (agent_info.has("mutes")) { - BOOL moderator_muted_text = agent_info["mutes"]["text"].asBoolean(); + BOOL moderator_muted_text = agent_info["mutes"]["text"].asBoolean(); mInputEditor->setEnabled(!moderator_muted_text); std::string label; if (moderator_muted_text) @@ -1027,27 +888,11 @@ void LLIMFloater::processAgentListUpdates(const LLSD& body) } } -void LLIMFloater::processChatHistoryStyleUpdate() -{ - LLFontGL* font = LLViewerChat::getChatFont(); - LLFloaterReg::const_instance_list_t& inst_list = LLFloaterReg::getFloaterList("impanel"); - for (LLFloaterReg::const_instance_list_t::const_iterator iter = inst_list.begin(); - iter != inst_list.end(); ++iter) - { - LLIMFloater* floater = dynamic_cast(*iter); - if (floater) - { - floater->reloadMessages(); - floater->mInputEditor->setFont(font); - } - } -} - void LLIMFloater::processSessionUpdate(const LLSD& session_update) { // *TODO : verify following code when moderated mode will be implemented - if ( false && session_update.has("moderated_mode") && - session_update["moderated_mode"].has("voice") ) + if (false && session_update.has("moderated_mode") && + session_update["moderated_mode"].has("voice")) { BOOL voice_moderated = session_update["moderated_mode"]["voice"]; const std::string session_label = LLIMModel::instance().getName(mSessionID); @@ -1069,14 +914,14 @@ void LLIMFloater::processSessionUpdate(const LLSD& session_update) } BOOL LLIMFloater::handleDragAndDrop(S32 x, S32 y, MASK mask, - BOOL drop, EDragAndDropType cargo_type, - void *cargo_data, EAcceptance *accept, - std::string& tooltip_msg) + BOOL drop, EDragAndDropType cargo_type, + void *cargo_data, EAcceptance *accept, + std::string& tooltip_msg) { if (mDialog == IM_NOTHING_SPECIAL) { LLToolDragAndDrop::handleGiveDragAndDrop(mOtherParticipantUUID, mSessionID, drop, - cargo_type, cargo_data, accept); + cargo_type, cargo_data, accept); } // handle case for dropping calling cards (and folders of calling cards) onto invitation panel for invites @@ -1086,14 +931,14 @@ BOOL LLIMFloater::handleDragAndDrop(S32 x, S32 y, MASK mask, if (cargo_type == DAD_CALLINGCARD) { - if (dropCallingCard((LLInventoryItem*)cargo_data, drop)) + if (dropCallingCard((LLInventoryItem*) cargo_data, drop)) { *accept = ACCEPT_YES_MULTI; } } else if (cargo_type == DAD_CATEGORY) { - if (dropCategory((LLInventoryCategory*)cargo_data, drop)) + if (dropCategory((LLInventoryCategory*) cargo_data, drop)) { *accept = ACCEPT_YES_MULTI; } @@ -1105,9 +950,9 @@ BOOL LLIMFloater::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL LLIMFloater::dropCallingCard(LLInventoryItem* item, BOOL drop) { BOOL rv = isInviteAllowed(); - if(rv && item && item->getCreatorUUID().notNull()) + if (rv && item && item->getCreatorUUID().notNull()) { - if(drop) + if (drop) { uuid_vec_t ids; ids.push_back(item->getCreatorUUID()); @@ -1125,26 +970,26 @@ BOOL LLIMFloater::dropCallingCard(LLInventoryItem* item, BOOL drop) BOOL LLIMFloater::dropCategory(LLInventoryCategory* category, BOOL drop) { BOOL rv = isInviteAllowed(); - if(rv && category) + if (rv && category) { LLInventoryModel::cat_array_t cats; LLInventoryModel::item_array_t items; LLUniqueBuddyCollector buddies; gInventory.collectDescendentsIf(category->getUUID(), - cats, - items, - LLInventoryModel::EXCLUDE_TRASH, - buddies); + cats, + items, + LLInventoryModel::EXCLUDE_TRASH, + buddies); S32 count = items.count(); - if(count == 0) + if (count == 0) { rv = FALSE; } - else if(drop) + else if (drop) { uuid_vec_t ids; ids.reserve(count); - for(S32 i = 0; i < count; ++i) + for (S32 i = 0; i < count; ++i) { ids.push_back(items.get(i)->getCreatorUUID()); } @@ -1156,11 +1001,11 @@ BOOL LLIMFloater::dropCategory(LLInventoryCategory* category, BOOL drop) BOOL LLIMFloater::isInviteAllowed() const { - return ( (IM_SESSION_CONFERENCE_START == mDialog) - || (IM_SESSION_INVITE == mDialog) ); + return ((IM_SESSION_CONFERENCE_START == mDialog) + || (IM_SESSION_INVITE == mDialog)); } -class LLSessionInviteResponder : public LLHTTPClient::Responder +class LLSessionInviteResponder: public LLHTTPClient::Responder { public: LLSessionInviteResponder(const LLUUID& session_id) @@ -1181,60 +1026,60 @@ private: BOOL LLIMFloater::inviteToSession(const uuid_vec_t& ids) { LLViewerRegion* region = gAgent.getRegion(); - if (!region) + bool is_region_exist = !!region; + + if (is_region_exist) { - return FALSE; - } + S32 count = ids.size(); - S32 count = ids.size(); + if (isInviteAllowed() && (count > 0)) + { + llinfos << "LLIMFloater::inviteToSession() - inviting participants" << llendl; - if( isInviteAllowed() && (count > 0) ) - { - llinfos << "LLIMFloater::inviteToSession() - inviting participants" << llendl; + std::string url = region->getCapability("ChatSessionRequest"); - std::string url = region->getCapability("ChatSessionRequest"); + LLSD data; - LLSD data; + data["params"] = LLSD::emptyArray(); + for (int i = 0; i < count; i++) + { + data["params"].append(ids[i]); + } - data["params"] = LLSD::emptyArray(); - for (int i = 0; i < count; i++) + data["method"] = "invite"; + data["session-id"] = mSessionID; + LLHTTPClient::post( + url, + data, + new LLSessionInviteResponder(mSessionID)); + } + else { - data["params"].append(ids[i]); + llinfos << "LLIMFloater::inviteToSession -" + << " no need to invite agents for " + << mDialog << llendl; + // successful add, because everyone that needed to get added + // was added. } - - data["method"] = "invite"; - data["session-id"] = mSessionID; - LLHTTPClient::post( - url, - data, - new LLSessionInviteResponder(mSessionID)); - } - else - { - llinfos << "LLIMFloater::inviteToSession -" - << " no need to invite agents for " - << mDialog << llendl; - // successful add, because everyone that needed to get added - // was added. } - return TRUE; + return is_region_exist; } void LLIMFloater::addTypingIndicator(const LLIMInfo* im_info) { // We may have lost a "stop-typing" packet, don't add it twice - if ( im_info && !mOtherTyping ) + if (im_info && !mOtherTyping) { mOtherTyping = true; // Save and set new title mSavedTitle = getTitle(); - setTitle (mTypingStart); + setTitle(mTypingStart); // Update speaker LLIMSpeakerMgr* speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(mSessionID); - if ( speaker_mgr ) + if (speaker_mgr) { speaker_mgr->setSpeakerTyping(im_info->mFromID, TRUE); } @@ -1243,18 +1088,18 @@ void LLIMFloater::addTypingIndicator(const LLIMInfo* im_info) void LLIMFloater::removeTypingIndicator(const LLIMInfo* im_info) { - if ( mOtherTyping ) + if (mOtherTyping) { mOtherTyping = false; // Revert the title to saved one setTitle(mSavedTitle); - if ( im_info ) + if (im_info) { // Update speaker LLIMSpeakerMgr* speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(mSessionID); - if ( speaker_mgr ) + if (speaker_mgr) { speaker_mgr->setSpeakerTyping(im_info->mFromID, FALSE); } @@ -1262,59 +1107,6 @@ void LLIMFloater::removeTypingIndicator(const LLIMInfo* im_info) } } -void LLIMFloater::updateHeaderAndToolbar() -{ - bool is_hosted = getHost() != NULL; - - if (is_hosted) - { - for (S32 i = 0; i < BUTTON_COUNT; i++) - { - if (!mButtons[i]) - { - continue; - } - - // Hide the standard header buttons in a docked IM floater. - mButtons[i]->setVisible(false); - } -} - - bool is_control_panel_visible = false; - if (mControlPanel) - { - // Control panel should be visible only in torn off floaters. - is_control_panel_visible = !is_hosted && gSavedSettings.getBOOL("IMShowControlPanel"); - mControlPanel->getParent()->setVisible(is_control_panel_visible); - } - - // Display collapse image (<<) if the floater is hosted - // or if it is torn off but has an open control panel. - bool is_expanded = is_hosted || is_control_panel_visible; - mExpandCollapseBtn->setImageOverlay(getString(is_expanded ? "collapse_icon" : "expand_icon")); - - LLIMModel::LLIMSession* session = LLIMModel::instance().findIMSession(mSessionID); - if (session) - { - // The button (>>) should be disabled for torn off P2P conversations. - mExpandCollapseBtn->setEnabled(is_hosted || !session->isP2PSessionType()); - } - else - { - llwarns << "IM session not found." << llendl; - } - - if (mDragHandle) - { - // toggle floater's drag handle and title visibility - mDragHandle->setVisible(!is_hosted); - } - - mTearOffBtn->setImageOverlay(getString(is_hosted ? "tear_off_icon" : "return_icon")); - - mCloseBtn->setVisible(is_hosted); -} - // static void LLIMFloater::closeHiddenIMToasts() { @@ -1351,14 +1143,6 @@ void LLIMFloater::confirmLeaveCallCallback(const LLSD& notification, const LLSD& return; } -// static -bool LLIMFloater::isChatMultiTab() -{ - // Restart is required in order to change chat window type. - static bool is_single_window = gSavedSettings.getS32("ChatWindow") == 1; - return is_single_window; -} - // static void LLIMFloater::initIMFloater() { @@ -1390,28 +1174,32 @@ void LLIMFloater::sRemoveTypingIndicator(const LLSD& data) void LLIMFloater::onIMChicletCreated( const LLUUID& session_id ) { + LLIMFloater::addToHost(session_id); +} - if (isChatMultiTab()) +void LLIMFloater::addToHost(const LLUUID& session_id) +{ + if (LLIMConversation::isChatMultiTab()) { - LLIMFloaterContainer* im_box = LLIMFloaterContainer::getInstance(); + LLIMFloaterContainer* im_box = LLIMFloaterContainer::findInstance(); if (!im_box) - return; - - if (LLIMFloater::findInstance(session_id)) - return; - - LLIMFloater* new_tab = LLIMFloater::getInstance(session_id); + { + im_box = LLIMFloaterContainer::getInstance(); + } - im_box->addFloater(new_tab, FALSE, LLTabContainer::END); + if (im_box && !LLIMFloater::findInstance(session_id)) + { + LLIMFloater* new_tab = LLIMFloater::getInstance(session_id); + im_box->addFloater(new_tab, FALSE, LLTabContainer::END); + } } - } void LLIMFloater::onClickCloseBtn() { LLIMModel::LLIMSession* session = LLIMModel::instance().findIMSession( - mSessionID); + mSessionID); if (session == NULL) { -- cgit v1.2.3 From bba0f4f74e56d911df8fc534d83cd4a84993bc8b Mon Sep 17 00:00:00 2001 From: Seth ProductEngine Date: Thu, 31 May 2012 16:37:22 +0300 Subject: CHUI-119 WIP --- indra/newview/llimfloater.cpp | 67 ++++++++++--------------------------------- 1 file changed, 15 insertions(+), 52 deletions(-) (limited to 'indra/newview/llimfloater.cpp') diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index 5339bcb936..c99da9e9c1 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -44,7 +44,6 @@ //#include "lllayoutstack.h" #include "lllineeditor.h" #include "lllogchat.h" -#include "llpanelimcontrolpanel.h" #include "llscreenchannel.h" #include "llsyswellwindow.h" #include "lltrans.h" @@ -82,29 +81,7 @@ LLIMFloater::LLIMFloater(const LLUUID& session_id) { mIsP2PChat = mSession->isP2PSessionType(); mSessionInitialized = mSession->mSessionInitialized; - mDialog = mSession->mType; - switch (mDialog) - { - case IM_SESSION_CONFERENCE_START: - mFactoryMap["panel_im_control_panel"] = LLCallbackMap(createPanelAdHocControl, this); - break; - case IM_SESSION_GROUP_START: - mFactoryMap["panel_im_control_panel"] = LLCallbackMap(createPanelGroupControl, this); - break; - case IM_SESSION_INVITE: - if (gAgent.isInGroup(mSessionID)) - { - mFactoryMap["panel_im_control_panel"] = LLCallbackMap(createPanelGroupControl, this); - } - else - { - mFactoryMap["panel_im_control_panel"] = LLCallbackMap(createPanelAdHocControl, this); - } - break; - default: - break; - } } setOverlapsScreenChannel(true); @@ -113,24 +90,6 @@ LLIMFloater::LLIMFloater(const LLUUID& session_id) setDocked(true); } -// static -void* LLIMFloater::createPanelGroupControl(void* userdata) -{ - LLIMFloater *self = (LLIMFloater*) userdata; - self->mControlPanel = new LLPanelGroupControlPanel(self->mSessionID); - self->mControlPanel->setXMLFilename("panel_group_control_panel.xml"); - return self->mControlPanel; -} - -// static -void* LLIMFloater::createPanelAdHocControl(void* userdata) -{ - LLIMFloater *self = (LLIMFloater*) userdata; - self->mControlPanel = new LLPanelAdHocControlPanel(self->mSessionID); - self->mControlPanel->setXMLFilename("panel_adhoc_control_panel.xml"); - return self->mControlPanel; -} - void LLIMFloater::onFocusLost() { LLIMModel::getInstance()->resetActiveSessionID(); @@ -409,8 +368,10 @@ void LLIMFloater::onAvatarNameCache(const LLUUID& agent_id, } // virtual -void LLIMFloater::draw() +BOOL LLIMFloater::tick() { + BOOL parents_retcode = LLIMConversation::tick(); + if ( mMeTyping ) { // Time out if user hasn't typed for a while. @@ -420,7 +381,7 @@ void LLIMFloater::draw() } } - LLTransientDockableFloater::draw(); + return parents_retcode; } //static @@ -643,16 +604,14 @@ void LLIMFloater::sessionInitReplyReceived(const LLUUID& im_session_id) if (mSessionID != im_session_id) { mSessionID = im_session_id; - setKey(im_session_id); - if (mControlPanel) - { - mControlPanel->setSessionId(im_session_id); - } + boundVoiceChannel(); mSession = LLIMModel::getInstance()->findIMSession(mSessionID); mIsP2PChat = mSession && mSession->isP2PSessionType(); + + buildParticipantList(); } //*TODO here we should remove "starting session..." warning message if we added it in postBuild() (IB) @@ -841,10 +800,14 @@ void LLIMFloater::setTyping(bool typing) } } - LLIMSpeakerMgr* speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(mSessionID); - if (speaker_mgr) - speaker_mgr->setSpeakerTyping(gAgent.getID(), FALSE); - + if (!mIsNearbyChat) + { + LLIMSpeakerMgr* speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(mSessionID); + if (speaker_mgr) + { + speaker_mgr->setSpeakerTyping(gAgent.getID(), FALSE); + } + } } void LLIMFloater::processIMTyping(const LLIMInfo* im_info, BOOL typing) -- cgit v1.2.3 From d11f542ffefdc5db845028d5a260b5b0ad12dea6 Mon Sep 17 00:00:00 2001 From: Seth ProductEngine Date: Thu, 7 Jun 2012 00:59:05 +0300 Subject: CHUI-120 WIP Added starting ad hoc conference in the same floater as P2P chat, after adding more participants. - Added a parameter to LLAvatarActions::startConference() and LLIMMgr::addSession() to pass the uuid of a P2P IM floater which should be used to start a new conference in it. - In LLChicletBar::sessionRemoved() we don't close the IM floater if it is going to be re-used for a new conference. --- indra/newview/llimfloater.cpp | 158 ++++++++++++++++++++++-------------------- 1 file changed, 81 insertions(+), 77 deletions(-) (limited to 'indra/newview/llimfloater.cpp') diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index c99da9e9c1..f04fecca26 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -71,18 +71,12 @@ LLIMFloater::LLIMFloater(const LLUUID& session_id) mTypingTimer(), mTypingTimeoutTimer(), mPositioned(false), - mSessionInitialized(false) + mSessionInitialized(false), + mStartConferenceInSameFloater(false) { mIsNearbyChat = false; + initIMSession(session_id); - mSession = LLIMModel::getInstance()->findIMSession(mSessionID); - - if (mSession) - { - mIsP2PChat = mSession->isP2PSessionType(); - mSessionInitialized = mSession->mSessionInitialized; - mDialog = mSession->mType; - } setOverlapsScreenChannel(true); LLTransientFloaterMgr::getInstance()->addControlView(LLTransientFloaterMgr::IM, this); @@ -112,6 +106,29 @@ void LLIMFloater::onFocusReceived() // virtual void LLIMFloater::onClose(bool app_quitting) { + LLIMModel::LLIMSession* session = LLIMModel::instance().findIMSession( + mSessionID); + + if (session == NULL) + { + llwarns << "Empty session." << llendl; + return; + } + + bool is_call_with_chat = session->isGroupSessionType() + || session->isAdHocSessionType() || session->isP2PSessionType(); + + LLVoiceChannel* voice_channel = LLIMModel::getInstance()->getVoiceChannel(mSessionID); + + if (is_call_with_chat && voice_channel != NULL + && voice_channel->isActive()) + { + LLSD payload; + payload["session_id"] = mSessionID; + LLNotificationsUtil::add("ConfirmLeaveCall", LLSD(), payload, confirmLeaveCallCallback); + return; + } + setTyping(false); // The source of much argument and design thrashing @@ -211,8 +228,24 @@ LLIMFloater::~LLIMFloater() LLTransientFloaterMgr::getInstance()->removeControlView(LLTransientFloaterMgr::IM, this); } -//virtual -BOOL LLIMFloater::postBuild() +void LLIMFloater::initIMSession(const LLUUID& session_id) +{ + // Change the floater key to bind it to a new session. + setKey(session_id); + + mSessionID = session_id; + mSession = LLIMModel::getInstance()->findIMSession(mSessionID); + + if (mSession) + { + mIsP2PChat = mSession->isP2PSessionType(); + mSessionInitialized = mSession->mSessionInitialized; + + mDialog = mSession->mType; + } +} + +void LLIMFloater::initIMFloater() { const LLUUID& other_party_id = LLIMModel::getInstance()->getOtherParticipantID(mSessionID); @@ -223,6 +256,34 @@ BOOL LLIMFloater::postBuild() boundVoiceChannel(); + // Show control panel in torn off floaters only. + mParticipantListPanel->setVisible(!getHost() && gSavedSettings.getBOOL("IMShowControlPanel")); + + // Disable input editor if session cannot accept text + if ( mSession && !mSession->mTextIMPossible ) + { + mInputEditor->setEnabled(FALSE); + mInputEditor->setLabel(LLTrans::getString("IM_unavailable_text_label")); + } + + if (mIsP2PChat) + { + // look up display name for window title + LLAvatarNameCache::get(mSession->mOtherParticipantID, + boost::bind(&LLIMFloater::onAvatarNameCache, + this, _1, _2)); + } + else + { + std::string session_name(LLIMModel::instance().getName(mSessionID)); + updateSessionName(session_name, session_name); + } +} + +//virtual +BOOL LLIMFloater::postBuild() +{ + LLIMConversation::postBuild(); mInputEditor = getChild("chat_editor"); mInputEditor->setMaxTextLength(1023); @@ -248,26 +309,6 @@ BOOL LLIMFloater::postBuild() mTypingStart = LLTrans::getString("IM_typing_start_string"); - // Disable input editor if session cannot accept text - if ( mSession && !mSession->mTextIMPossible ) - { - mInputEditor->setEnabled(FALSE); - mInputEditor->setLabel(LLTrans::getString("IM_unavailable_text_label")); - } - - if (mIsP2PChat) - { - // look up display name for window title - LLAvatarNameCache::get(mSession->mOtherParticipantID, - boost::bind(&LLIMFloater::onAvatarNameCache, - this, _1, _2)); - } - else - { - std::string session_name(LLIMModel::instance().getName(mSessionID)); - updateSessionName(session_name, session_name); - } - childSetAction("voice_call_btn", boost::bind(&LLIMFloater::onCallButtonClicked, this)); LLVoiceClient::getInstance()->addObserver(this); @@ -275,7 +316,9 @@ BOOL LLIMFloater::postBuild() //*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) - return LLIMConversation::postBuild(); + initIMFloater(); + + return TRUE; } void LLIMFloater::boundVoiceChannel() @@ -603,17 +646,15 @@ void LLIMFloater::sessionInitReplyReceived(const LLUUID& im_session_id) //will be different only for an ad-hoc im session if (mSessionID != im_session_id) { - mSessionID = im_session_id; - setKey(im_session_id); + initIMSession(im_session_id); boundVoiceChannel(); - mSession = LLIMModel::getInstance()->findIMSession(mSessionID); - mIsP2PChat = mSession && mSession->isP2PSessionType(); - buildParticipantList(); } - + + initIMFloater(); + //*TODO here we should remove "starting session..." warning message if we added it in postBuild() (IB) //need to send delayed messaged collected while waiting for session initialization @@ -965,7 +1006,8 @@ BOOL LLIMFloater::dropCategory(LLInventoryCategory* category, BOOL drop) BOOL LLIMFloater::isInviteAllowed() const { return ((IM_SESSION_CONFERENCE_START == mDialog) - || (IM_SESSION_INVITE == mDialog)); + || (IM_SESSION_INVITE == mDialog && !gAgent.isInGroup(mSessionID)) + || mIsP2PChat); } class LLSessionInviteResponder: public LLHTTPClient::Responder @@ -1107,14 +1149,6 @@ void LLIMFloater::confirmLeaveCallCallback(const LLSD& notification, const LLSD& } // static -void LLIMFloater::initIMFloater() -{ - // This is called on viewer start up - // init chat window type before user changed it in preferences - isChatMultiTab(); -} - -//static void LLIMFloater::sRemoveTypingIndicator(const LLSD& data) { LLUUID session_id = data["session_id"]; @@ -1139,7 +1173,6 @@ void LLIMFloater::onIMChicletCreated( const LLUUID& session_id ) { LLIMFloater::addToHost(session_id); } - void LLIMFloater::addToHost(const LLUUID& session_id) { if (LLIMConversation::isChatMultiTab()) @@ -1157,32 +1190,3 @@ void LLIMFloater::addToHost(const LLUUID& session_id) } } } - -void LLIMFloater::onClickCloseBtn() -{ - - LLIMModel::LLIMSession* session = LLIMModel::instance().findIMSession( - mSessionID); - - if (session == NULL) - { - llwarns << "Empty session." << llendl; - return; - } - - bool is_call_with_chat = session->isGroupSessionType() - || session->isAdHocSessionType() || session->isP2PSessionType(); - - LLVoiceChannel* voice_channel = LLIMModel::getInstance()->getVoiceChannel(mSessionID); - - if (is_call_with_chat && voice_channel != NULL - && voice_channel->isActive()) - { - LLSD payload; - payload["session_id"] = mSessionID; - LLNotificationsUtil::add("ConfirmLeaveCall", LLSD(), payload, confirmLeaveCallCallback); - return; - } - - LLFloater::onClickCloseBtn(); -} -- cgit v1.2.3 From 8353a1ab4d9dab891535b766329c5d92323fe3b6 Mon Sep 17 00:00:00 2001 From: Seth ProductEngine Date: Fri, 8 Jun 2012 01:08:56 +0300 Subject: CHUI-120 WIP Added avatar picker that allows to add other users to an existing chat if they don't participate in it already. --- indra/newview/llimfloater.cpp | 69 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) (limited to 'indra/newview/llimfloater.cpp') diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index f04fecca26..f49375798d 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -33,12 +33,14 @@ #include "llagent.h" #include "llappviewer.h" +#include "llavataractions.h" #include "llavatarnamecache.h" #include "llbutton.h" #include "llchannelmanager.h" #include "llchiclet.h" #include "llchicletbar.h" #include "llfloaterreg.h" +#include "llfloateravatarpicker.h" #include "llimfloatercontainer.h" // to replace separate IM Floaters with multifloater container #include "llinventoryfunctions.h" //#include "lllayoutstack.h" @@ -309,6 +311,7 @@ BOOL LLIMFloater::postBuild() mTypingStart = LLTrans::getString("IM_typing_start_string"); + childSetAction("add_btn", boost::bind(&LLIMFloater::onAddButtonClicked, this)); childSetAction("voice_call_btn", boost::bind(&LLIMFloater::onCallButtonClicked, this)); LLVoiceClient::getInstance()->addObserver(this); @@ -321,6 +324,72 @@ BOOL LLIMFloater::postBuild() return TRUE; } +void LLIMFloater::onAddButtonClicked() +{ + LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(boost::bind(&LLIMFloater::onAvatarPicked, this, _1, _2), TRUE, TRUE); + if (!picker) + { + return; + } + + // Need to disable 'ok' button when selected users are already in conversation. + picker->setOkBtnEnableCb(boost::bind(&LLIMFloater::canAddSelectedToChat, this, _1)); + LLFloater* root_floater = gFloaterView->getParentFloater(this); + if (root_floater) + { + root_floater->addDependentFloater(picker); + } +} + +void LLIMFloater::onAvatarPicked(const uuid_vec_t& ids, const std::vector names) +{ + if (mIsP2PChat) + { + mStartConferenceInSameFloater = true; + onClose(false); + + uuid_vec_t temp_ids; + temp_ids.push_back(mOtherParticipantUUID); + temp_ids.insert(temp_ids.end(), ids.begin(), ids.end()); + + LLAvatarActions::startConference(temp_ids, mSessionID); + } + else + { + inviteToSession(ids); + } +} + +bool LLIMFloater::canAddSelectedToChat(const uuid_vec_t& uuids) +{ + if (!mSession + || mDialog == IM_SESSION_GROUP_START + || mDialog == IM_SESSION_INVITE && gAgent.isInGroup(mSessionID)) + { + return false; + } + + for (uuid_vec_t::const_iterator id = uuids.begin(); + id != uuids.end(); ++id) + { + if (*id == mOtherParticipantUUID) + { + return false; + } + + for (uuid_vec_t::const_iterator target_id = mSession->mInitialTargetIDs.begin(); + target_id != mSession->mInitialTargetIDs.end(); ++target_id) + { + if (*id == *target_id) + { + return false; + } + } + } + + return true; +} + void LLIMFloater::boundVoiceChannel() { LLVoiceChannel* voice_channel = LLIMModel::getInstance()->getVoiceChannel(mSessionID); -- cgit v1.2.3 From 9b92235291382deac15b860efa281f625d2173dd Mon Sep 17 00:00:00 2001 From: Seth ProductEngine Date: Fri, 8 Jun 2012 01:08:58 +0300 Subject: CHUI-120 WIP Added conversations participants drag and drop from avatar lists to IM floaters. - Added new drag and drop type DAD_PERSON and source SOURCE_PEOPLE to avoid highliting the toolbars when using SOURCE_VIEWER. - Disabled calling card drop support as it is considered obsolete. --- indra/newview/llimfloater.cpp | 97 ++++++++++++++----------------------------- 1 file changed, 31 insertions(+), 66 deletions(-) (limited to 'indra/newview/llimfloater.cpp') diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index f49375798d..6a510c4df1 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -986,90 +986,55 @@ void LLIMFloater::processSessionUpdate(const LLSD& session_update) } } -BOOL LLIMFloater::handleDragAndDrop(S32 x, S32 y, MASK mask, - BOOL drop, EDragAndDropType cargo_type, - void *cargo_data, EAcceptance *accept, - std::string& tooltip_msg) +// virtual +BOOL LLIMFloater::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, + EDragAndDropType cargo_type, + void* cargo_data, + EAcceptance* accept, + std::string& tooltip_msg) { - if (mDialog == IM_NOTHING_SPECIAL) - { - LLToolDragAndDrop::handleGiveDragAndDrop(mOtherParticipantUUID, mSessionID, drop, - cargo_type, cargo_data, accept); - } - - // handle case for dropping calling cards (and folders of calling cards) onto invitation panel for invites - else if (isInviteAllowed()) + if (cargo_type == DAD_PERSON) { - *accept = ACCEPT_NO; - - if (cargo_type == DAD_CALLINGCARD) + if (dropPerson(static_cast(cargo_data), drop)) { - if (dropCallingCard((LLInventoryItem*) cargo_data, drop)) - { - *accept = ACCEPT_YES_MULTI; - } + *accept = ACCEPT_YES_MULTI; } - else if (cargo_type == DAD_CATEGORY) + else { - if (dropCategory((LLInventoryCategory*) cargo_data, drop)) - { - *accept = ACCEPT_YES_MULTI; - } + *accept = ACCEPT_NO; } } return TRUE; } -BOOL LLIMFloater::dropCallingCard(LLInventoryItem* item, BOOL drop) +bool LLIMFloater::dropPerson(LLInventoryObject* item, bool drop) { - BOOL rv = isInviteAllowed(); - if (rv && item && item->getCreatorUUID().notNull()) + bool res = item && item->getUUID().notNull(); + if(res) { - if (drop) - { - uuid_vec_t ids; - ids.push_back(item->getCreatorUUID()); - inviteToSession(ids); - } - } - else - { - // set to false if creator uuid is null. - rv = FALSE; - } - return rv; -} + uuid_vec_t ids; + ids.push_back(item->getUUID()); -BOOL LLIMFloater::dropCategory(LLInventoryCategory* category, BOOL drop) -{ - BOOL rv = isInviteAllowed(); - if (rv && category) - { - LLInventoryModel::cat_array_t cats; - LLInventoryModel::item_array_t items; - LLUniqueBuddyCollector buddies; - gInventory.collectDescendentsIf(category->getUUID(), - cats, - items, - LLInventoryModel::EXCLUDE_TRASH, - buddies); - S32 count = items.count(); - if (count == 0) - { - rv = FALSE; - } - else if (drop) + res = canAddSelectedToChat(ids); + if(res && drop) { - uuid_vec_t ids; - ids.reserve(count); - for (S32 i = 0; i < count; ++i) + if (mIsP2PChat) { - ids.push_back(items.get(i)->getCreatorUUID()); + mStartConferenceInSameFloater = true; + onClose(false); + + ids.push_back(mOtherParticipantUUID); + + LLAvatarActions::startConference(ids, mSessionID); + } + else + { + inviteToSession(ids); } - inviteToSession(ids); } } - return rv; + + return res; } BOOL LLIMFloater::isInviteAllowed() const -- cgit v1.2.3 From f7f85dd0dda563a9fb49ed65b193a9ea98da9ba2 Mon Sep 17 00:00:00 2001 From: Seth ProductEngine Date: Fri, 8 Jun 2012 01:09:00 +0300 Subject: CHUI-122 FIX Add button enabled only for P2P and ad hoc IM sessions. --- indra/newview/llimfloater.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'indra/newview/llimfloater.cpp') diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index 6a510c4df1..dcd19b5856 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -311,7 +311,12 @@ BOOL LLIMFloater::postBuild() mTypingStart = LLTrans::getString("IM_typing_start_string"); - childSetAction("add_btn", boost::bind(&LLIMFloater::onAddButtonClicked, this)); + LLButton* add_btn = getChild("add_btn"); + + // Allow to add chat participants depending on the session type + add_btn->setEnabled(isInviteAllowed()); + add_btn->setClickedCallback(boost::bind(&LLIMFloater::onAddButtonClicked, this)); + childSetAction("voice_call_btn", boost::bind(&LLIMFloater::onCallButtonClicked, this)); LLVoiceClient::getInstance()->addObserver(this); -- cgit v1.2.3 From b50349ab8490c9b48e9cf89b8de186b528d90e60 Mon Sep 17 00:00:00 2001 From: Seth ProductEngine Date: Wed, 13 Jun 2012 19:26:17 +0300 Subject: CHUI-120 WIP Fix for crash after closing the chat floater. --- indra/newview/llimfloater.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'indra/newview/llimfloater.cpp') diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index dcd19b5856..3458e740e7 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -487,6 +487,10 @@ void LLIMFloater::onAvatarNameCache(const LLUUID& agent_id, // virtual BOOL LLIMFloater::tick() { + // This check is needed until LLFloaterReg::removeInstance() is synchronized with deleting the floater + // via LLMortician::updateClass(), to avoid calling dead instances. See LLFloater::destroy(). + if (isDead()) return false; + BOOL parents_retcode = LLIMConversation::tick(); if ( mMeTyping ) -- cgit v1.2.3 From 569146f27c7350ca2245f1fa7bc4cb9c16a428ea Mon Sep 17 00:00:00 2001 From: Seth ProductEngine Date: Wed, 13 Jun 2012 21:21:19 +0300 Subject: CHUI-120 WIP Modified chat participants drag and drop not to use LLClipboard. --- indra/newview/llimfloater.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'indra/newview/llimfloater.cpp') diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index 3458e740e7..7c6de01c96 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -1004,7 +1004,7 @@ BOOL LLIMFloater::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, { if (cargo_type == DAD_PERSON) { - if (dropPerson(static_cast(cargo_data), drop)) + if (dropPerson(static_cast(cargo_data), drop)) { *accept = ACCEPT_YES_MULTI; } @@ -1016,13 +1016,13 @@ BOOL LLIMFloater::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, return TRUE; } -bool LLIMFloater::dropPerson(LLInventoryObject* item, bool drop) +bool LLIMFloater::dropPerson(LLUUID* person_id, bool drop) { - bool res = item && item->getUUID().notNull(); + bool res = person_id && person_id->notNull(); if(res) { uuid_vec_t ids; - ids.push_back(item->getUUID()); + ids.push_back(*person_id); res = canAddSelectedToChat(ids); if(res && drop) -- cgit v1.2.3 From 51a39b5ac6465238178363f3ec3143dae4f73919 Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Thu, 14 Jun 2012 20:00:41 +0300 Subject: CHUI-199 WIP Modified the nearby chat for using floater_im_session.xml; merging LLNearbyChatBar with LLNearbyChat; clean up code; supressed a double creation of LLNearbyChat --- indra/newview/llimfloater.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'indra/newview/llimfloater.cpp') diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index 7c6de01c96..30a9c29ec6 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -489,7 +489,10 @@ BOOL LLIMFloater::tick() { // This check is needed until LLFloaterReg::removeInstance() is synchronized with deleting the floater // via LLMortician::updateClass(), to avoid calling dead instances. See LLFloater::destroy(). - if (isDead()) return false; + if (isDead()) + { + return false; + } BOOL parents_retcode = LLIMConversation::tick(); -- cgit v1.2.3 From 06f142e974854854c91988b6a8bc5c6005a40731 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Mon, 18 Jun 2012 18:12:38 -0700 Subject: CHUI-145 : Select on list focus on relevant panel, torn off or not; torn off im stay in list; closed im suppressed from lits in all situations --- indra/newview/llimfloater.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'indra/newview/llimfloater.cpp') diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index 30a9c29ec6..14fcd602fc 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -139,6 +139,16 @@ void LLIMFloater::onClose(bool app_quitting) // Last change: // EXT-3516 X Button should end IM session, _ button should hide gIMMgr->leaveSession(mSessionID); + + // Suppress the IM from the conversations list + if (LLIMConversation::isChatMultiTab()) + { + LLIMFloaterContainer* im_box = LLIMFloaterContainer::findInstance(); + if (im_box) + { + im_box->removeConversationListItem(mSessionID); + } + } } /* static */ -- cgit v1.2.3 From 18aabdfd3d2efc1b5507e2fe001cfc36ee84b710 Mon Sep 17 00:00:00 2001 From: Paul ProductEngine Date: Tue, 19 Jun 2012 09:44:40 +0300 Subject: CHUI-127 FIXED (Make chat field auto resizable) - Replaced LLLineEditor with newly created LLChatEntry - Moved some functionality (such as setting label) to the LLTextBase as it can be useful to the other derived classes --- indra/newview/llimfloater.cpp | 34 ++++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 10 deletions(-) (limited to 'indra/newview/llimfloater.cpp') diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index 30a9c29ec6..dde7d248dd 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -44,7 +44,7 @@ #include "llimfloatercontainer.h" // to replace separate IM Floaters with multifloater container #include "llinventoryfunctions.h" //#include "lllayoutstack.h" -#include "lllineeditor.h" +#include "llchatentry.h" #include "lllogchat.h" #include "llscreenchannel.h" #include "llsyswellwindow.h" @@ -64,6 +64,7 @@ LLIMFloater::LLIMFloater(const LLUUID& session_id) mLastMessageIndex(-1), mDialog(IM_NOTHING_SPECIAL), mInputEditor(NULL), + mInputEditorTopPad(0), mSavedTitle(), mTypingStart(), mShouldSendTypingState(false), @@ -190,7 +191,9 @@ void LLIMFloater::sendMsg() { if (mInputEditor) { - LLWString text = mInputEditor->getConvertedText(); + LLWString text = mInputEditor->getWText(); + LLWStringUtil::trim(text); + LLWStringUtil::replaceChar(text,182,'\n'); // Convert paragraph symbols back into newlines. if(!text.empty()) { // Truncate and convert to UTF8 for transport @@ -287,26 +290,26 @@ BOOL LLIMFloater::postBuild() { LLIMConversation::postBuild(); - mInputEditor = getChild("chat_editor"); + mInputEditor = getChild("chat_editor"); mInputEditor->setMaxTextLength(1023); // enable line history support for instant message bar - mInputEditor->setEnableLineHistory(TRUE); LLFontGL* font = LLViewerChat::getChatFont(); mInputEditor->setFont(font); mInputEditor->setFocusReceivedCallback( boost::bind(onInputEditorFocusReceived, _1, this) ); mInputEditor->setFocusLostCallback( boost::bind(onInputEditorFocusLost, _1, this) ); - mInputEditor->setKeystrokeCallback( onInputEditorKeystroke, this ); + mInputEditor->setKeystrokeCallback( boost::bind(onInputEditorKeystroke, _1, this) ); mInputEditor->setCommitOnFocusLost( FALSE ); - mInputEditor->setRevertOnEsc( FALSE ); - mInputEditor->setReplaceNewlinesWithSpaces( FALSE ); mInputEditor->setPassDelete( TRUE ); - childSetCommitCallback("chat_editor", onSendMsg, this); + mInputEditor->setCommitCallback(boost::bind(onSendMsg, _1, this)); + mInputEditor->setTextExpandedCallback(boost::bind(&LLIMFloater::reshapeChatHistory, this)); mChatHistory = getChild("chat_history"); + mInputEditorTopPad = mChatHistory->getRect().mBottom - mInputEditor->getRect().mTop; + setDocked(true); mTypingStart = LLTrans::getString("IM_typing_start_string"); @@ -880,7 +883,7 @@ void LLIMFloater::onInputEditorFocusLost(LLFocusableElement* caller, void* userd } // static -void LLIMFloater::onInputEditorKeystroke(LLLineEditor* caller, void* userdata) +void LLIMFloater::onInputEditorKeystroke(LLTextEditor* caller, void* userdata) { LLIMFloater* self = (LLIMFloater*) userdata; std::string text = self->mInputEditor->getText(); @@ -1077,7 +1080,7 @@ private: BOOL LLIMFloater::inviteToSession(const uuid_vec_t& ids) { LLViewerRegion* region = gAgent.getRegion(); - bool is_region_exist = !!region; + bool is_region_exist = region != NULL; if (is_region_exist) { @@ -1158,6 +1161,17 @@ void LLIMFloater::removeTypingIndicator(const LLIMInfo* im_info) } } +void LLIMFloater::reshapeChatHistory() +{ + LLRect chat_rect = mChatHistory->getRect(); + LLRect input_rect = mInputEditor->getRect(); + + int delta_height = chat_rect.mBottom - (input_rect.mTop + mInputEditorTopPad); + + chat_rect.setLeftTopAndSize(chat_rect.mLeft, chat_rect.mTop, chat_rect.getWidth(), chat_rect.getHeight() + delta_height); + mChatHistory->setShape(chat_rect); +} + // static void LLIMFloater::closeHiddenIMToasts() { -- cgit v1.2.3 From c0842339e72b15331a5bbb6bd41324c28916d678 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Tue, 19 Jun 2012 15:05:20 -0700 Subject: CHUI-138 : Suppress chiclets for conversations when using tabbed UI; Make sure list is cleaned up on close --- indra/newview/llimfloater.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'indra/newview/llimfloater.cpp') diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index 882637151d..4b954de738 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -109,6 +109,16 @@ void LLIMFloater::onFocusReceived() // virtual void LLIMFloater::onClose(bool app_quitting) { + // Always suppress the IM from the conversations list on close if present for any reason + if (LLIMConversation::isChatMultiTab()) + { + LLIMFloaterContainer* im_box = LLIMFloaterContainer::findInstance(); + if (im_box) + { + im_box->removeConversationListItem(mSessionID); + } + } + LLIMModel::LLIMSession* session = LLIMModel::instance().findIMSession( mSessionID); @@ -140,16 +150,6 @@ void LLIMFloater::onClose(bool app_quitting) // Last change: // EXT-3516 X Button should end IM session, _ button should hide gIMMgr->leaveSession(mSessionID); - - // Suppress the IM from the conversations list - if (LLIMConversation::isChatMultiTab()) - { - LLIMFloaterContainer* im_box = LLIMFloaterContainer::findInstance(); - if (im_box) - { - im_box->removeConversationListItem(mSessionID); - } - } } /* static */ -- cgit v1.2.3 From 6bb554fc3661d3b8b1284db96bb7c7b0934df621 Mon Sep 17 00:00:00 2001 From: Paul ProductEngine Date: Fri, 22 Jun 2012 16:54:42 +0300 Subject: CHUI-160 FIXED (Text entered in local chat text field scrolls up and becomes only partially visible after hitting return) - Replaced LLLineEditor with LLChatEntry in nearby chat - Moved reshape method from LLIMFloater to the base LLIMConversation so that vertical reshaping work properly for both LLNearbyChat and LLIMFloater --- indra/newview/llimfloater.cpp | 15 --------------- 1 file changed, 15 deletions(-) (limited to 'indra/newview/llimfloater.cpp') diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index 4b954de738..98ebc82f99 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -64,7 +64,6 @@ LLIMFloater::LLIMFloater(const LLUUID& session_id) mLastMessageIndex(-1), mDialog(IM_NOTHING_SPECIAL), mInputEditor(NULL), - mInputEditorTopPad(0), mSavedTitle(), mTypingStart(), mShouldSendTypingState(false), @@ -314,12 +313,9 @@ BOOL LLIMFloater::postBuild() mInputEditor->setPassDelete( TRUE ); mInputEditor->setCommitCallback(boost::bind(onSendMsg, _1, this)); - mInputEditor->setTextExpandedCallback(boost::bind(&LLIMFloater::reshapeChatHistory, this)); mChatHistory = getChild("chat_history"); - mInputEditorTopPad = mChatHistory->getRect().mBottom - mInputEditor->getRect().mTop; - setDocked(true); mTypingStart = LLTrans::getString("IM_typing_start_string"); @@ -1171,17 +1167,6 @@ void LLIMFloater::removeTypingIndicator(const LLIMInfo* im_info) } } -void LLIMFloater::reshapeChatHistory() -{ - LLRect chat_rect = mChatHistory->getRect(); - LLRect input_rect = mInputEditor->getRect(); - - int delta_height = chat_rect.mBottom - (input_rect.mTop + mInputEditorTopPad); - - chat_rect.setLeftTopAndSize(chat_rect.mLeft, chat_rect.mTop, chat_rect.getWidth(), chat_rect.getHeight() + delta_height); - mChatHistory->setShape(chat_rect); -} - // static void LLIMFloater::closeHiddenIMToasts() { -- cgit v1.2.3 From 9353a9e6ef071bd980c319d038b1dedb649d2db0 Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Mon, 25 Jun 2012 23:55:25 +0300 Subject: CHUI-167 FIXED Move onClose() from LLIMFloater to it's basic class (LLIMConversation) for correct using add/remove conversation list items also for LLNearbyChat --- indra/newview/llimfloater.cpp | 84 ++++++++++++++++++++----------------------- 1 file changed, 39 insertions(+), 45 deletions(-) (limited to 'indra/newview/llimfloater.cpp') diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index 98ebc82f99..37ee7b8a7c 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -105,51 +105,6 @@ void LLIMFloater::onFocusReceived() } } -// virtual -void LLIMFloater::onClose(bool app_quitting) -{ - // Always suppress the IM from the conversations list on close if present for any reason - if (LLIMConversation::isChatMultiTab()) - { - LLIMFloaterContainer* im_box = LLIMFloaterContainer::findInstance(); - if (im_box) - { - im_box->removeConversationListItem(mSessionID); - } - } - - LLIMModel::LLIMSession* session = LLIMModel::instance().findIMSession( - mSessionID); - - if (session == NULL) - { - llwarns << "Empty session." << llendl; - return; - } - - bool is_call_with_chat = session->isGroupSessionType() - || session->isAdHocSessionType() || session->isP2PSessionType(); - - LLVoiceChannel* voice_channel = LLIMModel::getInstance()->getVoiceChannel(mSessionID); - - if (is_call_with_chat && voice_channel != NULL - && voice_channel->isActive()) - { - LLSD payload; - payload["session_id"] = mSessionID; - LLNotificationsUtil::add("ConfirmLeaveCall", LLSD(), payload, confirmLeaveCallCallback); - return; - } - - setTyping(false); - - // The source of much argument and design thrashing - // Should the window hide or the session close when the X is clicked? - // - // Last change: - // EXT-3516 X Button should end IM session, _ button should hide - gIMMgr->leaveSession(mSessionID); -} /* static */ void LLIMFloater::newIMCallback(const LLSD& data) @@ -611,6 +566,45 @@ LLIMFloater* LLIMFloater::getInstance(const LLUUID& session_id) return conversation; } +void LLIMFloater::onClose(bool app_quitting) +{ + LLIMConversation::onClose(app_quitting); + + + LLIMModel::LLIMSession* session = LLIMModel::instance().findIMSession( + mSessionID); + + if (session == NULL) + { + llwarns << "Empty session." << llendl; + return; + } + + bool is_call_with_chat = session->isGroupSessionType() + || session->isAdHocSessionType() || session->isP2PSessionType(); + + LLVoiceChannel* voice_channel = LLIMModel::getInstance()->getVoiceChannel(mSessionID); + + if (is_call_with_chat && voice_channel != NULL + && voice_channel->isActive()) + { + LLSD payload; + payload["session_id"] = mSessionID; + LLNotificationsUtil::add("ConfirmLeaveCall", LLSD(), payload, confirmLeaveCallCallback); + return; + } + + setTyping(false); + + // The source of much argument and design thrashing + // Should the window hide or the session close when the X is clicked? + // + // Last change: + // EXT-3516 X Button should end IM session, _ button should hide + gIMMgr->leaveSession(mSessionID); + +} + void LLIMFloater::setDocked(bool docked, bool pop_on_undock) { // update notification channel state -- cgit v1.2.3 From c233f0c9494d7dddbd8baab0f87b0ad54f42b0f9 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Tue, 26 Jun 2012 17:05:16 -0700 Subject: CHUI-164 : Fix crash when closing ad-hoc conversations; insure consistency of the conversation list when adding and removing items from it --- indra/newview/llimfloater.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'indra/newview/llimfloater.cpp') diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index 98ebc82f99..f89bafc7ea 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -540,8 +540,10 @@ LLIMFloater* LLIMFloater::show(const LLUUID& session_id) } } + // Test the existence of the floater before we try to create it bool exist = findInstance(session_id); + // Get the floater: this will create the instance if it didn't exist LLIMFloater* floater = getInstance(session_id); if (!floater) return NULL; @@ -550,18 +552,21 @@ LLIMFloater* LLIMFloater::show(const LLUUID& session_id) { LLIMFloaterContainer* floater_container = LLIMFloaterContainer::getInstance(); - // do not add existed floaters to avoid adding torn off instances + // Do not add again existing floaters if (!exist) { // LLTabContainer::eInsertionPoint i_pt = user_initiated ? LLTabContainer::RIGHT_OF_CURRENT : LLTabContainer::END; // TODO: mantipov: use LLTabContainer::RIGHT_OF_CURRENT if it exists LLTabContainer::eInsertionPoint i_pt = LLTabContainer::END; - if (floater_container) { floater_container->addFloater(floater, TRUE, i_pt); } } + + // Add a conversation list item in the left pane: nothing will be done if already in there + // but relevant clean up will be done to ensure consistency of the conversation list + floater_container->addConversationListItem(floater->getTitle(), session_id, floater); floater->openFloater(floater->getKey()); } -- cgit v1.2.3 From 0cfea7b406c87bf593d2f7cf6040d92ef99b64cf Mon Sep 17 00:00:00 2001 From: Seth ProductEngine Date: Tue, 26 Jun 2012 01:38:59 +0300 Subject: CHUI-147 FIX Added updating conference participants in IM floater title - The title is updated with the data from participants list widget in IM floater. - Creating the participants list is fixed for the case of starting the ad hoc session when the session id changes upon initialization (see LLIMConversation::buildParticipantList()). - LLEventTimer replaced with simple LLTimer to avoid crashes in LLEventTimer::tick(). - Moved the build_residents_string() code to LLAvatarActions::buildResidentsString() to use it in LLIMFloater::onParticipantsListChanged(). --- indra/newview/llimfloater.cpp | 93 +++++++++++++++++++++++++++++++++---------- 1 file changed, 71 insertions(+), 22 deletions(-) (limited to 'indra/newview/llimfloater.cpp') diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index 9ea4bec069..6a5bf153d4 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -105,6 +105,18 @@ void LLIMFloater::onFocusReceived() } } +// virtual +void LLIMFloater::refresh() +{ + if (mMeTyping) + { + // Time out if user hasn't typed for a while. + if (mTypingTimeoutTimer.getElapsedTimeF32() > LLAgent::TYPING_TIMEOUT_SECS) + { + setTyping(false); + } + } +} /* static */ void LLIMFloater::newIMCallback(const LLSD& data) @@ -188,6 +200,7 @@ void LLIMFloater::sendMsg() LLIMFloater::~LLIMFloater() { + mParticipantsListRefreshConnection.disconnect(); mVoiceChannelStateChangeConnection.disconnect(); if(LLVoiceClient::instanceExists()) { @@ -225,6 +238,8 @@ void LLIMFloater::initIMFloater() boundVoiceChannel(); + mTypingStart = LLTrans::getString("IM_typing_start_string"); + // Show control panel in torn off floaters only. mParticipantListPanel->setVisible(!getHost() && gSavedSettings.getBOOL("IMShowControlPanel")); @@ -246,6 +261,20 @@ void LLIMFloater::initIMFloater() { std::string session_name(LLIMModel::instance().getName(mSessionID)); updateSessionName(session_name, session_name); + + // For ad hoc conferences we should update the title with participants names. + if ((IM_SESSION_INVITE == mDialog && !gAgent.isInGroup(mSessionID)) + || mDialog == IM_SESSION_CONFERENCE_START) + { + if (mParticipantsListRefreshConnection.connected()) + { + mParticipantsListRefreshConnection.disconnect(); + } + + LLAvatarList* avatar_list = getChild("speakers_list"); + mParticipantsListRefreshConnection = avatar_list->setRefreshCompleteCallback( + boost::bind(&LLIMFloater::onParticipantsListChanged, this, _1)); + } } } @@ -273,8 +302,6 @@ BOOL LLIMFloater::postBuild() setDocked(true); - mTypingStart = LLTrans::getString("IM_typing_start_string"); - LLButton* add_btn = getChild("add_btn"); // Allow to add chat participants depending on the session type @@ -341,7 +368,9 @@ bool LLIMFloater::canAddSelectedToChat(const uuid_vec_t& uuids) for (uuid_vec_t::const_iterator id = uuids.begin(); id != uuids.end(); ++id) { - if (*id == mOtherParticipantUUID) + // Skip this check for ad hoc conferences, + // conference participants should be listed in mSession->mInitialTargetIDs. + if (mIsP2PChat && *id == mOtherParticipantUUID) { return false; } @@ -411,11 +440,6 @@ void LLIMFloater::onCallButtonClicked() } } -/*void LLIMFloater::onOpenVoiceControlsClicked() -{ - LLFloaterReg::showInstance("voice_controls"); -}*/ - void LLIMFloater::onChange(EStatusType status, const std::string &channelURI, bool proximal) { if(status != STATUS_JOINING && status != STATUS_LEFT_CHANNEL) @@ -448,28 +472,55 @@ void LLIMFloater::onAvatarNameCache(const LLUUID& agent_id, mTypingStart.setArg("[NAME]", ui_title); } -// virtual -BOOL LLIMFloater::tick() +void LLIMFloater::onParticipantsListChanged(LLUICtrl* ctrl) { - // This check is needed until LLFloaterReg::removeInstance() is synchronized with deleting the floater - // via LLMortician::updateClass(), to avoid calling dead instances. See LLFloater::destroy(). - if (isDead()) + LLAvatarList* avatar_list = dynamic_cast(ctrl); + if (!avatar_list) { - return false; + return; } - BOOL parents_retcode = LLIMConversation::tick(); + bool all_names_resolved = true; + std::vector participants_uuids; - if ( mMeTyping ) + avatar_list->getValues(participants_uuids); + + // Check whether we have all participants names in LLAvatarNameCache + for (std::vector::const_iterator it = participants_uuids.begin(); it != participants_uuids.end(); ++it) { - // Time out if user hasn't typed for a while. - if ( mTypingTimeoutTimer.getElapsedTimeF32() > LLAgent::TYPING_TIMEOUT_SECS ) + const LLUUID& id = it->asUUID(); + LLAvatarName av_name; + if (!LLAvatarNameCache::get(id, &av_name)) { - setTyping(false); + all_names_resolved = false; + + // If a name is not found in cache, request it and continue the process recursively + // until all ids are resolved into names. + LLAvatarNameCache::get(id, + boost::bind(&LLIMFloater::onParticipantsListChanged, this, avatar_list)); + break; } } - return parents_retcode; + if (all_names_resolved) + { + std::vector avatar_names; + std::vector::const_iterator it = participants_uuids.begin(); + for (; it != participants_uuids.end(); ++it) + { + const LLUUID& id = it->asUUID(); + LLAvatarName av_name; + if (LLAvatarNameCache::get(id, &av_name)) + { + avatar_names.push_back(av_name); + } + } + + std::string ui_title; + LLAvatarActions::buildResidentsString(avatar_names, ui_title); + + updateSessionName(ui_title, ui_title); + } } //static @@ -737,8 +788,6 @@ void LLIMFloater::sessionInitReplyReceived(const LLUUID& im_session_id) { initIMSession(im_session_id); - boundVoiceChannel(); - buildParticipantList(); } -- cgit v1.2.3 From 9091986c698af6d008a12f1944724609d649b63e Mon Sep 17 00:00:00 2001 From: Seth ProductEngine Date: Wed, 27 Jun 2012 19:33:22 +0300 Subject: CHUI-147 FIX Added check against empty participants names array to pass the assertion in LLAvatarActions::buildResidentsString. --- indra/newview/llimfloater.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'indra/newview/llimfloater.cpp') diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index 6a5bf153d4..1bbf6cc320 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -516,10 +516,14 @@ void LLIMFloater::onParticipantsListChanged(LLUICtrl* ctrl) } } - std::string ui_title; - LLAvatarActions::buildResidentsString(avatar_names, ui_title); - - updateSessionName(ui_title, ui_title); + // We should check whether the vector is not empty to pass the assertion + // that avatar_names.size() > 0 in LLAvatarActions::buildResidentsString. + if (!avatar_names.empty()) + { + std::string ui_title; + LLAvatarActions::buildResidentsString(avatar_names, ui_title); + updateSessionName(ui_title, ui_title); + } } } -- cgit v1.2.3 From 0eda1f9a4d909870b15c6d7243e47838540598e8 Mon Sep 17 00:00:00 2001 From: Seth ProductEngine Date: Wed, 27 Jun 2012 19:33:27 +0300 Subject: CHUI-169 FIX Restored inventory sharing functionality via IM floater drag and drop. --- indra/newview/llimfloater.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'indra/newview/llimfloater.cpp') diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index 1bbf6cc320..b94a4048d4 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -1077,6 +1077,12 @@ BOOL LLIMFloater::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, *accept = ACCEPT_NO; } } + else if (mDialog == IM_NOTHING_SPECIAL) + { + LLToolDragAndDrop::handleGiveDragAndDrop(mOtherParticipantUUID, mSessionID, drop, + cargo_type, cargo_data, accept); + } + return TRUE; } -- cgit v1.2.3 From 7a147c1de99a7d03008d2921f091aa3de03a559f Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Wed, 27 Jun 2012 17:08:19 -0700 Subject: CHUI-146 : Fixed. Focus goes to first conversation in list when a conversation is dismissed. --- indra/newview/llimfloater.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'indra/newview/llimfloater.cpp') diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index b94a4048d4..9d3c0f98ce 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -628,9 +628,6 @@ LLIMFloater* LLIMFloater::getInstance(const LLUUID& session_id) void LLIMFloater::onClose(bool app_quitting) { - LLIMConversation::onClose(app_quitting); - - LLIMModel::LLIMSession* session = LLIMModel::instance().findIMSession( mSessionID); @@ -663,6 +660,8 @@ void LLIMFloater::onClose(bool app_quitting) // EXT-3516 X Button should end IM session, _ button should hide gIMMgr->leaveSession(mSessionID); + // Clean up the conversation *after* the session has been ended + LLIMConversation::onClose(app_quitting); } void LLIMFloater::setDocked(bool docked, bool pop_on_undock) -- cgit v1.2.3 From ad1f2eb5106a9ba0217ff1080d029f912ecc25e5 Mon Sep 17 00:00:00 2001 From: Seth ProductEngine Date: Tue, 3 Jul 2012 22:31:58 +0300 Subject: CHUI-186 CHUI-187 FIX Removing a P2P convrsation from converstaion widget in the upper right corner when a new participant is added. End call prompt removed when adding a new participant to a P2P voice call. After adding a participant to a P2P voice conversation the resulting conference call is restarted voice invites to all participants. --- indra/newview/llimfloater.cpp | 73 ++++++++++++++++++++++++------------------- 1 file changed, 40 insertions(+), 33 deletions(-) (limited to 'indra/newview/llimfloater.cpp') diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index 9d3c0f98ce..536d0b9a23 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -322,7 +322,7 @@ BOOL LLIMFloater::postBuild() void LLIMFloater::onAddButtonClicked() { - LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(boost::bind(&LLIMFloater::onAvatarPicked, this, _1, _2), TRUE, TRUE); + LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(boost::bind(&LLIMFloater::addSessionParticipants, this, _1), TRUE, TRUE); if (!picker) { return; @@ -337,25 +337,6 @@ void LLIMFloater::onAddButtonClicked() } } -void LLIMFloater::onAvatarPicked(const uuid_vec_t& ids, const std::vector names) -{ - if (mIsP2PChat) - { - mStartConferenceInSameFloater = true; - onClose(false); - - uuid_vec_t temp_ids; - temp_ids.push_back(mOtherParticipantUUID); - temp_ids.insert(temp_ids.end(), ids.begin(), ids.end()); - - LLAvatarActions::startConference(temp_ids, mSessionID); - } - else - { - inviteToSession(ids); - } -} - bool LLIMFloater::canAddSelectedToChat(const uuid_vec_t& uuids) { if (!mSession @@ -388,6 +369,44 @@ bool LLIMFloater::canAddSelectedToChat(const uuid_vec_t& uuids) return true; } +void LLIMFloater::addSessionParticipants(const uuid_vec_t& uuids) +{ + if (mIsP2PChat) + { + mStartConferenceInSameFloater = true; + + uuid_vec_t temp_ids; + + // Add the initial participant of a P2P session + temp_ids.push_back(mOtherParticipantUUID); + temp_ids.insert(temp_ids.end(), uuids.begin(), uuids.end()); + + LLVoiceChannel* voice_channel = LLIMModel::getInstance()->getVoiceChannel(mSessionID); + + // first check whether this is a voice session + bool is_voice_call = voice_channel != NULL && voice_channel->isActive(); + + // then we can close the current session + gIMMgr->leaveSession(mSessionID); + LLIMConversation::onClose(false); + + // Start a new ad hoc voice call if we invite new participants to a P2P call, + // or start a text chat otherwise. + if (is_voice_call) + { + LLAvatarActions::startAdhocCall(temp_ids, mSessionID); + } + else + { + LLAvatarActions::startConference(temp_ids, mSessionID); + } + } + else + { + inviteToSession(uuids); + } +} + void LLIMFloater::boundVoiceChannel() { LLVoiceChannel* voice_channel = LLIMModel::getInstance()->getVoiceChannel(mSessionID); @@ -1096,19 +1115,7 @@ bool LLIMFloater::dropPerson(LLUUID* person_id, bool drop) res = canAddSelectedToChat(ids); if(res && drop) { - if (mIsP2PChat) - { - mStartConferenceInSameFloater = true; - onClose(false); - - ids.push_back(mOtherParticipantUUID); - - LLAvatarActions::startConference(ids, mSessionID); - } - else - { - inviteToSession(ids); - } + addSessionParticipants(ids); } } -- cgit v1.2.3 From ac0243a006fa28e872e4ee88f7c1588eaefeaecf Mon Sep 17 00:00:00 2001 From: Seth ProductEngine Date: Tue, 3 Jul 2012 22:32:21 +0300 Subject: CHUI-188 FIX for crash in adding chat participants. Modified the duplicated participants check procedure LLIMFloater::canAddSelectedToChat() to use the list, updated by LLSpeakerMgr instead of LLIMSession::mInitialTargetIDs list, which is initialized at session start and not updated afterwards. --- indra/newview/llimfloater.cpp | 72 +++++++++++++++++++++++++++---------------- 1 file changed, 46 insertions(+), 26 deletions(-) (limited to 'indra/newview/llimfloater.cpp') diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index 536d0b9a23..a506f0f9f3 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -339,34 +339,54 @@ void LLIMFloater::onAddButtonClicked() bool LLIMFloater::canAddSelectedToChat(const uuid_vec_t& uuids) { - if (!mSession - || mDialog == IM_SESSION_GROUP_START - || mDialog == IM_SESSION_INVITE && gAgent.isInGroup(mSessionID)) - { - return false; - } + if (!mSession + || mDialog == IM_SESSION_GROUP_START + || mDialog == IM_SESSION_INVITE && gAgent.isInGroup(mSessionID)) + { + return false; + } - for (uuid_vec_t::const_iterator id = uuids.begin(); - id != uuids.end(); ++id) - { - // Skip this check for ad hoc conferences, - // conference participants should be listed in mSession->mInitialTargetIDs. - if (mIsP2PChat && *id == mOtherParticipantUUID) - { - return false; - } - - for (uuid_vec_t::const_iterator target_id = mSession->mInitialTargetIDs.begin(); - target_id != mSession->mInitialTargetIDs.end(); ++target_id) - { - if (*id == *target_id) - { - return false; - } - } - } + if (mIsP2PChat) + { + // For a P2P session just check if we are not adding the other participant. + + for (uuid_vec_t::const_iterator id = uuids.begin(); + id != uuids.end(); ++id) + { + if (*id == mOtherParticipantUUID) + { + return false; + } + } + } + else + { + // For a conference session we need to check against the list from LLSpeakerMgr, + // because this list may change when participants join or leave the session. + + LLSpeakerMgr::speaker_list_t speaker_list; + LLIMSpeakerMgr* speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(mSessionID); + if (speaker_mgr) + { + speaker_mgr->getSpeakerList(&speaker_list, true); + } - return true; + for (uuid_vec_t::const_iterator id = uuids.begin(); + id != uuids.end(); ++id) + { + for (LLSpeakerMgr::speaker_list_t::const_iterator it = speaker_list.begin(); + it != speaker_list.end(); ++it) + { + const LLPointer& speaker = *it; + if (*id == speaker->mID) + { + return false; + } + } + } + } + + return true; } void LLIMFloater::addSessionParticipants(const uuid_vec_t& uuids) -- cgit v1.2.3 From b203fe12f8ea19ee80d9de1ac6ff4ebbc3bdb493 Mon Sep 17 00:00:00 2001 From: Seth ProductEngine Date: Tue, 10 Jul 2012 16:49:49 +0300 Subject: CHUI-201 FIX for crash when leaving a voice call via the end call prompt. Fixed the problem with confirmLeaveCallCallback() firing after the chat floater is destroyed. --- indra/newview/llimfloater.cpp | 57 +++++++++++++++++++++++-------------------- 1 file changed, 31 insertions(+), 26 deletions(-) (limited to 'indra/newview/llimfloater.cpp') diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index a506f0f9f3..23c97c5345 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -118,6 +118,35 @@ void LLIMFloater::refresh() } } +// virtual +void LLIMFloater::onClickCloseBtn() +{ + LLIMModel::LLIMSession* session = LLIMModel::instance().findIMSession( + mSessionID); + + if (session == NULL) + { + llwarns << "Empty session." << llendl; + return; + } + + bool is_call_with_chat = session->isGroupSessionType() + || session->isAdHocSessionType() || session->isP2PSessionType(); + + LLVoiceChannel* voice_channel = LLIMModel::getInstance()->getVoiceChannel(mSessionID); + + if (is_call_with_chat && voice_channel != NULL + && voice_channel->isActive()) + { + LLSD payload; + payload["session_id"] = mSessionID; + LLNotificationsUtil::add("ConfirmLeaveCall", LLSD(), payload, confirmLeaveCallCallback); + return; + } + + LLIMConversation::onClickCloseBtn(); +} + /* static */ void LLIMFloater::newIMCallback(const LLSD& data) { @@ -407,8 +436,7 @@ void LLIMFloater::addSessionParticipants(const uuid_vec_t& uuids) bool is_voice_call = voice_channel != NULL && voice_channel->isActive(); // then we can close the current session - gIMMgr->leaveSession(mSessionID); - LLIMConversation::onClose(false); + onClose(false); // Start a new ad hoc voice call if we invite new participants to a P2P call, // or start a text chat otherwise. @@ -667,29 +695,6 @@ LLIMFloater* LLIMFloater::getInstance(const LLUUID& session_id) void LLIMFloater::onClose(bool app_quitting) { - LLIMModel::LLIMSession* session = LLIMModel::instance().findIMSession( - mSessionID); - - if (session == NULL) - { - llwarns << "Empty session." << llendl; - return; - } - - bool is_call_with_chat = session->isGroupSessionType() - || session->isAdHocSessionType() || session->isP2PSessionType(); - - LLVoiceChannel* voice_channel = LLIMModel::getInstance()->getVoiceChannel(mSessionID); - - if (is_call_with_chat && voice_channel != NULL - && voice_channel->isActive()) - { - LLSD payload; - payload["session_id"] = mSessionID; - LLNotificationsUtil::add("ConfirmLeaveCall", LLSD(), payload, confirmLeaveCallCallback); - return; - } - setTyping(false); // The source of much argument and design thrashing @@ -1278,7 +1283,7 @@ void LLIMFloater::confirmLeaveCallCallback(const LLSD& notification, const LLSD& const LLSD& payload = notification["payload"]; LLUUID session_id = payload["session_id"]; - LLFloater* im_floater = LLFloaterReg::findInstance("impanel", session_id); + LLFloater* im_floater = findInstance(session_id); if (option == 0 && im_floater != NULL) { im_floater->closeFloater(); -- cgit v1.2.3 From 7c9be0e3de6821478c71e4646f07fb112e0e572c Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Thu, 19 Jul 2012 15:11:56 +0300 Subject: CHUI-229 [FIXED] Nearby chat conversation does not appear initially in conversation list if no other conversations are present --- indra/newview/llimfloater.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'indra/newview/llimfloater.cpp') diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index 23c97c5345..22ce3cd42b 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -346,6 +346,10 @@ BOOL LLIMFloater::postBuild() initIMFloater(); + // Add a conversation list item in the left pane + LLIMFloaterContainer* im_box = LLIMFloaterContainer::getInstance(); + im_box->addConversationListItem(getTitle(), getKey(), this); + return TRUE; } @@ -641,10 +645,6 @@ LLIMFloater* LLIMFloater::show(const LLUUID& session_id) } } - // Add a conversation list item in the left pane: nothing will be done if already in there - // but relevant clean up will be done to ensure consistency of the conversation list - floater_container->addConversationListItem(floater->getTitle(), session_id, floater); - floater->openFloater(floater->getKey()); } else -- cgit v1.2.3 From 0ee0a5eff41a3763b1fc3fc45a36f87fc6eedac5 Mon Sep 17 00:00:00 2001 From: Paul ProductEngine Date: Fri, 27 Jul 2012 22:25:17 +0300 Subject: CHUI-151 FIXED (Implement conversation log) A brief explanation of what have been implemented. More information can be found in comments. 1. Created conversation history viewer (llfloaterconversationpreview) 2. Created LLConversation and LLConversationLog classes which represent and hold data of conversations (llconversationlog) 3. Created LLConversationLogList and LLConversationLogListItem which are the visual representation of LLConversationLog and LLConversation respectively 4. Created LLFloaterConversationLog - which holds and displays LLConversationLogList --- indra/newview/llimfloater.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'indra/newview/llimfloater.cpp') diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index 22ce3cd42b..f1d7d1c04f 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -59,6 +59,8 @@ #include "llviewerchat.h" #include "llnotificationmanager.h" +floater_showed_signal_t LLIMFloater::sIMFloaterShowedSignal; + LLIMFloater::LLIMFloater(const LLUUID& session_id) : LLIMConversation(session_id), mLastMessageIndex(-1), @@ -765,6 +767,11 @@ void LLIMFloater::setVisible(BOOL visible) chiclet->setToggleState(false); } } + + if (visible) + { + sIMFloaterShowedSignal(mSessionID); + } } BOOL LLIMFloater::getVisible() @@ -1334,3 +1341,8 @@ void LLIMFloater::addToHost(const LLUUID& session_id) } } } + +boost::signals2::connection LLIMFloater::setIMFloaterShowedCallback(const floater_showed_signal_t::slot_type& cb) +{ + return LLIMFloater::sIMFloaterShowedSignal.connect(cb); +} -- cgit v1.2.3 From 0479e8d4ad1212b0028805cd4e39b6fe593b86c7 Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Fri, 27 Jul 2012 14:28:31 -0700 Subject: Updating comments for merge conflicts after reviewing with Richard. --- indra/newview/llimfloater.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llimfloater.cpp') diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index 5e0e0973fc..260957011e 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -316,7 +316,7 @@ BOOL LLIMFloater::postBuild() mInputEditor = getChild("chat_editor"); mInputEditor->setMaxTextLength(1023); // enable line history support for instant message bar - // XXX stinson TODO : resolve merge conflict + // XXX stinson TODO : resolve merge by adding autoreplace to text editors #if 0 // *TODO Establish LineEditor with autoreplace callback mInputEditor->setAutoreplaceCallback(boost::bind(&LLAutoReplace::autoreplaceCallback, LLAutoReplace::getInstance(), _1, _2)); -- cgit v1.2.3 From 4cb1e766fcfcaba702c2638f4c7daa9dd17bcbd8 Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Wed, 1 Aug 2012 21:08:42 +0300 Subject: CHUI-268 (Transfer the common functionality from LLNearbyChat and LLIMFloater to LLIMConversation): Remove duplication of functionality from LLNearbyChat; transfer mChatHistory, mInputEditor and some its settings and callbacks to the base class. --- indra/newview/llimfloater.cpp | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) (limited to 'indra/newview/llimfloater.cpp') diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index 1b08c454b7..3399a88c9e 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -66,11 +66,9 @@ LLIMFloater::LLIMFloater(const LLUUID& session_id) : LLIMConversation(session_id), mLastMessageIndex(-1), mDialog(IM_NOTHING_SPECIAL), - mInputEditor(NULL), mSavedTitle(), mTypingStart(), mShouldSendTypingState(false), - mChatHistory(NULL), mMeTyping(false), mOtherTyping(false), mTypingTimer(), @@ -80,6 +78,7 @@ LLIMFloater::LLIMFloater(const LLUUID& session_id) mStartConferenceInSameFloater(false) { mIsNearbyChat = false; + initIMSession(session_id); setOverlapsScreenChannel(true); @@ -313,9 +312,8 @@ void LLIMFloater::initIMFloater() //virtual BOOL LLIMFloater::postBuild() { - LLIMConversation::postBuild(); + BOOL result = LLIMConversation::postBuild(); - mInputEditor = getChild("chat_editor"); mInputEditor->setMaxTextLength(1023); // enable line history support for instant message bar // XXX stinson TODO : resolve merge by adding autoreplace to text editors @@ -323,19 +321,11 @@ BOOL LLIMFloater::postBuild() // *TODO Establish LineEditor with autoreplace callback mInputEditor->setAutoreplaceCallback(boost::bind(&LLAutoReplace::autoreplaceCallback, LLAutoReplace::getInstance(), _1, _2)); #endif - - LLFontGL* font = LLViewerChat::getChatFont(); - mInputEditor->setFont(font); mInputEditor->setFocusReceivedCallback( boost::bind(onInputEditorFocusReceived, _1, this) ); mInputEditor->setFocusLostCallback( boost::bind(onInputEditorFocusLost, _1, this) ); mInputEditor->setKeystrokeCallback( boost::bind(onInputEditorKeystroke, _1, this) ); - mInputEditor->setCommitOnFocusLost( FALSE ); - mInputEditor->setPassDelete( TRUE ); - mInputEditor->setCommitCallback(boost::bind(onSendMsg, _1, this)); - - mChatHistory = getChild("chat_history"); setDocked(true); @@ -358,7 +348,7 @@ BOOL LLIMFloater::postBuild() LLIMFloaterContainer* im_box = LLIMFloaterContainer::getInstance(); im_box->addConversationListItem(getTitle(), getKey(), this); - return TRUE; + return result; } void LLIMFloater::onAddButtonClicked() @@ -1004,7 +994,7 @@ void LLIMFloater::onInputEditorKeystroke(LLTextEditor* caller, void* userdata) // Deleting all text counts as stopping typing. self->setTyping(!text.empty()); - } +} void LLIMFloater::setTyping(bool typing) { -- cgit v1.2.3 From 324200dfd7d70324fe15329100140d98bb1f9b17 Mon Sep 17 00:00:00 2001 From: Seth ProductEngine Date: Thu, 9 Aug 2012 00:00:25 +0300 Subject: CHUI-120 WIP Added notifications about newly invited chat participants. --- indra/newview/llimfloater.cpp | 124 +++++++++++++++++++++++++++++++++--------- 1 file changed, 98 insertions(+), 26 deletions(-) (limited to 'indra/newview/llimfloater.cpp') diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index 3399a88c9e..a2989375ea 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -352,19 +352,19 @@ BOOL LLIMFloater::postBuild() } void LLIMFloater::onAddButtonClicked() +{ + LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(boost::bind(&LLIMFloater::onAddSessionParticipants, this, _1), TRUE, TRUE); + if (!picker) { - LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(boost::bind(&LLIMFloater::addSessionParticipants, this, _1), TRUE, TRUE); - if (!picker) - { - return; + return; } - // Need to disable 'ok' button when selected users are already in conversation. - picker->setOkBtnEnableCb(boost::bind(&LLIMFloater::canAddSelectedToChat, this, _1)); - LLFloater* root_floater = gFloaterView->getParentFloater(this); - if (root_floater) + // Need to disable 'ok' button when selected users are already in conversation. + picker->setOkBtnEnableCb(boost::bind(&LLIMFloater::canAddSelectedToChat, this, _1)); + LLFloater* root_floater = gFloaterView->getParentFloater(this); + if (root_floater) { - root_floater->addDependentFloater(picker); + root_floater->addDependentFloater(picker); } } @@ -420,8 +420,54 @@ bool LLIMFloater::canAddSelectedToChat(const uuid_vec_t& uuids) return true; } -void LLIMFloater::addSessionParticipants(const uuid_vec_t& uuids) +void LLIMFloater::onAddSessionParticipants(const uuid_vec_t& uuids) +{ + LLSD payload; + LLSD args; + for (uuid_vec_t::const_iterator iter = uuids.begin(); iter != uuids.end(); ++iter) + { + payload["participant_ids"].append(*iter); + } + + LLNotificationsUtil::add("ConfirmAddingChatParticipants", args, payload, + boost::bind(&LLIMFloater::addSessionParticipants, this, _1, _2)); +} + +void LLIMFloater::addSessionParticipants(const LLSD& notification, const LLSD& response) +{ + uuid_vec_t uuids; + LLSD::array_const_iterator list_it = notification["payload"]["participant_ids"].beginArray(); + LLSD::array_const_iterator list_end = notification["payload"]["participant_ids"].endArray(); + for (; list_it != list_end; ++list_it) + { + uuids.push_back(list_it->asUUID()); + } + + std::vector avatar_names; + uuid_vec_t::const_iterator it = uuids.begin(); + for (; it != uuids.end(); ++it) { + const LLUUID& id = *it; + LLAvatarName av_name; + if (LLAvatarNameCache::get(id, &av_name)) + { + avatar_names.push_back(av_name); + } + } + + std::string added_participants; + + // We should check whether the vector is not empty to pass the assertion + // that avatar_names.size() > 0 in LLAvatarActions::buildResidentsString. + if (!avatar_names.empty()) + { + LLAvatarActions::buildResidentsString(avatar_names, added_participants); + } + + LLStringUtil::format_map_t args; + args["[NAMES]"] = added_participants; + std::string participants_added_notification; + if (mIsP2PChat) { mStartConferenceInSameFloater = true; @@ -440,19 +486,45 @@ void LLIMFloater::addSessionParticipants(const uuid_vec_t& uuids) // then we can close the current session onClose(false); + participants_added_notification = getString("participants_added_new_window", args); + participants_added_notification = utf8str_truncate(participants_added_notification, MAX_MSG_BUF_SIZE - 1); + + if (mSessionInitialized) + { + LLIMModel::sendMessage(participants_added_notification, mSessionID, mOtherParticipantUUID, mDialog); + } + else + { + //queue up the message to send once the session is initialized + mQueuedMsgsForInit.append(participants_added_notification); + } + // Start a new ad hoc voice call if we invite new participants to a P2P call, // or start a text chat otherwise. if (is_voice_call) { LLAvatarActions::startAdhocCall(temp_ids, mSessionID); - } - else - { + } + else + { LLAvatarActions::startConference(temp_ids, mSessionID); + } } -} else { + participants_added_notification = getString("participants_added", args); + participants_added_notification = utf8str_truncate(participants_added_notification, MAX_MSG_BUF_SIZE - 1); + + if (mSessionInitialized) + { + LLIMModel::sendMessage(participants_added_notification, mSessionID, mOtherParticipantUUID, mDialog); + } + else + { + //queue up the message to send once the session is initialized + mQueuedMsgsForInit.append(participants_added_notification); + } + inviteToSession(uuids); } } @@ -1115,19 +1187,19 @@ BOOL LLIMFloater::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, if (cargo_type == DAD_PERSON) { if (dropPerson(static_cast(cargo_data), drop)) - { + { *accept = ACCEPT_YES_MULTI; - } + } else - { - *accept = ACCEPT_NO; - } + { + *accept = ACCEPT_NO; } + } else if (mDialog == IM_NOTHING_SPECIAL) - { + { LLToolDragAndDrop::handleGiveDragAndDrop(mOtherParticipantUUID, mSessionID, drop, cargo_type, cargo_data, accept); - } + } return TRUE; } @@ -1137,18 +1209,18 @@ bool LLIMFloater::dropPerson(LLUUID* person_id, bool drop) bool res = person_id && person_id->notNull(); if(res) { - uuid_vec_t ids; + uuid_vec_t ids; ids.push_back(*person_id); res = canAddSelectedToChat(ids); if(res && drop) - { - addSessionParticipants(ids); + { + onAddSessionParticipants(ids); + } } -} return res; - } +} BOOL LLIMFloater::isInviteAllowed() const { -- cgit v1.2.3 From 6cf49a4a715c9f498d4b063f8d74e295be1f418c Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Thu, 9 Aug 2012 16:48:33 +0300 Subject: CHUI-171 WIP (Conversation not automatically readded to conversation window listing when open) - removal of the dependence between items of the conversations list and conversation's floaters. --- indra/newview/llimfloater.cpp | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) (limited to 'indra/newview/llimfloater.cpp') diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index 3399a88c9e..6a1437f318 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -344,10 +344,6 @@ BOOL LLIMFloater::postBuild() initIMFloater(); - // Add a conversation list item in the left pane - LLIMFloaterContainer* im_box = LLIMFloaterContainer::getInstance(); - im_box->addConversationListItem(getTitle(), getKey(), this); - return result; } @@ -547,7 +543,7 @@ void LLIMFloater::onParticipantsListChanged(LLUICtrl* ctrl) if (!avatar_list) { return; - } + } bool all_names_resolved = true; std::vector participants_uuids; @@ -555,12 +551,12 @@ void LLIMFloater::onParticipantsListChanged(LLUICtrl* ctrl) avatar_list->getValues(participants_uuids); // Check whether we have all participants names in LLAvatarNameCache - for (std::vector::const_iterator it = participants_uuids.begin(); it != participants_uuids.end(); ++it) -{ + for (std::vector::const_iterator it = participants_uuids.begin(); it != participants_uuids.end(); ++it) + { const LLUUID& id = it->asUUID(); LLAvatarName av_name; - if (!LLAvatarNameCache::get(id, &av_name)) - { + if (!LLAvatarNameCache::get(id, &av_name)) + { all_names_resolved = false; // If a name is not found in cache, request it and continue the process recursively @@ -568,8 +564,8 @@ void LLIMFloater::onParticipantsListChanged(LLUICtrl* ctrl) LLAvatarNameCache::get(id, boost::bind(&LLIMFloater::onParticipantsListChanged, this, avatar_list)); break; - } -} + } + } if (all_names_resolved) { @@ -580,20 +576,20 @@ void LLIMFloater::onParticipantsListChanged(LLUICtrl* ctrl) const LLUUID& id = it->asUUID(); LLAvatarName av_name; if (LLAvatarNameCache::get(id, &av_name)) -{ + { avatar_names.push_back(av_name); - } -} + } + } // We should check whether the vector is not empty to pass the assertion // that avatar_names.size() > 0 in LLAvatarActions::buildResidentsString. if (!avatar_names.empty()) -{ + { std::string ui_title; LLAvatarActions::buildResidentsString(avatar_names, ui_title); updateSessionName(ui_title, ui_title); } -} + } } //static -- cgit v1.2.3 From f744fe8b5496e8d2d357ce88b3552eeee2125a5e Mon Sep 17 00:00:00 2001 From: Seth ProductEngine Date: Fri, 10 Aug 2012 02:51:56 +0300 Subject: CHUI-120 WIP Different notifications about single and multiple chat participants invited. The notification about starting a new conversation now applies only to P2P chat. Some code refactoring and clean up. --- indra/newview/llimfloater.cpp | 285 ++++++++++++++++++------------------------ 1 file changed, 125 insertions(+), 160 deletions(-) (limited to 'indra/newview/llimfloater.cpp') diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index a2989375ea..c3c9e334f2 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -60,6 +60,10 @@ #include "llnotificationmanager.h" #include "llautoreplace.h" +/// Helper function to resolve resident names from given uuids +/// and form a string of names separated by "words_separator". +static void build_names_string(const uuid_vec_t& uuids, std::string& names_string); + floater_showed_signal_t LLIMFloater::sIMFloaterShowedSignal; LLIMFloater::LLIMFloater(const LLUUID& session_id) @@ -186,49 +190,55 @@ void LLIMFloater::onVisibilityChange(const LLSD& new_visibility) void LLIMFloater::onSendMsg( LLUICtrl* ctrl, void* userdata ) { LLIMFloater* self = (LLIMFloater*) userdata; - self->sendMsg(); + self->sendMsgFromInputEditor(); self->setTyping(false); } -void LLIMFloater::sendMsg() +void LLIMFloater::sendMsgFromInputEditor() { if (gAgent.isGodlike() || (mDialog != IM_NOTHING_SPECIAL) || !mOtherParticipantUUID.isNull()) { - if (mInputEditor) - { + if (mInputEditor) + { LLWString text = mInputEditor->getWText(); LLWStringUtil::trim(text); LLWStringUtil::replaceChar(text,182,'\n'); // Convert paragraph symbols back into newlines. - if(!text.empty()) - { - // Truncate and convert to UTF8 for transport - std::string utf8_text = wstring_to_utf8str(text); - utf8_text = utf8str_truncate(utf8_text, MAX_MSG_BUF_SIZE - 1); - - if (mSessionInitialized) - { - LLIMModel::sendMessage(utf8_text, mSessionID, mOtherParticipantUUID, mDialog); - } - else + if(!text.empty()) { - //queue up the message to send once the session is initialized - mQueuedMsgsForInit.append(utf8_text); - } + // Truncate and convert to UTF8 for transport + std::string utf8_text = wstring_to_utf8str(text); - mInputEditor->setText(LLStringUtil::null); + sendMsg(utf8_text); - updateMessages(); + mInputEditor->setText(LLStringUtil::null); + } } } -} else { llinfos << "Cannot send IM to everyone unless you're a god." << llendl; } } +void LLIMFloater::sendMsg(const std::string& msg) +{ + const std::string utf8_text = utf8str_truncate(msg, MAX_MSG_BUF_SIZE - 1); + + if (mSessionInitialized) + { + LLIMModel::sendMessage(utf8_text, mSessionID, mOtherParticipantUUID, mDialog); + } + else + { + //queue up the message to send once the session is initialized + mQueuedMsgsForInit.append(utf8_text); + } + + updateMessages(); +} + LLIMFloater::~LLIMFloater() { mParticipantsListRefreshConnection.disconnect(); @@ -241,6 +251,7 @@ LLIMFloater::~LLIMFloater() LLTransientFloaterMgr::getInstance()->removeControlView(LLTransientFloaterMgr::IM, this); } + void LLIMFloater::initIMSession(const LLUUID& session_id) { // Change the floater key to bind it to a new session. @@ -353,7 +364,7 @@ BOOL LLIMFloater::postBuild() void LLIMFloater::onAddButtonClicked() { - LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(boost::bind(&LLIMFloater::onAddSessionParticipants, this, _1), TRUE, TRUE); + LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(boost::bind(&LLIMFloater::addSessionParticipants, this, _1), TRUE, TRUE); if (!picker) { return; @@ -420,113 +431,65 @@ bool LLIMFloater::canAddSelectedToChat(const uuid_vec_t& uuids) return true; } -void LLIMFloater::onAddSessionParticipants(const uuid_vec_t& uuids) +void LLIMFloater::addSessionParticipants(const uuid_vec_t& uuids) { - LLSD payload; - LLSD args; - for (uuid_vec_t::const_iterator iter = uuids.begin(); iter != uuids.end(); ++iter) + if (mIsP2PChat) { - payload["participant_ids"].append(*iter); - } - - LLNotificationsUtil::add("ConfirmAddingChatParticipants", args, payload, - boost::bind(&LLIMFloater::addSessionParticipants, this, _1, _2)); -} + LLSD payload; + LLSD args; -void LLIMFloater::addSessionParticipants(const LLSD& notification, const LLSD& response) -{ - uuid_vec_t uuids; - LLSD::array_const_iterator list_it = notification["payload"]["participant_ids"].beginArray(); - LLSD::array_const_iterator list_end = notification["payload"]["participant_ids"].endArray(); - for (; list_it != list_end; ++list_it) - { - uuids.push_back(list_it->asUUID()); + LLNotificationsUtil::add("ConfirmAddingChatParticipants", args, payload, + boost::bind(&LLIMFloater::addP2PSessionParticipants, this, uuids)); } - - std::vector avatar_names; - uuid_vec_t::const_iterator it = uuids.begin(); - for (; it != uuids.end(); ++it) + else { - const LLUUID& id = *it; - LLAvatarName av_name; - if (LLAvatarNameCache::get(id, &av_name)) - { - avatar_names.push_back(av_name); - } - } - - std::string added_participants; + sendParticipantsAddedNotification(uuids); - // We should check whether the vector is not empty to pass the assertion - // that avatar_names.size() > 0 in LLAvatarActions::buildResidentsString. - if (!avatar_names.empty()) - { - LLAvatarActions::buildResidentsString(avatar_names, added_participants); + inviteToSession(uuids); } +} - LLStringUtil::format_map_t args; - args["[NAMES]"] = added_participants; - std::string participants_added_notification; - - if (mIsP2PChat) - { - mStartConferenceInSameFloater = true; +void LLIMFloater::addP2PSessionParticipants(const uuid_vec_t& uuids) +{ + sendParticipantsAddedNotification(uuids); - uuid_vec_t temp_ids; + mStartConferenceInSameFloater = true; - // Add the initial participant of a P2P session - temp_ids.push_back(mOtherParticipantUUID); - temp_ids.insert(temp_ids.end(), uuids.begin(), uuids.end()); + LLVoiceChannel* voice_channel = LLIMModel::getInstance()->getVoiceChannel(mSessionID); - LLVoiceChannel* voice_channel = LLIMModel::getInstance()->getVoiceChannel(mSessionID); + // first check whether this is a voice session + bool is_voice_call = voice_channel != NULL && voice_channel->isActive(); - // first check whether this is a voice session - bool is_voice_call = voice_channel != NULL && voice_channel->isActive(); + uuid_vec_t temp_ids; - // then we can close the current session - onClose(false); + // Add the initial participant of a P2P session + temp_ids.push_back(mOtherParticipantUUID); + temp_ids.insert(temp_ids.end(), uuids.begin(), uuids.end()); - participants_added_notification = getString("participants_added_new_window", args); - participants_added_notification = utf8str_truncate(participants_added_notification, MAX_MSG_BUF_SIZE - 1); + // then we can close the current session + onClose(false); - if (mSessionInitialized) - { - LLIMModel::sendMessage(participants_added_notification, mSessionID, mOtherParticipantUUID, mDialog); - } - else - { - //queue up the message to send once the session is initialized - mQueuedMsgsForInit.append(participants_added_notification); - } - - // Start a new ad hoc voice call if we invite new participants to a P2P call, - // or start a text chat otherwise. - if (is_voice_call) - { - LLAvatarActions::startAdhocCall(temp_ids, mSessionID); - } - else - { - LLAvatarActions::startConference(temp_ids, mSessionID); - } + // Start a new ad hoc voice call if we invite new participants to a P2P call, + // or start a text chat otherwise. + if (is_voice_call) + { + LLAvatarActions::startAdhocCall(temp_ids, mSessionID); } else { - participants_added_notification = getString("participants_added", args); - participants_added_notification = utf8str_truncate(participants_added_notification, MAX_MSG_BUF_SIZE - 1); + LLAvatarActions::startConference(temp_ids, mSessionID); + } +} - if (mSessionInitialized) - { - LLIMModel::sendMessage(participants_added_notification, mSessionID, mOtherParticipantUUID, mDialog); - } - else - { - //queue up the message to send once the session is initialized - mQueuedMsgsForInit.append(participants_added_notification); - } +void LLIMFloater::sendParticipantsAddedNotification(const uuid_vec_t& uuids) +{ + std::string names_string; + build_names_string(uuids, names_string); + LLStringUtil::format_map_t args; + args["[NAME]"] = names_string; + args["[NEW_WINDOW]"] = mIsP2PChat ? getString("new_window") : LLStringUtil::null; - inviteToSession(uuids); - } + sendMsg(getString(uuids.size() > 1 ? "multiple_participants_added" : "participant_added", args)); } void LLIMFloater::boundVoiceChannel() @@ -619,17 +582,19 @@ void LLIMFloater::onParticipantsListChanged(LLUICtrl* ctrl) if (!avatar_list) { return; - } + } bool all_names_resolved = true; std::vector participants_uuids; + uuid_vec_t temp_uuids; // uuids vector for building the added participants' names string avatar_list->getValues(participants_uuids); // Check whether we have all participants names in LLAvatarNameCache for (std::vector::const_iterator it = participants_uuids.begin(); it != participants_uuids.end(); ++it) -{ + { const LLUUID& id = it->asUUID(); + temp_uuids.push_back(id); LLAvatarName av_name; if (!LLAvatarNameCache::get(id, &av_name)) { @@ -641,31 +606,14 @@ void LLIMFloater::onParticipantsListChanged(LLUICtrl* ctrl) boost::bind(&LLIMFloater::onParticipantsListChanged, this, avatar_list)); break; } -} + } if (all_names_resolved) { - std::vector avatar_names; - std::vector::const_iterator it = participants_uuids.begin(); - for (; it != participants_uuids.end(); ++it) - { - const LLUUID& id = it->asUUID(); - LLAvatarName av_name; - if (LLAvatarNameCache::get(id, &av_name)) -{ - avatar_names.push_back(av_name); - } -} - - // We should check whether the vector is not empty to pass the assertion - // that avatar_names.size() > 0 in LLAvatarActions::buildResidentsString. - if (!avatar_names.empty()) -{ - std::string ui_title; - LLAvatarActions::buildResidentsString(avatar_names, ui_title); - updateSessionName(ui_title, ui_title); - } -} + std::string ui_title; + build_names_string(temp_uuids, ui_title); + updateSessionName(ui_title, ui_title); + } } //static @@ -1215,7 +1163,7 @@ bool LLIMFloater::dropPerson(LLUUID* person_id, bool drop) res = canAddSelectedToChat(ids); if(res && drop) { - onAddSessionParticipants(ids); + addSessionParticipants(ids); } } @@ -1254,37 +1202,32 @@ BOOL LLIMFloater::inviteToSession(const uuid_vec_t& ids) if (is_region_exist) { - S32 count = ids.size(); + S32 count = ids.size(); - if( isInviteAllowed() && (count > 0) ) - { - llinfos << "LLIMFloater::inviteToSession() - inviting participants" << llendl; - - std::string url = region->getCapability("ChatSessionRequest"); + if( isInviteAllowed() && (count > 0) ) + { + llinfos << "LLIMFloater::inviteToSession() - inviting participants" << llendl; - LLSD data; + std::string url = region->getCapability("ChatSessionRequest"); - data["params"] = LLSD::emptyArray(); - for (int i = 0; i < count; i++) + LLSD data; + data["params"] = LLSD::emptyArray(); + for (int i = 0; i < count; i++) + { + data["params"].append(ids[i]); + } + data["method"] = "invite"; + data["session-id"] = mSessionID; + LLHTTPClient::post(url, data,new LLSessionInviteResponder(mSessionID)); + } + else { - data["params"].append(ids[i]); + llinfos << "LLIMFloater::inviteToSession -" + << " no need to invite agents for " + << mDialog << llendl; + // successful add, because everyone that needed to get added + // was added. } - - data["method"] = "invite"; - data["session-id"] = mSessionID; - LLHTTPClient::post( - url, - data, - new LLSessionInviteResponder(mSessionID)); - } - else - { - llinfos << "LLIMFloater::inviteToSession -" - << " no need to invite agents for " - << mDialog << llendl; - // successful add, because everyone that needed to get added - // was added. - } } return is_region_exist; @@ -1414,3 +1357,25 @@ boost::signals2::connection LLIMFloater::setIMFloaterShowedCallback(const floate { return LLIMFloater::sIMFloaterShowedSignal.connect(cb); } + +// static +void build_names_string(const uuid_vec_t& uuids, std::string& names_string) +{ + std::vector avatar_names; + uuid_vec_t::const_iterator it = uuids.begin(); + for (; it != uuids.end(); ++it) + { + LLAvatarName av_name; + if (LLAvatarNameCache::get(*it, &av_name)) + { + avatar_names.push_back(av_name); + } + } + + // We should check whether the vector is not empty to pass the assertion + // that avatar_names.size() > 0 in LLAvatarActions::buildResidentsString. + if (!avatar_names.empty()) + { + LLAvatarActions::buildResidentsString(avatar_names, names_string); + } +} -- cgit v1.2.3 From 3a21eb59f1cf0b7672e2beb671e1dbc717e28b3f Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Wed, 15 Aug 2012 20:10:00 +0300 Subject: CHUI-286 (Conversations floater opened by default when a new IM session is started (no IM toast shown): now floater silently adds itself to the container --- indra/newview/llimfloater.cpp | 91 +++++++++++++++++++++---------------------- 1 file changed, 45 insertions(+), 46 deletions(-) (limited to 'indra/newview/llimfloater.cpp') diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index 6a1437f318..cdd5ba6889 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -128,7 +128,7 @@ void LLIMFloater::onClickCloseBtn() if (session == NULL) { - llwarns << "Empty session." << llendl; + llwarns << "Empty session with id: " << (mSessionID.asString()) << llendl; return; } @@ -250,7 +250,7 @@ void LLIMFloater::initIMSession(const LLUUID& session_id) mSession = LLIMModel::getInstance()->findIMSession(mSessionID); if (mSession) -{ + { mIsP2PChat = mSession->isP2PSessionType(); mSessionInitialized = mSession->mSessionInitialized; @@ -593,38 +593,19 @@ void LLIMFloater::onParticipantsListChanged(LLUICtrl* ctrl) } //static -LLIMFloater* LLIMFloater::show(const LLUUID& session_id) +LLIMFloater* LLIMFloater::addToIMContainer(const LLUUID& session_id) { - closeHiddenIMToasts(); - if (!gIMMgr->hasSession(session_id)) return NULL; - if(!isChatMultiTab()) - { - //hide all - LLFloaterReg::const_instance_list_t& inst_list = LLFloaterReg::getFloaterList("impanel"); - for (LLFloaterReg::const_instance_list_t::const_iterator iter = inst_list.begin(); - iter != inst_list.end(); ++iter) - { - LLIMFloater* floater = dynamic_cast(*iter); - if (floater && floater->isDocked()) - { - floater->setVisible(false); - } - } - } - // Test the existence of the floater before we try to create it bool exist = findInstance(session_id); // Get the floater: this will create the instance if it didn't exist LLIMFloater* floater = getInstance(session_id); - if (!floater) - return NULL; - - if(isChatMultiTab()) + if (floater) { + LLIMFloaterContainer* floater_container = LLIMFloaterContainer::getInstance(); // Do not add again existing floaters @@ -639,33 +620,51 @@ LLIMFloater* LLIMFloater::show(const LLUUID& session_id) } } - floater->openFloater(floater->getKey()); + if (floater_container && floater_container->getVisible()) + { + floater->openFloater(floater->getKey()); + floater->setVisible(TRUE); + } + else + { + floater->setVisible(FALSE); + } } - else - { - // Docking may move chat window, hide it before moving, or user will see how window "jumps" - floater->setVisible(false); + return floater; +} - if (floater->getDockControl() == NULL) - { - LLChiclet* chiclet = - LLChicletBar::getInstance()->getChicletPanel()->findChiclet( - session_id); - if (chiclet == NULL) - { - llerror("Dock chiclet for LLIMFloater doesn't exists", 0); - } - else - { - LLChicletBar::getInstance()->getChicletPanel()->scrollToChiclet(chiclet); - } +//static +LLIMFloater* LLIMFloater::show(const LLUUID& session_id) +{ + closeHiddenIMToasts(); - floater->setDockControl(new LLDockControl(chiclet, floater, floater->getDockTongue(), - LLDockControl::BOTTOM)); - } + if (!gIMMgr->hasSession(session_id)) + return NULL; - // window is positioned, now we can show it. + // Test the existence of the floater before we try to create it + bool exist = findInstance(session_id); + + // Get the floater: this will create the instance if it didn't exist + LLIMFloater* floater = getInstance(session_id); + if (!floater) + return NULL; + + LLIMFloaterContainer* floater_container = LLIMFloaterContainer::getInstance(); + + // Do not add again existing floaters + if (!exist) + { + // LLTabContainer::eInsertionPoint i_pt = user_initiated ? LLTabContainer::RIGHT_OF_CURRENT : LLTabContainer::END; + // TODO: mantipov: use LLTabContainer::RIGHT_OF_CURRENT if it exists + LLTabContainer::eInsertionPoint i_pt = LLTabContainer::END; + if (floater_container) + { + floater_container->addFloater(floater, TRUE, i_pt); + } } + + floater->openFloater(floater->getKey()); + floater->setVisible(TRUE); return floater; -- cgit v1.2.3 From effccb94489d41a533e76f5f5834d52e3e817cbd Mon Sep 17 00:00:00 2001 From: Seth ProductEngine Date: Thu, 16 Aug 2012 04:55:48 +0300 Subject: CHUI-120 WIP Notifications about added chat participants should be sent to the conference when those participants actually join. - Removed notifying existing P2P participants about ad hoc conference staring in a new window. Now the notifications should arrive in that new window. - Fixed "Cancel" button which had no effect in adding P2P participants notification. --- indra/newview/llimfloater.cpp | 131 ++++++++++++++++++++++++++++-------------- 1 file changed, 89 insertions(+), 42 deletions(-) (limited to 'indra/newview/llimfloater.cpp') diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index c3c9e334f2..0f0048b0d0 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -127,14 +127,13 @@ void LLIMFloater::refresh() // virtual void LLIMFloater::onClickCloseBtn() { - LLIMModel::LLIMSession* session = LLIMModel::instance().findIMSession( - mSessionID); + LLIMModel::LLIMSession* session = LLIMModel::instance().findIMSession(mSessionID); if (session == NULL) { llwarns << "Empty session." << llendl; return; -} + } bool is_call_with_chat = session->isGroupSessionType() || session->isAdHocSessionType() || session->isP2PSessionType(); @@ -228,7 +227,7 @@ void LLIMFloater::sendMsg(const std::string& msg) if (mSessionInitialized) { - LLIMModel::sendMessage(utf8_text, mSessionID, mOtherParticipantUUID, mDialog); + LLIMModel::sendMessage(utf8_text, mSessionID, mOtherParticipantUUID, mDialog); } else { @@ -261,7 +260,7 @@ void LLIMFloater::initIMSession(const LLUUID& session_id) mSession = LLIMModel::getInstance()->findIMSession(mSessionID); if (mSession) -{ + { mIsP2PChat = mSession->isP2PSessionType(); mSessionInitialized = mSession->mSessionInitialized; @@ -411,7 +410,7 @@ bool LLIMFloater::canAddSelectedToChat(const uuid_vec_t& uuids) if (speaker_mgr) { speaker_mgr->getSpeakerList(&speaker_list, true); - } + } for (uuid_vec_t::const_iterator id = uuids.begin(); id != uuids.end(); ++id) @@ -439,19 +438,24 @@ void LLIMFloater::addSessionParticipants(const uuid_vec_t& uuids) LLSD args; LLNotificationsUtil::add("ConfirmAddingChatParticipants", args, payload, - boost::bind(&LLIMFloater::addP2PSessionParticipants, this, uuids)); + boost::bind(&LLIMFloater::addP2PSessionParticipants, this, _1, _2, uuids)); } else { - sendParticipantsAddedNotification(uuids); - + // remember whom we have invited, to notify others later, when the invited ones actually join + mInvitedParticipants.insert(mInvitedParticipants.end(), uuids.begin(), uuids.end()); + inviteToSession(uuids); } } -void LLIMFloater::addP2PSessionParticipants(const uuid_vec_t& uuids) +void LLIMFloater::addP2PSessionParticipants(const LLSD& notification, const LLSD& response, const uuid_vec_t& uuids) { - sendParticipantsAddedNotification(uuids); + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); + if (option != 0) + { + return; + } mStartConferenceInSameFloater = true; @@ -469,6 +473,12 @@ void LLIMFloater::addP2PSessionParticipants(const uuid_vec_t& uuids) // then we can close the current session onClose(false); + // we start a new session so reset the initialization flag + mSessionInitialized = false; + + // remember whom we have invited, to notify others later, when the invited ones actually join + mInvitedParticipants.insert(mInvitedParticipants.end(), uuids.begin(), uuids.end()); + // Start a new ad hoc voice call if we invite new participants to a P2P call, // or start a text chat otherwise. if (is_voice_call) @@ -487,7 +497,6 @@ void LLIMFloater::sendParticipantsAddedNotification(const uuid_vec_t& uuids) build_names_string(uuids, names_string); LLStringUtil::format_map_t args; args["[NAME]"] = names_string; - args["[NEW_WINDOW]"] = mIsP2PChat ? getString("new_window") : LLStringUtil::null; sendMsg(getString(uuids.size() > 1 ? "multiple_participants_added" : "participant_added", args)); } @@ -865,18 +874,20 @@ void LLIMFloater::sessionInitReplyReceived(const LLUUID& im_session_id) //*TODO here we should remove "starting session..." warning message if we added it in postBuild() (IB) - //need to send delayed messaged collected while waiting for session initialization + //need to send delayed messages collected while waiting for session initialization if (mQueuedMsgsForInit.size()) { - LLSD::array_iterator iter; - for ( iter = mQueuedMsgsForInit.beginArray(); - iter != mQueuedMsgsForInit.endArray(); ++iter) - { - LLIMModel::sendMessage(iter->asString(), mSessionID, - mOtherParticipantUUID, mDialog); + LLSD::array_iterator iter; + for ( iter = mQueuedMsgsForInit.beginArray(); + iter != mQueuedMsgsForInit.endArray(); ++iter) + { + LLIMModel::sendMessage(iter->asString(), mSessionID, + mOtherParticipantUUID, mDialog); + } + + mQueuedMsgsForInit.clear(); } } -} void LLIMFloater::appendMessage(const LLChat& chat, const LLSD &args) { @@ -1044,19 +1055,18 @@ void LLIMFloater::setTyping(bool typing) { LLIMModel::instance().sendTypingState(mSessionID, mOtherParticipantUUID, mMeTyping); - mShouldSendTypingState = false; - - } + mShouldSendTypingState = false; } + } if (!mIsNearbyChat) + { + LLIMSpeakerMgr* speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(mSessionID); + if (speaker_mgr) { - LLIMSpeakerMgr* speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(mSessionID); - if (speaker_mgr) - { - speaker_mgr->setSpeakerTyping(gAgent.getID(), FALSE); + speaker_mgr->setSpeakerTyping(gAgent.getID(), FALSE); } -} + } } void LLIMFloater::processIMTyping(const LLIMInfo* im_info, BOOL typing) @@ -1075,29 +1085,66 @@ void LLIMFloater::processIMTyping(const LLIMInfo* im_info, BOOL typing) void LLIMFloater::processAgentListUpdates(const LLSD& body) { + uuid_vec_t joined_uuids; + if (body.isMap() && body.has("agent_updates") && body["agent_updates"].isMap()) { - LLSD agent_data = body["agent_updates"].get(gAgentID.asString()); - if (agent_data.isMap() && agent_data.has("info")) + LLSD::map_const_iterator update_it; + for(update_it = body["agent_updates"].beginMap(); + update_it != body["agent_updates"].endMap(); + ++update_it) { - LLSD agent_info = agent_data["info"]; + LLUUID agent_id(update_it->first); + LLSD agent_data = update_it->second; - if (agent_info.has("mutes")) + if (agent_data.isMap()) { - BOOL moderator_muted_text = agent_info["mutes"]["text"].asBoolean(); - mInputEditor->setEnabled(!moderator_muted_text); - std::string label; - if (moderator_muted_text) - label = LLTrans::getString("IM_muted_text_label"); - else - label = LLTrans::getString("IM_to_label") + " " + LLIMModel::instance().getName(mSessionID); - mInputEditor->setLabel(label); + // store the new participants in joined_uuids + if (agent_data.has("transition") && agent_data["transition"].asString() == "ENTER") + { + joined_uuids.push_back(agent_id); + } - if (moderator_muted_text) - LLNotificationsUtil::add("TextChatIsMutedByModerator"); + // 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(); + mInputEditor->setEnabled(!moderator_muted_text); + std::string label; + if (moderator_muted_text) + label = LLTrans::getString("IM_muted_text_label"); + else + label = LLTrans::getString("IM_to_label") + " " + LLIMModel::instance().getName(mSessionID); + mInputEditor->setLabel(label); + + if (moderator_muted_text) + LLNotificationsUtil::add("TextChatIsMutedByModerator"); + } } } } + + // the vectors need to be sorted for computing the intersection and difference + std::sort(mInvitedParticipants.begin(), mInvitedParticipants.end()); + std::sort(joined_uuids.begin(), joined_uuids.end()); + + uuid_vec_t intersection; // uuids of invited residents who have joined the conversation + std::set_intersection(mInvitedParticipants.begin(), mInvitedParticipants.end(), + joined_uuids.begin(), joined_uuids.end(), + std::back_inserter(intersection)); + + if (intersection.size() > 0) + { + sendParticipantsAddedNotification(intersection); + } + + // Remove all joined participants from invited array. + // The difference between the two vectors (the elements in mInvitedParticipants which are not in joined_uuids) + // is placed at the beginning of mInvitedParticipants, then all other elements are erased. + mInvitedParticipants.erase(std::set_difference(mInvitedParticipants.begin(), mInvitedParticipants.end(), + joined_uuids.begin(), joined_uuids.end(), + mInvitedParticipants.begin()), + mInvitedParticipants.end()); } void LLIMFloater::processSessionUpdate(const LLSD& session_update) -- cgit v1.2.3 From 3d2045877c07810188ecbd4aac14befea57ddfb3 Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Fri, 17 Aug 2012 19:33:24 +0300 Subject: CHUI-286 ADD. FIX (Conversations floater opened by default when a new IM session is started (no IM toast shown)): repair toast's system - suppress toasts only if corresponding floater is visible --- indra/newview/llimfloater.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'indra/newview/llimfloater.cpp') diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index cdd5ba6889..2efe5d94e2 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -97,12 +97,12 @@ void LLIMFloater::onFocusLost() void LLIMFloater::onFocusReceived() { - LLIMModel::getInstance()->setActiveSessionID(mSessionID); - LLChicletBar::getInstance()->getChicletPanel()->setChicletToggleState(mSessionID, true); if (getVisible()) { + // suppress corresponding toast only if this floater is visible and have focus + LLIMModel::getInstance()->setActiveSessionID(mSessionID); LLIMModel::instance().sendNoUnreadMessages(mSessionID); } } @@ -726,6 +726,7 @@ void LLIMFloater::setVisible(BOOL visible) LLNotificationsUI::LLScreenChannel* channel = static_cast (LLNotificationsUI::LLChannelManager::getInstance()-> findChannelByID(LLUUID(gSavedSettings.getString("NotificationChannelUUID")))); + LLTransientDockableFloater::setVisible(visible); // update notification channel state -- cgit v1.2.3 From 41c85d357c8793f5119246b79441dd1dad9aa563 Mon Sep 17 00:00:00 2001 From: Paul ProductEngine Date: Thu, 23 Aug 2012 18:07:35 +0300 Subject: CHUI-296 FIXED (Unread IM messages icon not showing in conversation log) - Sometimes IM floater with offline unread messages is visible but not in visible chain and the flag of offline unread messages is erroneously reset. So made condition of whether floater is visible more strict. --- indra/newview/llimfloater.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llimfloater.cpp') diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index 5780ac52a5..1c6445610f 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -789,7 +789,7 @@ void LLIMFloater::setVisible(BOOL visible) } } - if (visible) + if (visible && isInVisibleChain()) { sIMFloaterShowedSignal(mSessionID); } -- cgit v1.2.3 From be61b5be2f4089e12ca25ca1ece13bd0fdaea543 Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Wed, 29 Aug 2012 19:18:25 -0700 Subject: CHUI-305: Problem: The 'resident picker' had multiple parents and due to the design of the resident picker it can have only one parent. Having multiple parents caused both parents to fight for depth ordering...which caused the flickering. Resolution: Now multiple 'resident pickers' can exist and they are coupled to the floater that spawned then. Meaning that when the parent floater closes, the 'resident picker' floater will also close. In addition, a shadow frustum eminates from the button that opened the 'resident picker'. --- indra/newview/llimfloater.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'indra/newview/llimfloater.cpp') diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index 1c6445610f..732a204ddf 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -359,7 +359,9 @@ BOOL LLIMFloater::postBuild() void LLIMFloater::onAddButtonClicked() { - LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(boost::bind(&LLIMFloater::addSessionParticipants, this, _1), TRUE, TRUE); + LLView * button = getChildView("toolbar_panel")->getChildView("add_btn"); + LLFloater* root_floater = gFloaterView->getParentFloater(this); + LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(boost::bind(&LLIMFloater::addSessionParticipants, this, _1), TRUE, TRUE, FALSE, root_floater->getName(), button); if (!picker) { return; @@ -367,7 +369,7 @@ void LLIMFloater::onAddButtonClicked() // Need to disable 'ok' button when selected users are already in conversation. picker->setOkBtnEnableCb(boost::bind(&LLIMFloater::canAddSelectedToChat, this, _1)); - LLFloater* root_floater = gFloaterView->getParentFloater(this); + if (root_floater) { root_floater->addDependentFloater(picker); -- cgit v1.2.3 From d67c295d8bb6cfd58655bf961dcf835157abb3e7 Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Thu, 30 Aug 2012 16:20:27 -0700 Subject: CHUI-305: Minor changes after code review. Using templated findChild() instead of getChildView(). Also using settings.xml to store common custom variables. --- indra/newview/llimfloater.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llimfloater.cpp') diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index 732a204ddf..a601561c62 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -359,7 +359,7 @@ BOOL LLIMFloater::postBuild() void LLIMFloater::onAddButtonClicked() { - LLView * button = getChildView("toolbar_panel")->getChildView("add_btn"); + LLView * button = findChild("toolbar_panel")->findChild("add_btn"); LLFloater* root_floater = gFloaterView->getParentFloater(this); LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(boost::bind(&LLIMFloater::addSessionParticipants, this, _1), TRUE, TRUE, FALSE, root_floater->getName(), button); if (!picker) -- cgit v1.2.3 From 3cf624b371eace5ec382796d7bd811d181d5e877 Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Wed, 5 Sep 2012 18:48:07 +0300 Subject: CHUI-268 (Transfer the common functionality from LLNearbyChat and LLIMFloater to LLIMConversation): moved focusLost(), focusReceived and enable/disable of the call button to base class --- indra/newview/llimfloater.cpp | 39 --------------------------------------- 1 file changed, 39 deletions(-) (limited to 'indra/newview/llimfloater.cpp') diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index a601561c62..7b475c1e0b 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -92,24 +92,6 @@ LLIMFloater::LLIMFloater(const LLUUID& session_id) setDocked(true); } -void LLIMFloater::onFocusLost() -{ - LLIMModel::getInstance()->resetActiveSessionID(); - - LLChicletBar::getInstance()->getChicletPanel()->setChicletToggleState(mSessionID, false); -} - -void LLIMFloater::onFocusReceived() -{ - LLChicletBar::getInstance()->getChicletPanel()->setChicletToggleState(mSessionID, true); - - if (getVisible()) - { - // suppress corresponding toast only if this floater is visible and have focus - LLIMModel::getInstance()->setActiveSessionID(mSessionID); - LLIMModel::instance().sendNoUnreadMessages(mSessionID); - } -} // virtual void LLIMFloater::refresh() @@ -513,27 +495,6 @@ void LLIMFloater::boundVoiceChannel() } } -void LLIMFloater::enableDisableCallBtn() -{ - bool voice_enabled = LLVoiceClient::getInstance()->voiceEnabled() - && LLVoiceClient::getInstance()->isVoiceWorking(); - - if (mSession) - { - bool session_initialized = mSession->mSessionInitialized; - bool callback_enabled = mSession->mCallBackEnabled; - - BOOL enable_connect = - session_initialized && voice_enabled && callback_enabled; - getChildView("voice_call_btn")->setEnabled(enable_connect); - } - else - { - getChildView("voice_call_btn")->setEnabled(false); - } -} - - void LLIMFloater::onCallButtonClicked() { LLVoiceChannel* voice_channel = LLIMModel::getInstance()->getVoiceChannel(mSessionID); -- cgit v1.2.3 From 47fe3b48fe32f9eb810a23d82eb08c11c41ac335 Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Mon, 10 Sep 2012 13:48:37 +0300 Subject: CHUI-268 (Transfer the common functionality from LLNearbyChat and LLIMFloater to LLIMConversation): moved appendMessage() to base class --- indra/newview/llimfloater.cpp | 19 ------------------- 1 file changed, 19 deletions(-) (limited to 'indra/newview/llimfloater.cpp') diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index 7b475c1e0b..2474fe0891 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -848,25 +848,6 @@ void LLIMFloater::sessionInitReplyReceived(const LLUUID& im_session_id) } } -void LLIMFloater::appendMessage(const LLChat& chat, const LLSD &args) -{ - LLChat& tmp_chat = const_cast(chat); - - if (!chat.mMuted) - { - tmp_chat.mFromName = chat.mFromName; - LLSD chat_args; - if (args) chat_args = args; - chat_args["use_plain_text_chat_history"] = - gSavedSettings.getBOOL("PlainTextChatHistory"); - chat_args["show_time"] = gSavedSettings.getBOOL("IMShowTime"); - chat_args["show_names_for_p2p_conv"] = !mIsP2PChat - || gSavedSettings.getBOOL("IMShowNamesForP2PConv"); - - mChatHistory->appendMessage(chat, chat_args); - } -} - void LLIMFloater::updateMessages() { std::list messages; -- cgit v1.2.3 From f5fc2a9c3af23cc1aaf74e432eb3690d8d376d89 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Wed, 19 Sep 2012 17:59:37 -0700 Subject: CHUI-340 : WIP : Update time stamp for IM and voice utterance --- indra/newview/llimfloater.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'indra/newview/llimfloater.cpp') diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index 2474fe0891..fbc1b8e7fe 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -907,6 +907,9 @@ void LLIMFloater::updateMessages() chat.mText = message; } + // Merov debug + llinfos << "Merov debug : LLIMFloater::updateMessages, session = " << mSessionID << ", from = " << msg["from"].asString() << ", uuid = " << msg["from_id"].asString() << ", date = " << LLFrameTimer::getElapsedSeconds() << llendl; + appendMessage(chat); mLastMessageIndex = msg["index"].asInteger(); -- cgit v1.2.3 From fc6bbee3f4ba1abba2956ee92f7ac7ba01d0f59b Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Thu, 20 Sep 2012 20:48:20 -0700 Subject: CHUI-340 : WIP : Implement time update on all IM typing cases --- indra/newview/llimfloater.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'indra/newview/llimfloater.cpp') diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index fbc1b8e7fe..8268764816 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -907,9 +907,11 @@ void LLIMFloater::updateMessages() chat.mText = message; } - // Merov debug + // Update the participant activity time + mParticipantList->setParticipantTimeNow(from_id); llinfos << "Merov debug : LLIMFloater::updateMessages, session = " << mSessionID << ", from = " << msg["from"].asString() << ", uuid = " << msg["from_id"].asString() << ", date = " << LLFrameTimer::getElapsedSeconds() << llendl; + // Add the message to the chat log appendMessage(chat); mLastMessageIndex = msg["index"].asInteger(); -- cgit v1.2.3 From b5583906d0cce652f456851732db5b1c19659662 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Fri, 21 Sep 2012 18:12:06 -0700 Subject: CHUI-340 : WIP : Fix sorting bugs on time for sessions, simplified the update time mechanism and clean up --- indra/newview/llimfloater.cpp | 4 ---- 1 file changed, 4 deletions(-) (limited to 'indra/newview/llimfloater.cpp') diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index 8268764816..43adfdfd08 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -907,10 +907,6 @@ void LLIMFloater::updateMessages() chat.mText = message; } - // Update the participant activity time - mParticipantList->setParticipantTimeNow(from_id); - llinfos << "Merov debug : LLIMFloater::updateMessages, session = " << mSessionID << ", from = " << msg["from"].asString() << ", uuid = " << msg["from_id"].asString() << ", date = " << LLFrameTimer::getElapsedSeconds() << llendl; - // Add the message to the chat log appendMessage(chat); mLastMessageIndex = msg["index"].asInteger(); -- cgit v1.2.3 From 507b66aeb1614a1293890ffacbab53ccecc25e20 Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Fri, 28 Sep 2012 19:40:17 +0300 Subject: CHUI-349 (Crash when clicking on nearby chat toast): removed a faulty method LLIMFloater::addToIMContainer; replaced it's calls to calls of its correct twin - LLIMFloater::addToHost --- indra/newview/llimfloater.cpp | 47 ++++++++++++++++--------------------------- 1 file changed, 17 insertions(+), 30 deletions(-) (limited to 'indra/newview/llimfloater.cpp') diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index 43adfdfd08..d11504d312 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -582,13 +582,14 @@ void LLIMFloater::onParticipantsListChanged(LLUICtrl* ctrl) build_names_string(temp_uuids, ui_title); updateSessionName(ui_title, ui_title); } - } +} -//static -LLIMFloater* LLIMFloater::addToIMContainer(const LLUUID& session_id) +void LLIMFloater::addToHost(const LLUUID& session_id, const bool force) { - if (!gIMMgr->hasSession(session_id)) - return NULL; + if (!LLIMConversation::isChatMultiTab() || !gIMMgr->hasSession(session_id)) + { + return; + } // Test the existence of the floater before we try to create it bool exist = findInstance(session_id); @@ -612,19 +613,22 @@ LLIMFloater* LLIMFloater::addToIMContainer(const LLUUID& session_id) } } - if (floater_container && floater_container->getVisible()) + if (force) { - floater->openFloater(floater->getKey()); - floater->setVisible(TRUE); - } - else - { - floater->setVisible(FALSE); + if (floater_container && floater_container->getVisible()) + { + floater->openFloater(floater->getKey()); + floater->setVisible(TRUE); + } + else + { + floater->setVisible(FALSE); + } } } - return floater; } + //static LLIMFloater* LLIMFloater::show(const LLUUID& session_id) { @@ -1323,23 +1327,6 @@ void LLIMFloater::onIMChicletCreated( const LLUUID& session_id ) { LLIMFloater::addToHost(session_id); } -void LLIMFloater::addToHost(const LLUUID& session_id) - { - if (LLIMConversation::isChatMultiTab()) -{ - LLIMFloaterContainer* im_box = LLIMFloaterContainer::findInstance(); - if (!im_box) - { - im_box = LLIMFloaterContainer::getInstance(); - } - - if (im_box && !LLIMFloater::findInstance(session_id)) - { - LLIMFloater* new_tab = LLIMFloater::getInstance(session_id); - im_box->addFloater(new_tab, FALSE, LLTabContainer::END); - } - } -} boost::signals2::connection LLIMFloater::setIMFloaterShowedCallback(const floater_showed_signal_t::slot_type& cb) { -- cgit v1.2.3 From a8159facdeb478abf094d8ba8ad229c0e282f9f6 Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Tue, 2 Oct 2012 19:36:46 +0300 Subject: CHUI-374 FIXED (Nearby chat is torn off and cannot be docked if nearby chat is received while conversation floater is closed) Nearby_chat is created only after the creation of the im_container --- indra/newview/llimfloater.cpp | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) (limited to 'indra/newview/llimfloater.cpp') diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index d11504d312..99337bd5f3 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -111,23 +111,25 @@ void LLIMFloater::onClickCloseBtn() { LLIMModel::LLIMSession* session = LLIMModel::instance().findIMSession(mSessionID); - if (session == NULL) + if (session != NULL) { - llwarns << "Empty session with id: " << (mSessionID.asString()) << llendl; - return; - } + bool is_call_with_chat = session->isGroupSessionType() + || session->isAdHocSessionType() || session->isP2PSessionType(); - bool is_call_with_chat = session->isGroupSessionType() - || session->isAdHocSessionType() || session->isP2PSessionType(); + LLVoiceChannel* voice_channel = LLIMModel::getInstance()->getVoiceChannel(mSessionID); - LLVoiceChannel* voice_channel = LLIMModel::getInstance()->getVoiceChannel(mSessionID); - - if (is_call_with_chat && voice_channel != NULL - && voice_channel->isActive()) + if (is_call_with_chat && voice_channel != NULL + && voice_channel->isActive()) + { + LLSD payload; + payload["session_id"] = mSessionID; + LLNotificationsUtil::add("ConfirmLeaveCall", LLSD(), payload, confirmLeaveCallCallback); + return; + } + } + else { - LLSD payload; - payload["session_id"] = mSessionID; - LLNotificationsUtil::add("ConfirmLeaveCall", LLSD(), payload, confirmLeaveCallCallback); + llwarns << "Empty session with id: " << (mSessionID.asString()) << llendl; return; } -- cgit v1.2.3 From db452823e5cc615225f3f163d827954447cf9bd8 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Fri, 5 Oct 2012 20:28:11 -0700 Subject: CHUI-194 : WIP : Update the ad-hoc conversation line item title, add a new update_session event. Still some clean up to do. --- indra/newview/llimfloater.cpp | 30 ++---------------------------- 1 file changed, 2 insertions(+), 28 deletions(-) (limited to 'indra/newview/llimfloater.cpp') diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index 99337bd5f3..467f48600a 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -60,10 +60,6 @@ #include "llnotificationmanager.h" #include "llautoreplace.h" -/// Helper function to resolve resident names from given uuids -/// and form a string of names separated by "words_separator". -static void build_names_string(const uuid_vec_t& uuids, std::string& names_string); - floater_showed_signal_t LLIMFloater::sIMFloaterShowedSignal; LLIMFloater::LLIMFloater(const LLUUID& session_id) @@ -476,7 +472,7 @@ void LLIMFloater::addP2PSessionParticipants(const LLSD& notification, const LLSD void LLIMFloater::sendParticipantsAddedNotification(const uuid_vec_t& uuids) { std::string names_string; - build_names_string(uuids, names_string); + LLAvatarActions::buildResidentsString(uuids, names_string); LLStringUtil::format_map_t args; args["[NAME]"] = names_string; @@ -581,7 +577,7 @@ void LLIMFloater::onParticipantsListChanged(LLUICtrl* ctrl) if (all_names_resolved) { std::string ui_title; - build_names_string(temp_uuids, ui_title); + LLAvatarActions::buildResidentsString(temp_uuids, ui_title); updateSessionName(ui_title, ui_title); } } @@ -1334,25 +1330,3 @@ boost::signals2::connection LLIMFloater::setIMFloaterShowedCallback(const floate { return LLIMFloater::sIMFloaterShowedSignal.connect(cb); } - -// static -void build_names_string(const uuid_vec_t& uuids, std::string& names_string) -{ - std::vector avatar_names; - uuid_vec_t::const_iterator it = uuids.begin(); - for (; it != uuids.end(); ++it) - { - LLAvatarName av_name; - if (LLAvatarNameCache::get(*it, &av_name)) - { - avatar_names.push_back(av_name); - } - } - - // We should check whether the vector is not empty to pass the assertion - // that avatar_names.size() > 0 in LLAvatarActions::buildResidentsString. - if (!avatar_names.empty()) - { - LLAvatarActions::buildResidentsString(avatar_names, names_string); - } -} -- cgit v1.2.3 From 8aa424128ad06567f4c32c6672dc63d9b2111efa Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Thu, 11 Oct 2012 10:38:34 -0700 Subject: CHUI-380: Before code review changes. Now the user selects a conversation or participant of a conversation the correct chat floater will appear. Focus will be redirected to the chat input text box automatically allowing the user to type into the input text box. --- indra/newview/llimfloater.cpp | 37 ++++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 15 deletions(-) (limited to 'indra/newview/llimfloater.cpp') diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index 99337bd5f3..990b9c45f9 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -719,6 +719,27 @@ void LLIMFloater::setDocked(bool docked, bool pop_on_undock) } } +void LLIMFloater::setFocus(BOOL focusFlag) +{ + LLTransientDockableFloater::setFocus(focusFlag); + + BOOL is_minimized = focusFlag && isChatMultiTab() + ? LLIMFloaterContainer::getInstance()->isMinimized() + : !focusFlag; + + //Redirect focus to input editor + if (!is_minimized && mChatHistory && mInputEditor) + { + //only if floater was construced and initialized from xml + updateMessages(); + //prevent stealing focus when opening a background IM tab (EXT-5387, checking focus for EXT-6781) + if (!isChatMultiTab() || hasFocus()) + { + mInputEditor->setFocus(TRUE); + } + } +} + void LLIMFloater::setVisible(BOOL visible) { LLNotificationsUI::LLScreenChannel* channel = static_cast @@ -734,21 +755,6 @@ void LLIMFloater::setVisible(BOOL visible) channel->redrawToasts(); } - BOOL is_minimized = visible && isChatMultiTab() - ? LLIMFloaterContainer::getInstance()->isMinimized() - : !visible; - - if (!is_minimized && mChatHistory && mInputEditor) - { - //only if floater was construced and initialized from xml - updateMessages(); - //prevent stealing focus when opening a background IM tab (EXT-5387, checking focus for EXT-6781) - if (!isChatMultiTab() || hasFocus()) - { - mInputEditor->setFocus(TRUE); - } - } - if(!visible) { LLIMChiclet* chiclet = LLChicletBar::getInstance()->getChicletPanel()->findChiclet(mSessionID); @@ -761,6 +767,7 @@ void LLIMFloater::setVisible(BOOL visible) if (visible && isInVisibleChain()) { sIMFloaterShowedSignal(mSessionID); + setFocus(TRUE); } } -- cgit v1.2.3 From 375f380ea388b37c34ace9570822d0c117b3d2f1 Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Thu, 11 Oct 2012 12:17:46 -0700 Subject: CHUI-380: Code cleanup after code review. --- indra/newview/llimfloater.cpp | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) (limited to 'indra/newview/llimfloater.cpp') diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index 990b9c45f9..a1ed1e0b01 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -723,20 +723,11 @@ void LLIMFloater::setFocus(BOOL focusFlag) { LLTransientDockableFloater::setFocus(focusFlag); - BOOL is_minimized = focusFlag && isChatMultiTab() - ? LLIMFloaterContainer::getInstance()->isMinimized() - : !focusFlag; - //Redirect focus to input editor - if (!is_minimized && mChatHistory && mInputEditor) + if (focusFlag) { - //only if floater was construced and initialized from xml updateMessages(); - //prevent stealing focus when opening a background IM tab (EXT-5387, checking focus for EXT-6781) - if (!isChatMultiTab() || hasFocus()) - { - mInputEditor->setFocus(TRUE); - } + mInputEditor->setFocus(TRUE); } } -- cgit v1.2.3 From f4b10aaebbaf8eb66d41ffa703f6ed7b909ba7e7 Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Thu, 11 Oct 2012 17:48:39 -0700 Subject: CHUI-380: Fixing a bug that occurred when right clicking nearby chat and then right clicking a participant under a conversation. This would result in both the participant and conversation to be highlighted. Still a work in progress. This change involves introducing an old bug CHUI 289 and finding a different approach to solving it. --- indra/newview/llimfloater.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'indra/newview/llimfloater.cpp') diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index a8add9c6ab..e4032738a7 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -725,6 +725,7 @@ void LLIMFloater::setFocus(BOOL focusFlag) updateMessages(); mInputEditor->setFocus(TRUE); } + } void LLIMFloater::setVisible(BOOL visible) @@ -754,8 +755,10 @@ void LLIMFloater::setVisible(BOOL visible) if (visible && isInVisibleChain()) { sIMFloaterShowedSignal(mSessionID); - setFocus(TRUE); + } + + setFocus(visible); } BOOL LLIMFloater::getVisible() -- cgit v1.2.3 From 3f020d0be92859e1d9261261ccc9c377df700118 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Mon, 22 Oct 2012 19:26:18 -0700 Subject: CHUI-441 : WIP : Initial changes to LLIMFloater to use the same model as LLIMFloaterContainer --- indra/newview/llimfloater.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'indra/newview/llimfloater.cpp') diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index e4032738a7..29e84e1332 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -582,7 +582,7 @@ void LLIMFloater::onParticipantsListChanged(LLUICtrl* ctrl) } } -void LLIMFloater::addToHost(const LLUUID& session_id, const bool force) +void LLIMFloater::addToHost(const LLUUID& session_id, LLConversationItemSession* session_root_model, const bool force) { if (!LLIMConversation::isChatMultiTab() || !gIMMgr->hasSession(session_id)) { @@ -593,7 +593,7 @@ void LLIMFloater::addToHost(const LLUUID& session_id, const bool force) bool exist = findInstance(session_id); // Get the floater: this will create the instance if it didn't exist - LLIMFloater* floater = getInstance(session_id); + LLIMFloater* floater = getInstance(session_id, session_root_model); if (floater) { @@ -672,11 +672,12 @@ LLIMFloater* LLIMFloater::findInstance(const LLUUID& session_id) return conversation; } -LLIMFloater* LLIMFloater::getInstance(const LLUUID& session_id) +LLIMFloater* LLIMFloater::getInstance(const LLUUID& session_id, LLConversationItemSession* session_root_model) { LLIMFloater* conversation = LLFloaterReg::getTypedInstance("impanel", session_id); + conversation->setSessionRoot(session_root_model); return conversation; } @@ -1322,6 +1323,7 @@ void LLIMFloater::sRemoveTypingIndicator(const LLSD& data) floater->removeTypingIndicator(); } +// CHUI-441 : We should not create a floater here but go through LLIMFLoaterContainer void LLIMFloater::onIMChicletCreated( const LLUUID& session_id ) { LLIMFloater::addToHost(session_id); -- cgit v1.2.3 From 68815045a629eeb0e4ab33c05d3773d272eafb50 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Wed, 24 Oct 2012 13:18:41 -0700 Subject: CHUI-441 : WIP : Initial refactor part 2. Works but the list doesn't update in the torn off dialog. --- indra/newview/llimfloater.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'indra/newview/llimfloater.cpp') diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index 29e84e1332..9f7b3cd50b 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -582,10 +582,11 @@ void LLIMFloater::onParticipantsListChanged(LLUICtrl* ctrl) } } -void LLIMFloater::addToHost(const LLUUID& session_id, LLConversationItemSession* session_root_model, const bool force) +void LLIMFloater::addToHost(const LLUUID& session_id, const bool force) { if (!LLIMConversation::isChatMultiTab() || !gIMMgr->hasSession(session_id)) { + llinfos << "Merov debug : addToHost, not added! multitab = " << LLIMConversation::isChatMultiTab() << ", has session = " << gIMMgr->hasSession(session_id) << llendl; return; } @@ -593,12 +594,14 @@ void LLIMFloater::addToHost(const LLUUID& session_id, LLConversationItemSession* bool exist = findInstance(session_id); // Get the floater: this will create the instance if it didn't exist - LLIMFloater* floater = getInstance(session_id, session_root_model); + LLIMFloater* floater = getInstance(session_id); if (floater) { LLIMFloaterContainer* floater_container = LLIMFloaterContainer::getInstance(); + llinfos << "Merov debug : addToHost, done! exist = " << exist << llendl; + // Do not add again existing floaters if (!exist) { @@ -672,12 +675,11 @@ LLIMFloater* LLIMFloater::findInstance(const LLUUID& session_id) return conversation; } -LLIMFloater* LLIMFloater::getInstance(const LLUUID& session_id, LLConversationItemSession* session_root_model) +LLIMFloater* LLIMFloater::getInstance(const LLUUID& session_id) { LLIMFloater* conversation = LLFloaterReg::getTypedInstance("impanel", session_id); - conversation->setSessionRoot(session_root_model); return conversation; } -- cgit v1.2.3 From b5d76c2b55666083279580f383e5a7b139517504 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Wed, 24 Oct 2012 20:08:36 -0700 Subject: CHUI-441 : WIP : Fix the initial attach code so to allow creation of the conversation item before the dialog --- indra/newview/llimfloater.cpp | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'indra/newview/llimfloater.cpp') diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index 9f7b3cd50b..8fbf691897 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -586,13 +586,9 @@ void LLIMFloater::addToHost(const LLUUID& session_id, const bool force) { if (!LLIMConversation::isChatMultiTab() || !gIMMgr->hasSession(session_id)) { - llinfos << "Merov debug : addToHost, not added! multitab = " << LLIMConversation::isChatMultiTab() << ", has session = " << gIMMgr->hasSession(session_id) << llendl; return; } - // Test the existence of the floater before we try to create it - bool exist = findInstance(session_id); - // Get the floater: this will create the instance if it didn't exist LLIMFloater* floater = getInstance(session_id); if (floater) @@ -600,10 +596,8 @@ void LLIMFloater::addToHost(const LLUUID& session_id, const bool force) LLIMFloaterContainer* floater_container = LLIMFloaterContainer::getInstance(); - llinfos << "Merov debug : addToHost, done! exist = " << exist << llendl; - - // Do not add again existing floaters - if (!exist) + // Do not attach to the IM container if it's already attached + if (!getFloaterHost()) { // LLTabContainer::eInsertionPoint i_pt = user_initiated ? LLTabContainer::RIGHT_OF_CURRENT : LLTabContainer::END; // TODO: mantipov: use LLTabContainer::RIGHT_OF_CURRENT if it exists -- cgit v1.2.3 From 83562e059fdcf9f732bc8effba99d1e95d39cd36 Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Fri, 26 Oct 2012 11:36:14 -0700 Subject: CHUI-383: Now a new conversation will not take focus. Instead a toast will appear. Problem: Each time a conversation was added, code would execute to add the conversation floater AND select the conversation. Resolution: This is no longer the expected behavior so adjusted LLIMFloater::addToHost() to only add a floater and not select/show the floater. If selection and/or showing is needed it seems to make sense that this is done outside LLIMFloater:addToHost(). --- indra/newview/llimfloater.cpp | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) (limited to 'indra/newview/llimfloater.cpp') diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index e4032738a7..1af5def5f0 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -582,7 +582,7 @@ void LLIMFloater::onParticipantsListChanged(LLUICtrl* ctrl) } } -void LLIMFloater::addToHost(const LLUUID& session_id, const bool force) +void LLIMFloater::addToHost(const LLUUID& session_id) { if (!LLIMConversation::isChatMultiTab() || !gIMMgr->hasSession(session_id)) { @@ -607,20 +607,7 @@ void LLIMFloater::addToHost(const LLUUID& session_id, const bool force) LLTabContainer::eInsertionPoint i_pt = LLTabContainer::END; if (floater_container) { - floater_container->addFloater(floater, TRUE, i_pt); - } - } - - if (force) - { - if (floater_container && floater_container->getVisible()) - { - floater->openFloater(floater->getKey()); - floater->setVisible(TRUE); - } - else - { - floater->setVisible(FALSE); + floater_container->addFloater(floater, FALSE, i_pt); } } } -- cgit v1.2.3 From 09282019ef4d068fe95a94931bf341d8e84f29ea Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Fri, 26 Oct 2012 19:12:19 -0700 Subject: CHUI-469 : WIP : Add participants to the nearby chat torn off panel --- indra/newview/llimfloater.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'indra/newview/llimfloater.cpp') diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index 8fbf691897..560b3fa60a 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -825,8 +825,7 @@ void LLIMFloater::sessionInitReplyReceived(const LLUUID& im_session_id) if (mSessionID != im_session_id) { initIMSession(im_session_id); - - buildParticipantList(); + buildConversationViewParticipant(); } initIMFloater(); -- cgit v1.2.3 From a8ca9dc5a98d0bd99581d17be45a36c602ce87fd Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Wed, 31 Oct 2012 17:51:55 +0200 Subject: CHUI-374 ADD. FIX, CHUI-442 FIXED (Nearby chat is torn off and cannot be docked if nearby chat is received while conversation floater is closed) - implement. lazy creating of container --- indra/newview/llimfloater.cpp | 34 ++-------------------------------- 1 file changed, 2 insertions(+), 32 deletions(-) (limited to 'indra/newview/llimfloater.cpp') diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index 1af5def5f0..3545b8ff18 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -582,37 +582,6 @@ void LLIMFloater::onParticipantsListChanged(LLUICtrl* ctrl) } } -void LLIMFloater::addToHost(const LLUUID& session_id) -{ - if (!LLIMConversation::isChatMultiTab() || !gIMMgr->hasSession(session_id)) - { - return; - } - - // Test the existence of the floater before we try to create it - bool exist = findInstance(session_id); - - // Get the floater: this will create the instance if it didn't exist - LLIMFloater* floater = getInstance(session_id); - if (floater) - { - - LLIMFloaterContainer* floater_container = LLIMFloaterContainer::getInstance(); - - // Do not add again existing floaters - if (!exist) - { - // LLTabContainer::eInsertionPoint i_pt = user_initiated ? LLTabContainer::RIGHT_OF_CURRENT : LLTabContainer::END; - // TODO: mantipov: use LLTabContainer::RIGHT_OF_CURRENT if it exists - LLTabContainer::eInsertionPoint i_pt = LLTabContainer::END; - if (floater_container) - { - floater_container->addFloater(floater, FALSE, i_pt); - } - } - } -} - //static LLIMFloater* LLIMFloater::show(const LLUUID& session_id) @@ -721,7 +690,7 @@ void LLIMFloater::setVisible(BOOL visible) (LLNotificationsUI::LLChannelManager::getInstance()-> findChannelByID(LLUUID(gSavedSettings.getString("NotificationChannelUUID")))); - LLTransientDockableFloater::setVisible(visible); + LLIMConversation::setVisible(visible); // update notification channel state if(channel) @@ -1309,6 +1278,7 @@ void LLIMFloater::sRemoveTypingIndicator(const LLSD& data) floater->removeTypingIndicator(); } +// static void LLIMFloater::onIMChicletCreated( const LLUUID& session_id ) { LLIMFloater::addToHost(session_id); -- cgit v1.2.3 From ef5121ffb309c0317a4eb478e9527d33441377c2 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Fri, 2 Nov 2012 11:01:08 -0700 Subject: CHUI-481 : WIP : Make updateSessionName() a virtual method of LLIMConversation so we can eventually call it on events --- indra/newview/llimfloater.cpp | 54 ++++++++++++++++++++++++++----------------- 1 file changed, 33 insertions(+), 21 deletions(-) (limited to 'indra/newview/llimfloater.cpp') diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index 6d90b6a0b2..4e1bfb4e77 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -243,7 +243,6 @@ void LLIMFloater::initIMSession(const LLUUID& session_id) { mIsP2PChat = mSession->isP2PSessionType(); mSessionInitialized = mSession->mSessionInitialized; - mDialog = mSession->mType; } } @@ -281,7 +280,7 @@ void LLIMFloater::initIMFloater() else { std::string session_name(LLIMModel::instance().getName(mSessionID)); - updateSessionName(session_name, session_name); + updateSessionName(session_name); // For ad hoc conferences we should update the title with participants names. if ((IM_SESSION_INVITE == mDialog && !gAgent.isInGroup(mSessionID)) @@ -292,6 +291,8 @@ void LLIMFloater::initIMFloater() mParticipantsListRefreshConnection.disconnect(); } + // CHUI-441: We shouldn't have any avatar_list anymore... see floater_im_session.xml + // *TODO: Track and delete if not necessary anymore LLAvatarList* avatar_list = getChild("speakers_list"); mParticipantsListRefreshConnection = avatar_list->setRefreshCompleteCallback( boost::bind(&LLIMFloater::onParticipantsListChanged, this, _1)); @@ -525,20 +526,21 @@ void LLIMFloater::onVoiceChannelStateChanged( updateCallBtnState(callIsActive); } -void LLIMFloater::updateSessionName(const std::string& ui_title, - const std::string& ui_label) +void LLIMFloater::updateSessionName(const std::string& name) { - mInputEditor->setLabel(LLTrans::getString("IM_to_label") + " " + ui_label); - setTitle(ui_title); + LLIMConversation::updateSessionName(name); + setTitle(name); } void LLIMFloater::onAvatarNameCache(const LLUUID& agent_id, const LLAvatarName& av_name) { - // Use display name only for labels, as the extended name will be in the - // floater title + // Use display name for label + updateSessionName(av_name.mDisplayName); + + // Overwrite the floater title with the extended name std::string ui_title = av_name.getCompleteName(); - updateSessionName(ui_title, av_name.mDisplayName); + setTitle(ui_title); mTypingStart.setArg("[NAME]", ui_title); } @@ -550,35 +552,45 @@ void LLIMFloater::onParticipantsListChanged(LLUICtrl* ctrl) return; } - bool all_names_resolved = true; std::vector participants_uuids; uuid_vec_t temp_uuids; // uuids vector for building the added participants' names string + LLUUID unfound_id; avatar_list->getValues(participants_uuids); - // Check whether we have all participants names in LLAvatarNameCache + // Check participants names in LLAvatarNameCache for (std::vector::const_iterator it = participants_uuids.begin(); it != participants_uuids.end(); ++it) { const LLUUID& id = it->asUUID(); - temp_uuids.push_back(id); LLAvatarName av_name; if (!LLAvatarNameCache::get(id, &av_name)) { - all_names_resolved = false; - - // If a name is not found in cache, request it and continue the process recursively - // until all ids are resolved into names. - LLAvatarNameCache::get(id, - boost::bind(&LLIMFloater::onParticipantsListChanged, this, avatar_list)); - break; + // Keep the first not found avatar id + if (unfound_id.isNull()) + { + unfound_id = id; + } } + else + { + // Add the participant to the list of existing names + temp_uuids.push_back(id); + } } - if (all_names_resolved) + if (temp_uuids.size() != 0) { + // Build the session name and update it std::string ui_title; LLAvatarActions::buildResidentsString(temp_uuids, ui_title); - updateSessionName(ui_title, ui_title); + updateSessionName(ui_title); + } + + if (unfound_id.notNull()) + { + // If a name is not found in cache, request it and continue the process recursively + // until all ids are resolved into names. + LLAvatarNameCache::get(unfound_id, boost::bind(&LLIMFloater::onParticipantsListChanged, this, avatar_list)); } } -- cgit v1.2.3 From 4da02c26e10fe59dfde762cdb3c0d20be7f6ebde Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Fri, 2 Nov 2012 19:36:46 -0700 Subject: CHUI-481, CHUI-404, CHUI-405, CHUI-406, CHUI-407, CHUI-408 : Fixed! Change the way Ad-hoc and P2P chats update their session name in a way which is consistent and honor display name. --- indra/newview/llimfloater.cpp | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) (limited to 'indra/newview/llimfloater.cpp') diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index 4e1bfb4e77..75be0a7edc 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -270,14 +270,7 @@ void LLIMFloater::initIMFloater() mInputEditor->setLabel(LLTrans::getString("IM_unavailable_text_label")); } - if (mIsP2PChat) - { - // look up display name for window title - LLAvatarNameCache::get(mSession->mOtherParticipantID, - boost::bind(&LLIMFloater::onAvatarNameCache, - this, _1, _2)); - } - else + if (!mIsP2PChat) { std::string session_name(LLIMModel::instance().getName(mSessionID)); updateSessionName(session_name); @@ -530,18 +523,7 @@ void LLIMFloater::updateSessionName(const std::string& name) { LLIMConversation::updateSessionName(name); setTitle(name); -} - -void LLIMFloater::onAvatarNameCache(const LLUUID& agent_id, - const LLAvatarName& av_name) -{ - // Use display name for label - updateSessionName(av_name.mDisplayName); - - // Overwrite the floater title with the extended name - std::string ui_title = av_name.getCompleteName(); - setTitle(ui_title); - mTypingStart.setArg("[NAME]", ui_title); + mTypingStart.setArg("[NAME]", name); } void LLIMFloater::onParticipantsListChanged(LLUICtrl* ctrl) -- cgit v1.2.3 From 8d6aaf8e8e7c2d0f68bf79100f163803cbdd02bc Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Mon, 5 Nov 2012 13:47:49 -0800 Subject: CHUI-468 : Suppress LLIMFloater::onParticipantsListChanged(). Not useful anymore. --- indra/newview/llimfloater.cpp | 68 ------------------------------------------- 1 file changed, 68 deletions(-) (limited to 'indra/newview/llimfloater.cpp') diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index 8742460689..d9c201d856 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -220,7 +220,6 @@ void LLIMFloater::sendMsg(const std::string& msg) LLIMFloater::~LLIMFloater() { - mParticipantsListRefreshConnection.disconnect(); mVoiceChannelStateChangeConnection.disconnect(); if(LLVoiceClient::instanceExists()) { @@ -274,22 +273,6 @@ void LLIMFloater::initIMFloater() { std::string session_name(LLIMModel::instance().getName(mSessionID)); updateSessionName(session_name); - - // For ad hoc conferences we should update the title with participants names. - if ((IM_SESSION_INVITE == mDialog && !gAgent.isInGroup(mSessionID)) - || mDialog == IM_SESSION_CONFERENCE_START) - { - if (mParticipantsListRefreshConnection.connected()) - { - mParticipantsListRefreshConnection.disconnect(); - } - - // CHUI-441: We shouldn't have any avatar_list anymore... see floater_im_session.xml - // *TODO: Track and delete if not necessary anymore - LLAvatarList* avatar_list = getChild("speakers_list"); - mParticipantsListRefreshConnection = avatar_list->setRefreshCompleteCallback( - boost::bind(&LLIMFloater::onParticipantsListChanged, this, _1)); - } } } @@ -526,57 +509,6 @@ void LLIMFloater::updateSessionName(const std::string& name) mTypingStart.setArg("[NAME]", name); } -void LLIMFloater::onParticipantsListChanged(LLUICtrl* ctrl) -{ - LLAvatarList* avatar_list = dynamic_cast(ctrl); - if (!avatar_list) - { - return; - } - - std::vector participants_uuids; - uuid_vec_t temp_uuids; // uuids vector for building the added participants' names string - LLUUID unfound_id; - - avatar_list->getValues(participants_uuids); - - // Check participants names in LLAvatarNameCache - for (std::vector::const_iterator it = participants_uuids.begin(); it != participants_uuids.end(); ++it) - { - const LLUUID& id = it->asUUID(); - LLAvatarName av_name; - if (!LLAvatarNameCache::get(id, &av_name)) - { - // Keep the first not found avatar id - if (unfound_id.isNull()) - { - unfound_id = id; - } - } - else - { - // Add the participant to the list of existing names - temp_uuids.push_back(id); - } - } - - if (temp_uuids.size() != 0) - { - // Build the session name and update it - std::string ui_title; - LLAvatarActions::buildResidentsString(temp_uuids, ui_title); - updateSessionName(ui_title); - } - - if (unfound_id.notNull()) - { - // If a name is not found in cache, request it and continue the process recursively - // until all ids are resolved into names. - LLAvatarNameCache::get(unfound_id, boost::bind(&LLIMFloater::onParticipantsListChanged, this, avatar_list)); - } -} - - //static LLIMFloater* LLIMFloater::show(const LLUUID& session_id) { -- cgit v1.2.3 From d1f45654d91762af4e614de2156304d7acad6619 Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Wed, 7 Nov 2012 18:45:02 +0200 Subject: CHUI-473, CHUI-482 FIXED (Clicking on nearby chat toast to open Conversation floater does not show Nearby Chat conversation selected in list; Nearby chat conversation is not selected in list by default when it is the only conversation ): implement. new logic in LLIMFloaterContainer for the syncronous select the conv. list's item and corresponding convers. floater; removed floater selecting from conv. items; fixed bug with item select --- indra/newview/llimfloater.cpp | 13 ------------- 1 file changed, 13 deletions(-) (limited to 'indra/newview/llimfloater.cpp') diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index 3545b8ff18..2ff883da67 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -671,19 +671,6 @@ void LLIMFloater::setDocked(bool docked, bool pop_on_undock) } } -void LLIMFloater::setFocus(BOOL focusFlag) -{ - LLTransientDockableFloater::setFocus(focusFlag); - - //Redirect focus to input editor - if (focusFlag) - { - updateMessages(); - mInputEditor->setFocus(TRUE); - } - -} - void LLIMFloater::setVisible(BOOL visible) { LLNotificationsUI::LLScreenChannel* channel = static_cast -- cgit v1.2.3 From 486bdf32845e248ec4923224f1f4ea5d239ac0f3 Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Fri, 9 Nov 2012 12:45:36 +0200 Subject: CHUI-337 FIXED: To avoid confusion with a classes "...conversation..." and in accordance with the naming convention in the project, some classes and corresponding files should be renamed: LLIMConversation -> LLFloaterIMSessionTab LLIMFloater -> LLFloaterIMSession LLNearbyChat -> LLFloaterIMNearbyChat LLIMFloaterContainer -> LLFloaterIMContainer LLNearbyChatBarListener -> LLFloaterIMNearbyChatListener LLNearbyChatHandler -> LLFloaterIMNearbyChatHandler --- indra/newview/llimfloater.cpp | 1202 ----------------------------------------- 1 file changed, 1202 deletions(-) delete mode 100644 indra/newview/llimfloater.cpp (limited to 'indra/newview/llimfloater.cpp') diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp deleted file mode 100644 index 73c7be37eb..0000000000 --- a/indra/newview/llimfloater.cpp +++ /dev/null @@ -1,1202 +0,0 @@ -/** - * @file llimfloater.cpp - * @brief LLIMFloater class definition - * - * $LicenseInfo:firstyear=2009&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#include "llviewerprecompiledheaders.h" - -#include "llimfloater.h" - -#include "lldraghandle.h" -#include "llnotificationsutil.h" - -#include "llagent.h" -#include "llappviewer.h" -#include "llavataractions.h" -#include "llavatarnamecache.h" -#include "llbutton.h" -#include "llchannelmanager.h" -#include "llchiclet.h" -#include "llchicletbar.h" -#include "llfloaterreg.h" -#include "llfloateravatarpicker.h" -#include "llimfloatercontainer.h" // to replace separate IM Floaters with multifloater container -#include "llinventoryfunctions.h" -//#include "lllayoutstack.h" -#include "llchatentry.h" -#include "lllogchat.h" -#include "llscreenchannel.h" -#include "llsyswellwindow.h" -#include "lltrans.h" -#include "llchathistory.h" -#include "llnotifications.h" -#include "llviewerwindow.h" -#include "lltransientfloatermgr.h" -#include "llinventorymodel.h" -#include "llrootview.h" -#include "llspeakers.h" -#include "llviewerchat.h" -#include "llnotificationmanager.h" -#include "llautoreplace.h" - -floater_showed_signal_t LLIMFloater::sIMFloaterShowedSignal; - -LLIMFloater::LLIMFloater(const LLUUID& session_id) - : LLIMConversation(session_id), - mLastMessageIndex(-1), - mDialog(IM_NOTHING_SPECIAL), - mSavedTitle(), - mTypingStart(), - mShouldSendTypingState(false), - mMeTyping(false), - mOtherTyping(false), - mTypingTimer(), - mTypingTimeoutTimer(), - mPositioned(false), - mSessionInitialized(false), - mStartConferenceInSameFloater(false) -{ - mIsNearbyChat = false; - - initIMSession(session_id); - - setOverlapsScreenChannel(true); - - LLTransientFloaterMgr::getInstance()->addControlView(LLTransientFloaterMgr::IM, this); - - setDocked(true); -} - - -// virtual -void LLIMFloater::refresh() -{ - if (mMeTyping) -{ - // Time out if user hasn't typed for a while. - if (mTypingTimeoutTimer.getElapsedTimeF32() > LLAgent::TYPING_TIMEOUT_SECS) - { - setTyping(false); - } - } -} - -// virtual -void LLIMFloater::onClickCloseBtn() -{ - LLIMModel::LLIMSession* session = LLIMModel::instance().findIMSession(mSessionID); - - if (session != NULL) - { - bool is_call_with_chat = session->isGroupSessionType() - || session->isAdHocSessionType() || session->isP2PSessionType(); - - LLVoiceChannel* voice_channel = LLIMModel::getInstance()->getVoiceChannel(mSessionID); - - if (is_call_with_chat && voice_channel != NULL - && voice_channel->isActive()) - { - LLSD payload; - payload["session_id"] = mSessionID; - LLNotificationsUtil::add("ConfirmLeaveCall", LLSD(), payload, confirmLeaveCallCallback); - return; - } - } - else - { - llwarns << "Empty session with id: " << (mSessionID.asString()) << llendl; - return; - } - - LLIMConversation::onClickCloseBtn(); -} - -/* static */ -void LLIMFloater::newIMCallback(const LLSD& data) -{ - if (data["num_unread"].asInteger() > 0 || data["from_id"].asUUID().isNull()) - { - LLUUID session_id = data["session_id"].asUUID(); - - LLIMFloater* floater = LLFloaterReg::findTypedInstance("impanel", session_id); - - // update if visible, otherwise will be updated when opened - if (floater && floater->getVisible()) - { - floater->updateMessages(); - } - } -} - -void LLIMFloater::onVisibilityChange(const LLSD& new_visibility) -{ - bool visible = new_visibility.asBoolean(); - - LLVoiceChannel* voice_channel = LLIMModel::getInstance()->getVoiceChannel(mSessionID); - - if (visible && voice_channel && - voice_channel->getState() == LLVoiceChannel::STATE_CONNECTED) - { - LLFloaterReg::showInstance("voice_call", mSessionID); - } - else - { - LLFloaterReg::hideInstance("voice_call", mSessionID); - } -} - -void LLIMFloater::onSendMsg( LLUICtrl* ctrl, void* userdata ) -{ - LLIMFloater* self = (LLIMFloater*) userdata; - self->sendMsgFromInputEditor(); - self->setTyping(false); -} - -void LLIMFloater::sendMsgFromInputEditor() -{ - if (gAgent.isGodlike() - || (mDialog != IM_NOTHING_SPECIAL) - || !mOtherParticipantUUID.isNull()) - { - if (mInputEditor) - { - LLWString text = mInputEditor->getWText(); - LLWStringUtil::trim(text); - LLWStringUtil::replaceChar(text,182,'\n'); // Convert paragraph symbols back into newlines. - if(!text.empty()) - { - // Truncate and convert to UTF8 for transport - std::string utf8_text = wstring_to_utf8str(text); - - sendMsg(utf8_text); - - mInputEditor->setText(LLStringUtil::null); - } - } - } - else - { - llinfos << "Cannot send IM to everyone unless you're a god." << llendl; - } -} - -void LLIMFloater::sendMsg(const std::string& msg) -{ - const std::string utf8_text = utf8str_truncate(msg, MAX_MSG_BUF_SIZE - 1); - - if (mSessionInitialized) - { - LLIMModel::sendMessage(utf8_text, mSessionID, mOtherParticipantUUID, mDialog); - } - else - { - //queue up the message to send once the session is initialized - mQueuedMsgsForInit.append(utf8_text); - } - - updateMessages(); -} - -LLIMFloater::~LLIMFloater() -{ - mVoiceChannelStateChangeConnection.disconnect(); - if(LLVoiceClient::instanceExists()) - { - LLVoiceClient::getInstance()->removeObserver(this); - } - - LLTransientFloaterMgr::getInstance()->removeControlView(LLTransientFloaterMgr::IM, this); -} - - -void LLIMFloater::initIMSession(const LLUUID& session_id) -{ - // Change the floater key to bind it to a new session. - setKey(session_id); - - mSessionID = session_id; - mSession = LLIMModel::getInstance()->findIMSession(mSessionID); - - if (mSession) - { - mIsP2PChat = mSession->isP2PSessionType(); - mSessionInitialized = mSession->mSessionInitialized; - mDialog = mSession->mType; - } -} - -void LLIMFloater::initIMFloater() -{ - const LLUUID& other_party_id = - LLIMModel::getInstance()->getOtherParticipantID(mSessionID); - if (other_party_id.notNull()) - { - mOtherParticipantUUID = other_party_id; - } - - boundVoiceChannel(); - - mTypingStart = LLTrans::getString("IM_typing_start_string"); - - // Show control panel in torn off floaters only. - mParticipantListPanel->setVisible(!getHost() && gSavedSettings.getBOOL("IMShowControlPanel")); - - // Disable input editor if session cannot accept text - if ( mSession && !mSession->mTextIMPossible ) - { - mInputEditor->setEnabled(FALSE); - mInputEditor->setLabel(LLTrans::getString("IM_unavailable_text_label")); - } - - if (!mIsP2PChat) - { - std::string session_name(LLIMModel::instance().getName(mSessionID)); - updateSessionName(session_name); - } -} - -//virtual -BOOL LLIMFloater::postBuild() -{ - BOOL result = LLIMConversation::postBuild(); - - mInputEditor->setMaxTextLength(1023); - // enable line history support for instant message bar - // XXX stinson TODO : resolve merge by adding autoreplace to text editors -#if 0 - // *TODO Establish LineEditor with autoreplace callback - mInputEditor->setAutoreplaceCallback(boost::bind(&LLAutoReplace::autoreplaceCallback, LLAutoReplace::getInstance(), _1, _2)); -#endif - - mInputEditor->setFocusReceivedCallback( boost::bind(onInputEditorFocusReceived, _1, this) ); - mInputEditor->setFocusLostCallback( boost::bind(onInputEditorFocusLost, _1, this) ); - mInputEditor->setKeystrokeCallback( boost::bind(onInputEditorKeystroke, _1, this) ); - mInputEditor->setCommitCallback(boost::bind(onSendMsg, _1, this)); - - setDocked(true); - - LLButton* add_btn = getChild("add_btn"); - - // Allow to add chat participants depending on the session type - add_btn->setEnabled(isInviteAllowed()); - add_btn->setClickedCallback(boost::bind(&LLIMFloater::onAddButtonClicked, this)); - - childSetAction("voice_call_btn", boost::bind(&LLIMFloater::onCallButtonClicked, this)); - - LLVoiceClient::getInstance()->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) - - initIMFloater(); - - return result; -} - -void LLIMFloater::onAddButtonClicked() -{ - LLView * button = findChild("toolbar_panel")->findChild("add_btn"); - LLFloater* root_floater = gFloaterView->getParentFloater(this); - LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(boost::bind(&LLIMFloater::addSessionParticipants, this, _1), TRUE, TRUE, FALSE, root_floater->getName(), button); - if (!picker) - { - return; - } - - // Need to disable 'ok' button when selected users are already in conversation. - picker->setOkBtnEnableCb(boost::bind(&LLIMFloater::canAddSelectedToChat, this, _1)); - - if (root_floater) - { - root_floater->addDependentFloater(picker); - } -} - -bool LLIMFloater::canAddSelectedToChat(const uuid_vec_t& uuids) -{ - if (!mSession - || mDialog == IM_SESSION_GROUP_START - || mDialog == IM_SESSION_INVITE && gAgent.isInGroup(mSessionID)) - { - return false; - } - - if (mIsP2PChat) - { - // For a P2P session just check if we are not adding the other participant. - - for (uuid_vec_t::const_iterator id = uuids.begin(); - id != uuids.end(); ++id) - { - if (*id == mOtherParticipantUUID) - { - return false; - } - } - } - else - { - // For a conference session we need to check against the list from LLSpeakerMgr, - // because this list may change when participants join or leave the session. - - LLSpeakerMgr::speaker_list_t speaker_list; - LLIMSpeakerMgr* speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(mSessionID); - if (speaker_mgr) - { - speaker_mgr->getSpeakerList(&speaker_list, true); - } - - for (uuid_vec_t::const_iterator id = uuids.begin(); - id != uuids.end(); ++id) - { - for (LLSpeakerMgr::speaker_list_t::const_iterator it = speaker_list.begin(); - it != speaker_list.end(); ++it) - { - const LLPointer& speaker = *it; - if (*id == speaker->mID) - { - return false; - } - } - } - } - - return true; -} - -void LLIMFloater::addSessionParticipants(const uuid_vec_t& uuids) -{ - if (mIsP2PChat) - { - LLSD payload; - LLSD args; - - LLNotificationsUtil::add("ConfirmAddingChatParticipants", args, payload, - boost::bind(&LLIMFloater::addP2PSessionParticipants, this, _1, _2, uuids)); - } - else - { - // remember whom we have invited, to notify others later, when the invited ones actually join - mInvitedParticipants.insert(mInvitedParticipants.end(), uuids.begin(), uuids.end()); - - inviteToSession(uuids); - } -} - -void LLIMFloater::addP2PSessionParticipants(const LLSD& notification, const LLSD& response, const uuid_vec_t& uuids) -{ - S32 option = LLNotificationsUtil::getSelectedOption(notification, response); - if (option != 0) - { - return; - } - - mStartConferenceInSameFloater = true; - - LLVoiceChannel* voice_channel = LLIMModel::getInstance()->getVoiceChannel(mSessionID); - - // first check whether this is a voice session - bool is_voice_call = voice_channel != NULL && voice_channel->isActive(); - - uuid_vec_t temp_ids; - - // Add the initial participant of a P2P session - temp_ids.push_back(mOtherParticipantUUID); - temp_ids.insert(temp_ids.end(), uuids.begin(), uuids.end()); - - // then we can close the current session - onClose(false); - - // we start a new session so reset the initialization flag - mSessionInitialized = false; - - // remember whom we have invited, to notify others later, when the invited ones actually join - mInvitedParticipants.insert(mInvitedParticipants.end(), uuids.begin(), uuids.end()); - - // Start a new ad hoc voice call if we invite new participants to a P2P call, - // or start a text chat otherwise. - if (is_voice_call) - { - LLAvatarActions::startAdhocCall(temp_ids, mSessionID); - } - else - { - LLAvatarActions::startConference(temp_ids, mSessionID); - } -} - -void LLIMFloater::sendParticipantsAddedNotification(const uuid_vec_t& uuids) -{ - std::string names_string; - LLAvatarActions::buildResidentsString(uuids, names_string); - LLStringUtil::format_map_t args; - args["[NAME]"] = names_string; - - sendMsg(getString(uuids.size() > 1 ? "multiple_participants_added" : "participant_added", args)); -} - -void LLIMFloater::boundVoiceChannel() -{ - LLVoiceChannel* voice_channel = LLIMModel::getInstance()->getVoiceChannel(mSessionID); - if(voice_channel) - { - mVoiceChannelStateChangeConnection = voice_channel->setStateChangedCallback( - boost::bind(&LLIMFloater::onVoiceChannelStateChanged, this, _1, _2)); - - //call (either p2p, group or ad-hoc) can be already in started state - bool callIsActive = voice_channel->getState() >= LLVoiceChannel::STATE_CALL_STARTED; - updateCallBtnState(callIsActive); - } -} - -void LLIMFloater::onCallButtonClicked() -{ - LLVoiceChannel* voice_channel = LLIMModel::getInstance()->getVoiceChannel(mSessionID); - if (voice_channel) - { - bool is_call_active = voice_channel->getState() >= LLVoiceChannel::STATE_CALL_STARTED; - if (is_call_active) - { - gIMMgr->endCall(mSessionID); - } - else - { - gIMMgr->startCall(mSessionID); - } - } -} - -void LLIMFloater::onChange(EStatusType status, const std::string &channelURI, bool proximal) -{ - if(status != STATUS_JOINING && status != STATUS_LEFT_CHANNEL) - { - enableDisableCallBtn(); - } -} - -void LLIMFloater::onVoiceChannelStateChanged( - const LLVoiceChannel::EState& old_state, const LLVoiceChannel::EState& new_state) -{ - bool callIsActive = new_state >= LLVoiceChannel::STATE_CALL_STARTED; - updateCallBtnState(callIsActive); -} - -void LLIMFloater::updateSessionName(const std::string& name) -{ - LLIMConversation::updateSessionName(name); - setTitle(name); - mTypingStart.setArg("[NAME]", name); -} - -//static -LLIMFloater* LLIMFloater::show(const LLUUID& session_id) -{ - closeHiddenIMToasts(); - - if (!gIMMgr->hasSession(session_id)) - return NULL; - - // Test the existence of the floater before we try to create it - bool exist = findInstance(session_id); - - // Get the floater: this will create the instance if it didn't exist - LLIMFloater* floater = getInstance(session_id); - if (!floater) - return NULL; - - LLIMFloaterContainer* floater_container = LLIMFloaterContainer::getInstance(); - - // Do not add again existing floaters - if (!exist) - { - // LLTabContainer::eInsertionPoint i_pt = user_initiated ? LLTabContainer::RIGHT_OF_CURRENT : LLTabContainer::END; - // TODO: mantipov: use LLTabContainer::RIGHT_OF_CURRENT if it exists - LLTabContainer::eInsertionPoint i_pt = LLTabContainer::END; - if (floater_container) - { - floater_container->addFloater(floater, TRUE, i_pt); - } - } - - floater->openFloater(floater->getKey()); - - floater->setVisible(TRUE); - - return floater; -} -//static -LLIMFloater* LLIMFloater::findInstance(const LLUUID& session_id) -{ - LLIMFloater* conversation = - LLFloaterReg::findTypedInstance("impanel", session_id); - - return conversation; -} - -LLIMFloater* LLIMFloater::getInstance(const LLUUID& session_id) -{ - LLIMFloater* conversation = - LLFloaterReg::getTypedInstance("impanel", session_id); - - return conversation; -} - -void LLIMFloater::onClose(bool app_quitting) -{ - setTyping(false); - - // The source of much argument and design thrashing - // Should the window hide or the session close when the X is clicked? - // - // Last change: - // EXT-3516 X Button should end IM session, _ button should hide - gIMMgr->leaveSession(mSessionID); - - // Clean up the conversation *after* the session has been ended - LLIMConversation::onClose(app_quitting); -} - -void LLIMFloater::setDocked(bool docked, bool pop_on_undock) -{ - // update notification channel state - LLNotificationsUI::LLScreenChannel* channel = static_cast - (LLNotificationsUI::LLChannelManager::getInstance()-> - findChannelByID(LLUUID(gSavedSettings.getString("NotificationChannelUUID")))); - - if(!isChatMultiTab()) - { - LLTransientDockableFloater::setDocked(docked, pop_on_undock); - } - - // update notification channel state - if(channel) - { - channel->updateShowToastsState(); - channel->redrawToasts(); - } -} - -void LLIMFloater::setVisible(BOOL visible) -{ - LLNotificationsUI::LLScreenChannel* channel = static_cast - (LLNotificationsUI::LLChannelManager::getInstance()-> - findChannelByID(LLUUID(gSavedSettings.getString("NotificationChannelUUID")))); - - LLIMConversation::setVisible(visible); - - // update notification channel state - if(channel) - { - channel->updateShowToastsState(); - channel->redrawToasts(); - } - - if(!visible) - { - LLIMChiclet* chiclet = LLChicletBar::getInstance()->getChicletPanel()->findChiclet(mSessionID); - if(chiclet) - { - chiclet->setToggleState(false); - } - } - - if (visible && isInVisibleChain()) - { - sIMFloaterShowedSignal(mSessionID); - - } - - setFocus(visible); -} - -BOOL LLIMFloater::getVisible() -{ - bool visible; - - if(isChatMultiTab()) - { - LLIMFloaterContainer* im_container = - LLIMFloaterContainer::getInstance(); - - // Treat inactive floater as invisible. - bool is_active = im_container->getActiveFloater() == this; - - //torn off floater is always inactive - if (!is_active && getHost() != im_container) - { - visible = LLTransientDockableFloater::getVisible(); - } - else - { - // getVisible() returns TRUE when Tabbed IM window is minimized. - visible = is_active && !im_container->isMinimized() - && im_container->getVisible(); - } - } - else - { - visible = LLTransientDockableFloater::getVisible(); - } - - return visible; -} - -//static -bool LLIMFloater::toggle(const LLUUID& session_id) -{ - if(!isChatMultiTab()) - { - LLIMFloater* floater = LLFloaterReg::findTypedInstance( - "impanel", session_id); - if (floater && floater->getVisible() && floater->hasFocus()) - { - // clicking on chiclet to close floater just hides it to maintain existing - // scroll/text entry state - floater->setVisible(false); - return false; - } - else if(floater && (!floater->isDocked() || floater->getVisible() && !floater->hasFocus())) - { - floater->setVisible(TRUE); - floater->setFocus(TRUE); - return true; - } - } - - // ensure the list of messages is updated when floater is made visible - show(session_id); - return true; -} - -void LLIMFloater::sessionInitReplyReceived(const LLUUID& im_session_id) -{ - mSessionInitialized = true; - - //will be different only for an ad-hoc im session - if (mSessionID != im_session_id) - { - initIMSession(im_session_id); - buildConversationViewParticipant(); - } - - initIMFloater(); - - //*TODO here we should remove "starting session..." warning message if we added it in postBuild() (IB) - - //need to send delayed messages collected while waiting for session initialization - if (mQueuedMsgsForInit.size()) - { - LLSD::array_iterator iter; - for ( iter = mQueuedMsgsForInit.beginArray(); - iter != mQueuedMsgsForInit.endArray(); ++iter) - { - LLIMModel::sendMessage(iter->asString(), mSessionID, - mOtherParticipantUUID, mDialog); - } - - mQueuedMsgsForInit.clear(); - } -} - -void LLIMFloater::updateMessages() -{ - std::list messages; - - // we shouldn't reset unread message counters if IM floater doesn't have focus - LLIMModel::instance().getMessages( - mSessionID, messages, mLastMessageIndex + 1, hasFocus()); - - if (messages.size()) - { - std::ostringstream message; - std::list::const_reverse_iterator iter = messages.rbegin(); - std::list::const_reverse_iterator iter_end = messages.rend(); - for (; iter != iter_end; ++iter) - { - LLSD msg = *iter; - - std::string time = msg["time"].asString(); - LLUUID from_id = msg["from_id"].asUUID(); - std::string from = msg["from"].asString(); - std::string message = msg["message"].asString(); - bool is_history = msg["is_history"].asBoolean(); - - LLChat chat; - chat.mFromID = from_id; - chat.mSessionID = mSessionID; - chat.mFromName = from; - chat.mTimeStr = time; - chat.mChatStyle = is_history ? CHAT_STYLE_HISTORY : chat.mChatStyle; - - // process offer notification - if (msg.has("notification_id")) - { - chat.mNotifId = msg["notification_id"].asUUID(); - // if notification exists - embed it - if (LLNotificationsUtil::find(chat.mNotifId) != NULL) - { - // remove embedded notification from channel - LLNotificationsUI::LLScreenChannel* channel = static_cast - (LLNotificationsUI::LLChannelManager::getInstance()-> - findChannelByID(LLUUID(gSavedSettings.getString("NotificationChannelUUID")))); - if (getVisible()) - { - // toast will be automatically closed since it is not storable toast - channel->hideToast(chat.mNotifId); - } - } - // if notification doesn't exist - try to use next message which should be log entry - else - { - continue; - } - } - //process text message - else - { - chat.mText = message; - } - - // Add the message to the chat log - appendMessage(chat); - mLastMessageIndex = msg["index"].asInteger(); - - // if it is a notification - next message is a notification history log, so skip it - if (chat.mNotifId.notNull() && LLNotificationsUtil::find(chat.mNotifId) != NULL) - { - if (++iter == iter_end) - { - break; - } - else - { - mLastMessageIndex++; - } - } - } - } -} - -void LLIMFloater::reloadMessages() -{ - mChatHistory->clear(); - mLastMessageIndex = -1; - updateMessages(); - mInputEditor->setFont(LLViewerChat::getChatFont()); -} - -// static -void LLIMFloater::onInputEditorFocusReceived( LLFocusableElement* caller, void* userdata ) -{ - LLIMFloater* self= (LLIMFloater*) userdata; - - // Allow enabling the LLIMFloater input editor only if session can accept text - LLIMModel::LLIMSession* im_session = - LLIMModel::instance().findIMSession(self->mSessionID); - //TODO: While disabled lllineeditor can receive focus we need to check if it is enabled (EK) - if( im_session && im_session->mTextIMPossible && self->mInputEditor->getEnabled()) - { - //in disconnected state IM input editor should be disabled - self->mInputEditor->setEnabled(!gDisconnected); - } -} - -// static -void LLIMFloater::onInputEditorFocusLost(LLFocusableElement* caller, void* userdata) -{ - LLIMFloater* self = (LLIMFloater*) userdata; - self->setTyping(false); -} - -// static -void LLIMFloater::onInputEditorKeystroke(LLTextEditor* caller, void* userdata) -{ - LLIMFloater* self = (LLIMFloater*)userdata; - std::string text = self->mInputEditor->getText(); - - // Deleting all text counts as stopping typing. - self->setTyping(!text.empty()); -} - -void LLIMFloater::setTyping(bool typing) -{ - if ( typing ) - { - // Started or proceeded typing, reset the typing timeout timer - mTypingTimeoutTimer.reset(); - } - - if ( mMeTyping != typing ) - { - // Typing state is changed - mMeTyping = typing; - // So, should send current state - mShouldSendTypingState = true; - // In case typing is started, send state after some delay - mTypingTimer.reset(); - } - - // Don't want to send typing indicators to multiple people, potentially too - // much network traffic. Only send in person-to-person IMs. - if ( mShouldSendTypingState && mDialog == IM_NOTHING_SPECIAL ) - { - // Still typing, send 'start typing' notification or - // send 'stop typing' notification immediately - if (!mMeTyping || mTypingTimer.getElapsedTimeF32() > 1.f) - { - LLIMModel::instance().sendTypingState(mSessionID, - mOtherParticipantUUID, mMeTyping); - mShouldSendTypingState = false; - } - } - - if (!mIsNearbyChat) - { - LLIMSpeakerMgr* speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(mSessionID); - if (speaker_mgr) - { - speaker_mgr->setSpeakerTyping(gAgent.getID(), FALSE); - } - } -} - -void LLIMFloater::processIMTyping(const LLIMInfo* im_info, BOOL typing) -{ - if ( typing ) - { - // other user started typing - addTypingIndicator(im_info); - } - else - { - // other user stopped typing - removeTypingIndicator(im_info); - } -} - -void LLIMFloater::processAgentListUpdates(const LLSD& body) -{ - uuid_vec_t joined_uuids; - - if (body.isMap() && body.has("agent_updates") && body["agent_updates"].isMap()) - { - LLSD::map_const_iterator update_it; - for(update_it = body["agent_updates"].beginMap(); - update_it != body["agent_updates"].endMap(); - ++update_it) - { - LLUUID agent_id(update_it->first); - LLSD agent_data = update_it->second; - - if (agent_data.isMap()) - { - // store the new participants in joined_uuids - if (agent_data.has("transition") && agent_data["transition"].asString() == "ENTER") - { - joined_uuids.push_back(agent_id); - } - - // 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(); - mInputEditor->setEnabled(!moderator_muted_text); - std::string label; - if (moderator_muted_text) - label = LLTrans::getString("IM_muted_text_label"); - else - label = LLTrans::getString("IM_to_label") + " " + LLIMModel::instance().getName(mSessionID); - mInputEditor->setLabel(label); - - if (moderator_muted_text) - LLNotificationsUtil::add("TextChatIsMutedByModerator"); - } - } - } - } - - // the vectors need to be sorted for computing the intersection and difference - std::sort(mInvitedParticipants.begin(), mInvitedParticipants.end()); - std::sort(joined_uuids.begin(), joined_uuids.end()); - - uuid_vec_t intersection; // uuids of invited residents who have joined the conversation - std::set_intersection(mInvitedParticipants.begin(), mInvitedParticipants.end(), - joined_uuids.begin(), joined_uuids.end(), - std::back_inserter(intersection)); - - if (intersection.size() > 0) - { - sendParticipantsAddedNotification(intersection); - } - - // Remove all joined participants from invited array. - // The difference between the two vectors (the elements in mInvitedParticipants which are not in joined_uuids) - // is placed at the beginning of mInvitedParticipants, then all other elements are erased. - mInvitedParticipants.erase(std::set_difference(mInvitedParticipants.begin(), mInvitedParticipants.end(), - joined_uuids.begin(), joined_uuids.end(), - mInvitedParticipants.begin()), - mInvitedParticipants.end()); -} - -void LLIMFloater::processSessionUpdate(const LLSD& session_update) -{ - // *TODO : verify following code when moderated mode will be implemented - if ( false && session_update.has("moderated_mode") && - session_update["moderated_mode"].has("voice") ) - { - BOOL voice_moderated = session_update["moderated_mode"]["voice"]; - const std::string session_label = LLIMModel::instance().getName(mSessionID); - - if (voice_moderated) - { - setTitle(session_label + std::string(" ") - + LLTrans::getString("IM_moderated_chat_label")); - } - else - { - setTitle(session_label); - } - - // *TODO : uncomment this when/if LLPanelActiveSpeakers panel will be added - //update the speakers dropdown too - //mSpeakerPanel->setVoiceModerationCtrlMode(voice_moderated); - } -} - -// virtual -BOOL LLIMFloater::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, - EDragAndDropType cargo_type, - void* cargo_data, - EAcceptance* accept, - std::string& tooltip_msg) -{ - if (cargo_type == DAD_PERSON) - { - if (dropPerson(static_cast(cargo_data), drop)) - { - *accept = ACCEPT_YES_MULTI; - } - else - { - *accept = ACCEPT_NO; - } - } - else if (mDialog == IM_NOTHING_SPECIAL) - { - LLToolDragAndDrop::handleGiveDragAndDrop(mOtherParticipantUUID, mSessionID, drop, - cargo_type, cargo_data, accept); - } - - return TRUE; -} - -bool LLIMFloater::dropPerson(LLUUID* person_id, bool drop) -{ - bool res = person_id && person_id->notNull(); - if(res) - { - uuid_vec_t ids; - ids.push_back(*person_id); - - res = canAddSelectedToChat(ids); - if(res && drop) - { - addSessionParticipants(ids); - } - } - - return res; -} - -BOOL LLIMFloater::isInviteAllowed() const -{ - return ( (IM_SESSION_CONFERENCE_START == mDialog) - || (IM_SESSION_INVITE == mDialog && !gAgent.isInGroup(mSessionID)) - || mIsP2PChat); -} - -class LLSessionInviteResponder : public LLHTTPClient::Responder -{ -public: - LLSessionInviteResponder(const LLUUID& session_id) - { - mSessionID = session_id; - } - - void error(U32 statusNum, const std::string& reason) - { - llinfos << "Error inviting all agents to session" << llendl; - //throw something back to the viewer here? - } - -private: - LLUUID mSessionID; -}; - -BOOL LLIMFloater::inviteToSession(const uuid_vec_t& ids) -{ - LLViewerRegion* region = gAgent.getRegion(); - bool is_region_exist = region != NULL; - - if (is_region_exist) - { - S32 count = ids.size(); - - if( isInviteAllowed() && (count > 0) ) - { - llinfos << "LLIMFloater::inviteToSession() - inviting participants" << llendl; - - std::string url = region->getCapability("ChatSessionRequest"); - - LLSD data; - data["params"] = LLSD::emptyArray(); - for (int i = 0; i < count; i++) - { - data["params"].append(ids[i]); - } - data["method"] = "invite"; - data["session-id"] = mSessionID; - LLHTTPClient::post(url, data,new LLSessionInviteResponder(mSessionID)); - } - else - { - llinfos << "LLIMFloater::inviteToSession -" - << " no need to invite agents for " - << mDialog << llendl; - // successful add, because everyone that needed to get added - // was added. - } - } - - return is_region_exist; -} - -void LLIMFloater::addTypingIndicator(const LLIMInfo* im_info) -{ - // We may have lost a "stop-typing" packet, don't add it twice - if ( im_info && !mOtherTyping ) - { - mOtherTyping = true; - - // Save and set new title - mSavedTitle = getTitle(); - setTitle (mTypingStart); - - // Update speaker - LLIMSpeakerMgr* speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(mSessionID); - if ( speaker_mgr ) - { - speaker_mgr->setSpeakerTyping(im_info->mFromID, TRUE); - } - } -} - -void LLIMFloater::removeTypingIndicator(const LLIMInfo* im_info) -{ - if ( mOtherTyping ) - { - mOtherTyping = false; - - // Revert the title to saved one - setTitle(mSavedTitle); - - if ( im_info ) - { - // Update speaker - LLIMSpeakerMgr* speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(mSessionID); - if ( speaker_mgr ) - { - speaker_mgr->setSpeakerTyping(im_info->mFromID, FALSE); - } - } - } -} - -// static -void LLIMFloater::closeHiddenIMToasts() -{ - class IMToastMatcher: public LLNotificationsUI::LLScreenChannel::Matcher - { - public: - bool matches(const LLNotificationPtr notification) const - { - // "notifytoast" type of notifications is reserved for IM notifications - return "notifytoast" == notification->getType(); - } - }; - - LLNotificationsUI::LLScreenChannel* channel = - LLNotificationsUI::LLChannelManager::getNotificationScreenChannel(); - if (channel != NULL) - { - channel->closeHiddenToasts(IMToastMatcher()); - } -} -// static -void LLIMFloater::confirmLeaveCallCallback(const LLSD& notification, const LLSD& response) -{ - S32 option = LLNotificationsUtil::getSelectedOption(notification, response); - const LLSD& payload = notification["payload"]; - LLUUID session_id = payload["session_id"]; - - LLFloater* im_floater = findInstance(session_id); - if (option == 0 && im_floater != NULL) - { - im_floater->closeFloater(); - } - - return; -} - -// static -void LLIMFloater::sRemoveTypingIndicator(const LLSD& data) -{ - LLUUID session_id = data["session_id"]; - if (session_id.isNull()) - return; - - LLUUID from_id = data["from_id"]; - if (gAgentID == from_id || LLUUID::null == from_id) - return; - - LLIMFloater* floater = LLIMFloater::findInstance(session_id); - if (!floater) - return; - - if (IM_NOTHING_SPECIAL != floater->mDialog) - return; - - floater->removeTypingIndicator(); -} - -// static -void LLIMFloater::onIMChicletCreated( const LLUUID& session_id ) -{ - LLIMFloater::addToHost(session_id); -} - -boost::signals2::connection LLIMFloater::setIMFloaterShowedCallback(const floater_showed_signal_t::slot_type& cb) -{ - return LLIMFloater::sIMFloaterShowedSignal.connect(cb); -} -- cgit v1.2.3