summaryrefslogtreecommitdiff
path: root/indra/newview/llchathistory.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llchathistory.cpp')
-rwxr-xr-xindra/newview/llchathistory.cpp120
1 files changed, 117 insertions, 3 deletions
diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp
index 43a733f918..2eb4074c97 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
+ {
+ 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);
@@ -968,6 +1065,22 @@ 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)
+ {
+ 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)
{
@@ -989,6 +1102,7 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL
mEditor->appendWidget(params, "\n", false);
}
}
+ }
// usual messages showing
else