diff options
Diffstat (limited to 'indra/newview/llchathistory.cpp')
-rwxr-xr-x | indra/newview/llchathistory.cpp | 156 |
1 files changed, 21 insertions, 135 deletions
diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp index ae0ac57e76..43a733f918 100755 --- a/indra/newview/llchathistory.cpp +++ b/indra/newview/llchathistory.cpp @@ -60,8 +60,6 @@ #include "llstring.h" #include "llurlaction.h" #include "llviewercontrol.h" -#include "llviewerobjectlist.h" -#include "llmutelist.h" static LLDefaultChildRegistry::Register<LLChatHistory> r("chat_history"); @@ -183,18 +181,6 @@ 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); @@ -203,75 +189,13 @@ 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()); @@ -536,7 +460,7 @@ protected: if(menu) { - bool is_friend = LLAvatarActions::isFriend(mAvatarID); + bool is_friend = LLAvatarTracker::instance().getBuddyInfo(mAvatarID) != NULL; menu->setItemEnabled("Add Friend", !is_friend); menu->setItemEnabled("Remove Friend", is_friend); @@ -546,34 +470,13 @@ 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); } - else + + if (mSessionID == LLIMMgr::computeSessionID(IM_NOTHING_SPECIAL, mAvatarID)) { - 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->setItemVisible("Send IM", false); } - 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); @@ -1065,42 +968,25 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL // notify processing if (chat.mNotifId.notNull()) { - bool create_toast = true; - for (LLToastNotifyPanel::instance_iter ti(LLToastNotifyPanel::beginInstances()) - , tend(LLToastNotifyPanel::endInstances()); ti != tend; ++ti) + LLNotificationPtr notification = LLNotificationsUtil::find(chat.mNotifId); + if (notification != NULL) { - LLToastNotifyPanel& panel = *ti; - LLIMToastNotifyPanel * imtoastp = dynamic_cast<LLIMToastNotifyPanel *>(&panel); - const std::string& notification_name = panel.getNotificationName(); - if (notification_name == "OfferFriendship" && panel.isControlPanelEnabled() && imtoastp) - { - create_toast = false; - break; - } - } - - if (create_toast) - { - LLNotificationPtr notification = LLNotificationsUtil::find(chat.mNotifId); - if (notification != NULL) - { - LLIMToastNotifyPanel* notify_box = new LLIMToastNotifyPanel( + LLIMToastNotifyPanel* notify_box = new LLIMToastNotifyPanel( notification, chat.mSessionID, LLRect::null, !use_plain_text_chat_history, mEditor); - //Prepare the rect for the view - LLRect target_rect = mEditor->getDocumentView()->getRect(); - // squeeze down the widget by subtracting padding off left and right - target_rect.mLeft += mLeftWidgetPad + mEditor->getHPad(); - target_rect.mRight -= mRightWidgetPad; - notify_box->reshape(target_rect.getWidth(), notify_box->getRect().getHeight()); - notify_box->setOrigin(target_rect.mLeft, notify_box->getRect().mBottom); - - LLInlineViewSegment::Params params; - params.view = notify_box; - params.left_pad = mLeftWidgetPad; - params.right_pad = mRightWidgetPad; - mEditor->appendWidget(params, "\n", false); - } + //Prepare the rect for the view + LLRect target_rect = mEditor->getDocumentView()->getRect(); + // squeeze down the widget by subtracting padding off left and right + target_rect.mLeft += mLeftWidgetPad + mEditor->getHPad(); + target_rect.mRight -= mRightWidgetPad; + notify_box->reshape(target_rect.getWidth(), notify_box->getRect().getHeight()); + notify_box->setOrigin(target_rect.mLeft, notify_box->getRect().mBottom); + + LLInlineViewSegment::Params params; + params.view = notify_box; + params.left_pad = mLeftWidgetPad; + params.right_pad = mRightWidgetPad; + mEditor->appendWidget(params, "\n", false); } } @@ -1130,7 +1016,7 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL if (square_brackets) { message += "]"; - } + } mEditor->appendText(message, prependNewLineState, body_message_params); prependNewLineState = false; |