diff options
-rwxr-xr-x | indra/newview/llchathistory.cpp | 105 | ||||
-rwxr-xr-x | indra/newview/skins/default/xui/en/menu_avatar_icon.xml | 70 |
2 files changed, 168 insertions, 7 deletions
diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp index af3c6eff11..afa6d4eaeb 100755 --- a/indra/newview/llchathistory.cpp +++ b/indra/newview/llchathistory.cpp @@ -60,6 +60,8 @@ #include "llstring.h" #include "llurlaction.h" #include "llviewercontrol.h" +#include "llviewerobjectlist.h" +#include "llmutelist.h" static LLDefaultChildRegistry::Register<LLChatHistory> r("chat_history"); @@ -181,6 +183,18 @@ public: { LLAvatarActions::startIM(getAvatarId()); } + else if (level == "teleport") + { + LLAvatarActions::offerTeleport(getAvatarId()); + } + else if (level == "voice_call") + { + LLAvatarActions::startCall(getAvatarId()); + } + else if (level == "chat_history") + { + LLAvatarActions::viewChatHistory(getAvatarId()); + } else if (level == "add") { LLAvatarActions::requestFriendshipDialog(getAvatarId(), mFrom); @@ -189,13 +203,75 @@ public: { LLAvatarActions::removeFriendDialog(getAvatarId()); } + else if (level == "invite_to_group") + { + LLAvatarActions::inviteToGroup(getAvatarId()); + } + else if (level == "zoom_in") + { + handle_zoom_to_object(getAvatarId()); + } + else if (level == "map") + { + LLAvatarActions::showOnMap(getAvatarId()); + } + else if (level == "share") + { + LLAvatarActions::share(getAvatarId()); + } + else if (level == "pay") + { + LLAvatarActions::pay(getAvatarId()); + } + else if(level == "block_unblock") + { + mute(getAvatarId(), LLMute::flagVoiceChat); + } + else if(level == "mute_unmute") + { + mute(getAvatarId(), LLMute::flagTextChat); + } + } + + bool onAvatarIconContextMenuItemChecked(const LLSD& userdata) + { + std::string level = userdata.asString(); + + if (level == "is_blocked") + { + return LLMuteList::getInstance()->isMuted(getAvatarId(), LLMute::flagVoiceChat); + } + if (level == "is_muted") + { + return LLMuteList::getInstance()->isMuted(getAvatarId(), LLMute::flagTextChat); + } + return false; + } + + void mute(const LLUUID& participant_id, U32 flags) + { + BOOL is_muted = LLMuteList::getInstance()->isMuted(participant_id, flags); + std::string name; + gCacheName->getFullName(participant_id, name); + LLMute mute(participant_id, name, LLMute::AGENT); + + if (!is_muted) + { + LLMuteList::getInstance()->add(mute, flags); + } + else + { + LLMuteList::getInstance()->remove(mute, flags); + } } BOOL postBuild() { LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar; + LLUICtrl::EnableCallbackRegistry::ScopedRegistrar registrar_enable; registrar.add("AvatarIcon.Action", boost::bind(&LLChatHistoryHeader::onAvatarIconContextMenuItemClicked, this, _2)); + registrar_enable.add("AvatarIcon.Check", boost::bind(&LLChatHistoryHeader::onAvatarIconContextMenuItemChecked, this, _2)); registrar.add("ObjectIcon.Action", boost::bind(&LLChatHistoryHeader::onObjectIconContextMenuItemClicked, this, _2)); LLMenuGL* menu = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_avatar_icon.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance()); @@ -460,7 +536,7 @@ protected: if(menu) { - bool is_friend = LLAvatarTracker::instance().getBuddyInfo(mAvatarID) != NULL; + bool is_friend = LLAvatarActions::isFriend(mAvatarID); menu->setItemEnabled("Add Friend", !is_friend); menu->setItemEnabled("Remove Friend", is_friend); @@ -470,13 +546,34 @@ protected: menu->setItemEnabled("Add Friend", false); menu->setItemEnabled("Send IM", false); menu->setItemEnabled("Remove Friend", false); + menu->setItemEnabled("Offer Teleport",false); + menu->setItemEnabled("Voice Call", false); + menu->setItemEnabled("Invite Group", false); + menu->setItemEnabled("Zoom In", false); + menu->setItemEnabled("Share", false); + menu->setItemEnabled("Pay", false); + menu->setItemEnabled("Block Unblock", false); + menu->setItemEnabled("Mute Text", false); } - - if (mSessionID == LLIMMgr::computeSessionID(IM_NOTHING_SPECIAL, mAvatarID)) + else { - menu->setItemVisible("Send IM", false); + LLUUID currentSessionID = LLIMMgr::computeSessionID(IM_NOTHING_SPECIAL, mAvatarID); + if (mSessionID == currentSessionID) + { + menu->setItemVisible("Send IM", false); + } + menu->setItemEnabled("Offer Teleport", LLAvatarActions::canOfferTeleport(mAvatarID)); + menu->setItemEnabled("Voice Call", LLAvatarActions::canCall()); + + // We should only show 'Zoom in' item in a nearby chat + bool should_show_zoom = !LLIMModel::getInstance()->findIMSession(currentSessionID); + menu->setItemVisible("Zoom In", should_show_zoom && gObjectList.findObject(mAvatarID)); + menu->setItemEnabled("Block Unblock", LLAvatarActions::canBlock(mAvatarID)); + menu->setItemEnabled("Mute Text", LLAvatarActions::canBlock(mAvatarID)); } + menu->setItemEnabled("Chat History", LLLogChat::isTranscriptExist(mAvatarID)); + menu->setItemEnabled("Map", (LLAvatarTracker::instance().isBuddyOnline(mAvatarID) && is_agent_mappable(mAvatarID)) || gAgent.isGodlike() ); menu->buildDrawLabels(); menu->updateParent(LLMenuGL::sMenuContainer); LLMenuGL::showPopup(this, menu, x, y); diff --git a/indra/newview/skins/default/xui/en/menu_avatar_icon.xml b/indra/newview/skins/default/xui/en/menu_avatar_icon.xml index 50910dff32..77b9095f7c 100755 --- a/indra/newview/skins/default/xui/en/menu_avatar_icon.xml +++ b/indra/newview/skins/default/xui/en/menu_avatar_icon.xml @@ -17,7 +17,7 @@ parameter="profile" /> </menu_item_call> <menu_item_call - label="Send IM..." + label="IM" layout="topleft" name="Send IM"> <menu_item_call.on_click @@ -25,7 +25,26 @@ parameter="im" /> </menu_item_call> <menu_item_call - label="Add Friend..." + label="Offer teleport" + layout="topleft" + name="Offer Teleport"> + <on_click function="AvatarIcon.Action" parameter="teleport"/> + </menu_item_call> + <menu_item_call + label="Voice call" + layout="topleft" + name="Voice Call"> + <on_click function="AvatarIcon.Action" parameter="voice_call"/> + </menu_item_call> + <menu_item_call + label="Chat history..." + layout="topleft" + name="Chat History"> + <on_click function="AvatarIcon.Action" parameter="chat_history"/> + </menu_item_call> + <menu_item_separator layout="topleft" name="separator_chat_history"/> + <menu_item_call + label="Add friend" layout="topleft" name="Add Friend"> <menu_item_call.on_click @@ -33,11 +52,56 @@ parameter="add" /> </menu_item_call> <menu_item_call - label="Remove Friend..." + label="Remove friend" layout="topleft" name="Remove Friend"> <menu_item_call.on_click function="AvatarIcon.Action" parameter="remove" /> </menu_item_call> + <menu_item_call + label="Invite to group..." + layout="topleft" + name="Invite Group"> + <on_click function="AvatarIcon.Action" parameter="invite_to_group" /> + </menu_item_call> + <menu_item_separator layout="topleft" name="separator_invite_to_group"/> + <menu_item_call + label="Zoom In" + layout="topleft" + name="Zoom In"> + <on_click function="AvatarIcon.Action" parameter="zoom_in" /> + </menu_item_call> + <menu_item_call + label="Map" + layout="topleft" + name="Map"> + <on_click function="AvatarIcon.Action" parameter="map" /> + </menu_item_call> + <menu_item_call + label="Share" + layout="topleft" + name="Share"> + <on_click function="AvatarIcon.Action" parameter="share" /> + </menu_item_call> + <menu_item_call + label="Pay" + layout="topleft" + name="Pay"> + <on_click function="AvatarIcon.Action" parameter="pay" /> + </menu_item_call> + <menu_item_check + label="Block Voice" + layout="topleft" + name="Block Unblock"> + <on_click function="AvatarIcon.Action" parameter="block_unblock" /> + <on_check function="AvatarIcon.Check" parameter="is_blocked" /> + </menu_item_check> + <menu_item_check + label="Block Text" + layout="topleft" + name="Mute Text"> + <on_click function="AvatarIcon.Action" parameter="mute_unmute" /> + <on_check function="AvatarIcon.Check" parameter="is_muted" /> + </menu_item_check> </menu> |