diff options
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llconversationmodel.cpp | 31 | ||||
-rwxr-xr-x | indra/newview/llconversationmodel.h | 1 | ||||
-rw-r--r-- | indra/newview/llimfloatercontainer.cpp | 162 | ||||
-rw-r--r-- | indra/newview/llimfloatercontainer.h | 5 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/menu_conversation.xml | 18 |
5 files changed, 177 insertions, 40 deletions
diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp index 265f77365f..5fc305da81 100644 --- a/indra/newview/llconversationmodel.cpp +++ b/indra/newview/llconversationmodel.cpp @@ -28,6 +28,7 @@ #include "llviewerprecompiledheaders.h" #include "llconversationmodel.h" +#include "llimview.h" //For LLIMModel // // Conversation items : common behaviors @@ -221,10 +222,40 @@ void LLConversationItemSession::buildContextMenu(LLMenuGL& menu, U32 flags) items.push_back(std::string("separator_disconnect_from_voice")); buildParticipantMenuOptions(items); } + else if(this->getType() == CONV_SESSION_GROUP) + { + items.push_back(std::string("close_conversation")); + addVoiceOptions(items); + items.push_back(std::string("chat_history")); + items.push_back(std::string("separator_chat_history")); + items.push_back(std::string("group_profile")); + items.push_back(std::string("activate_group")); + items.push_back(std::string("leave_group")); + } + else if(this->getType() == CONV_SESSION_AD_HOC) + { + items.push_back(std::string("close_conversation")); + addVoiceOptions(items); + items.push_back(std::string("chat_history")); + } hide_context_entries(menu, items, disabled_items); } +void LLConversationItemSession::addVoiceOptions(menuentry_vec_t& items) +{ + LLVoiceChannel* voice_channel = LLIMModel::getInstance() ? LLIMModel::getInstance()->getVoiceChannel(this->getUUID()) : NULL; + + if(voice_channel != LLVoiceChannel::getCurrentVoiceChannel()) + { + items.push_back(std::string("open_voice_conversation")); + } + else + { + items.push_back(std::string("disconnect_from_voice")); + } +} + // The time of activity of a session is the time of the most recent activity, session and participants included const bool LLConversationItemSession::getTime(F64& time) const { diff --git a/indra/newview/llconversationmodel.h b/indra/newview/llconversationmodel.h index f84fbe39f1..bc72cd96ea 100755 --- a/indra/newview/llconversationmodel.h +++ b/indra/newview/llconversationmodel.h @@ -160,6 +160,7 @@ public: bool isLoaded() { return mIsLoaded; } void buildContextMenu(LLMenuGL& menu, U32 flags); + void addVoiceOptions(menuentry_vec_t& items); virtual const bool getTime(F64& time) const; void dumpDebugData(); diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index d25a195f33..a33fc2c57e 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -39,6 +39,7 @@ #include "llavatariconctrl.h" #include "llavatarnamecache.h" #include "llcallbacklist.h" +#include "llgroupactions.h" #include "llgroupiconctrl.h" #include "llfloateravatarpicker.h" #include "llfloaterpreference.h" @@ -64,6 +65,8 @@ LLIMFloaterContainer::LLIMFloaterContainer(const LLSD& seed) mEnableCallbackRegistrar.add("Avatar.CheckItem", boost::bind(&LLIMFloaterContainer::checkContextMenuItem, this, _2)); mEnableCallbackRegistrar.add("Avatar.EnableItem", boost::bind(&LLIMFloaterContainer::enableContextMenuItem, this, _2)); mCommitCallbackRegistrar.add("Avatar.DoToSelected", boost::bind(&LLIMFloaterContainer::doToSelected, this, _2)); + + mCommitCallbackRegistrar.add("Group.DoToSelected", boost::bind(&LLIMFloaterContainer::doToSelectedGroup, this, _2)); // Firstly add our self to IMSession observers, so we catch session events LLIMMgr::getInstance()->addSessionObserver(this); @@ -731,81 +734,160 @@ void LLIMFloaterContainer::getSelectedUUIDs(uuid_vec_t& selected_uuids) selected_uuids.push_back(conversationItem->getUUID()); } } -void LLIMFloaterContainer::doToSelected(const LLSD& userdata) + +const LLConversationItem * LLIMFloaterContainer::getCurSelectedViewModelItem() { - std::string command = userdata.asString(); - uuid_vec_t selected_uuids; - LLUUID currentSelectedUUID; - LLIMFloater * conversation; + LLConversationItem * conversationItem = NULL; - getSelectedUUIDs(selected_uuids); - //Find the conversation floater associated with the selected id - conversation = LLIMFloater::findInstance(selected_uuids.front()); - - //When a one-on-one conversation exists, retrieve the participant id from the conversation floater b/c - //selected_uuids.front() does not pertain to the UUID of the person you are having the conversation with. - if(conversation && - mConversationsRoot && - mConversationsRoot->getCurSelectedItem() && - mConversationsRoot->getCurSelectedItem()->getViewModelItem() && - static_cast<LLConversationItem *>(mConversationsRoot->getCurSelectedItem()->getViewModelItem())->getType() == LLConversationItem::CONV_SESSION_1_ON_1) + if(mConversationsRoot && + mConversationsRoot->getCurSelectedItem() && + mConversationsRoot->getCurSelectedItem()->getViewModelItem()) { - currentSelectedUUID = conversation->getOtherParticipantUUID(); - } - //Otherwise can get the UUID directly from selected_uuids - else - { - currentSelectedUUID = selected_uuids.front(); + conversationItem = static_cast<LLConversationItem *>(mConversationsRoot->getCurSelectedItem()->getViewModelItem()); } - //Close the selected conversation - if(conversation && "close_conversation" == command) - { - LLFloater::onClickClose(conversation); - } - else if ("view_profile" == command) + return conversationItem; +} + +void LLIMFloaterContainer::doToUsers(const std::string& command, uuid_vec_t selectedIDS) +{ + LLUUID userID; + userID = selectedIDS.front(); + + if ("view_profile" == command) { - LLAvatarActions::showProfile(currentSelectedUUID); + LLAvatarActions::showProfile(userID); } else if("im" == command) { - LLAvatarActions::startIM(currentSelectedUUID); + LLAvatarActions::startIM(userID); } else if("offer_teleport" == command) { - LLAvatarActions::offerTeleport(selected_uuids); + LLAvatarActions::offerTeleport(selectedIDS); } else if("voice_call" == command) { - LLAvatarActions::startCall(currentSelectedUUID); + LLAvatarActions::startCall(userID); + } + else if("chat_history" == command) + { + LLAvatarActions::viewChatHistory(userID); } else if("add_friend" == command) { - LLAvatarActions::requestFriendshipDialog(currentSelectedUUID); + LLAvatarActions::requestFriendshipDialog(userID); } else if("remove_friend" == command) { - LLAvatarActions::removeFriendDialog(currentSelectedUUID); + LLAvatarActions::removeFriendDialog(userID); } else if("invite_to_group" == command) { - LLAvatarActions::inviteToGroup(currentSelectedUUID); + LLAvatarActions::inviteToGroup(userID); } else if("map" == command) { - LLAvatarActions::showOnMap(currentSelectedUUID); + LLAvatarActions::showOnMap(userID); } else if("share" == command) { - LLAvatarActions::share(currentSelectedUUID); + LLAvatarActions::share(userID); } else if("pay" == command) { - LLAvatarActions::pay(currentSelectedUUID); + LLAvatarActions::pay(userID); } else if("block_unblock" == command) { - LLAvatarActions::toggleBlock(currentSelectedUUID); + LLAvatarActions::toggleBlock(userID); + } +} + +void LLIMFloaterContainer::doToSelectedParticipant(const std::string& command) +{ + uuid_vec_t selected_uuids; + getSelectedUUIDs(selected_uuids); + + doToUsers(command, selected_uuids); +} + +void LLIMFloaterContainer::doToSelectedConversation(const std::string& command) +{ + LLUUID participantID; + + //Find the conversation floater associated with the selected id + const LLConversationItem * conversationItem = getCurSelectedViewModelItem(); + LLIMFloater *conversationFloater = LLIMFloater::findInstance(conversationItem->getUUID()); + + if(conversationFloater) + { + //When a one-on-one conversation exists, retrieve the participant id from the conversation floater b/c + //selected_uuids.front() does not pertain to the UUID of the person you are having the conversation with. + if(conversationItem->getType() == LLConversationItem::CONV_SESSION_1_ON_1) + { + participantID = conversationFloater->getOtherParticipantUUID(); + } + + //Close the selected conversation + if("close_conversation" == command) + { + LLFloater::onClickClose(conversationFloater); + } + else if("open_voice_conversation" == command) + { + gIMMgr->startCall(conversationItem->getUUID()); + } + else if("disconnect_from_voice" == command) + { + gIMMgr->endCall(conversationItem->getUUID()); + } + else if("chat_history" == command) + { + LLAvatarActions::viewChatHistory(conversationItem->getUUID()); + } + else + { + uuid_vec_t selected_uuids; + selected_uuids.push_back(participantID); + doToUsers(command, selected_uuids); + } + } +} + +void LLIMFloaterContainer::doToSelected(const LLSD& userdata) +{ + std::string command = userdata.asString(); + const LLConversationItem * conversationItem = getCurSelectedViewModelItem(); + + if(conversationItem->getType() == LLConversationItem::CONV_SESSION_1_ON_1 || + conversationItem->getType() == LLConversationItem::CONV_SESSION_GROUP || + conversationItem->getType() == LLConversationItem::CONV_SESSION_AD_HOC) + { + doToSelectedConversation(command); + } + else + { + doToSelectedParticipant(command); + } +} + +void LLIMFloaterContainer::doToSelectedGroup(const LLSD& userdata) +{ + std::string action = userdata.asString(); + LLUUID selected_group = getCurSelectedViewModelItem()->getUUID(); + + if (action == "group_profile") + { + LLGroupActions::show(selected_group); + } + else if (action == "activate_group") + { + LLGroupActions::activate(selected_group); + } + else if (action == "leave_group") + { + LLGroupActions::leave(selected_group); } } @@ -896,7 +978,7 @@ bool LLIMFloaterContainer::enableContextMenuItem(const LLSD& userdata) bool LLIMFloaterContainer::checkContextMenuItem(const LLSD& userdata) { std::string item = userdata.asString(); - const LLUUID& id = static_cast<LLConversationItem *>(mConversationsRoot->getCurSelectedItem()->getViewModelItem())->getUUID(); + const LLUUID& id = getCurSelectedViewModelItem()->getUUID(); if (item == std::string("is_blocked")) { diff --git a/indra/newview/llimfloatercontainer.h b/indra/newview/llimfloatercontainer.h index 49a41e5cdd..a622ddfc8c 100644 --- a/indra/newview/llimfloatercontainer.h +++ b/indra/newview/llimfloatercontainer.h @@ -112,7 +112,12 @@ private: void setSortOrder(const LLConversationSort& order); void getSelectedUUIDs(uuid_vec_t& selected_uuids); + const LLConversationItem * getCurSelectedViewModelItem(); void doToSelected(const LLSD& userdata); + void doToSelectedConversation(const std::string& command); + void doToSelectedParticipant(const std::string& command); + void doToUsers(const std::string& command, uuid_vec_t selectedIDS); + void doToSelectedGroup(const LLSD& userdata); bool checkContextMenuItem(const LLSD& userdata); bool enableContextMenuItem(const LLSD& userdata); diff --git a/indra/newview/skins/default/xui/en/menu_conversation.xml b/indra/newview/skins/default/xui/en/menu_conversation.xml index 94399be61c..912ff811d9 100644 --- a/indra/newview/skins/default/xui/en/menu_conversation.xml +++ b/indra/newview/skins/default/xui/en/menu_conversation.xml @@ -106,4 +106,22 @@ <on_check function="Avatar.CheckItem" parameter="is_blocked" /> <on_enable function="Avatar.EnableItem" parameter="can_block" /> </menu_item_check> + <menu_item_call + label="Group Profile" + layout="topleft" + name="group_profile"> + <on_click function="Group.DoToSelected" parameter="group_profile"/> + </menu_item_call> + <menu_item_call + label="Activate Group" + layout="topleft" + name="activate_group"> + <on_click function="Group.DoToSelected" parameter="activate_group"/> + </menu_item_call> + <menu_item_call + label="Leave Group" + layout="topleft" + name="leave_group"> + <on_click function="Group.DoToSelected" parameter="leave_group"/> + </menu_item_call> </toggleable_menu> |