diff options
Diffstat (limited to 'indra/newview/llavataractions.cpp')
-rw-r--r-- | indra/newview/llavataractions.cpp | 49 |
1 files changed, 45 insertions, 4 deletions
diff --git a/indra/newview/llavataractions.cpp b/indra/newview/llavataractions.cpp index 2f67401301..dae4296a82 100644 --- a/indra/newview/llavataractions.cpp +++ b/indra/newview/llavataractions.cpp @@ -57,6 +57,7 @@ #include "llviewerobjectlist.h" #include "llviewermessage.h" // for handle_lure #include "llviewerregion.h" +#include "llimfloater.h" // static @@ -176,11 +177,47 @@ void LLAvatarActions::startIM(const LLUUID& id) std::string name; gCacheName->getFullName(id, name); - gIMMgr->addSession(name, IM_NOTHING_SPECIAL, id); + LLUUID session_id = gIMMgr->addSession(name, IM_NOTHING_SPECIAL, id); + if (session_id != LLUUID::null) + { + LLIMFloater::show(session_id); + } make_ui_sound("UISndStartIM"); } // 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 @@ -189,7 +226,11 @@ void LLAvatarActions::startConference(const std::vector<LLUUID>& ids) { id_array.push_back(*it); } - gIMMgr->addSession("Friends Conference", IM_SESSION_CONFERENCE_START, ids[0], id_array); + LLUUID session_id = gIMMgr->addSession("Friends Conference", IM_SESSION_CONFERENCE_START, ids[0], id_array); + if (session_id != LLUUID::null) + { + LLIMFloater::show(session_id); + } make_ui_sound("UISndStartIM"); } @@ -343,7 +384,7 @@ bool LLAvatarActions::callbackAddFriend(const LLSD& notification, const LLSD& re // Servers older than 1.25 require the text of the message to be the // calling card folder ID for the offering user. JC LLUUID calling_card_folder_id = - gInventory.findCategoryUUIDForType(LLAssetType::AT_CALLINGCARD); + gInventory.findCategoryUUIDForType(LLFolderType::FT_CALLINGCARD); std::string message = calling_card_folder_id.asString(); requestFriendship(notification["payload"]["id"].asUUID(), notification["payload"]["name"].asString(), @@ -355,7 +396,7 @@ bool LLAvatarActions::callbackAddFriend(const LLSD& notification, const LLSD& re // static void LLAvatarActions::requestFriendship(const LLUUID& target_id, const std::string& target_name, const std::string& message) { - LLUUID calling_card_folder_id = gInventory.findCategoryUUIDForType(LLAssetType::AT_CALLINGCARD); + const LLUUID calling_card_folder_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_CALLINGCARD); send_improved_im(target_id, target_name, message, |