summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorSeth ProductEngine <slitovchuk@productengine.com>2012-08-09 00:00:25 +0300
committerSeth ProductEngine <slitovchuk@productengine.com>2012-08-09 00:00:25 +0300
commit324200dfd7d70324fe15329100140d98bb1f9b17 (patch)
treec8577cb13d5a48ddc008905eb5c90126c93211c9 /indra/newview
parent25855962a86331a337c4baff2754c63850605aea (diff)
CHUI-120 WIP Added notifications about newly invited chat participants.
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llimfloater.cpp124
-rw-r--r--indra/newview/llimfloater.h3
-rw-r--r--indra/newview/skins/default/xui/en/floater_im_session.xml6
-rw-r--r--indra/newview/skins/default/xui/en/notifications.xml14
4 files changed, 120 insertions, 27 deletions
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<LLAvatarName> 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<LLUUID*>(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
{
diff --git a/indra/newview/llimfloater.h b/indra/newview/llimfloater.h
index 434613ff43..d98213b54c 100644
--- a/indra/newview/llimfloater.h
+++ b/indra/newview/llimfloater.h
@@ -160,7 +160,8 @@ private:
static void onInputEditorKeystroke(LLTextEditor* caller, void* userdata);
void setTyping(bool typing);
void onAddButtonClicked();
- void addSessionParticipants(const uuid_vec_t& uuids);
+ void onAddSessionParticipants(const uuid_vec_t& uuids);
+ void addSessionParticipants(const LLSD& notification, const LLSD& response);
bool canAddSelectedToChat(const uuid_vec_t& uuids);
void onCallButtonClicked();
diff --git a/indra/newview/skins/default/xui/en/floater_im_session.xml b/indra/newview/skins/default/xui/en/floater_im_session.xml
index 4abe4d6941..2b63430106 100644
--- a/indra/newview/skins/default/xui/en/floater_im_session.xml
+++ b/indra/newview/skins/default/xui/en/floater_im_session.xml
@@ -34,6 +34,12 @@
<floater.string
name="return_icon"
value="Conv_toolbar_arrow_sw"/>
+ <floater.string
+ name="participants_added"
+ value="New participant(s) were invited to the conversation: [NAMES]."/>
+ <floater.string
+ name="participants_added_new_window"
+ value="New participant(s) were invited to the conversation: [NAMES]. The conversation will be started in a new window."/>
<view
follows="all"
layout="topleft"
diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml
index e85637826d..2ffa2cfb22 100644
--- a/indra/newview/skins/default/xui/en/notifications.xml
+++ b/indra/newview/skins/default/xui/en/notifications.xml
@@ -4948,6 +4948,20 @@ Go to your [http://secondlife.com/account/ Dashboard] to see your account histor
<notification
icon="alertmodal.tga"
+ name="ConfirmAddingChatParticipants"
+ type="alertmodal">
+ <unique/>
+When you add a person to an existing conversation, a new conversation will be created. All participants will receive new conversation notifications.
+ <tag>confirm</tag>
+ <usetemplate
+ ignoretext="Confirm adding chat paticipants"
+ name="okcancelignore"
+ notext="Cancel"
+ yestext="Ok"/>
+ </notification>
+
+ <notification
+ icon="alertmodal.tga"
name="ConfirmQuit"
type="alertmodal">
<unique/>