summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/newview/llavataractions.cpp32
-rw-r--r--indra/newview/llavataractions.h10
-rw-r--r--indra/newview/llviewermenu.cpp32
-rw-r--r--indra/newview/skins/default/xui/en/panel_profile.xml1
4 files changed, 56 insertions, 19 deletions
diff --git a/indra/newview/llavataractions.cpp b/indra/newview/llavataractions.cpp
index 3fc37aa3d5..dae4296a82 100644
--- a/indra/newview/llavataractions.cpp
+++ b/indra/newview/llavataractions.cpp
@@ -186,6 +186,38 @@ void LLAvatarActions::startIM(const LLUUID& id)
}
// static
+void LLAvatarActions::startCall(const LLUUID& id)
+{
+ if (id.isNull() || isCalling(id))
+ {
+ return;
+ }
+
+ std::string name;
+ gCacheName->getFullName(id, name);
+ LLUUID session_id = gIMMgr->addSession(name, IM_NOTHING_SPECIAL, id);
+ if (session_id != LLUUID::null)
+ {
+ // always open IM window when connecting to voice
+ LLIMFloater::show(session_id);
+ gIMMgr->startCall(session_id);
+ }
+ make_ui_sound("UISndStartIM");
+}
+
+// static
+bool LLAvatarActions::isCalling(const LLUUID &id)
+{
+ if (id.isNull())
+ {
+ return false;
+ }
+
+ LLUUID session_id = gIMMgr->computeSessionID(IM_NOTHING_SPECIAL, id);
+ return (LLIMModel::getInstance()->findIMSession(session_id) != NULL);
+}
+
+// static
void LLAvatarActions::startConference(const std::vector<LLUUID>& ids)
{
// *HACK: Copy into dynamic array
diff --git a/indra/newview/llavataractions.h b/indra/newview/llavataractions.h
index 512f673b43..0ec20ae357 100644
--- a/indra/newview/llavataractions.h
+++ b/indra/newview/llavataractions.h
@@ -67,6 +67,11 @@ public:
static void startIM(const LLUUID& id);
/**
+ * Start an avatar-to-avatar voice call with another user
+ */
+ static void startCall(const LLUUID& id);
+
+ /**
* Start conference chat with the given avatars.
*/
static void startConference(const std::vector<LLUUID>& ids);
@@ -97,6 +102,11 @@ public:
static bool isBlocked(const LLUUID& id);
/**
+ * Return true if the avatar is in a P2P voice call with a given user
+ */
+ static bool isCalling(const LLUUID &id);
+
+ /**
* Invite avatar to a group.
*/
static void inviteToGroup(const LLUUID& id);
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp
index 4d4ad1c022..cb1be5fabc 100644
--- a/indra/newview/llviewermenu.cpp
+++ b/indra/newview/llviewermenu.cpp
@@ -6252,25 +6252,20 @@ class LLAvatarSendIM : public view_listener_t
LLVOAvatar* avatar = find_avatar_from_object( LLSelectMgr::getInstance()->getSelection()->getPrimaryObject() );
if(avatar)
{
- std::string name("IM");
- LLNameValue *first = avatar->getNVPair("FirstName");
- LLNameValue *last = avatar->getNVPair("LastName");
- if (first && last)
- {
- name.assign( first->getString() );
- name.append(" ");
- name.append( last->getString() );
- }
+ LLAvatarActions::startIM(avatar->getID());
+ }
+ return true;
+ }
+};
- //EInstantMessage type = have_agent_callingcard(gLastHitObjectID)
- // ? IM_SESSION_ADD : IM_SESSION_CARDLESS_START;
- LLUUID session_id = gIMMgr->addSession(name,
- IM_NOTHING_SPECIAL,
- avatar->getID());
- if (session_id != LLUUID::null)
- {
- LLIMFloater::show(session_id);
- }
+class LLAvatarCall : public view_listener_t
+{
+ bool handleEvent(const LLSD& userdata)
+ {
+ LLVOAvatar* avatar = find_avatar_from_object( LLSelectMgr::getInstance()->getSelection()->getPrimaryObject() );
+ if(avatar)
+ {
+ LLAvatarActions::startCall(avatar->getID());
}
return true;
}
@@ -7941,6 +7936,7 @@ void initialize_menus()
view_listener_t::addMenu(new LLAvatarGiveCard(), "Avatar.GiveCard");
commit.add("Avatar.Eject", boost::bind(&handle_avatar_eject, LLSD()));
view_listener_t::addMenu(new LLAvatarSendIM(), "Avatar.SendIM");
+ view_listener_t::addMenu(new LLAvatarCall(), "Avatar.Call");
view_listener_t::addMenu(new LLAvatarReportAbuse(), "Avatar.ReportAbuse");
view_listener_t::addMenu(new LLAvatarEnableAddFriend(), "Avatar.EnableAddFriend");
diff --git a/indra/newview/skins/default/xui/en/panel_profile.xml b/indra/newview/skins/default/xui/en/panel_profile.xml
index a0055383b1..0f5e96416d 100644
--- a/indra/newview/skins/default/xui/en/panel_profile.xml
+++ b/indra/newview/skins/default/xui/en/panel_profile.xml
@@ -294,7 +294,6 @@
left_pad="5"
width="45" />
<button
- enabled="false"
follows="bottom|left"
height="19"
label="Call"