summaryrefslogtreecommitdiff
path: root/indra/newview/llavataractions.cpp
diff options
context:
space:
mode:
authorLynx Linden <lynx@lindenlab.com>2009-11-10 18:53:07 +0000
committerLynx Linden <lynx@lindenlab.com>2009-11-10 18:53:07 +0000
commit162924aadfb6a7312287d91a25a129885239c0a4 (patch)
tree53a512ebede0358e4bc1a34cc88ae9591fc336ab /indra/newview/llavataractions.cpp
parent93adff4569d66d0a8699615b7a21d789921ca15c (diff)
DEV-41317 DEV-42311: Added ad-hoc voice call support.
You can now multiple select users in the People panel, hit Call, and start an ad-hoc voice conference call with those users. The most difficult part here was automatically starting the call once the conference chat panel popped up. We have to wait for the panel to initialize before we can start a call, so I added another callback to LLIMModel to enable us to get notified when the panel has initialized. This is all wrapped up behind a new LLAvatarActions::startAdhocCall() API.
Diffstat (limited to 'indra/newview/llavataractions.cpp')
-rw-r--r--indra/newview/llavataractions.cpp50
1 files changed, 49 insertions, 1 deletions
diff --git a/indra/newview/llavataractions.cpp b/indra/newview/llavataractions.cpp
index dae4296a82..4456e0aa74 100644
--- a/indra/newview/llavataractions.cpp
+++ b/indra/newview/llavataractions.cpp
@@ -58,7 +58,10 @@
#include "llviewermessage.h" // for handle_lure
#include "llviewerregion.h"
#include "llimfloater.h"
+#include "lltrans.h"
+// callback connection to auto-call when the IM floater initializes
+boost::signals2::connection gAdhocAutoCall;
// static
void LLAvatarActions::requestFriendshipDialog(const LLUUID& id, const std::string& name)
@@ -206,6 +209,39 @@ void LLAvatarActions::startCall(const LLUUID& id)
}
// static
+void LLAvatarActions::startAdhocCall(const std::vector<LLUUID>& ids)
+{
+ if (ids.size() == 0)
+ {
+ return;
+ }
+
+ // convert vector into LLDynamicArray for addSession
+ LLDynamicArray<LLUUID> id_array;
+ for (std::vector<LLUUID>::const_iterator it = ids.begin(); it != ids.end(); ++it)
+ {
+ id_array.push_back(*it);
+ }
+
+ // create the new ad hoc voice session
+ const std::string title = LLTrans::getString("conference-title");
+ LLUUID session_id = gIMMgr->addSession(title, IM_SESSION_CONFERENCE_START,
+ ids[0], id_array);
+ if (session_id == LLUUID::null)
+ {
+ return;
+ }
+
+ // always open IM window when connecting to voice
+ LLIMFloater::show(session_id);
+
+ // start the call once the floater has fully initialized
+ gAdhocAutoCall = LLIMModel::getInstance()->addSessionInitializedCallback(callbackAutoStartCall);
+
+ make_ui_sound("UISndStartIM");
+}
+
+// static
bool LLAvatarActions::isCalling(const LLUUID &id)
{
if (id.isNull())
@@ -226,7 +262,8 @@ void LLAvatarActions::startConference(const std::vector<LLUUID>& ids)
{
id_array.push_back(*it);
}
- LLUUID session_id = gIMMgr->addSession("Friends Conference", IM_SESSION_CONFERENCE_START, ids[0], id_array);
+ const std::string title = LLTrans::getString("conference-title");
+ LLUUID session_id = gIMMgr->addSession(title, IM_SESSION_CONFERENCE_START, ids[0], id_array);
if (session_id != LLUUID::null)
{
LLIMFloater::show(session_id);
@@ -394,6 +431,17 @@ bool LLAvatarActions::callbackAddFriend(const LLSD& notification, const LLSD& re
}
// static
+void LLAvatarActions::callbackAutoStartCall(const LLSD& data)
+{
+ // start the adhoc voice call now the IM panel has initialized
+ LLUUID session_id = data["session_id"].asUUID();
+ gIMMgr->startCall(session_id);
+
+ // and deschedule this callback as its work is done now
+ gAdhocAutoCall.disconnect();
+}
+
+// static
void LLAvatarActions::requestFriendship(const LLUUID& target_id, const std::string& target_name, const std::string& message)
{
const LLUUID calling_card_folder_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_CALLINGCARD);