summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/newview/llimfloater.cpp69
-rw-r--r--indra/newview/llimfloater.h4
2 files changed, 73 insertions, 0 deletions
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<LLAvatarName> 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);
diff --git a/indra/newview/llimfloater.h b/indra/newview/llimfloater.h
index b97d4ab90c..b5822db8dd 100644
--- a/indra/newview/llimfloater.h
+++ b/indra/newview/llimfloater.h
@@ -147,6 +147,10 @@ private:
static void onInputEditorFocusLost(LLFocusableElement* caller, void* userdata);
static void onInputEditorKeystroke(LLLineEditor* caller, void* userdata);
void setTyping(bool typing);
+ void onAddButtonClicked();
+ void onAvatarPicked(const uuid_vec_t& ids, const std::vector<LLAvatarName> names);
+ bool canAddSelectedToChat(const uuid_vec_t& uuids);
+
void onCallButtonClicked();
// set the enable/disable state for the Call button