From c701c615664f598818d070775b1509103a24f03e Mon Sep 17 00:00:00 2001 From: Lirusaito Date: Wed, 29 May 2013 23:56:33 -0400 Subject: [PATCH] LLAvatarActions all hooked up! Rlva style~ So update to RLVa stuff! Adds support for @startim and @startimto Enables hasOpenIM and hasOpenProfile, Yay functionality! RLV_BHVR_STARTIM and RLV_BHVR_STARTIMTO added While I was working, I was updating LLAgentHandler, after long enough it was identical enough to the one in llpanelprofile, so we're using that now. Cleans up llfloateravatarinfo to the point of being a floater and instancetracker wrapper for a panelavatar (profile panel) Bypasses looking up expired names that we know via get, this should avoid chats (and profiles, but that bug never got out) never opening for people we already know the name of on a bad connection; of course, this will only cause a faster reaction on the UI's part, messages may never get sent still (and profiles may never load) if the connection is truly terrible. Cleans up llfloaterfriends and some parts of llfloateravatarlist (avatarlist could be cleaned up more from this perhaps in the future) May slightly look better with copy detection and without space changes.. llgivemoney.cpp changes fix up some dummy view warnings I noticed while testing these changes llpreview.cpp changes avoid segfault caused by llfloateravatarinfo not being a preview anymore but being inside a multipreview nonetheless. Translators, don't worry, I covered this one with updates from v3 (Except German team) --- indra/newview/CMakeLists.txt | 2 + indra/newview/llavataractions.cpp | 734 ++++++++++++++++++ indra/newview/llavataractions.h | 188 +++++ indra/newview/llfloateractivespeakers.cpp | 43 +- indra/newview/llfloateravatarinfo.cpp | 272 +------ indra/newview/llfloateravatarinfo.h | 48 +- indra/newview/llfloateravatarlist.cpp | 49 +- indra/newview/llfloateravatarpicker.cpp | 5 +- indra/newview/llfloaterfriends.cpp | 303 ++------ indra/newview/llfloaterfriends.h | 16 - indra/newview/llfloatergroups.cpp | 1 - indra/newview/llfloaterinspect.cpp | 10 +- indra/newview/llfloaterland.cpp | 7 +- indra/newview/llfloaterobjectiminfo.cpp | 5 +- indra/newview/llfloaterproperties.cpp | 17 +- indra/newview/llfloatertopobjects.cpp | 5 +- indra/newview/llgiveinventory.cpp | 14 + indra/newview/llgivemoney.cpp | 12 +- indra/newview/llimpanel.cpp | 26 +- indra/newview/llimpanel.h | 2 - indra/newview/llimview.cpp | 13 +- indra/newview/llinventorybridge.cpp | 9 +- indra/newview/llmenucommands.cpp | 6 - indra/newview/llmenucommands.h | 1 - indra/newview/llnetmap.cpp | 12 +- indra/newview/llpanelavatar.cpp | 462 ++--------- indra/newview/llpanelavatar.h | 23 +- indra/newview/llpanelclassified.cpp | 6 +- indra/newview/llpaneldirbrowser.cpp | 2 +- indra/newview/llpaneldirclassified.cpp | 7 - indra/newview/llpaneldirclassified.h | 3 - indra/newview/llpanelgroupgeneral.cpp | 4 +- indra/newview/llpanelgrouproles.cpp | 5 +- indra/newview/llpanelpermissions.cpp | 21 +- indra/newview/llpanelprofile.cpp | 12 +- indra/newview/llpreview.cpp | 9 +- indra/newview/llpreviewtexture.cpp | 6 +- indra/newview/llviewermedia.cpp | 3 +- indra/newview/llviewermenu.cpp | 72 +- indra/newview/llviewermenu.h | 2 - indra/newview/llviewermessage.cpp | 10 +- indra/newview/llworldmapview.cpp | 2 +- indra/newview/rlvdefines.h | 2 + indra/newview/rlvfloaterbehaviour.cpp | 1 + indra/newview/rlvhandler.cpp | 2 + indra/newview/rlvhandler.h | 10 + indra/newview/rlvui.cpp | 7 +- indra/newview/rlvui.h | 4 +- .../default/xui/en-us/floater_directory.xml | 3 - .../default/xui/en-us/floater_directory2.xml | 3 - .../default/xui/en-us/floater_directory3.xml | 3 - .../skins/default/xui/en-us/notifications.xml | 21 +- .../skins/default/xui/en-us/panel_avatar.xml | 7 +- .../skins/default/xui/en-us/strings.xml | 9 + .../default/xui/es/floater_directory.xml | 1 - .../default/xui/es/floater_directory2.xml | 1 - .../default/xui/es/floater_directory3.xml | 1 - .../skins/default/xui/es/notifications.xml | 13 +- .../newview/skins/default/xui/es/strings.xml | 7 + .../default/xui/fr/floater_directory.xml | 1 - .../skins/default/xui/fr/notifications.xml | 11 +- .../newview/skins/default/xui/fr/strings.xml | 12 + .../default/xui/pt/floater_directory.xml | 1 - .../skins/default/xui/pt/notifications.xml | 11 +- .../newview/skins/default/xui/pt/strings.xml | 14 + 65 files changed, 1264 insertions(+), 1330 deletions(-) create mode 100644 indra/newview/llavataractions.cpp create mode 100644 indra/newview/llavataractions.h diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 8a0406c18..35f550ff1 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -118,6 +118,7 @@ set(viewer_SOURCE_FILES llassetuploadresponders.cpp llattachmentsmgr.cpp llaudiosourcevo.cpp + llavataractions.cpp llavatarpropertiesprocessor.cpp llbox.cpp llcallbacklist.cpp @@ -615,6 +616,7 @@ set(viewer_HEADER_FILES llassetuploadresponders.h llattachmentsmgr.h llaudiosourcevo.h + llavataractions.h llavatarpropertiesprocessor.h llbox.h llcallbacklist.h diff --git a/indra/newview/llavataractions.cpp b/indra/newview/llavataractions.cpp new file mode 100644 index 000000000..b48ca89b9 --- /dev/null +++ b/indra/newview/llavataractions.cpp @@ -0,0 +1,734 @@ +/** + * @file llavataractions.cpp + * @brief Friend-related actions (add, remove, offer teleport, etc) + * + * $LicenseInfo:firstyear=2009&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + + +#include "llviewerprecompiledheaders.h" + +#include "llavataractions.h" + +#include "llavatarnamecache.h" // IDEVO +#include "llnotificationsutil.h" // for LLNotificationsUtil +#include "roles_constants.h" // for GP_MEMBER_INVITE + +#include "llagent.h" +#include "llcallingcard.h" // LLAvatarTracker +#include "llfloateravatarinfo.h" +#include "llfloatergroupinvite.h" +#include "llfloatergroups.h" +#include "llfloaterworldmap.h" +#include "llgivemoney.h" +#include "llimview.h" // for gIMMgr +#include "llinventoryobserver.h" +#include "llmutelist.h" +#include "lltrans.h" +#include "llvoiceclient.h" +#include "llweb.h" +// [RLVa:KB] - Checked: 2011-04-11 (RLVa-1.3.0h) | Added: RLVa-1.3.0h +#include "rlvhandler.h" +// [/RLVa:KB] + +extern const S32 TRANS_GIFT; +void give_money(const LLUUID& uuid, LLViewerRegion* region, S32 amount, BOOL is_group = FALSE, S32 trx_type = TRANS_GIFT, const std::string& desc = LLStringUtil::null); +void handle_lure(const uuid_vec_t& ids); +void send_improved_im(const LLUUID& to_id, const std::string& name, const std::string& message, U8 offline, EInstantMessage dialog, const LLUUID& id, U32 timestamp = NO_TIMESTAMP, const U8* binary_bucket = (U8*)EMPTY_BINARY_BUCKET, S32 binary_bucket_size = EMPTY_BINARY_BUCKET_SIZE); + +// static +void LLAvatarActions::requestFriendshipDialog(const LLUUID& id, const std::string& name) +{ + if(id == gAgentID) + { + LLNotificationsUtil::add("AddSelfFriend"); + return; + } + + LLSD args; + args["NAME"] = name; + LLSD payload; + payload["id"] = id; + payload["name"] = name; + + LLNotificationsUtil::add("AddFriendWithMessage", args, payload, &callbackAddFriendWithMessage); +} + +void on_avatar_name_friendship(const LLUUID& id, const LLAvatarName av_name) +{ + LLAvatarActions::requestFriendshipDialog(id, av_name.getCompleteName()); +} + +// static +void LLAvatarActions::requestFriendshipDialog(const LLUUID& id) +{ + if(id.isNull()) + { + return; + } + + LLAvatarNameCache::get(id, boost::bind(&on_avatar_name_friendship, _1, _2)); +} + +// static +void LLAvatarActions::removeFriendDialog(const LLUUID& id) +{ + if (id.isNull()) + return; + + uuid_vec_t ids; + ids.push_back(id); + removeFriendsDialog(ids); +} + +// static +void LLAvatarActions::removeFriendsDialog(const uuid_vec_t& ids) +{ + if(ids.size() == 0) + return; + + LLSD args; + std::string msgType; + if(ids.size() == 1) + { + LLUUID agent_id = ids[0]; + std::string av_name; + if(LLAvatarNameCache::getPNSName(agent_id, av_name)) + { + args["NAME"] = av_name; + } + + msgType = "RemoveFromFriends"; + } + else + { + msgType = "RemoveMultipleFromFriends"; + } + + LLSD payload; + for (uuid_vec_t::const_iterator it = ids.begin(); it != ids.end(); ++it) + { + payload["ids"].append(*it); + } + + LLNotificationsUtil::add(msgType, + args, + payload, + &handleRemove); +} + +// static +void LLAvatarActions::offerTeleport(const LLUUID& invitee) +{ + if (invitee.isNull()) + return; + + LLDynamicArray ids; + ids.push_back(invitee); + offerTeleport(ids); +} + +// static +void LLAvatarActions::offerTeleport(const uuid_vec_t& ids) +{ + if (ids.size() == 0) + return; + + handle_lure(ids); +} + +static void on_avatar_name_cache_start_im(const LLUUID& agent_id, const LLAvatarName& av_name) +{ + static LLCachedControl tear_off("OtherChatsTornOff"); + if (!tear_off) gIMMgr->setFloaterOpen(true); + gIMMgr->addSession(LLCacheName::cleanFullName(av_name.getLegacyName()), IM_NOTHING_SPECIAL, agent_id); + make_ui_sound("UISndStartIM"); +} + +// static +void LLAvatarActions::startIM(const LLUUID& id) +{ + if (id.isNull() || gAgentID == id) + return; + +// [RLVa:KB] - Checked: 2011-04-11 (RLVa-1.3.0h) | Added: RLVa-1.3.0h + if ( (rlv_handler_t::isEnabled()) && (!gRlvHandler.canStartIM(id)) ) + { + LLUUID idSession = gIMMgr->computeSessionID(IM_NOTHING_SPECIAL, id); + if ( (idSession.notNull()) && (!gIMMgr->hasSession(idSession)) ) + { + make_ui_sound("UISndInvalidOp"); + RlvUtil::notifyBlocked(RLV_STRING_BLOCKED_STARTIM, LLSD().with("RECIPIENT", id/*LLSLURL("agent", id, "completename").getSLURLString()*/)); + return; + } + } +// [/RLVa:KB] + + LLAvatarName av_name; + if (LLAvatarNameCache::get(id, &av_name)) // Bypass expiration, open NOW! + on_avatar_name_cache_start_im(id, av_name); + else + LLAvatarNameCache::get(id, boost::bind(&on_avatar_name_cache_start_im, _1, _2)); +} + +// static +void LLAvatarActions::endIM(const LLUUID& id) +{ + if (id.isNull()) + return; + + LLUUID session_id = gIMMgr->computeSessionID(IM_NOTHING_SPECIAL, id); + if (session_id.notNull()) + { + gIMMgr->removeSession(session_id); + } +} + +/* Singu TODO: Voice refactor +static void on_avatar_name_cache_start_call(const LLUUID& agent_id, + const LLAvatarName& av_name) +{ + LLUUID session_id = gIMMgr->addSession(LLCacheName::cleanFullName(av_name.getLegacyName()), IM_NOTHING_SPECIAL, agent_id, true); + if (session_id.notNull()) + { + gIMMgr->startCall(session_id); + } + make_ui_sound("UISndStartIM"); +} + + +// static +void LLAvatarActions::startCall(const LLUUID& id) +{ + if (id.isNull()) + { + return; + } + +// [RLVa:KB] - Checked: 2011-04-11 (RLVa-1.3.0h) | Added: RLVa-1.3.0h + if ( (rlv_handler_t::isEnabled()) && (!gRlvHandler.canStartIM(id)) ) + { + LLUUID idSession = gIMMgr->computeSessionID(IM_NOTHING_SPECIAL, id); + if ( (idSession.notNull()) && (!gIMMgr->hasSession(idSession)) ) + { + make_ui_sound("UISndInvalidOp"); + RlvUtil::notifyBlocked(RLV_STRING_BLOCKED_STARTIM, LLSD().with("RECIPIENT", id));//LLSLURL("agent", id, "completename").getSLURLString())); + return; + } + } +// [/RLVa:KB] + + LLAvatarNameCache::get(id, + boost::bind(&on_avatar_name_cache_start_call, _1, _2)); +} + +// static +void LLAvatarActions::startAdhocCall(const uuid_vec_t& ids) +{ + if (ids.size() == 0) + { + return; + } + + // convert vector into LLDynamicArray for addSession + LLDynamicArray id_array; + for (uuid_vec_t::const_iterator it = ids.begin(); it != ids.end(); ++it) + { +// [RLVa:KB] - Checked: 2011-04-11 (RLVa-1.3.0h) | Added: RLVa-1.3.0h + const LLUUID& idAgent = *it; + if ( (rlv_handler_t::isEnabled()) && (!gRlvHandler.canStartIM(idAgent)) ) + { + make_ui_sound("UISndInvalidOp"); + RlvUtil::notifyBlocked(RLV_STRING_BLOCKED_STARTCONF, LLSD().with("RECIPIENT", idAgent));//LLSLURL("agent", idAgent, "completename").getSLURLString())); + return; + } + id_array.push_back(idAgent); +// [/RLVa:KB] +// id_array.push_back(*it); + } + + // create the new ad hoc voice session + const std::string title = LLTrans::getString("conference-title"); + LLUUID session_id = gIMMgr->addSession(title, IM_SESSION_CONFERENCE_START, + ids[0], id_array, true); + if (session_id.isNull()) + { + return; + } + + gIMMgr->autoStartCallOnStartup(session_id); + + make_ui_sound("UISndStartIM"); +} +*/ + +/* AD *TODO: Is this function needed any more? + I fixed it a bit(added check for canCall), but it appears that it is not used + anywhere. Maybe it should be removed? +// static +bool LLAvatarActions::isCalling(const LLUUID &id) +{ + if (id.isNull() || !canCall()) + { + return false; + } + + LLUUID session_id = gIMMgr->computeSessionID(IM_NOTHING_SPECIAL, id); + return (LLIMModel::getInstance()->findIMSession(session_id) != NULL); +}*/ + +//static +bool LLAvatarActions::canCall() +{ + return LLVoiceClient::getInstance()->voiceEnabled() /*&& LLVoiceClient::getInstance()->isVoiceWorking()*/; +} + +// static +void LLAvatarActions::startConference(const uuid_vec_t& ids) +{ + for (uuid_vec_t::const_iterator it = ids.begin(); it != ids.end(); ++it) + { +// [RLVa:KB] - Checked: 2011-04-11 (RLVa-1.3.0h) | Added: RLVa-1.3.0h + const LLUUID& idAgent = *it; + if ( (rlv_handler_t::isEnabled()) && (!gRlvHandler.canStartIM(idAgent)) ) + { + make_ui_sound("UISndInvalidOp"); + RlvUtil::notifyBlocked(RLV_STRING_BLOCKED_STARTCONF, LLSD().with("RECIPIENT", idAgent/*LLSLURL("agent", idAgent, "completename").getSLURLString()*/)); + return; + } +// [/RLVa:KB] + } + static LLCachedControl tear_off("OtherChatsTornOff"); + if (!tear_off) gIMMgr->setFloaterOpen(true); + const std::string title = LLTrans::getString("conference-title"); + gIMMgr->addSession(title, IM_SESSION_CONFERENCE_START, ids[0], ids); + make_ui_sound("UISndStartIM"); +} + +/* Singu TODO: Web Profiles +static const char* get_profile_floater_name(const LLUUID& avatar_id) +{ + // Use different floater XML for our profile to be able to save its rect. + return avatar_id == gAgentID ? "my_profile" : "profile"; +} +*/ + +static void on_avatar_name_show_profile(const LLUUID& agent_id, const LLAvatarName& av_name) +{ + //if (!gSavedSettings.getBOOL("UseWebProfiles") + //{ + LLFloaterAvatarInfo* floater = LLFloaterAvatarInfo::getInstance(agent_id); + if(!floater) + { + floater = new LLFloaterAvatarInfo(LLTrans::getString("Command_Profile_Label")+" "+av_name.getCompleteName(), agent_id); + floater->center(); + } + + // ...bring that window to front + floater->open(); /*Flawfinder: ignore*/ + //} + /* + else + { + std::string username = av_name.mUsername; + if (username.empty()) + { + username = LLCacheName::buildUsername(av_name.mDisplayName); + } + + llinfos << "opening web profile for " << username << llendl; + std::string url = getProfileURL(username); + + // PROFILES: open in webkit window + LLFloaterWebContent::Params p; + p.url(url). + id(agent_id.asString()); + LLFloaterReg::showInstance(get_profile_floater_name(agent_id), p); + } + */ +} + +// static +void LLAvatarActions::showProfile(const LLUUID& id) +{ + if (id.notNull()) + { + LLAvatarName av_name; + if (LLAvatarNameCache::get(id, &av_name)) // Bypass expiration, open NOW! + on_avatar_name_show_profile(id, av_name); + else + LLAvatarNameCache::get(id, boost::bind(&on_avatar_name_show_profile, _1, _2)); + } +} + +//static +bool LLAvatarActions::profileVisible(const LLUUID& id) +{ + LLFloater* browser = getProfileFloater(id); + return browser && browser->getVisible(); +} + +//static +LLFloater* LLAvatarActions::getProfileFloater(const LLUUID& id) +{ + LLFloater* browser; + //if (!gSavedSettings.getBOOL("UseWebProfiles") + browser = LLFloaterAvatarInfo::getInstance(id); + /*else + browser = dynamic_cast + (LLFloaterReg::findInstance(get_profile_floater_name(id), LLSD().with("id", id))); + */ + return browser; +} + +//static +void LLAvatarActions::hideProfile(const LLUUID& id) +{ + LLFloater* browser = getProfileFloater(id); + if (browser) + { + browser->close(); + } +} + +// static +void LLAvatarActions::showOnMap(const LLUUID& id) +{ + std::string av_name; + if (!LLAvatarNameCache::getPNSName(id, av_name)) + { + LLAvatarNameCache::get(id, boost::bind(&LLAvatarActions::showOnMap, id)); + return; + } + + gFloaterWorldMap->trackAvatar(id, av_name); + LLFloaterWorldMap::show(true); +} + +// static +void LLAvatarActions::pay(const LLUUID& id) +{ + LLNotification::Params params("BusyModePay"); + params.functor(boost::bind(&LLAvatarActions::handlePay, _1, _2, id)); + + if (gAgent.getBusy()) + { + // warn users of being in busy mode during a transaction + LLNotifications::instance().add(params); + } + else + { + LLNotifications::instance().forceResponse(params, 1); + } +} + +// static +void LLAvatarActions::kick(const LLUUID& id) +{ + LLSD payload; + payload["avatar_id"] = id; + LLNotifications::instance().add("KickUser", LLSD(), payload, handleKick); +} + +// static +void LLAvatarActions::freeze(const LLUUID& id) +{ + LLSD payload; + payload["avatar_id"] = id; + LLNotifications::instance().add("FreezeUser", LLSD(), payload, handleFreeze); +} + +// static +void LLAvatarActions::unfreeze(const LLUUID& id) +{ + LLSD payload; + payload["avatar_id"] = id; + LLNotifications::instance().add("UnFreezeUser", LLSD(), payload, handleUnfreeze); +} + +//static +void LLAvatarActions::csr(const LLUUID& id) +{ + std::string name; + if (!gCacheName->getFullName(id, name)) return; + + std::string url = "http://csr.lindenlab.com/agent/"; + + // slow and stupid, but it's late + S32 len = name.length(); + for (S32 i = 0; i < len; i++) + { + if (name[i] == ' ') + { + url += "%20"; + } + else + { + url += name[i]; + } + } + + LLWeb::loadURL(url); +} + +// Singu TODO: Share inventory code block should live here + +// static +void LLAvatarActions::toggleBlock(const LLUUID& id) +{ + std::string name; + + gCacheName->getFullName(id, name); // needed for mute + LLMute mute(id, name, LLMute::AGENT); + + if (LLMuteList::getInstance()->isMuted(mute.mID, mute.mName)) + { + LLMuteList::getInstance()->remove(mute); + } + else + { + LLMuteList::getInstance()->add(mute); + } +} + +// static +bool LLAvatarActions::canOfferTeleport(const LLUUID& id) +{ + // First use LLAvatarTracker::isBuddy() + // If LLAvatarTracker::instance().isBuddyOnline function only is used + // then for avatars that are online and not a friend it will return false. + // But we should give an ability to offer a teleport for such avatars. + if(LLAvatarTracker::instance().isBuddy(id)) + { + return LLAvatarTracker::instance().isBuddyOnline(id); + } + + return true; +} + +// static +bool LLAvatarActions::canOfferTeleport(const uuid_vec_t& ids) +{ + // We can't send more than 250 lures in a single message, so disable this + // button when there are too many id's selected. + if(ids.size() > 250) return false; + + bool result = true; + for (uuid_vec_t::const_iterator it = ids.begin(); it != ids.end(); ++it) + { + if(!canOfferTeleport(*it)) + { + result = false; + break; + } + } + return result; +} + +void LLAvatarActions::inviteToGroup(const LLUUID& id) +{ + LLFloaterGroupPicker* widget = LLFloaterGroupPicker::showInstance(LLSD(id)); + if (widget) + { + widget->center(); + widget->setPowersMask(GP_MEMBER_INVITE); + //widget->removeNoneOption(); + widget->setSelectCallback(callback_invite_to_group, (void*)&id); + } +} + +//== private methods ======================================================================================== + +// static +bool LLAvatarActions::handleRemove(const LLSD& notification, const LLSD& response) +{ + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); + + const LLSD& ids = notification["payload"]["ids"]; + for (LLSD::array_const_iterator itr = ids.beginArray(); itr != ids.endArray(); ++itr) + { + LLUUID id = itr->asUUID(); + const LLRelationship* ip = LLAvatarTracker::instance().getBuddyInfo(id); + if (ip) + { + switch (option) + { + case 0: // YES + if( ip->isRightGrantedTo(LLRelationship::GRANT_MODIFY_OBJECTS)) + { + LLAvatarTracker::instance().empower(id, FALSE); + LLAvatarTracker::instance().notifyObservers(); + } + LLAvatarTracker::instance().terminateBuddy(id); + LLAvatarTracker::instance().notifyObservers(); + gInventory.addChangedMask(LLInventoryObserver::LABEL | LLInventoryObserver::CALLING_CARD, LLUUID::null); + gInventory.notifyObservers(); + break; + + case 1: // NO + default: + llinfos << "No removal performed." << llendl; + break; + } + } + } + return false; +} + +// static +bool LLAvatarActions::handlePay(const LLSD& notification, const LLSD& response, LLUUID avatar_id) +{ + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); + if (option == 0) + { + gAgent.clearBusy(); + } + + LLFloaterPay::payDirectly(&give_money, avatar_id, /*is_group=*/false); + return false; +} + +// static +void LLAvatarActions::callback_invite_to_group(LLUUID group_id, void* id) +{ + uuid_vec_t agent_ids; + agent_ids.push_back(*static_cast(id)); + + LLFloaterGroupInvite::showForGroup(group_id, &agent_ids); +} + + +// static +bool LLAvatarActions::callbackAddFriendWithMessage(const LLSD& notification, const LLSD& response) +{ + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); + if (option == 0) + { + requestFriendship(notification["payload"]["id"].asUUID(), + notification["payload"]["name"].asString(), + response["message"].asString()); + } + return false; +} + +// static +bool LLAvatarActions::handleKick(const LLSD& notification, const LLSD& response) +{ + S32 option = LLNotification::getSelectedOption(notification, response); + + if (option == 0) + { + LLUUID avatar_id = notification["payload"]["avatar_id"].asUUID(); + LLMessageSystem* msg = gMessageSystem; + + msg->newMessageFast(_PREHASH_GodKickUser); + msg->nextBlockFast(_PREHASH_UserInfo); + msg->addUUIDFast(_PREHASH_GodID, gAgent.getID() ); + msg->addUUIDFast(_PREHASH_GodSessionID, gAgent.getSessionID()); + msg->addUUIDFast(_PREHASH_AgentID, avatar_id ); + msg->addU32("KickFlags", KICK_FLAGS_DEFAULT ); + msg->addStringFast(_PREHASH_Reason, response["message"].asString() ); + gAgent.sendReliableMessage(); + } + return false; +} +bool LLAvatarActions::handleFreeze(const LLSD& notification, const LLSD& response) +{ + S32 option = LLNotification::getSelectedOption(notification, response); + + if (option == 0) + { + LLUUID avatar_id = notification["payload"]["avatar_id"].asUUID(); + LLMessageSystem* msg = gMessageSystem; + + msg->newMessageFast(_PREHASH_GodKickUser); + msg->nextBlockFast(_PREHASH_UserInfo); + msg->addUUIDFast(_PREHASH_GodID, gAgent.getID() ); + msg->addUUIDFast(_PREHASH_GodSessionID, gAgent.getSessionID()); + msg->addUUIDFast(_PREHASH_AgentID, avatar_id ); + msg->addU32("KickFlags", KICK_FLAGS_FREEZE ); + msg->addStringFast(_PREHASH_Reason, response["message"].asString() ); + gAgent.sendReliableMessage(); + } + return false; +} +bool LLAvatarActions::handleUnfreeze(const LLSD& notification, const LLSD& response) +{ + S32 option = LLNotification::getSelectedOption(notification, response); + std::string text = response["message"].asString(); + if (option == 0) + { + LLUUID avatar_id = notification["payload"]["avatar_id"].asUUID(); + LLMessageSystem* msg = gMessageSystem; + + msg->newMessageFast(_PREHASH_GodKickUser); + msg->nextBlockFast(_PREHASH_UserInfo); + msg->addUUIDFast(_PREHASH_GodID, gAgent.getID() ); + msg->addUUIDFast(_PREHASH_GodSessionID, gAgent.getSessionID()); + msg->addUUIDFast(_PREHASH_AgentID, avatar_id ); + msg->addU32("KickFlags", KICK_FLAGS_UNFREEZE ); + msg->addStringFast(_PREHASH_Reason, text ); + gAgent.sendReliableMessage(); + } + return false; +} + +// static +void LLAvatarActions::requestFriendship(const LLUUID& target_id, const std::string& target_name, const std::string& message) +{ + const LLUUID calling_card_folder_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_CALLINGCARD); + send_improved_im(target_id, + target_name, + message, + IM_ONLINE, + IM_FRIENDSHIP_OFFERED, + calling_card_folder_id); + + LLSD args; + args["TO_NAME"] = target_name; + + LLSD payload; + payload["from_id"] = target_id; + //payload["SUPPRESS_TOAST"] = true; + LLNotificationsUtil::add("FriendshipOffered", args, payload); +} + +//static +bool LLAvatarActions::isFriend(const LLUUID& id) +{ + return ( NULL != LLAvatarTracker::instance().getBuddyInfo(id) ); +} + +// static +bool LLAvatarActions::isBlocked(const LLUUID& id) +{ + return LLMuteList::getInstance()->isMuted(id); +} + +// static +bool LLAvatarActions::canBlock(const LLUUID& id) +{ + bool is_linden = LLMuteList::getInstance()->isLinden(id); + bool is_self = id == gAgentID; + return !is_self && !is_linden; +} + diff --git a/indra/newview/llavataractions.h b/indra/newview/llavataractions.h new file mode 100644 index 000000000..0fc76f3e4 --- /dev/null +++ b/indra/newview/llavataractions.h @@ -0,0 +1,188 @@ +/** + * @file llavataractions.h + * @brief Friend-related actions (add, remove, offer teleport, etc) + * + * $LicenseInfo:firstyear=2009&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_LLAVATARACTIONS_H +#define LL_LLAVATARACTIONS_H + +class LLFloater; + +/** + * Friend-related actions (add, remove, offer teleport, etc) + */ +class LLAvatarActions +{ +public: + /** + * Show a dialog explaining what friendship entails, then request friendship. + */ + static void requestFriendshipDialog(const LLUUID& id, const std::string& name); + + /** + * Show a dialog explaining what friendship entails, then request friendship. + */ + static void requestFriendshipDialog(const LLUUID& id); + + /** + * Show a friend removal dialog. + */ + static void removeFriendDialog(const LLUUID& id); + static void removeFriendsDialog(const uuid_vec_t& ids); + + /** + * Show teleport offer dialog. + */ + static void offerTeleport(const LLUUID& invitee); + static void offerTeleport(const uuid_vec_t& ids); + + /** + * Start instant messaging session. + */ + static void startIM(const LLUUID& id); + + /** + * End instant messaging session. + */ + static void endIM(const LLUUID& id); + + /** + * Start an avatar-to-avatar voice call with another user + */ + static void startCall(const LLUUID& id); + + /** + * Start an ad-hoc conference voice call with multiple users + */ + static void startAdhocCall(const uuid_vec_t& ids); + + /** + * Start conference chat with the given avatars. + */ + static void startConference(const uuid_vec_t& ids); + + /** + * Show avatar profile. + */ + static void showProfile(const LLUUID& id); + static void hideProfile(const LLUUID& id); + static bool profileVisible(const LLUUID& id); + static LLFloater* getProfileFloater(const LLUUID& id); + + /** + * Show avatar on world map. + */ + static void showOnMap(const LLUUID& id); + + /** + * Give money to the avatar. + */ + static void pay(const LLUUID& id); + /** + * Block/unblock the avatar. + */ + static void toggleBlock(const LLUUID& id); + + /** + * Return true if avatar with "id" is a friend + */ + static bool isFriend(const LLUUID& id); + + /** + * @return true if the avatar is blocked + */ + static bool isBlocked(const LLUUID& id); + + /** + * @return true if you can block the avatar + */ + static bool canBlock(const LLUUID& id); + + /** + * Return true if the avatar is in a P2P voice call with a given user + */ + /* AD *TODO: Is this function needed any more? + I fixed it a bit(added check for canCall), but it appears that it is not used + anywhere. Maybe it should be removed? + static bool isCalling(const LLUUID &id);*/ + + /** + * @return true if call to the resident can be made + */ + + static bool canCall(); + /** + * Invite avatar to a group. + */ + static void inviteToGroup(const LLUUID& id); + + /** + * Kick avatar off grid + */ + static void kick(const LLUUID& id); + + /** + * Freeze avatar + */ + static void freeze(const LLUUID& id); + + /** + * Unfreeze avatar + */ + static void unfreeze(const LLUUID& id); + + /** + * Open csr page for avatar + */ + static void csr(const LLUUID& id); + + /** + * Checks whether we can offer a teleport to the avatar, only offline friends + * cannot be offered a teleport. + * + * @return false if avatar is a friend and not visibly online + */ + static bool canOfferTeleport(const LLUUID& id); + + /** + * @return false if any one of the specified avatars a friend and not visibly online + */ + static bool canOfferTeleport(const uuid_vec_t& ids); + +private: + static bool callbackAddFriendWithMessage(const LLSD& notification, const LLSD& response); + static bool handleRemove(const LLSD& notification, const LLSD& response); + static bool handlePay(const LLSD& notification, const LLSD& response, LLUUID avatar_id); + static bool handleKick(const LLSD& notification, const LLSD& response); + static bool handleFreeze(const LLSD& notification, const LLSD& response); + static bool handleUnfreeze(const LLSD& notification, const LLSD& response); + static void callback_invite_to_group(LLUUID group_id, void* id); + +public: + // Just request friendship, no dialog. + static void requestFriendship(const LLUUID& target_id, const std::string& target_name, const std::string& message); +}; + +#endif // LL_LLAVATARACTIONS_H + diff --git a/indra/newview/llfloateractivespeakers.cpp b/indra/newview/llfloateractivespeakers.cpp index 839769e27..ebae098e8 100644 --- a/indra/newview/llfloateractivespeakers.cpp +++ b/indra/newview/llfloateractivespeakers.cpp @@ -36,27 +36,24 @@ #include "llagent.h" #include "llappviewer.h" -#include "llimview.h" -#include "llsdutil.h" -#include "llfloateravatarinfo.h" -#include "lluictrlfactory.h" -#include "llviewercontrol.h" -#include "llscrolllistctrl.h" +#include "llavataractions.h" #include "llbutton.h" -#include "lltextbox.h" -#include "llmutelist.h" -#include "llviewerobjectlist.h" -#include "llvoavatar.h" #include "llimpanel.h" // LLVoiceChannel +#include "llimview.h" +#include "llmutelist.h" +#include "llscrolllistctrl.h" +#include "llsdutil.h" +#include "lltextbox.h" +#include "lluictrlfactory.h" +#include "llviewerobjectlist.h" #include "llviewerwindow.h" +#include "llvoavatar.h" #include "llworld.h" // [RLVa:KB] #include "rlvhandler.h" // [/RLVa:KB] -#include "llavatarname.h" - class AIHTTPTimeoutPolicy; extern AIHTTPTimeoutPolicy muteVoiceResponder_timeout; extern AIHTTPTimeoutPolicy muteTextResponder_timeout; @@ -770,32 +767,14 @@ void LLPanelActiveSpeakers::onClickProfile(void* user_data) // [/RLVa:KB] LLPanelActiveSpeakers* panelp = (LLPanelActiveSpeakers*)user_data; - LLUUID speaker_id = panelp->mSpeakerList->getValue().asUUID(); - - LLFloaterAvatarInfo::showFromDirectory(speaker_id); + LLAvatarActions::showProfile(panelp->mSpeakerList->getValue().asUUID()); } //static void LLPanelActiveSpeakers::onDoubleClickSpeaker(void* user_data) { -// [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g) | Added: RLVa-1.0.0g - if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) - { - return; - } -// [/RLVa:KB] - LLPanelActiveSpeakers* panelp = (LLPanelActiveSpeakers*)user_data; - LLUUID speaker_id = panelp->mSpeakerList->getValue().asUUID(); - - LLPointer speakerp = panelp->mSpeakerMgr->findSpeaker(speaker_id); - - if (speaker_id != gAgent.getID() && speakerp.notNull() && !speakerp->mLegacyName.empty()) - { - // Changed for display name support - //gIMMgr->addSession(speakerp->mDisplayName, IM_NOTHING_SPECIAL, speaker_id); - gIMMgr->addSession(speakerp->mLegacyName, IM_NOTHING_SPECIAL, speaker_id); - } + LLAvatarActions::startIM(panelp->mSpeakerList->getValue().asUUID()); } //static diff --git a/indra/newview/llfloateravatarinfo.cpp b/indra/newview/llfloateravatarinfo.cpp index cd0cbbc3c..4a6883ecf 100644 --- a/indra/newview/llfloateravatarinfo.cpp +++ b/indra/newview/llfloateravatarinfo.cpp @@ -35,168 +35,26 @@ #include "llviewerprecompiledheaders.h" #include "llfloateravatarinfo.h" -#include "llavatarnamecache.h" - -// viewer project includes -#include "llagentdata.h" -#include "llcommandhandler.h" -#include "llimview.h" -#include "llfloaterfriends.h" -#include "llfloatermute.h" -#include "llmenucommands.h" #include "llpanelavatar.h" -#include "llviewermessage.h" #include "lluictrlfactory.h" -#include "llweb.h" - -// linden library includes -#include "llinventory.h" -#include "lluuid.h" -#include "message.h" - - -const char FLOATER_TITLE[] = "Profile"; -const LLRect FAI_RECT(0, 530, 420, 0); - -//----------------------------------------------------------------------------- -// Globals -//----------------------------------------------------------------------------- - -class LLAgentHandler : public LLCommandHandler -{ -public: - void verbCallback(const std::string& verb, LLUUID agent_id, const LLAvatarName& avatar_name) - { - if (verb == "im") - { - gIMMgr->setFloaterOpen(TRUE); - gIMMgr->addSession( avatar_name.getCompleteName(), IM_NOTHING_SPECIAL, agent_id); - return; - } - - if (verb == "requestfriend") - { - LLPanelFriends::requestFriendshipDialog( agent_id, avatar_name.getCompleteName() ); - return; - } - - if (verb == "mute") - { - LLFloaterMute::getInstance()->open(); - LLMute mute(agent_id, avatar_name.getCompleteName(), LLMute::AGENT); - LLMuteList::getInstance()->add(mute); - return; - } - - if (verb == "unmute") - { - LLMute mute(agent_id, avatar_name.getCompleteName(), LLMute::AGENT); - LLMuteList::getInstance()->remove(mute); - return; - } - } - - // requires trusted browser to trigger - LLAgentHandler() : LLCommandHandler("agent", true) { } - - bool handle(const LLSD& params, const LLSD& query_map, - LLMediaCtrl* web) - { - if (params.size() < 2) - { - return false; - } - LLUUID agent_id; - if (!agent_id.set(params[0], FALSE)) - { - return false; - } - - const std::string verb = params[1].asString(); - if (verb == "about") - { - LLFloaterAvatarInfo::show(agent_id); - return true; - } - - if (verb == "pay") - { - handle_pay_by_id(agent_id); - return true; - } - - if (verb == "offerteleport") - { - handle_lure(agent_id); - return true; - } - - if ((verb == "im") || (verb == "requestfriend") || (verb == "unmute")) - { - LLAvatarNameCache::get(agent_id, boost::bind(&LLAgentHandler::verbCallback, this, verb, _1, _2)); - return true; - } - - if (verb == "mute") - { - if (LLMuteList::getInstance()->isMuted(agent_id)) - { - LLFloaterMute::getInstance()->open(); - LLFloaterMute::getInstance()->selectMute(agent_id); - } - else - { - LLAvatarNameCache::get(agent_id, boost::bind(&LLAgentHandler::verbCallback, this, verb, _1, _2)); - } - return true; - } - - return false; - } -}; -LLAgentHandler gAgentHandler; - -//----------------------------------------------------------------------------- -// Member functions -//----------------------------------------------------------------------------- - -//---------------------------------------------------------------------------- void* LLFloaterAvatarInfo::createPanelAvatar(void* data) { LLFloaterAvatarInfo* self = (LLFloaterAvatarInfo*)data; self->mPanelAvatarp = new LLPanelAvatar("PanelAv", LLRect(), TRUE); // allow edit self + self->mPanelAvatarp->setAvatarID(self->mAvatarID); return self->mPanelAvatarp; } -//---------------------------------------------------------------------------- - - -BOOL LLFloaterAvatarInfo::postBuild() +LLFloaterAvatarInfo::LLFloaterAvatarInfo(const std::string& name, const LLUUID &avatar_id) +: LLFloater(name), LLInstanceTracker(avatar_id), + mAvatarID(avatar_id) { - return TRUE; -} - -LLFloaterAvatarInfo::LLFloaterAvatarInfo(const std::string& name, const LLRect &rect, const LLUUID &avatar_id) -: LLPreview(name, rect, FLOATER_TITLE, LLUUID::null, LLUUID::null), LLInstanceTracker(avatar_id), - mAvatarID( avatar_id ), - mSuggestedOnlineStatus(ONLINE_STATUS_NO) -{ - setAutoFocus(TRUE); + setAutoFocus(true); LLCallbackMap::map_t factory_map; - factory_map["Panel Avatar"] = LLCallbackMap(createPanelAvatar, this); - LLUICtrlFactory::getInstance()->buildFloater(this, "floater_profile.xml", &factory_map); - - if(mPanelAvatarp) - { - mPanelAvatarp->selectTab(0); - } - - //gCacheName->get(avatar_id, FALSE, callbackLoadAvatarName); - LLAvatarNameCache::get(avatar_id, boost::bind(&LLFloaterAvatarInfo::callbackLoadAvatarName, this, _1, _2)); } // virtual @@ -206,131 +64,11 @@ LLFloaterAvatarInfo::~LLFloaterAvatarInfo() void LLFloaterAvatarInfo::resetGroupList() { - // only get these updates asynchronously via the group floater, which works on the agent only - if (mAvatarID != gAgentID) - { - return; - } - mPanelAvatarp->resetGroupList(); } -// static -LLFloaterAvatarInfo* LLFloaterAvatarInfo::show(const LLUUID &avatar_id) -{ - if (avatar_id.isNull()) - { - return NULL; - } - - LLFloaterAvatarInfo *floater = LLFloaterAvatarInfo::getInstance(avatar_id); - if(!floater) - { - floater = new LLFloaterAvatarInfo("avatarinfo", FAI_RECT, avatar_id ); - floater->center(); - } - - // ...bring that window to front - floater->open(); /*Flawfinder: ignore*/ - return floater; -} - -// Open profile to a certain tab. -// static -void LLFloaterAvatarInfo::showFromObject(const LLUUID& avatar_id,std::string tab_name) -{ - LLFloaterAvatarInfo *floater = show(avatar_id); - if (floater) - { - floater->mPanelAvatarp->setAvatarID(avatar_id, LLStringUtil::null, ONLINE_STATUS_NO); - floater->mPanelAvatarp->selectTabByName(tab_name); - } -} - -// static -void LLFloaterAvatarInfo::showFromDirectory(const LLUUID &avatar_id) -{ - LLFloaterAvatarInfo *floater = show(avatar_id); - if (floater) - { - floater->mPanelAvatarp->setAvatarID(avatar_id, LLStringUtil::null, ONLINE_STATUS_NO); - } -} - - -// static -void LLFloaterAvatarInfo::showFromFriend(const LLUUID& agent_id, BOOL online) -{ - LLFloaterAvatarInfo *floater = show(agent_id); - if (floater) - { - floater->mSuggestedOnlineStatus = online ? ONLINE_STATUS_YES : ONLINE_STATUS_NO; - } -} - - -// static -void LLFloaterAvatarInfo::showFromProfile(const LLUUID &avatar_id, LLRect rect) -{ - if (avatar_id.isNull()) - { - return; - } - - LLFloaterAvatarInfo *floater = LLFloaterAvatarInfo::getInstance(avatar_id); - if(!floater) - { - floater = new LLFloaterAvatarInfo("avatarinfo", FAI_RECT, avatar_id); - floater->translate(rect.mLeft - floater->getRect().mLeft + 16, - rect.mTop - floater->getRect().mTop - 16); - floater->mPanelAvatarp->setAvatarID(avatar_id, LLStringUtil::null, ONLINE_STATUS_NO); - } - floater->open(); -} - -void LLFloaterAvatarInfo::showProfileCallback(S32 option, void *userdata) -{ - if (option == 0) - { - showFromObject(gAgentID); - } -} - -void LLFloaterAvatarInfo::callbackLoadAvatarName(const LLUUID& id, const LLAvatarName& av_name) -{ - // Build a new title including the avatar name. - std::ostringstream title; - //title << first << " " << last << " - " << floater->getTitle(); - title << av_name.getCompleteName()<< " - " << getTitle(); - setTitle(title.str()); -} - -//// virtual -void LLFloaterAvatarInfo::draw() -{ - // skip LLPreview::draw() - LLFloater::draw(); -} - // virtual BOOL LLFloaterAvatarInfo::canClose() { return mPanelAvatarp && mPanelAvatarp->canClose(); } - -void LLFloaterAvatarInfo::loadAsset() -{ - if (mPanelAvatarp) { - mPanelAvatarp->setAvatarID(mAvatarID, LLStringUtil::null, mSuggestedOnlineStatus); - mAssetStatus = PREVIEW_ASSET_LOADING; - } -} - -LLPreview::EAssetStatus LLFloaterAvatarInfo::getAssetStatus() -{ - if (mPanelAvatarp && mPanelAvatarp->haveData()) - { - mAssetStatus = PREVIEW_ASSET_LOADED; - } - return mAssetStatus; -} diff --git a/indra/newview/llfloateravatarinfo.h b/indra/newview/llfloateravatarinfo.h index b9682b308..b95bd14d1 100644 --- a/indra/newview/llfloateravatarinfo.h +++ b/indra/newview/llfloateravatarinfo.h @@ -40,66 +40,24 @@ #define LL_LLFLOATERAVATARINFO_H #include "llfloater.h" -#include "llpreview.h" -#include "lluuid.h" -#include "llpanelavatar.h" #include "llinstancetracker.h" -class LLAvatarName; -class LLButton; -class LLCheckBoxCtrl; -class LLInventoryItem; -class LLLineEditor; -class LLMessageSystem; -class LLScrollListCtrl; -class LLTabContainer; -class LLTextBox; -class LLTextEditor; -class LLTextureCtrl; -class LLUICtrl; -class LLViewerTexture; -class LLViewerObject; +class LLPanelAvatar; class LLFloaterAvatarInfo -: public LLPreview, public LLInstanceTracker +: public LLFloater, public LLInstanceTracker { public: static void* createPanelAvatar(void* data); - virtual BOOL postBuild(); - - LLFloaterAvatarInfo(const std::string& name, const LLRect &rect, const LLUUID &avatar_id ); + LLFloaterAvatarInfo(const std::string& name, const LLUUID &avatar_id); /*virtual*/ ~LLFloaterAvatarInfo(); - - /*virtual*/ void draw(); - /*virtual*/ BOOL canClose(); - - /*virtual*/ void loadAsset(); - /*virtual*/ EAssetStatus getAssetStatus(); - - static LLFloaterAvatarInfo* show(const LLUUID& avatar_id); - // Core method, doesn't do anything funny with online status or - // tab selection. - - static void showFromObject(const LLUUID &avatar_id, std::string tab_name = std::string()); - - static void showFromDirectory(const LLUUID &avatar_id); - - static void showFromFriend(const LLUUID &agent_id, BOOL online); - - static void showFromProfile(const LLUUID &avatar_id, LLRect rect); - - static void showProfileCallback(S32 option, void *userdata); - void callbackLoadAvatarName(const LLUUID& agent_id, const LLAvatarName& av_name); void resetGroupList(); private: LLUUID mAvatarID; // for which avatar is this window? LLPanelAvatar* mPanelAvatarp; - EOnlineStatus mSuggestedOnlineStatus; }; -std::string getProfileURL(const std::string& agent_name); - #endif diff --git a/indra/newview/llfloateravatarlist.cpp b/indra/newview/llfloateravatarlist.cpp index 4a5640a27..c41e7f1db 100644 --- a/indra/newview/llfloateravatarlist.cpp +++ b/indra/newview/llfloateravatarlist.cpp @@ -25,21 +25,17 @@ #include "llwindow.h" #include "llscrolllistctrl.h" #include "llradiogroup.h" -#include "llviewercontrol.h" #include "llnotificationsutil.h" #include "llvoavatar.h" #include "llimview.h" -#include "llfloateravatarinfo.h" -#include "llregionflags.h" #include "llfloaterreporter.h" #include "llagent.h" #include "llagentcamera.h" +#include "llavataractions.h" #include "llfloaterregioninfo.h" #include "llviewerregion.h" #include "lltracker.h" -#include "llviewerstats.h" -#include "llerror.h" #include "llchat.h" #include "llfloaterchat.h" #include "llviewermessage.h" @@ -882,7 +878,7 @@ void LLFloaterAvatarList::refreshAvatarList() name_color = ascent_estate_owner_color; } //without these dots, SL would suck. - else if(is_agent_friend(av_id)) + else if(LLAvatarActions::isFriend(av_id)) { static const LLCachedControl ascent_friend_color("AscentFriendColor",LLColor4(1.f,1.f,0.f,1.f)); name_color = ascent_friend_color; @@ -1142,22 +1138,12 @@ void LLFloaterAvatarList::onClickIM() if (ids.size() == 1) { // Single avatar - LLUUID agent_id = ids[0]; - - std::string avatar_name; - if (gCacheName->getFullName(agent_id, avatar_name)) - { - gIMMgr->setFloaterOpen(TRUE); - gIMMgr->addSession(avatar_name,IM_NOTHING_SPECIAL,agent_id); - } + LLAvatarActions::startIM(ids[0]); } else { // Group IM - LLUUID session_id; - session_id.generate(); - gIMMgr->setFloaterOpen(TRUE); - gIMMgr->addSession("Avatars Conference", IM_SESSION_CONFERENCE_START, ids[0], ids); + LLAvatarActions::startConference(ids); } } } @@ -1265,30 +1251,7 @@ BOOL LLFloaterAvatarList::handleKeyHere(KEY key, MASK mask) if (( KEY_RETURN == key ) && (MASK_SHIFT == mask)) { - uuid_vec_t ids = mAvatarList->getSelectedIDs(); - if (ids.size() > 0) - { - if (ids.size() == 1) - { - // Single avatar - LLUUID agent_id = ids[0]; - - std::string avatar_name; - if (gCacheName->getFullName(agent_id, avatar_name)) - { - gIMMgr->setFloaterOpen(TRUE); - gIMMgr->addSession(avatar_name,IM_NOTHING_SPECIAL,agent_id); - } - } - else - { - // Group IM - LLUUID session_id; - session_id.generate(); - gIMMgr->setFloaterOpen(TRUE); - gIMMgr->addSession("Avatars Conference", IM_SESSION_CONFERENCE_START, ids[0], ids); - } - } + onClickIM(); } return LLPanel::handleKeyHere(key, mask); } @@ -1553,7 +1516,7 @@ static void cmd_append_names(const LLAvatarListEntry* entry, std::string &str, s { if(!str.empty())str.append(sep);str.append(entry->getName()); } static void cmd_toggle_mark(LLAvatarListEntry* entry) { entry->toggleMark(); } static void cmd_ar(const LLAvatarListEntry* entry) { LLFloaterReporter::showFromObject(entry->getID()); } -static void cmd_profile(const LLAvatarListEntry* entry) { LLFloaterAvatarInfo::showFromDirectory(entry->getID()); } +static void cmd_profile(const LLAvatarListEntry* entry) { LLAvatarActions::showProfile(entry->getID()); } static void cmd_teleport(const LLAvatarListEntry* entry) { gAgent.teleportViaLocation(entry->getPosition()); } static void cmd_freeze(const LLAvatarListEntry* entry) { send_freeze(entry->getID(), true); } static void cmd_unfreeze(const LLAvatarListEntry* entry) { send_freeze(entry->getID(), false); } diff --git a/indra/newview/llfloateravatarpicker.cpp b/indra/newview/llfloateravatarpicker.cpp index 6bf1d9a9e..a9e6bf4b6 100644 --- a/indra/newview/llfloateravatarpicker.cpp +++ b/indra/newview/llfloateravatarpicker.cpp @@ -557,7 +557,10 @@ BOOL LLFloaterAvatarPicker::handleDragAndDrop(S32 x, S32 y, MASK mask, std::string avatar_name = selection->getColumn(0)->getValue().asString(); if (dest_agent_id.notNull() && dest_agent_id != gAgentID) { - if (drop) +// if (drop) +// [RLVa:KB] - Checked: 2011-04-11 (RLVa-1.3.0h) | Added: RLVa-1.3.0h + if ( (drop) && ( (!rlv_handler_t::isEnabled()) || (gRlvHandler.canStartIM(dest_agent_id)) ) ) +// [/RLVa:KB] { // Start up IM before give the item session_id = gIMMgr->addSession(avatar_name, IM_NOTHING_SPECIAL, dest_agent_id); diff --git a/indra/newview/llfloaterfriends.cpp b/indra/newview/llfloaterfriends.cpp index d759fd52c..e6017e50e 100644 --- a/indra/newview/llfloaterfriends.cpp +++ b/indra/newview/llfloaterfriends.cpp @@ -37,46 +37,31 @@ #include "llfloaterfriends.h" -#include - -#include "lldir.h" #include "llagent.h" -#include "llappviewer.h" // for gLastVersionChannel - +#include "llavataractions.h" #include "llavatarnamecache.h" - -#include "llfloateravatarpicker.h" -#include "llviewerwindow.h" #include "llbutton.h" +#include "lldir.h" +#include "lleventtimer.h" #include "llfiltereditor.h" -#include "llfloateravatarinfo.h" -#include "llinventorymodel.h" +#include "llfloateravatarpicker.h" #include "llnamelistctrl.h" #include "llnotificationsutil.h" -#include "llresmgr.h" -#include "llimview.h" -#include "lluictrlfactory.h" -#include "llmenucommands.h" -#include "llviewercontrol.h" -#include "llviewermessage.h" -#include "lleventtimer.h" +#include "llsdserialize.h" #include "lltextbox.h" +#include "lluictrlfactory.h" +#include "llviewerwindow.h" #include "llvoiceclient.h" -#include "llsdserialize.h" #include "statemachine/aifilepicker.h" -#include "llviewermenufile.h" -#include "llviewermenu.h" -#include "llviewernetwork.h" #include "hippogridmanager.h" -#include "llchat.h" -#include "llfloaterchat.h" - // stuff for Contact groups //#include "ascentfloatercontactgroups.h" +//#include "llchat.h" +//#include "llfloaterchat.h" #define DEFAULT_PERIOD 5.0 #define RIGHTS_CHANGE_TIMEOUT 5.0 @@ -399,10 +384,10 @@ BOOL LLPanelFriends::postBuild() //childSetAction("assign_btn", onClickAssign, this); childSetAction("expand_collapse_btn", onClickExpand, this); childSetAction("profile_btn", onClickProfile, this); - childSetAction("offer_teleport_btn", onClickOfferTeleport, this); + getChild("offer_teleport_btn")->setCommitCallback(boost::bind(static_cast(LLAvatarActions::offerTeleport), boost::bind(&LLScrollListCtrl::getSelectedIDs, mFriendsList))); childSetAction("pay_btn", onClickPay, this); childSetAction("add_btn", onClickAddFriend, this); - childSetAction("remove_btn", onClickRemove, this); + getChild("remove_btn")->setCommitCallback(boost::bind(LLAvatarActions::removeFriendsDialog, boost::bind(&LLScrollListCtrl::getSelectedIDs, mFriendsList))); //childSetAction("export_btn", onClickExport, this); Making Dummy View -HgB //childSetAction("import_btn", onClickImport, this); Making Dummy View -HgB @@ -685,7 +670,6 @@ BOOL LLPanelFriends::refreshNamesSync(const LLAvatarTracker::buddy_map_t & all_b BOOL LLPanelFriends::refreshNamesPresence(const LLAvatarTracker::buddy_map_t & all_buddies) { - std::vector items = mFriendsList->getAllData(); std::sort(items.begin(), items.end(), SortFriendsByID()); @@ -784,10 +768,7 @@ void LLPanelFriends::onClickProfile(void* user_data) const uuid_vec_t ids = panelp->mFriendsList->getSelectedIDs(); if(!ids.empty()) { - LLUUID agent_id = ids[0]; - BOOL online; - online = LLAvatarTracker::instance().isBuddyOnline(agent_id); - LLFloaterAvatarInfo::showFromFriend(agent_id, online); + LLAvatarActions::showProfile(ids[0]); } } @@ -843,14 +824,6 @@ void LLPanelFriends::updateColumns(void* user_data) } } -static void on_avatar_name_cache_start_im(const LLUUID& agent_id, const LLAvatarName& av_name) -{ - static LLCachedControl tear_off("OtherChatsTornOff"); - if (!tear_off) gIMMgr->setFloaterOpen(true); - gIMMgr->addSession(LLCacheName::cleanFullName(av_name.getLegacyName()), IM_NOTHING_SPECIAL, agent_id); - make_ui_sound("UISndStartIM"); -} - void LLPanelFriends::onClickIM(void* user_data) { LLPanelFriends* panelp = (LLPanelFriends*)user_data; @@ -861,95 +834,22 @@ void LLPanelFriends::onClickIM(void* user_data) { if(ids.size() == 1) { - LLAvatarNameCache::get(ids[0], boost::bind(&on_avatar_name_cache_start_im, _1, _2)); + LLAvatarActions::startIM(ids[0]); } else { - static LLCachedControl tear_off("OtherChatsTornOff"); - if (!tear_off) gIMMgr->setFloaterOpen(true); - gIMMgr->addSession("Friends Conference", IM_SESSION_CONFERENCE_START, ids[0], ids); - make_ui_sound("UISndStartIM"); + LLAvatarActions::startConference(ids); } } } -// static -void LLPanelFriends::requestFriendship(const LLUUID& target_id, const std::string& target_name, const std::string& message) -{ - LLUUID calling_card_folder_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_CALLINGCARD); - send_improved_im(target_id, - target_name, - message, - IM_ONLINE, - IM_FRIENDSHIP_OFFERED, - calling_card_folder_id); -} - -// static -bool LLPanelFriends::callbackAddFriendWithMessage(const LLSD& notification, const LLSD& response) -{ - S32 option = LLNotificationsUtil::getSelectedOption(notification, response); - if (option == 0) - { - requestFriendship(notification["payload"]["id"].asUUID(), - notification["payload"]["name"].asString(), - response["message"].asString()); - } - return false; -} - -bool LLPanelFriends::callbackAddFriend(const LLSD& notification, const LLSD& response) -{ - S32 option = LLNotification::getSelectedOption(notification, response); - if (option == 0) - { - // 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(LLFolderType::FT_CALLINGCARD); - std::string message = calling_card_folder_id.asString(); - requestFriendship(notification["payload"]["id"].asUUID(), - notification["payload"]["name"].asString(), - message); - } - return false; -} - // static void LLPanelFriends::onPickAvatar( const uuid_vec_t& ids, const std::vector& names ) { if (names.empty()) return; if (ids.empty()) return; - requestFriendshipDialog(ids[0], names[0].getCompleteName()); -} - -// static -void LLPanelFriends::requestFriendshipDialog(const LLUUID& id, - const std::string& name) -{ - if(id == gAgentID) - { - LLNotificationsUtil::add("AddSelfFriend"); - return; - } - - LLSD args; - args["NAME"] = name; - LLSD payload; - payload["id"] = id; - payload["name"] = name; - // Look for server versions like: Second Life Server 1.24.4.95600 - if (gLastVersionChannel.find(" 1.24.") != std::string::npos) - { - // Old and busted server version, doesn't support friend - // requests with messages. - LLNotificationsUtil::add("AddFriend", args, payload, &callbackAddFriend); - } - else - { - LLNotificationsUtil::add("AddFriendWithMessage", args, payload, &callbackAddFriendWithMessage); - } + LLAvatarActions::requestFriendshipDialog(ids[0], names[0].getCompleteName()); } // static @@ -964,44 +864,6 @@ void LLPanelFriends::onClickAddFriend(void* user_data) } } -// static -void LLPanelFriends::onClickRemove(void* user_data) -{ - LLPanelFriends* panelp = (LLPanelFriends*)user_data; - - //llinfos << "LLPanelFriends::onClickRemove()" << llendl; - const uuid_vec_t ids = panelp->mFriendsList->getSelectedIDs(); - LLSD args; - if(!ids.empty()) - { - std::string msgType = "RemoveFromFriends"; - if(ids.size() == 1) - { - LLUUID agent_id = ids[0]; - std::string fullname; - if (LLAvatarNameCache::getPNSName(agent_id, fullname)) - args["NAME"] = fullname; - } - else - { - msgType = "RemoveMultipleFromFriends"; - } - LLSD payload; - - for (uuid_vec_t::const_iterator it = ids.begin(); - it != ids.end(); - ++it) - { - payload["ids"].append(*it); - } - - LLNotifications::instance().add(msgType, - args, - payload, - &handleRemove); - } -} - void LLPanelFriends::onClickExport(void* user_data) { std::string agn; @@ -1052,7 +914,6 @@ void LLPanelFriends::onClickExport_continued(void* user_data, AIFilePicker* file export_file.close(); } -bool LLPanelFriends::merging; void LLPanelFriends::onClickImport(void* user_data) { @@ -1093,6 +954,7 @@ void LLPanelFriends::onClickImport_filepicker_continued(AIFilePicker* filepicker LLSD importstatellsd; LLSDSerialize::fromXMLDocument(importstatellsd, stateload); + static bool merging; //LLMessageSystem* msg = gMessageSystem; LLSD newdata; @@ -1110,10 +972,10 @@ void LLPanelFriends::onClickImport_filepicker_continued(AIFilePicker* filepicker if(merging && importstatellsd.has(agent_id.asString()))continue;//dont need to request what we've already requested from another list import and have not got a reply yet std::string agent_name = content["name"]; - if(!is_agent_friend(agent_id))//dont need to request what we have + if(!LLAvatarActions::isFriend(agent_id))//dont need to request what we have { if(merging)importstatellsd[agent_id.asString()] = content;//MERGEEEE - requestFriendship(agent_id, agent_name, "Imported from "+file); + LLAvatarActions::requestFriendship(agent_id, agent_name, "Imported from "+file); newdata[iter->first] = iter->second; }else { @@ -1157,7 +1019,7 @@ void LLPanelFriends::FriendImportState(LLUUID id, bool accepted) if(can_map)rights |= LLRelationship::GRANT_MAP_LOCATION; if(can_mod)rights |= LLRelationship::GRANT_MODIFY_OBJECTS; if(see_online)rights |= LLRelationship::GRANT_ONLINE_STATUS; - if(is_agent_friend(id))//is this legit shit yo + if(LLAvatarActions::isFriend(id))//is this legit shit yo { const LLRelationship* friend_status = LLAvatarTracker::instance().getBuddyInfo(id); if(friend_status) @@ -1187,18 +1049,6 @@ void LLPanelFriends::FriendImportState(LLUUID id, bool accepted) } } -// static -void LLPanelFriends::onClickOfferTeleport(void* user_data) -{ - LLPanelFriends* panelp = (LLPanelFriends*)user_data; - - const uuid_vec_t ids = panelp->mFriendsList->getSelectedIDs(); - if(!ids.empty()) - { - handle_lure(ids); - } -} - // static void LLPanelFriends::onClickPay(void* user_data) { @@ -1207,58 +1057,52 @@ void LLPanelFriends::onClickPay(void* user_data) const uuid_vec_t ids = panelp->mFriendsList->getSelectedIDs(); if(!ids.empty()) { - handle_pay_by_id(ids[0]); + LLAvatarActions::pay(ids[0]); } } -void LLPanelFriends::confirmModifyRights(rights_map_t& ids, EGrantRevoke command) +void LLPanelFriends::confirmModifyRights(rights_map_t& rights, EGrantRevoke command) { - if (ids.empty()) return; + if (rights.empty()) return; - LLSD args; - if(!ids.empty()) + // for single friend, show their name + if (rights.size() == 1) { - rights_map_t* rights = new rights_map_t(ids); + LLSD args; + std::string fullname; + if (LLAvatarNameCache::getPNSName(rights.begin()->first, fullname)) + args["NAME"] = fullname; - // for single friend, show their name - if(ids.size() == 1) + if (command == GRANT) { - LLUUID agent_id = ids.begin()->first; - std::string fullname; - if (LLAvatarNameCache::getPNSName(agent_id, fullname)) - args["NAME"] = fullname; - - if (command == GRANT) - { - LLNotificationsUtil::add("GrantModifyRights", - args, - LLSD(), - boost::bind(&LLPanelFriends::modifyRightsConfirmation, this, _1, _2, rights)); - } - else - { - LLNotificationsUtil::add("RevokeModifyRights", - args, - LLSD(), - boost::bind(&LLPanelFriends::modifyRightsConfirmation, this, _1, _2, rights)); - } + LLNotificationsUtil::add("GrantModifyRights", + args, + LLSD(), + boost::bind(&LLPanelFriends::modifyRightsConfirmation, this, _1, _2, &rights)); } else { - if (command == GRANT) - { - LLNotificationsUtil::add("GrantModifyRightsMultiple", - args, - LLSD(), - boost::bind(&LLPanelFriends::modifyRightsConfirmation, this, _1, _2, rights)); - } - else - { - LLNotificationsUtil::add("RevokeModifyRightsMultiple", - args, - LLSD(), - boost::bind(&LLPanelFriends::modifyRightsConfirmation, this, _1, _2, rights)); - } + LLNotificationsUtil::add("RevokeModifyRights", + args, + LLSD(), + boost::bind(&LLPanelFriends::modifyRightsConfirmation, this, _1, _2, &rights)); + } + } + else + { + if (command == GRANT) + { + LLNotificationsUtil::add("GrantModifyRightsMultiple", + LLSD(), + LLSD(), + boost::bind(&LLPanelFriends::modifyRightsConfirmation, this, _1, _2, &rights)); + } + else + { + LLNotificationsUtil::add("RevokeModifyRightsMultiple", + LLSD(), + LLSD(), + boost::bind(&LLPanelFriends::modifyRightsConfirmation, this, _1, _2, &rights)); } } } @@ -1405,42 +1249,3 @@ void LLPanelFriends::sendRightsGrant(rights_map_t& ids) mNumRightsChanged = ids.size(); gAgent.sendReliableMessage(); } - - - -// static -bool LLPanelFriends::handleRemove(const LLSD& notification, const LLSD& response) -{ - S32 option = LLNotificationsUtil::getSelectedOption(notification, response); - - const LLSD& ids = notification["payload"]["ids"]; - for(LLSD::array_const_iterator itr = ids.beginArray(); itr != ids.endArray(); ++itr) - { - LLUUID id = itr->asUUID(); - const LLRelationship* ip = LLAvatarTracker::instance().getBuddyInfo(id); - if(ip) - { - switch(option) - { - case 0: // YES - if( ip->isRightGrantedTo(LLRelationship::GRANT_MODIFY_OBJECTS)) - { - LLAvatarTracker::instance().empower(id, FALSE); - LLAvatarTracker::instance().notifyObservers(); - } - LLAvatarTracker::instance().terminateBuddy(id); - LLAvatarTracker::instance().notifyObservers(); - gInventory.addChangedMask(LLInventoryObserver::LABEL | LLInventoryObserver::CALLING_CARD, LLUUID::null); - gInventory.notifyObservers(); - break; - - case 1: // NO - default: - llinfos << "No removal performed." << llendl; - break; - } - } - - } - return false; -} diff --git a/indra/newview/llfloaterfriends.h b/indra/newview/llfloaterfriends.h index 5fa23fe52..c82db7886 100644 --- a/indra/newview/llfloaterfriends.h +++ b/indra/newview/llfloaterfriends.h @@ -76,15 +76,6 @@ public: virtual BOOL postBuild(); - // Show a dialog explaining what friendship entails, then request - // friendship. JC - static void requestFriendshipDialog(const LLUUID& target_id, - const std::string& target_name); - - // Just request friendship, no dialog. - static void requestFriendship(const LLUUID& target_id, - const std::string& target_name, const std::string& message); - void populateContactGroupSelect(); private: @@ -130,8 +121,6 @@ private: // callback methods static void onSelectName(LLUICtrl* ctrl, void* user_data); static void onChangeContactGroup(LLUICtrl* ctrl, void* user_data); - static bool callbackAddFriend(const LLSD& notification, const LLSD& response); - static bool callbackAddFriendWithMessage(const LLSD& notification, const LLSD& response); static void onPickAvatar(const uuid_vec_t& ids, const std::vector& names ); void onContactFilterEdit(const std::string& search_string); static void onClickIM(void* user_data); @@ -140,7 +129,6 @@ private: static void updateColumns(void* user_data); static void onClickProfile(void* user_data); static void onClickAddFriend(void* user_data); - static void onClickRemove(void* user_data); static void onClickExport(void* user_data); static void onClickExport_continued(void* user_data, AIFilePicker* filepicker); static void onClickImport(void* user_data); @@ -148,12 +136,9 @@ private: public: static void FriendImportState(LLUUID id, bool accepted); private: - static void onClickOfferTeleport(void* user_data); static void onClickPay(void* user_data); static void onClickModifyStatus(LLUICtrl* ctrl, void* user_data); - - static bool handleRemove(const LLSD& notification, const LLSD& response); bool modifyRightsConfirmation(const LLSD& notification, const LLSD& response, rights_map_t* rights); private: @@ -168,7 +153,6 @@ private: S32 mNumRightsChanged; S32 mNumOnline; std::string mLastContactSearch; - static bool merging; }; diff --git a/indra/newview/llfloatergroups.cpp b/indra/newview/llfloatergroups.cpp index a1b0f4ae9..fe9fc1267 100644 --- a/indra/newview/llfloatergroups.cpp +++ b/indra/newview/llfloatergroups.cpp @@ -376,7 +376,6 @@ void LLPanelGroups::info() void LLPanelGroups::startIM() { - //llinfos << "LLPanelFriends::onClickIM()" << llendl; LLCtrlListInterface *group_list = childGetListInterface("group list"); LLUUID group_id; diff --git a/indra/newview/llfloaterinspect.cpp b/indra/newview/llfloaterinspect.cpp index 007a4670d..33d735f42 100644 --- a/indra/newview/llfloaterinspect.cpp +++ b/indra/newview/llfloaterinspect.cpp @@ -31,7 +31,8 @@ */ #include "llviewerprecompiledheaders.h" -#include "llfloateravatarinfo.h" + +#include "llavataractions.h" #include "llfloaterinspect.h" #include "llfloatertools.h" #include "llcachename.h" @@ -39,7 +40,6 @@ #include "llselectmgr.h" #include "lltoolcomp.h" #include "lltoolmgr.h" -#include "llviewercontrol.h" #include "llviewerobject.h" #include "lluictrlfactory.h" @@ -123,7 +123,7 @@ void LLFloaterInspect::onClickCreatorProfile(void* ctrl) LLSelectNode* node = sInstance->mObjectSelection->getFirstNode(&func); if(node) { - LLFloaterAvatarInfo::showFromDirectory(node->mPermissions->getCreator()); + LLAvatarActions::showProfile(node->mPermissions->getCreator()); } } } @@ -153,10 +153,10 @@ void LLFloaterInspect::onClickOwnerProfile(void* ctrl) // [RLVa:KB] - Checked: 2009-07-08 (RLVa-1.0.0e) if (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) { - LLFloaterAvatarInfo::showFromDirectory(owner_id); + LLAvatarActions::showProfile(owner_id); } // [/RLVa:KB] -// LLFloaterAvatarInfo::showFromDirectory(owner_id); +// LLAvatarActions::showProfile(owner_id); } } } diff --git a/indra/newview/llfloaterland.cpp b/indra/newview/llfloaterland.cpp index a00a1914d..755a1d6aa 100644 --- a/indra/newview/llfloaterland.cpp +++ b/indra/newview/llfloaterland.cpp @@ -47,13 +47,13 @@ #include "llagent.h" #include "llagentaccess.h" +#include "llavataractions.h" #include "llavatarconstants.h" //For new Online check - HgB #include "llbutton.h" #include "llcheckboxctrl.h" #include "llradiogroup.h" #include "llcombobox.h" #include "llfloaterauction.h" -#include "llfloateravatarinfo.h" #include "llfloateravatarpicker.h" #include "llfloatergroups.h" #include "llfloatergroupinfo.h" @@ -864,8 +864,7 @@ void LLPanelLandGeneral::onClickProfile() } else { - const LLUUID& avatar_id = parcel->getOwnerID(); - LLFloaterAvatarInfo::showFromObject(avatar_id); + LLAvatarActions::showProfile(parcel->getOwnerID()); } } @@ -1183,7 +1182,7 @@ void LLPanelLandObjects::onDoubleClickOwner(void *userdata) } else { - LLFloaterAvatarInfo::showFromDirectory(owner_id); + LLAvatarActions::showProfile(owner_id); } } } diff --git a/indra/newview/llfloaterobjectiminfo.cpp b/indra/newview/llfloaterobjectiminfo.cpp index 3ecc140b7..678ba576a 100644 --- a/indra/newview/llfloaterobjectiminfo.cpp +++ b/indra/newview/llfloaterobjectiminfo.cpp @@ -35,10 +35,9 @@ #include "llfloaterobjectiminfo.h" #include "llagentdata.h" +#include "llavataractions.h" #include "llcachename.h" #include "llcommandhandler.h" -#include "llfloater.h" -#include "llfloateravatarinfo.h" #include "llfloatergroupinfo.h" #include "llfloatermute.h" #include "llmutelist.h" @@ -154,7 +153,7 @@ void LLFloaterObjectIMInfo::onClickOwner(void* data) else if ( (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) || (!RlvUtil::isNearbyAgent(self->mOwnerID)) ) // [/RLVa:KB] { - LLFloaterAvatarInfo::showFromObject(self->mOwnerID); + LLAvatarActions::showProfile(self->mOwnerID); } } diff --git a/indra/newview/llfloaterproperties.cpp b/indra/newview/llfloaterproperties.cpp index 84d8f0650..e73e4e4a2 100644 --- a/indra/newview/llfloaterproperties.cpp +++ b/indra/newview/llfloaterproperties.cpp @@ -41,18 +41,19 @@ #include "llinventorydefines.h" #include "llagent.h" +#include "llavataractions.h" #include "llbutton.h" #include "llcheckboxctrl.h" -#include "llfloateravatarinfo.h" #include "llfloatergroupinfo.h" #include "llinventorymodel.h" +#include "llinventoryobserver.h" #include "lllineeditor.h" #include "llradiogroup.h" #include "llresmgr.h" #include "roles_constants.h" #include "llselectmgr.h" #include "lltextbox.h" -#include "lluiconstants.h" +#include "lltrans.h" #include "llviewerinventory.h" #include "llviewerobjectlist.h" #include "llviewerregion.h" @@ -593,10 +594,7 @@ void LLFloaterProperties::onClickCreator() { LLInventoryItem* item = findItem(); if(!item) return; - if(!item->getCreatorUUID().isNull()) - { - LLFloaterAvatarInfo::showFromObject(item->getCreatorUUID()); - } + LLAvatarActions::showProfile(item->getCreatorUUID()); } // static @@ -610,12 +608,11 @@ void LLFloaterProperties::onClickOwner() } else { -// if(!item->getPermissions().getOwner().isNull()) // [RLVa:KB] - Checked: 2009-07-08 (RLVa-1.0.0e) - if ( (!item->getPermissions().getOwner().isNull()) && (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) ) + if (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) // [/RLVa:KB] { - LLFloaterAvatarInfo::showFromObject(item->getPermissions().getOwner()); + LLAvatarActions::showProfile(item->getPermissions().getOwner()); } } } @@ -970,7 +967,7 @@ void LLFloaterProperties::dirtyAll() /// LLMultiProperties ///---------------------------------------------------------------------------- -LLMultiProperties::LLMultiProperties(const LLRect &rect) : LLMultiFloater(std::string("Properties"), rect) +LLMultiProperties::LLMultiProperties(const LLRect &rect) : LLMultiFloater(LLTrans::getString("MultiPropertiesTitle"), rect) { } diff --git a/indra/newview/llfloatertopobjects.cpp b/indra/newview/llfloatertopobjects.cpp index e737b3d56..46757f75b 100644 --- a/indra/newview/llfloatertopobjects.cpp +++ b/indra/newview/llfloatertopobjects.cpp @@ -38,9 +38,9 @@ #include "llfontgl.h" #include "llagent.h" +#include "llavataractions.h" #include "llbutton.h" #include "llfloatergodtools.h" -#include "llfloateravatarinfo.h" #include "llnotificationsutil.h" #include "llparcel.h" #include "llscrolllistctrl.h" @@ -481,8 +481,7 @@ void LLFloaterTopObjects::onProfile(void* data) if (!list) return; LLScrollListItem* first_selected = list->getFirstSelected(); if (!first_selected) return; - LLUUID taskid = first_selected->getUUID(); - LLFloaterAvatarInfo::showFromDirectory(taskid); + LLAvatarActions::showProfile(first_selected->getUUID()); } void LLFloaterTopObjects::onKickBtn(void* data) diff --git a/indra/newview/llgiveinventory.cpp b/indra/newview/llgiveinventory.cpp index 09f690cf0..25885e68f 100644 --- a/indra/newview/llgiveinventory.cpp +++ b/indra/newview/llgiveinventory.cpp @@ -320,6 +320,20 @@ void LLGiveInventory::logInventoryOffer(const LLUUID& to_agent, const LLUUID &im { gIMMgr->addSystemMessage(im_session_id, "inventory_item_offered", args); } +// [RLVa:KB] - Checked: 2010-05-26 (RLVa-1.2.2a) | Modified: RLVa-1.2.0h + else if ( (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) && (RlvUtil::isNearbyAgent(to_agent)) && + (!RlvUIEnabler::hasOpenProfile(to_agent)) ) + { + // Log to chat history if the user didn't drop on an IM session or a profile to avoid revealing the name of the recipient + std::string strMsgName = "inventory_item_offered"; LLSD args; LLAvatarName avName; + if (LLAvatarNameCache::get(to_agent, &avName)) + { + args["NAME"] = RlvStrings::getAnonym(avName); + strMsgName = "inventory_item_offered_rlv"; + } + gIMMgr->addSystemMessage(LLUUID::null, strMsgName, args); + } +// [/RLVa:KB] // If this item was given by drag-and-drop on avatar while IM panel was open, log this action in the IM panel chat. else if (gIMMgr->isIMSessionOpen(session_id)) { diff --git a/indra/newview/llgivemoney.cpp b/indra/newview/llgivemoney.cpp index b153216ac..6816c378a 100644 --- a/indra/newview/llgivemoney.cpp +++ b/indra/newview/llgivemoney.cpp @@ -347,17 +347,15 @@ void LLFloaterPay::onCacheOwnerName(const LLUUID& owner_id, const std::string& full_name, bool is_group) { - if (is_group) + if (LLView* view = findChild("payee_group")) { - childSetVisible("payee_group",true); - childSetVisible("payee_resident",false); + view->setVisible(is_group); } - else + if (LLView* view = findChild("payee_resident")) { - childSetVisible("payee_group",false); - childSetVisible("payee_resident",true); + view->setVisible(!is_group); } - + childSetTextArg("payee_name", "[NAME]", full_name); } diff --git a/indra/newview/llimpanel.cpp b/indra/newview/llimpanel.cpp index 9e9cd87c8..4ccab4186 100644 --- a/indra/newview/llimpanel.cpp +++ b/indra/newview/llimpanel.cpp @@ -45,13 +45,12 @@ #include "llnotificationsutil.h" #include "llagent.h" +#include "llavataractions.h" #include "llbutton.h" #include "llcallingcard.h" #include "llchat.h" #include "llconsole.h" -#include "llfloater.h" #include "llfloateractivespeakers.h" -#include "llfloateravatarinfo.h" #include "llfloaterchat.h" #include "llfloatergroupinfo.h" #include "llimview.h" @@ -1358,11 +1357,11 @@ BOOL LLFloaterIMPanel::postBuild() if (LLButton* btn = findChild("profile_callee_btn")) { - btn->setCommitCallback(boost::bind(&LLFloaterIMPanel::onClickProfile, this)); + btn->setCommitCallback(boost::bind(LLAvatarActions::showProfile, mOtherParticipantUUID)); if (!mProfileButtonEnabled) btn->setEnabled(false); } if (LLButton* btn = findChild("profile_tele_btn")) - btn->setCommitCallback(boost::bind(&LLFloaterIMPanel::onClickTeleport, this)); + btn->setCommitCallback(boost::bind(static_cast(LLAvatarActions::offerTeleport), mOtherParticipantUUID)); if (LLButton* btn = findChild("group_info_btn")) btn->setCommitCallback(boost::bind(&LLFloaterIMPanel::onClickGroupInfo, this)); childSetAction("history_btn", onClickHistory, this); @@ -1876,25 +1875,6 @@ void LLFloaterIMPanel::onTabClick(void* userdata) } -void LLFloaterIMPanel::onClickProfile() -{ - // Bring up the Profile window - if (mOtherParticipantUUID.notNull()) - { - LLFloaterAvatarInfo::showFromDirectory(mOtherParticipantUUID); - } -} - -void LLFloaterIMPanel::onClickTeleport() -{ - if (mOtherParticipantUUID.notNull()) - { - handle_lure(mOtherParticipantUUID); - //do a teleport to other part id - //LLFloaterAvatarInfo::showFromDirectory(mOtherParticipantID); - } -} - void LLFloaterIMPanel::onRPMode(const LLSD& value) { mRPMode = value.asBoolean(); diff --git a/indra/newview/llimpanel.h b/indra/newview/llimpanel.h index 95f5eb41e..0d4ecc9ae 100644 --- a/indra/newview/llimpanel.h +++ b/indra/newview/llimpanel.h @@ -239,10 +239,8 @@ public: void onInputEditorKeystroke(LLLineEditor* caller); static void onTabClick( void* userdata ); - void onClickProfile(); static void onClickHistory( void* userdata ); void onRPMode(const LLSD& value); - void onClickTeleport(); void onClickGroupInfo(); static void onClickClose( void* userdata ); static void onClickStartCall( void* userdata ); diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index b04a2cd18..ff46d3ab3 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -36,7 +36,6 @@ #include "llfontgl.h" #include "llrect.h" -#include "llerror.h" #include "llbutton.h" #include "llhttpclient.h" #include "llsdutil_math.h" @@ -46,6 +45,7 @@ #include "llagent.h" #include "llagentcamera.h" +#include "llavataractions.h" #include "llcallingcard.h" #include "llchat.h" #include "llresmgr.h" @@ -53,25 +53,16 @@ #include "llfloaterchatterbox.h" #include "llhttpnode.h" #include "llimpanel.h" -#include "llresizebar.h" #include "llsdserialize.h" #include "lltabcontainer.h" -#include "llviewercontrol.h" -#include "llfloater.h" #include "llmutelist.h" #include "llresizehandle.h" -#include "llkeyboard.h" -#include "llui.h" #include "llviewermenu.h" -#include "llcallingcard.h" -#include "lltoolbar.h" #include "llviewermessage.h" #include "llviewerwindow.h" #include "llnotify.h" #include "llviewerregion.h" -#include "llfirstuse.h" - // [RLVa:KB] #include "rlvhandler.h" // [/RLVa:KB] @@ -402,7 +393,7 @@ bool inviteUserResponse(const LLSD& notification, const LLSD& response) EInstantMessage LLIMMgr::defaultIMTypeForAgent(const LLUUID& agent_id) { EInstantMessage type = IM_NOTHING_SPECIAL; - if(is_agent_friend(agent_id)) + if (LLAvatarActions::isFriend(agent_id)) { if(LLAvatarTracker::instance().isBuddyOnline(agent_id)) { diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 983311680..27c58b764 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -39,9 +39,9 @@ #include "llagentwearables.h" #include "llappearancemgr.h" #include "llattachmentsmgr.h" +#include "llavataractions.h" #include "llcallingcard.h" #include "llfirstuse.h" -#include "llfloateravatarinfo.h" #include "llfloaterchat.h" #include "llfloatercustomize.h" #include "llfloateropenobject.h" @@ -4730,7 +4730,7 @@ void LLCallingCardBridge::buildContextMenu(LLMenuGL& menu, U32 flags) LLInventoryItem* item = getItem(); BOOL good_card = (item - && (LLUUID::null != item->getCreatorUUID()) + && (item->getCreatorUUID().notNull()) && (item->getCreatorUUID() != gAgent.getID())); BOOL user_online = FALSE; if (item) @@ -6441,10 +6441,9 @@ public: virtual void doIt() { LLViewerInventoryItem* item = getItem(); - if (item && item->getCreatorUUID().notNull()) + if (item) { - bool online = LLAvatarTracker::instance().isBuddyOnline(item->getCreatorUUID()); - LLFloaterAvatarInfo::showFromFriend(item->getCreatorUUID(), online); + LLAvatarActions::showProfile(item->getCreatorUUID()); } LLInvFVBridgeAction::doIt(); } diff --git a/indra/newview/llmenucommands.cpp b/indra/newview/llmenucommands.cpp index 988496eeb..94f70d379 100644 --- a/indra/newview/llmenucommands.cpp +++ b/indra/newview/llmenucommands.cpp @@ -78,12 +78,6 @@ void handle_track_avatar(const LLUUID& agent_id, const std::string& name) LLFloaterWorldMap::show(true); } -void handle_pay_by_id(const LLUUID& agent_id) -{ - const BOOL is_group = FALSE; - LLFloaterPay::payDirectly(&give_money, agent_id, is_group); -} - void handle_mouselook(void*) { gAgentCamera.changeCameraToMouselook(); diff --git a/indra/newview/llmenucommands.h b/indra/newview/llmenucommands.h index 03f7a2571..1c4550b07 100644 --- a/indra/newview/llmenucommands.h +++ b/indra/newview/llmenucommands.h @@ -36,7 +36,6 @@ class LLUUID; void handle_track_avatar(const LLUUID& agent_id, const std::string& name); -void handle_pay_by_id(const LLUUID& agent_id); void handle_mouselook(void*); void handle_map(void*); void handle_mini_map(void*); diff --git a/indra/newview/llnetmap.cpp b/indra/newview/llnetmap.cpp index 43fa927b4..7094c67b1 100644 --- a/indra/newview/llnetmap.cpp +++ b/indra/newview/llnetmap.cpp @@ -35,8 +35,6 @@ #include "llnetmap.h" -#include "indra_constants.h" -#include "llui.h" #include "llmath.h" // clampf() #include "llfocusmgr.h" #include "lllocalcliprect.h" @@ -46,11 +44,10 @@ #include "llagent.h" #include "llagentcamera.h" +#include "llavataractions.h" #include "llavatarnamecache.h" #include "llcallingcard.h" #include "llcolorscheme.h" -#include "llviewercontrol.h" -#include "llfloateravatarinfo.h" #include "llfloaterworldmap.h" #include "llframetimer.h" #include "lltracker.h" @@ -58,7 +55,6 @@ #include "llsurface.h" #include "lltextbox.h" #include "lluictrlfactory.h" -#include "lluuid.h" #include "llviewercamera.h" #include "llviewertexturelist.h" #include "llviewermenu.h" @@ -432,7 +428,7 @@ void LLNetMap::draw() avColor = em_color; } //without these dots, SL would suck. - else if(is_agent_friend(id)) + else if(LLAvatarActions::isFriend(id)) { avColor = friend_color; } @@ -1150,10 +1146,10 @@ bool LLNetMap::LLShowAgentProfile::handleEvent(LLPointer event, const L // [RLVa:KB] - Version: 1.23.4 | Checked: 2009-07-08 (RLVa-1.0.0e) | Modified: RLVa-0.2.0b if (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) { - LLFloaterAvatarInfo::show(self->mClosestAgentAtLastRightClick); + LLAvatarActions::showProfile(self->mClosestAgentAtLastRightClick); } // [/RLVa:KB] - //LLFloaterAvatarInfo::show(self->mClosestAgentAtLastRightClick); + //LLAvatarActions::showProfile(self->mClosestAgentAtLastRightClick); return true; } diff --git a/indra/newview/llpanelavatar.cpp b/indra/newview/llpanelavatar.cpp index 7af76fe68..1df44e508 100644 --- a/indra/newview/llpanelavatar.cpp +++ b/indra/newview/llpanelavatar.cpp @@ -34,74 +34,47 @@ #include "llpanelavatar.h" -#include "llclassifiedflags.h" -#include "llfontgl.h" -#include "llcachename.h" - #include "llavatarconstants.h" -#include "lluiconstants.h" -#include "lltextbox.h" -#include "llviewertexteditor.h" -#include "lltexturectrl.h" -#include "llagent.h" -#include "llviewerwindow.h" +#include "llavatarnamecache.h" #include "llbutton.h" -#include "llcallingcard.h" #include "llcheckboxctrl.h" -#include "llfloater.h" +#include "llclassifiedflags.h" +#include "lltextbox.h" +#include "lltexteditor.h" +#include "lltexturectrl.h" +#include "llwindow.h" -#include "llfloaterfriends.h" +#include "llagent.h" +#include "llavataractions.h" +#include "llcallingcard.h" +#include "lldroptarget.h" #include "llfloatergroupinfo.h" -#include "llfloatergroups.h" -#include "llfloaterinventory.h" -#include "llfloaterworldmap.h" #include "llfloatermute.h" #include "llfloateravatarinfo.h" -#include "lliconctrl.h" #include "lllineeditor.h" #include "llnameeditor.h" -#include "llmutelist.h" #include "llnotificationsutil.h" #include "llpanelclassified.h" #include "llpanelpick.h" #include "llpreviewtexture.h" #include "llpluginclassmedia.h" #include "llscrolllistctrl.h" -#include "llstatusbar.h" #include "lltabcontainer.h" -#include "llimview.h" -#include "llvoavatar.h" -#include "llviewercontrol.h" -#include "llviewergenericmessage.h" // send_generic_message -#include "llviewerobjectlist.h" -#include "llviewerregion.h" -#include "llweb.h" -#include "llinventorymodel.h" -#include "roles_constants.h" #include "lluictrlfactory.h" -#include "llavatarnamecache.h" -#include "lldroptarget.h" - +#include "llviewerwindow.h" +#include "llweb.h" #include #include - - // [RLVa:KB] #include "rlvhandler.h" // [/RLVa:KB] -#include "llavatarname.h" - // Statics std::list LLPanelAvatar::sAllPanels; BOOL LLPanelAvatar::sAllowFirstLife = FALSE; -extern void callback_invite_to_group(LLUUID group_id, void *user_data); -extern void handle_lure(const LLUUID& invitee); -extern void handle_pay_by_id(const LLUUID& payee); -BOOL is_agent_friend(const LLUUID& agent_id); BOOL is_agent_mappable(const LLUUID& agent_id); @@ -197,12 +170,6 @@ void LLPanelAvatarSecondLife::clearControls() { group_list->deleteAllItems(); } - /*LLScrollListCtrl* ratings_list = getChild("ratings"); createDummyWidget Making Dummy -HgB - if(ratings_list) - { - ratings_list->deleteAllItems(); - }*/ - } // virtual @@ -421,7 +388,7 @@ void LLPanelAvatarFirstLife::processProperties(void* data, EAvatarProcessorType void LLPanelAvatarSecondLife::onClickImage(void* data) { LLPanelAvatarSecondLife* self = (LLPanelAvatarSecondLife*)data; - LLNameEditor* name_ctrl = self->getChild("name"); + LLNameEditor* name_ctrl = self->getChild("dnname"); if(name_ctrl) { std::string name_text = name_ctrl->getText(); @@ -506,11 +473,7 @@ bool LLPanelAvatarSecondLife::onClickPartnerHelpLoadURL(const LLSD& notification void LLPanelAvatarSecondLife::onClickPartnerInfo(void *data) { LLPanelAvatarSecondLife* self = (LLPanelAvatarSecondLife*) data; - if (self->mPartnerID.notNull()) - { - LLFloaterAvatarInfo::showFromProfile(self->mPartnerID, - self->calcScreenRect()); - } + LLAvatarActions::showProfile(self->mPartnerID); } //----------------------------------------------------------------------------- @@ -542,8 +505,8 @@ BOOL LLPanelAvatarSecondLife::postBuild(void) childSetEnabled("partner_info", mPartnerID.notNull()); childSetAction("?",onClickPublishHelp,this); - BOOL own_avatar = (getPanelAvatar()->getAvatarID() == gAgent.getID() ); - enableControls(own_avatar); + LLPanelAvatar* pa = getPanelAvatar(); + enableControls(pa->getAvatarID() == gAgentID); childSetVisible("About:",LLPanelAvatar::sAllowFirstLife); childSetVisible("(500 chars)",LLPanelAvatar::sAllowFirstLife); @@ -554,16 +517,15 @@ BOOL LLPanelAvatarSecondLife::postBuild(void) childSetVisible("online_yes",FALSE); - childSetAction("Find on Map", LLPanelAvatar::onClickTrack, getPanelAvatar()); - childSetAction("Instant Message...", LLPanelAvatar::onClickIM, getPanelAvatar()); - childSetAction("GroupInvite_Button", LLPanelAvatar::onClickGroupInvite, getPanelAvatar()); + getChild("Find on Map")->setCommitCallback(boost::bind(LLAvatarActions::showOnMap, boost::bind(&LLPanelAvatar::getAvatarID, pa))); + getChild("Instant Message...")->setCommitCallback(boost::bind(LLAvatarActions::startIM, boost::bind(&LLPanelAvatar::getAvatarID, pa))); + getChild("GroupInvite_Button")->setCommitCallback(boost::bind(LLAvatarActions::inviteToGroup, boost::bind(&LLPanelAvatar::getAvatarID, pa))); - childSetAction("Add Friend...", LLPanelAvatar::onClickAddFriend, getPanelAvatar()); - childSetAction("Pay...", LLPanelAvatar::onClickPay, getPanelAvatar()); - childSetAction("Mute", LLPanelAvatar::onClickMute, getPanelAvatar() ); + getChild("Add Friend...")->setCommitCallback(boost::bind(LLAvatarActions::requestFriendshipDialog, boost::bind(&LLPanelAvatar::getAvatarID, pa))); + getChild("Pay...")->setCommitCallback(boost::bind(LLAvatarActions::pay, boost::bind(&LLPanelAvatar::getAvatarID, pa))); + childSetAction("Mute", LLPanelAvatar::onClickMute, pa); - childSetAction("Offer Teleport...", LLPanelAvatar::onClickOfferTeleport, - getPanelAvatar() ); + getChild("Offer Teleport...")->setCommitCallback(boost::bind(static_cast(LLAvatarActions::offerTeleport), boost::bind(&LLPanelAvatar::getAvatarID, pa))); getChild("groups")->setDoubleClickCallback(boost::bind(&LLPanelAvatarSecondLife::onDoubleClickGroup,this)); @@ -600,8 +562,6 @@ BOOL LLPanelAvatarWeb::postBuild(void) url_edit->setKeystrokeCallback(boost::bind(&LLPanelAvatarWeb::onURLKeystroke,this,_1)); url_edit->setCommitCallback(boost::bind(&LLPanelAvatarWeb::onCommitURL,this,_2)); - getChild("load")->setCommitCallback(boost::bind(&LLPanelAvatarWeb::onCommitLoad,this,_2)); - childSetAction("web_profile_help",onClickWebProfileHelp,this); childSetControlName("auto_load","AutoLoadWebProfiles"); @@ -621,7 +581,7 @@ void LLPanelAvatarWeb::processProperties(void* data, EAvatarProcessorType type) if(type == APT_PROPERTIES) { const LLAvatarData* pAvatarData = static_cast( data ); - if (pAvatarData && (mAvatarID == pAvatarData->avatar_id) && (pAvatarData->avatar_id != LLUUID::null)) + if (pAvatarData && (mAvatarID == pAvatarData->avatar_id) && (pAvatarData->avatar_id.notNull())) { setWebURL(pAvatarData->profile_url); } @@ -1424,14 +1384,13 @@ LLPanelAvatar::LLPanelAvatar( mPanelNotes(NULL), mPanelFirstLife(NULL), mPanelWeb(NULL), - mAvatarID( LLUUID::null ), // mAvatarID is set with 'setAvatar' or 'setAvatarID' + mAvatarID(LLUUID::null), // mAvatarID is set with setAvatarID() mHaveProperties(FALSE), mHaveStatistics(FALSE), mHaveNotes(false), mLastNotes(), mAllowEdit(allow_edit) { - sAllPanels.push_back(this); LLCallbackMap::map_t factory_map; @@ -1447,22 +1406,19 @@ LLPanelAvatar::LLPanelAvatar( LLUICtrlFactory::getInstance()->buildPanel(this, "panel_avatar.xml", &factory_map); selectTab(0); - - } BOOL LLPanelAvatar::postBuild(void) { mTab = getChild("tab"); - childSetAction("Kick",onClickKick,this); - childSetAction("Freeze",onClickFreeze, this); - childSetAction("Unfreeze", onClickUnfreeze, this); - childSetAction("csr_btn", onClickCSR, this); + getChild("Kick")->setCommitCallback(boost::bind(LLAvatarActions::kick, boost::bind(&LLPanelAvatar::getAvatarID, this))); + getChild("Freeze")->setCommitCallback(boost::bind(LLAvatarActions::freeze, boost::bind(&LLPanelAvatar::getAvatarID, this))); + getChild("Unfreeze")->setCommitCallback(boost::bind(LLAvatarActions::unfreeze, boost::bind(&LLPanelAvatar::getAvatarID, this))); + getChild("csr_btn")->setCommitCallback(boost::bind(LLAvatarActions::csr, boost::bind(&LLPanelAvatar::getAvatarID, this))); childSetAction("OK", onClickOK, this); childSetAction("Cancel", onClickCancel, this); childSetAction("copy_key",onClickGetKey,this); - childSetCommitCallback("avatar_key",onCommitKey,this); if(mTab && !sAllowFirstLife) { @@ -1502,38 +1458,6 @@ BOOL LLPanelAvatar::canClose() return !mPanelClassified || mPanelClassified->canClose(); } -void LLPanelAvatar::setAvatar(LLViewerObject *avatarp) -{ - // find the avatar and grab the name - LLNameValue *firstname = avatarp->getNVPair("FirstName"); - LLNameValue *lastname = avatarp->getNVPair("LastName"); - - std::string name; - if (firstname && lastname) - { - name.assign( firstname->getString() ); - name.append(" "); - name.append( lastname->getString() ); - } - else - { - name.assign(""); - } - - // If we have an avatar pointer, they must be online. - setAvatarID(avatarp->getID(), name, ONLINE_STATUS_YES); -} - -void LLPanelAvatar::onCommitKey(LLUICtrl* ctrl, void* data) -{ - LLPanelAvatar* self = (LLPanelAvatar*) data; - std::string keystring = self->getChild("avater_key")->getText(); - LLUUID av_key = LLUUID::null; - if(LLUUID::validate(keystring)) av_key = (LLUUID)keystring; - - self->setAvatarID(av_key, LLStringUtil::null, ONLINE_STATUS_NO); -} - void LLPanelAvatar::setOnlineStatus(EOnlineStatus online_status) { // Online status NO could be because they are hidden @@ -1554,6 +1478,7 @@ void LLPanelAvatar::setOnlineStatus(EOnlineStatus online_status) if (mAvatarID != gAgent.getID()) { childSetVisible("Offer Teleport...",TRUE); + childSetVisible("Find on Map", true); } BOOL in_prelude = gAgent.inPrelude(); @@ -1572,15 +1497,31 @@ void LLPanelAvatar::setOnlineStatus(EOnlineStatus online_status) childSetEnabled("Offer Teleport...", TRUE /*(online_status == ONLINE_STATUS_YES)*/); childSetToolTip("Offer Teleport...", getString("TeleportNormal")); } + + // Note: we don't always know online status, so always allow gods to try to track + childSetEnabled("Find on Map", gAgent.isGodlike() || is_agent_mappable(mAvatarID)); + if (!mIsFriend) + { + childSetToolTip("Find on Map", getString("ShowOnMapNonFriend")); + } + else if (ONLINE_STATUS_YES != online_status) + { + childSetToolTip("Find on Map", getString("ShowOnMapFriendOffline")); + } + else + { + childSetToolTip("Find on Map", getString("ShowOnMapFriendOnline")); + } } -void LLPanelAvatar::onAvatarNameResponse(const LLUUID& agent_id, const LLAvatarName& av_name){ - LLLineEditor* dnname_edit = getChild("dnname"); - if(LLAvatarNameCache::useDisplayNames() && agent_id==mAvatarID) dnname_edit->setText(av_name.getCompleteName()); +void LLPanelAvatar::onAvatarNameResponse(const LLUUID& agent_id, const LLAvatarName& av_name) +{ + std::string name; + LLAvatarNameCache::getPNSName(av_name, name); + getChild("dnname")->setText(name); } -void LLPanelAvatar::setAvatarID(const LLUUID &avatar_id, const std::string &name, - EOnlineStatus online_status) +void LLPanelAvatar::setAvatarID(const LLUUID &avatar_id) { if (avatar_id.isNull()) return; @@ -1598,13 +1539,12 @@ void LLPanelAvatar::setAvatarID(const LLUUID &avatar_id, const std::string &name LLAvatarPropertiesProcessor::getInstance()->addObserver(mAvatarID, this); // Determine if we have their calling card. - mIsFriend = is_agent_friend(mAvatarID); + mIsFriend = LLAvatarActions::isFriend(mAvatarID); // setOnlineStatus uses mIsFriend - setOnlineStatus(online_status); - + setOnlineStatus(ONLINE_STATUS_NO); + BOOL own_avatar = (mAvatarID == gAgent.getID() ); - BOOL avatar_is_friend = LLAvatarTracker::instance().getBuddyInfo(mAvatarID) != NULL; for(std::list::iterator it=mAvatarPanelList.begin();it!=mAvatarPanelList.end();++it) { @@ -1617,41 +1557,10 @@ void LLPanelAvatar::setAvatarID(const LLUUID &avatar_id, const std::string &name // Teens don't have this. if (mPanelFirstLife) mPanelFirstLife->enableControls(own_avatar && mAllowEdit); - getChild("drop_target_rect")->setEntityID(mAvatarID); + if (LLDropTarget* drop_target = findChild("drop_target_rect")) + drop_target->setEntityID(mAvatarID); - LLNameEditor* name_edit = getChild("name"); - if(name_edit) - { - if (name.empty()) - { - name_edit->setNameID(avatar_id, FALSE); - } - else - { - name_edit->setText(name); - } - } - - LLLineEditor* dnname_edit = getChild("dnname"); - LLAvatarName av_name; - if(dnname_edit){ - if(LLAvatarNameCache::useDisplayNames()){ - if(LLAvatarNameCache::get(avatar_id, &av_name)){ - dnname_edit->setText(av_name.getCompleteName()); - } - else{ - dnname_edit->setText(name_edit->getText()); - LLAvatarNameCache::get(avatar_id, boost::bind(&LLPanelAvatar::onAvatarNameResponse, this, _1, _2)); - } - childSetVisible("dnname",TRUE); - childSetVisible("name",FALSE); - } - else - { - childSetVisible("dnname",FALSE); - childSetVisible("name",TRUE); - } - } + LLAvatarNameCache::get(avatar_id, boost::bind(&LLPanelAvatar::onAvatarNameResponse, this, _1, _2)); LLNameEditor* key_edit = getChild("avatar_key"); if(key_edit) @@ -1727,25 +1636,8 @@ void LLPanelAvatar::setAvatarID(const LLUUID &avatar_id, const std::string &name childSetVisible("Mute",TRUE); childSetEnabled("Mute",FALSE); - - childSetVisible("Find on Map",TRUE); - // Note: we don't always know online status, so always allow gods to try to track - BOOL enable_track = gAgent.isGodlike() || is_agent_mappable(mAvatarID); - childSetEnabled("Find on Map",enable_track); - if (!mIsFriend) - { - childSetToolTip("Find on Map", getString("ShowOnMapNonFriend")); - } - else if (ONLINE_STATUS_YES != online_status) - { - childSetToolTip("Find on Map", getString("ShowOnMapFriendOffline")); - } - else - { - childSetToolTip("Find on Map", getString("ShowOnMapFriendOnline")); - } childSetVisible("Add Friend...", true); - childSetEnabled("Add Friend...", !avatar_is_friend); + childSetEnabled("Add Friend...", !mIsFriend); childSetVisible("Pay...",TRUE); childSetEnabled("Pay...",FALSE); } @@ -1756,9 +1648,7 @@ void LLPanelAvatar::setAvatarID(const LLUUID &avatar_id, const std::string &name } } - BOOL is_god = FALSE; - if (gAgent.isGodlike()) is_god = TRUE; - + bool is_god = gAgent.isGodlike(); childSetVisible("Kick", is_god); childSetEnabled("Kick", is_god); childSetVisible("Freeze", is_god); @@ -1832,36 +1722,6 @@ void LLPanelAvatar::resetGroupList() } } -// static -//----------------------------------------------------------------------------- -// onClickIM() -//----------------------------------------------------------------------------- -void LLPanelAvatar::onClickIM(void* userdata) -{ - LLPanelAvatar* self = (LLPanelAvatar*) userdata; - gIMMgr->setFloaterOpen(TRUE); - - std::string name; - LLNameEditor* nameedit = self->mPanelSecondLife->getChild("name"); - if (nameedit) name = nameedit->getText(); - gIMMgr->addSession(name, IM_NOTHING_SPECIAL, self->mAvatarID); -} - -void LLPanelAvatar::onClickGroupInvite(void* userdata) -{ - LLPanelAvatar* self = (LLPanelAvatar*) userdata; - if (self->getAvatarID().notNull()) - { - LLFloaterGroupPicker* widget; - widget = LLFloaterGroupPicker::showInstance(LLSD(gAgent.getID())); - if (widget) - { - widget->center(); - widget->setPowersMask(GP_MEMBER_INVITE); - widget->setSelectCallback(callback_invite_to_group, (void *)&(self->getAvatarID())); - } - } -} //static void LLPanelAvatar::onClickGetKey(void *userdata) { @@ -1873,37 +1733,6 @@ void LLPanelAvatar::onClickGetKey(void *userdata) gViewerWindow->mWindow->copyTextToClipboard(utf8str_to_wstring(agent_id.asString())); } -// static -//----------------------------------------------------------------------------- -// onClickTrack() -//----------------------------------------------------------------------------- -void LLPanelAvatar::onClickTrack(void* userdata) -{ - LLPanelAvatar* self = (LLPanelAvatar*) userdata; - - if( gFloaterWorldMap ) - { - std::string name; - LLNameEditor* nameedit = self->mPanelSecondLife->getChild("name"); - if (nameedit) name = nameedit->getText(); - gFloaterWorldMap->trackAvatar(self->mAvatarID, name); - LLFloaterWorldMap::show(true); - } -} - - -// static -void LLPanelAvatar::onClickAddFriend(void* userdata) -{ - LLPanelAvatar* self = (LLPanelAvatar*) userdata; - LLNameEditor* name_edit = self->mPanelSecondLife->getChild("name"); - if (name_edit) - { - LLPanelFriends::requestFriendshipDialog(self->getAvatarID(), - name_edit->getText()); - } -} - //----------------------------------------------------------------------------- // onClickMute() //----------------------------------------------------------------------------- @@ -1912,43 +1741,18 @@ void LLPanelAvatar::onClickMute(void *userdata) LLPanelAvatar* self = (LLPanelAvatar*) userdata; LLUUID agent_id = self->getAvatarID(); - LLNameEditor* name_edit = self->mPanelSecondLife->getChild("name"); - - if (name_edit) + + LLFloaterMute::showInstance(); + if (LLAvatarActions::isBlocked(agent_id)) { - std::string agent_name = name_edit->getText(); - LLFloaterMute::showInstance(); - - if (LLMuteList::getInstance()->isMuted(agent_id)) - { - LLFloaterMute::getInstance()->selectMute(agent_id); - } - else - { - LLMute mute(agent_id, agent_name, LLMute::AGENT); - LLMuteList::getInstance()->add(mute); - } + LLFloaterMute::getInstance()->selectMute(agent_id); + } + else + { + LLAvatarActions::toggleBlock(agent_id); } } - -// static -void LLPanelAvatar::onClickOfferTeleport(void *userdata) -{ - LLPanelAvatar* self = (LLPanelAvatar*) userdata; - - handle_lure(self->mAvatarID); -} - - -// static -void LLPanelAvatar::onClickPay(void *userdata) -{ - LLPanelAvatar* self = (LLPanelAvatar*) userdata; - handle_pay_by_id(self->mAvatarID); -} - - // static void LLPanelAvatar::onClickOK(void *userdata) { @@ -2043,7 +1847,7 @@ void LLPanelAvatar::processProperties(void* data, EAvatarProcessorType type) if(type == APT_PROPERTIES) { const LLAvatarData* pAvatarData = static_cast( data ); - if (pAvatarData && (mAvatarID == pAvatarData->avatar_id) && (pAvatarData->avatar_id != LLUUID::null)) + if (pAvatarData && (mAvatarID == pAvatarData->avatar_id) && (pAvatarData->avatar_id.notNull())) { childSetEnabled("Instant Message...",TRUE); childSetEnabled("GroupInvite_Button",TRUE); @@ -2166,136 +1970,6 @@ void LLPanelAvatar::selectTabByName(std::string tab_name) } } -// static -void LLPanelAvatar::onClickKick(void* userdata) -{ - LLPanelAvatar* self = (LLPanelAvatar*) userdata; - - S32 left, top; - gFloaterView->getNewFloaterPosition(&left, &top); - LLRect rect(left, top, left+400, top-300); - - LLSD payload; - payload["avatar_id"] = self->mAvatarID; - LLNotificationsUtil::add("KickUser", LLSD(), payload, finishKick); -} - -//static -bool LLPanelAvatar::finishKick(const LLSD& notification, const LLSD& response) -{ - S32 option = LLNotification::getSelectedOption(notification, response); - - if (option == 0) - { - LLUUID avatar_id = notification["payload"]["avatar_id"].asUUID(); - LLMessageSystem* msg = gMessageSystem; - - msg->newMessageFast(_PREHASH_GodKickUser); - msg->nextBlockFast(_PREHASH_UserInfo); - msg->addUUIDFast(_PREHASH_GodID, gAgent.getID() ); - msg->addUUIDFast(_PREHASH_GodSessionID, gAgent.getSessionID()); - msg->addUUIDFast(_PREHASH_AgentID, avatar_id ); - msg->addU32("KickFlags", KICK_FLAGS_DEFAULT ); - msg->addStringFast(_PREHASH_Reason, response["message"].asString() ); - gAgent.sendReliableMessage(); - } - return false; -} - -// static -void LLPanelAvatar::onClickFreeze(void* userdata) -{ - LLPanelAvatar* self = (LLPanelAvatar*) userdata; - LLSD payload; - payload["avatar_id"] = self->mAvatarID; - LLNotificationsUtil::add("FreezeUser", LLSD(), payload, LLPanelAvatar::finishFreeze); -} - -// static -bool LLPanelAvatar::finishFreeze(const LLSD& notification, const LLSD& response) -{ - S32 option = LLNotification::getSelectedOption(notification, response); - - if (option == 0) - { - LLUUID avatar_id = notification["payload"]["avatar_id"].asUUID(); - LLMessageSystem* msg = gMessageSystem; - - msg->newMessageFast(_PREHASH_GodKickUser); - msg->nextBlockFast(_PREHASH_UserInfo); - msg->addUUIDFast(_PREHASH_GodID, gAgent.getID() ); - msg->addUUIDFast(_PREHASH_GodSessionID, gAgent.getSessionID()); - msg->addUUIDFast(_PREHASH_AgentID, avatar_id ); - msg->addU32("KickFlags", KICK_FLAGS_FREEZE ); - msg->addStringFast(_PREHASH_Reason, response["message"].asString() ); - gAgent.sendReliableMessage(); - } - return false; -} - -// static -void LLPanelAvatar::onClickUnfreeze(void* userdata) -{ - LLPanelAvatar* self = (LLPanelAvatar*) userdata; - LLSD payload; - payload["avatar_id"] = self->mAvatarID; - LLNotificationsUtil::add("UnFreezeUser", LLSD(), payload, LLPanelAvatar::finishUnfreeze); -} - -// static -bool LLPanelAvatar::finishUnfreeze(const LLSD& notification, const LLSD& response) -{ - S32 option = LLNotification::getSelectedOption(notification, response); - std::string text = response["message"].asString(); - if (option == 0) - { - LLUUID avatar_id = notification["payload"]["avatar_id"].asUUID(); - LLMessageSystem* msg = gMessageSystem; - - msg->newMessageFast(_PREHASH_GodKickUser); - msg->nextBlockFast(_PREHASH_UserInfo); - msg->addUUIDFast(_PREHASH_GodID, gAgent.getID() ); - msg->addUUIDFast(_PREHASH_GodSessionID, gAgent.getSessionID()); - msg->addUUIDFast(_PREHASH_AgentID, avatar_id ); - msg->addU32("KickFlags", KICK_FLAGS_UNFREEZE ); - msg->addStringFast(_PREHASH_Reason, text ); - gAgent.sendReliableMessage(); - } - return false; -} - -// static -void LLPanelAvatar::onClickCSR(void* userdata) -{ - LLPanelAvatar* self = (LLPanelAvatar*)userdata; - if (!self) return; - - LLNameEditor* name_edit = self->getChild("name"); - if (!name_edit) return; - - std::string name = name_edit->getText(); - if (name.empty()) return; - - std::string url = "http://csr.lindenlab.com/agent/"; - - // slow and stupid, but it's late - S32 len = name.length(); - for (S32 i = 0; i < len; i++) - { - if (name[i] == ' ') - { - url += "%20"; - } - else - { - url += name[i]; - } - } - - LLWeb::loadURL(url); -} - - void* LLPanelAvatar::createPanelAvatarSecondLife(void* data) { LLPanelAvatar* self = (LLPanelAvatar*)data; diff --git a/indra/newview/llpanelavatar.h b/indra/newview/llpanelavatar.h index a524cd915..d43746308 100644 --- a/indra/newview/llpanelavatar.h +++ b/indra/newview/llpanelavatar.h @@ -303,8 +303,7 @@ public: // Fill in the avatar ID and handle some field fill-in, as well as // button enablement. - // Pass one of the ONLINE_STATUS_foo constants above. - void setAvatarID(const LLUUID &avatar_id, const std::string &name, EOnlineStatus online_status); + void setAvatarID(const LLUUID &avatar_id); void setOnlineStatus(EOnlineStatus online_status); @@ -328,30 +327,14 @@ public: BOOL haveData() { return mHaveProperties && mHaveStatistics; } BOOL isEditable() const { return mAllowEdit; } - static void onClickTrack( void *userdata); - static void onClickIM( void *userdata); - static void onClickGroupInvite( void *userdata); - static void onClickOfferTeleport( void *userdata); - static void onClickPay( void *userdata); static void onClickGetKey(void *userdata); - static void onClickAddFriend(void* userdata); static void onClickOK( void *userdata); static void onClickCancel( void *userdata); - static void onClickKick( void *userdata); - static void onClickFreeze( void *userdata); - static void onClickUnfreeze(void *userdata); - static void onClickCSR( void *userdata); static void onClickMute( void *userdata); - static void onCommitKey(LLUICtrl* ctrl, void* data); private: void enableOKIfReady(); - static bool finishKick(const LLSD& notification, const LLSD& response); - static bool finishFreeze(const LLSD& notification, const LLSD& response); - static bool finishUnfreeze(const LLSD& notification, const LLSD& response); - - static void showProfileCallback(S32 option, void *userdata); static void* createPanelAvatar(void* data); static void* createFloaterAvatarInfo(void* data); static void* createPanelAvatarSecondLife(void* data); @@ -393,8 +376,4 @@ private: static panel_list_t sAllPanels; }; -// helper funcs -void add_left_label(LLPanel *panel, const std::string& name, S32 y); - - #endif // LL_LLPANELAVATAR_H diff --git a/indra/newview/llpanelclassified.cpp b/indra/newview/llpanelclassified.cpp index d0d850db3..2b4b7f8eb 100644 --- a/indra/newview/llpanelclassified.cpp +++ b/indra/newview/llpanelclassified.cpp @@ -46,20 +46,18 @@ #include "message.h" #include "llagent.h" +#include "llavataractions.h" #include "llbutton.h" #include "llcheckboxctrl.h" #include "llclassifiedflags.h" #include "llclassifiedstatsresponder.h" #include "llcommandhandler.h" // for classified HTML detail page click tracking -#include "llviewercontrol.h" #include "lllineeditor.h" -#include "llfloateravatarinfo.h" #include "llfloaterclassified.h" #include "lltextbox.h" #include "llcombobox.h" #include "llviewertexteditor.h" #include "lltexturectrl.h" -#include "lluiconstants.h" #include "llurldispatcher.h" // for classified HTML detail click teleports #include "lluictrlfactory.h" #include "llviewerparcelmgr.h" @@ -894,7 +892,7 @@ void LLPanelClassified::onClickMap(void* data) void LLPanelClassified::onClickProfile(void* data) { LLPanelClassified* self = (LLPanelClassified*)data; - LLFloaterAvatarInfo::showFromDirectory(self->mCreatorID); + LLAvatarActions::showProfile(self->mCreatorID); self->sendClassifiedClickMessage("profile"); } diff --git a/indra/newview/llpaneldirbrowser.cpp b/indra/newview/llpaneldirbrowser.cpp index 7480fdffc..929b5c6b8 100644 --- a/indra/newview/llpaneldirbrowser.cpp +++ b/indra/newview/llpaneldirbrowser.cpp @@ -422,7 +422,7 @@ void LLPanelDirBrowser::showDetailPanel(S32 type, LLSD id) if (mFloaterDirectory && mFloaterDirectory->mPanelAvatarp) { mFloaterDirectory->mPanelAvatarp->setVisible(TRUE); - mFloaterDirectory->mPanelAvatarp->setAvatarID(id.asUUID(), LLStringUtil::null, ONLINE_STATUS_NO); + mFloaterDirectory->mPanelAvatarp->setAvatarID(id.asUUID()); } break; case EVENT_CODE: diff --git a/indra/newview/llpaneldirclassified.cpp b/indra/newview/llpaneldirclassified.cpp index e41fbf622..2bc854864 100644 --- a/indra/newview/llpaneldirclassified.cpp +++ b/indra/newview/llpaneldirclassified.cpp @@ -112,8 +112,6 @@ BOOL LLPanelDirClassified::postBuild() getChild("Browse")->setClickedCallback(boost::bind(&LLPanelDirBrowser::onClickSearchCore,this)); setDefaultBtn( "Browse" ); - getChild("Place an Ad...")->setClickedCallback(boost::bind(&LLPanelDirClassified::onClickCreateNewClassified,this)); - getChild("Delete")->setClickedCallback(boost::bind(&LLPanelDirClassified::onClickDelete,this)); childDisable("Delete"); childHide("Delete"); @@ -149,11 +147,6 @@ void LLPanelDirClassified::refresh() updateMaturityCheckbox(); } -void LLPanelDirClassified::onClickCreateNewClassified() -{ - LLFloaterAvatarInfo::showFromObject(gAgent.getID(), "Classified"); -} - void LLPanelDirClassified::onClickDelete() { LLUUID classified_id; diff --git a/indra/newview/llpaneldirclassified.h b/indra/newview/llpaneldirclassified.h index 92b05183f..6e0f73c8b 100644 --- a/indra/newview/llpaneldirclassified.h +++ b/indra/newview/llpaneldirclassified.h @@ -65,9 +65,6 @@ protected: void onClickSearch(); void onKeystrokeNameClassified(LLLineEditor* line); - - // - void onClickCreateNewClassified(); protected: }; diff --git a/indra/newview/llpanelgroupgeneral.cpp b/indra/newview/llpanelgroupgeneral.cpp index f215e8266..1851ac29b 100644 --- a/indra/newview/llpanelgroupgeneral.cpp +++ b/indra/newview/llpanelgroupgeneral.cpp @@ -36,8 +36,8 @@ #include "lluictrlfactory.h" #include "llagent.h" +#include "llavataractions.h" #include "roles_constants.h" -#include "llfloateravatarinfo.h" #include "llfloatergroupinfo.h" // UI elements @@ -394,7 +394,7 @@ void LLPanelGroupGeneral::openProfile(void* data) LLScrollListItem* selected = self->mListVisibleMembers->getFirstSelected(); if (selected) { - LLFloaterAvatarInfo::showFromDirectory( selected->getUUID() ); + LLAvatarActions::showProfile(selected->getUUID()); } } } diff --git a/indra/newview/llpanelgrouproles.cpp b/indra/newview/llpanelgrouproles.cpp index ab9ff5664..d341d3ce8 100644 --- a/indra/newview/llpanelgrouproles.cpp +++ b/indra/newview/llpanelgrouproles.cpp @@ -34,10 +34,10 @@ #include "llcheckboxctrl.h" #include "llagent.h" +#include "llavataractions.h" #include "llavatarnamecache.h" #include "llbutton.h" #include "llfiltereditor.h" -#include "llfloateravatarinfo.h" #include "llfloatergroupinvite.h" #include "lliconctrl.h" #include "lllineeditor.h" @@ -1202,8 +1202,7 @@ void LLPanelGroupMembersSubTab::handleMemberDoubleClick() LLScrollListItem* selected = mMembersList->getFirstSelected(); if (selected) { - LLUUID member_id = selected->getUUID(); - LLFloaterAvatarInfo::showFromDirectory( member_id ); + LLAvatarActions::showProfile(selected->getUUID()); } } diff --git a/indra/newview/llpanelpermissions.cpp b/indra/newview/llpanelpermissions.cpp index c81ae35e9..d09766643 100644 --- a/indra/newview/llpanelpermissions.cpp +++ b/indra/newview/llpanelpermissions.cpp @@ -36,16 +36,14 @@ #include "llpanelpermissions.h" -#include "lluuid.h" #include "llpermissions.h" -#include "llcategory.h" #include "llclickaction.h" #include "llfocusmgr.h" #include "llnotificationsutil.h" -#include "llstring.h" +#include "lltrans.h" +#include "llwindow.h" #include "llviewerwindow.h" -#include "llwindow.h" #include "llresmgr.h" #include "lltextbox.h" #include "llbutton.h" @@ -53,20 +51,16 @@ #include "llviewerobject.h" #include "llselectmgr.h" #include "llagent.h" -#include "llstatusbar.h" // for getBalance() +#include "llavataractions.h" #include "lllineeditor.h" #include "llradiogroup.h" #include "llcombobox.h" -#include "llfloateravatarinfo.h" -#include "lluiconstants.h" #include "lldbstrings.h" #include "llfloatergroupinfo.h" #include "llfloatergroups.h" #include "llnamebox.h" -#include "llviewercontrol.h" #include "lluictrlfactory.h" #include "roles_constants.h" -#include "lltrans.h" #include "llinventoryfunctions.h" #include "lfsimfeaturehandler.h" @@ -1007,7 +1001,7 @@ void LLPanelPermissions::onClickCreator(void *data) { LLPanelPermissions *self = (LLPanelPermissions *)data; - LLFloaterAvatarInfo::showFromObject(self->mCreatorID); + LLAvatarActions::showProfile(self->mCreatorID); } // static @@ -1026,18 +1020,17 @@ void LLPanelPermissions::onClickOwner(void *data) // [RLVa:KB] - Checked: 2009-07-08 (RLVa-1.0.0e) if (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) { - LLFloaterAvatarInfo::showFromObject(self->mOwnerID); + LLAvatarActions::showProfile(self->mOwnerID); } // [/RLVa:KB] -// LLFloaterAvatarInfo::showFromObject(self->mOwnerID); +// LLAvatarActions::showProfile(self->mOwnerID); } } void LLPanelPermissions::onClickLastOwner(void *data) { LLPanelPermissions *self = (LLPanelPermissions *)data; - if(self->mLastOwnerID.notNull()) - LLFloaterAvatarInfo::showFromObject(self->mLastOwnerID); + LLAvatarActions::showProfile(self->mLastOwnerID); } void LLPanelPermissions::onClickGroup(void* data) diff --git a/indra/newview/llpanelprofile.cpp b/indra/newview/llpanelprofile.cpp index 2bf44165e..009965c40 100644 --- a/indra/newview/llpanelprofile.cpp +++ b/indra/newview/llpanelprofile.cpp @@ -29,9 +29,13 @@ #ifdef AI_UNUSED #include "llagent.h" +#endif // AI_UNUSED #include "llavataractions.h" +#ifdef AI_UNUSED #include "llfloaterreg.h" +#endif // AI_UNUSED #include "llcommandhandler.h" +#ifdef AI_UNUSED #include "llnotificationsutil.h" #include "llpanelpicks.h" #include "lltabcontainer.h" @@ -75,12 +79,13 @@ public: } }; LLProfileHandler gProfileHandler; +#endif // AI_UNUSED class LLAgentHandler : public LLCommandHandler { public: // requires trusted browser to trigger - LLAgentHandler() : LLCommandHandler("agent", UNTRUSTED_THROTTLE) { } + LLAgentHandler() : LLCommandHandler("agent", true/*UNTRUSTED_THROTTLE*/) { } bool handle(const LLSD& params, const LLSD& query_map, LLMediaCtrl* web) @@ -99,11 +104,13 @@ public: return true; } + /* Singu TODO if (verb == "inspect") { LLFloaterReg::showInstance("inspect_avatar", LLSD().with("avatar_id", avatar_id)); return true; } + */ if (verb == "im") { @@ -113,11 +120,13 @@ public: if (verb == "pay") { + /* if (!LLUI::sSettingGroups["config"]->getBOOL("EnableAvatarPay")) { LLNotificationsUtil::add("NoAvatarPay", LLSD(), LLSD(), std::string("SwitchToStandardSkinAndQuit")); return true; } + */ LLAvatarActions::pay(avatar_id); return true; @@ -159,6 +168,7 @@ public: LLAgentHandler gAgentHandler; +#ifdef AI_UNUSED //-- LLPanelProfile::ChildStack begins ---------------------------------------- LLPanelProfile::ChildStack::ChildStack() : mParent(NULL) diff --git a/indra/newview/llpreview.cpp b/indra/newview/llpreview.cpp index c8b3a4b1f..de4598d15 100644 --- a/indra/newview/llpreview.cpp +++ b/indra/newview/llpreview.cpp @@ -54,6 +54,7 @@ #include "llagent.h" #include "llvoavatarself.h" #include "llselectmgr.h" +#include "lltrans.h" #include "llviewerinventory.h" #include "llviewerassettype.h" @@ -550,7 +551,7 @@ void LLPreview::handleReshape(const LLRect& new_rect, bool by_user) // LLMultiPreview // -LLMultiPreview::LLMultiPreview(const LLRect& rect) : LLMultiFloater(std::string("Preview"), rect) +LLMultiPreview::LLMultiPreview(const LLRect& rect) : LLMultiFloater(LLTrans::getString("MultiPreviewTitle"), rect) { setCanResize(TRUE); } @@ -558,7 +559,7 @@ LLMultiPreview::LLMultiPreview(const LLRect& rect) : LLMultiFloater(std::string( void LLMultiPreview::open() /*Flawfinder: ignore*/ { LLMultiFloater::open(); /*Flawfinder: ignore*/ - LLPreview* frontmost_preview = (LLPreview*)mTabContainer->getCurrentPanel(); + LLPreview* frontmost_preview = dynamic_cast(mTabContainer->getCurrentPanel()); if (frontmost_preview && frontmost_preview->getAssetStatus() == LLPreview::PREVIEW_ASSET_UNLOADED) { frontmost_preview->loadAsset(); @@ -571,7 +572,7 @@ void LLMultiPreview::handleReshape(const LLRect& new_rect, bool by_user) { if(new_rect.getWidth() != getRect().getWidth() || new_rect.getHeight() != getRect().getHeight()) { - LLPreview* frontmost_preview = (LLPreview*)mTabContainer->getCurrentPanel(); + LLPreview* frontmost_preview = dynamic_cast(mTabContainer->getCurrentPanel()); if (frontmost_preview) frontmost_preview->userResized(); } LLFloater::handleReshape(new_rect, by_user); @@ -580,7 +581,7 @@ void LLMultiPreview::handleReshape(const LLRect& new_rect, bool by_user) void LLMultiPreview::tabOpen(LLFloater* opened_floater) { - LLPreview* opened_preview = (LLPreview*)opened_floater; + LLPreview* opened_preview = dynamic_cast(opened_floater); if (opened_preview && opened_preview->getAssetStatus() == LLPreview::PREVIEW_ASSET_UNLOADED) { opened_preview->loadAsset(); diff --git a/indra/newview/llpreviewtexture.cpp b/indra/newview/llpreviewtexture.cpp index 2d09e2356..d2929d7a6 100644 --- a/indra/newview/llpreviewtexture.cpp +++ b/indra/newview/llpreviewtexture.cpp @@ -35,6 +35,7 @@ #include "llpreviewtexture.h" #include "llagent.h" +#include "llavataractions.h" #include "llbutton.h" #include "llcombobox.h" #include "statemachine/aifilepicker.h" @@ -47,12 +48,10 @@ #include "lltrans.h" #include "lltextbox.h" #include "lltextureview.h" -#include "llui.h" #include "llviewertexturelist.h" #include "lluictrlfactory.h" #include "llviewerwindow.h" #include "lllineeditor.h" -#include "llfloateravatarinfo.h" const S32 PREVIEW_TEXTURE_MIN_WIDTH = 300; const S32 PREVIEW_TEXTURE_MIN_HEIGHT = 120; @@ -672,8 +671,7 @@ bool LLPreviewTexture::setAspectRatio(const F32 width, const F32 height) void LLPreviewTexture::onClickProfile(void* userdata) { LLPreviewTexture* self = (LLPreviewTexture*) userdata; - LLUUID key = self->mCreatorKey; - if (!key.isNull()) LLFloaterAvatarInfo::showFromDirectory(key); + LLAvatarActions::showProfile(self->mCreatorKey); } void LLPreviewTexture::onAspectRatioCommit(LLUICtrl* ctrl, void* userdata) diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp index e6abe3676..175af63a3 100644 --- a/indra/newview/llviewermedia.cpp +++ b/indra/newview/llviewermedia.cpp @@ -39,6 +39,7 @@ #include "lldiriterator.h" #include "llevent.h" // LLSimpleListener #include "llhoverview.h" +#include "llhttpclient.h" #include "llkeyboard.h" #include "llmimetypes.h" #include "llnotifications.h" @@ -57,7 +58,7 @@ #include "llweb.h" #include "llwebprofile.h" -#include "llfloateravatarinfo.h" // for getProfileURL() function +std::string getProfileURL(const std::string& agent_name); //#include "viewerversion.h" class AIHTTPTimeoutPolicy; diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 52799fdf4..eb3df067a 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -63,7 +63,6 @@ #include "llfirstuse.h" #include "llfloaterabout.h" #include "llfloateractivespeakers.h" -#include "llfloateravatarinfo.h" #include "llfloateravatarlist.h" #include "llfloateravatartextures.h" #include "llfloaterbeacons.h" @@ -79,12 +78,9 @@ #include "llfloaterdirectory.h" #include "llfloatereditui.h" #include "llfloaterchatterbox.h" -#include "llfloaterfriends.h" #include "llfloaterfonttest.h" #include "llfloatergesture.h" #include "llfloatergodtools.h" -#include "llfloatergroupinvite.h" -#include "llfloatergroups.h" #include "llfloaterhtmlcurrency.h" #include "llfloatermediabrowser.h" // gViewerHtmlHelp #include "llfloaterhud.h" @@ -120,6 +116,7 @@ #include "llfloatermemleak.h" #include "llframestats.h" #include "llgivemoney.h" +#include "llavataractions.h" #include "llgroupmgr.h" #include "llhoverview.h" #include "llhudeffecttrail.h" @@ -3763,11 +3760,6 @@ bool LLHaveCallingcard::operator()(LLInventoryCategory* cat, } */ -BOOL is_agent_friend(const LLUUID& agent_id) -{ - return (LLAvatarTracker::instance().getBuddyInfo(agent_id) != NULL); -} - BOOL is_agent_mappable(const LLUUID& agent_id) { const LLRelationship* buddy_info = LLAvatarTracker::instance().getBuddyInfo(agent_id); @@ -3785,9 +3777,9 @@ class LLAvatarEnableAddFriend : public view_listener_t bool handleEvent(LLPointer event, const LLSD& userdata) { LLVOAvatar* avatar = find_avatar_from_object(LLSelectMgr::getInstance()->getSelection()->getPrimaryObject()); -// bool new_value = avatar && !is_agent_friend(avatar->getID()); +// bool new_value = avatar && !LLAvatarActions::isFriend(avatar->getID()); // [RLVa:KB] - Checked: 2010-04-20 (RLVa-1.2.0f) | Modified: RLVa-1.2.0f - bool new_value = avatar && !is_agent_friend(avatar->getID()) && (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)); + bool new_value = avatar && !LLAvatarActions::isFriend(avatar->getID()) && (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)); // [/RLVa:KB] gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); return true; @@ -3809,7 +3801,7 @@ void request_friendship(const LLUUID& dest_id) } if (!full_name.empty()) { - LLPanelFriends::requestFriendshipDialog(dest_id, full_name); + LLAvatarActions::requestFriendshipDialog(dest_id, full_name); } else { @@ -6089,30 +6081,6 @@ void handle_look_at_selection(const LLSD& param) } } -void callback_invite_to_group(LLUUID group_id, void *user_data) -{ - std::vector agent_ids; - agent_ids.push_back(*(LLUUID *)user_data); - - LLFloaterGroupInvite::showForGroup(group_id, &agent_ids); -} - -void invite_to_group(const LLUUID& dest_id) -{ - LLViewerObject* dest = gObjectList.findObject(dest_id); - if(dest && dest->isAvatar()) - { - LLFloaterGroupPicker* widget; - widget = LLFloaterGroupPicker::showInstance(LLSD(gAgent.getID())); - if (widget) - { - widget->center(); - widget->setPowersMask(GP_MEMBER_INVITE); - widget->setSelectCallback(callback_invite_to_group, (void *)&dest_id); - } - } -} - class LLAvatarInviteToGroup : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) @@ -6123,7 +6091,7 @@ class LLAvatarInviteToGroup : public view_listener_t if ( (avatar) && (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) ) // [/RLVa:KB] { - invite_to_group(avatar->getID()); + LLAvatarActions::inviteToGroup(avatar->getID()); } return true; } @@ -6134,9 +6102,9 @@ class LLAvatarAddFriend : public view_listener_t bool handleEvent(LLPointer event, const LLSD& userdata) { LLVOAvatar* avatar = find_avatar_from_object( LLSelectMgr::getInstance()->getSelection()->getPrimaryObject() ); -// if(avatar && !is_agent_friend(avatar->getID())) +// if(avatar && !LLAvatarActions::isFriend(avatar->getID())) // [RLVa:KB] - Checked: 2010-04-20 (RLVa-1.2.0f) | Modified: RLVa-1.2.0f - if ( (avatar && !is_agent_friend(avatar->getID())) && (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) ) + if ( (avatar && !LLAvatarActions::isFriend(avatar->getID())) && (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) ) // [/RLVa:KB] { request_friendship(avatar->getID()); @@ -6618,7 +6586,7 @@ class LLShowAgentProfile : public view_listener_t if ( (avatar) && ((!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) || (gAgent.getID() == agent_id)) ) // [/RLVa:KB] { - LLFloaterAvatarInfo::show(avatar->getID()); + LLAvatarActions::showProfile(avatar->getID()); } return true; } @@ -7269,28 +7237,12 @@ class LLAvatarSendIM : public view_listener_t bool handleEvent(LLPointer event, const LLSD& userdata) { LLVOAvatar* avatar = find_avatar_from_object( LLSelectMgr::getInstance()->getSelection()->getPrimaryObject() ); -// [RLVa:KB] - Checked: 2009-07-08 (RLVa-1.0.0e) | OK - if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) - { - return true; - } +// if(avatar) +// [RLVa:KB] - Checked: 2010-06-04 (RLVa-1.2.0d) | Added: RLVa-1.2.0d + if ((avatar) && (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES))) // [/RLVa:KB] - if(avatar) { - std::string name("IM"); - LLNameValue *first = avatar->getNVPair("FirstName"); - LLNameValue *last = avatar->getNVPair("LastName"); - if (first && last) - { - name.assign( first->getString() ); - name.append(" "); - name.append( last->getString() ); - } - - gIMMgr->setFloaterOpen(TRUE); - //EInstantMessage type = have_agent_callingcard(gLastHitObjectID) - // ? IM_SESSION_ADD : IM_SESSION_CARDLESS_START; - gIMMgr->addSession(LLCacheName::cleanFullName(name),IM_NOTHING_SPECIAL,avatar->getID()); + LLAvatarActions::startIM(avatar->getID()); } return true; } diff --git a/indra/newview/llviewermenu.h b/indra/newview/llviewermenu.h index 265f77fd3..6d3c2947f 100644 --- a/indra/newview/llviewermenu.h +++ b/indra/newview/llviewermenu.h @@ -74,8 +74,6 @@ BOOL enable_deselect(void*); BOOL enable_undo(void*); BOOL enable_redo(void*); -// returns TRUE if we have a friend relationship with agent_id -BOOL is_agent_friend(const LLUUID& agent_id); BOOL is_agent_mappable(const LLUUID& agent_id); void menu_toggle_control( void* user_data ); diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 3d22f49a5..9eb7ddde0 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -2680,9 +2680,10 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) case IM_INVENTORY_ACCEPTED: { // args["NAME"] = name; -// [RLVa:KB] - Version: 1.23.4 | Checked: 2009-07-08 (RLVa-1.0.0e) | Modified: RLVa-0.2.0b +// [RLVa:KB] - Checked: 2010-11-02 (RLVa-1.2.2a) | Modified: RLVa-1.2.2a + // Only anonymize the name if the agent is nearby, there isn't an open IM session to them and their profile isn't open bool fRlvFilterName = (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) && (RlvUtil::isNearbyAgent(from_id)) && - (!LLFloaterAvatarInfo::getInstance(from_id)); + (!RlvUIEnabler::hasOpenProfile(from_id)) && (!RlvUIEnabler::hasOpenIM(from_id)); args["NAME"] = (!fRlvFilterName) ? name : RlvStrings::getAnonym(name); // [/RLVa:KB] LLNotificationsUtil::add("InventoryAccepted", args); @@ -2691,9 +2692,10 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) case IM_INVENTORY_DECLINED: { // args["NAME"] = name; -// [RLVa:KB] - Version: 1.23.4 | Checked: 2009-07-08 (RLVa-1.0.0e) | Modified: RLVa-0.2.0b +// [RLVa:KB] - Checked: 2010-11-02 (RLVa-1.2.2a) | Modified: RLVa-1.2.2a + // Only anonymize the name if the agent is nearby, there isn't an open IM session to them and their profile isn't open bool fRlvFilterName = (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) && (RlvUtil::isNearbyAgent(from_id)) && - (!LLFloaterAvatarInfo::getInstance(from_id)); + (!RlvUIEnabler::hasOpenProfile(from_id)) && (!RlvUIEnabler::hasOpenIM(from_id)); args["NAME"] = (!fRlvFilterName) ? name : RlvStrings::getAnonym(name); // [/RLVa:KB] LLNotificationsUtil::add("InventoryDeclined", args); diff --git a/indra/newview/llworldmapview.cpp b/indra/newview/llworldmapview.cpp index 4f65135a4..806cff3b8 100644 --- a/indra/newview/llworldmapview.cpp +++ b/indra/newview/llworldmapview.cpp @@ -1238,7 +1238,7 @@ void LLWorldMapView::drawAgents() // Show Individual agents (or little stacks where real agents are) // Here's how we'd choose the color if info.mID were available but it's not being sent: - // LLColor4 color = (agent_count == 1 && is_agent_friend(info.mID)) ? friend_color : avatar_color; + // LLColor4 color = (agent_count == 1 && LLAvatarActions::isFriend(info.mID)) ? friend_color : avatar_color; // Reduce the stack size as you zoom out - always display at lease one agent where there is one or more S32 agent_count = (S32)(((it->getCount()-1) * agents_scale + (it->getCount()-1) * 0.1f)+.1f) + 1; drawImageStack(it->getGlobalPosition(), sAvatarSmallImage, agent_count, 3.f, avatar_color); diff --git a/indra/newview/rlvdefines.h b/indra/newview/rlvdefines.h index b7857fd41..e80b7e4cc 100644 --- a/indra/newview/rlvdefines.h +++ b/indra/newview/rlvdefines.h @@ -151,6 +151,8 @@ enum ERlvBehaviour { RLV_BHVR_SENDIMTO, // "sendimto" RLV_BHVR_RECVIM, // "recvim" RLV_BHVR_RECVIMFROM, // "recvimfrom" + RLV_BHVR_STARTIM, // "startim" + RLV_BHVR_STARTIMTO, // "startimto" RLV_BHVR_PERMISSIVE, // "permissive" RLV_BHVR_NOTIFY, // "notify" RLV_BHVR_SHOWINV, // "showinv" diff --git a/indra/newview/rlvfloaterbehaviour.cpp b/indra/newview/rlvfloaterbehaviour.cpp index 64807840c..b8c15214d 100644 --- a/indra/newview/rlvfloaterbehaviour.cpp +++ b/indra/newview/rlvfloaterbehaviour.cpp @@ -58,6 +58,7 @@ bool rlvGetShowException(ERlvBehaviour eBhvr) case RLV_BHVR_RECVEMOTE: case RLV_BHVR_SENDIM: case RLV_BHVR_RECVIM: + case RLV_BHVR_STARTIM: case RLV_BHVR_TPLURE: case RLV_BHVR_ACCEPTTP: return true; diff --git a/indra/newview/rlvhandler.cpp b/indra/newview/rlvhandler.cpp index 15518ad0d..3a3e023be 100644 --- a/indra/newview/rlvhandler.cpp +++ b/indra/newview/rlvhandler.cpp @@ -1322,6 +1322,7 @@ ERlvCmdRet RlvHandler::processAddRemCommand(const RlvCommand& rlvCmd) case RLV_BHVR_RECVEMOTE: // @recvemote[:]=n|y - Checked: 2009-12-05 (RLVa-1.1.0h) | Modified: RLVa-1.1.0h case RLV_BHVR_SENDIM: // @sendim[:]=n|y - Checked: 2009-12-05 (RLVa-1.1.0h) | Modified: RLVa-1.1.0h case RLV_BHVR_RECVIM: // @recvim[:]=n|y - Checked: 2009-12-05 (RLVa-1.1.0h) | Modified: RLVa-1.1.0h + case RLV_BHVR_STARTIM: // @startim[:]=n|y - Checked: 2011-04-11 (RLVa-1.3.0h) | Added: RLVa-1.3.0h case RLV_BHVR_TPLURE: // @tplure[:]=n|y - Checked: 2009-12-05 (RLVa-1.1.0h) | Modified: RLVa-1.1.0h case RLV_BHVR_ACCEPTTP: // @accepttp[:]=n|y - Checked: 2009-12-05 (RLVa-1.1.0h) | Modified: RLVa-1.1.0h case RLV_BHVR_TOUCHATTACH: // @touchattach[:=n|y - Checked: 2010-01-01 (RLVa-1.1.0l) | Added: RLVa-1.1.0l @@ -1350,6 +1351,7 @@ ERlvCmdRet RlvHandler::processAddRemCommand(const RlvCommand& rlvCmd) case RLV_BHVR_RECVEMOTEFROM: // @recvemotefrom:=n|y - Checked: 2010-11-30 (RLVa-1.3.0c) | Added: RLVa-1.3.0c case RLV_BHVR_SENDIMTO: // @sendimto:=n|y - Checked: 2010-11-30 (RLVa-1.3.0c) | Added: RLVa-1.3.0c case RLV_BHVR_RECVIMFROM: // @recvimfrom:=n|y - Checked: 2010-11-30 (RLVa-1.3.0c) | Added: RLVa-1.3.0c + case RLV_BHVR_STARTIMTO: // @startimto:=n|y - Checked: 2011-04-11 (RLVa-1.3.0h) | Added: RLVa-1.3.0h case RLV_BHVR_EDITOBJ: // @editobj:=n|y - Checked: 2010-11-29 (RLVa-1.3.0c) | Added: RLVa-1.3.0c case RLV_BHVR_TOUCHTHIS: // @touchthis:=n|y - Checked: 2010-01-01 (RLVa-1.1.0l) | Added: RLVa-1.1.0l { diff --git a/indra/newview/rlvhandler.h b/indra/newview/rlvhandler.h index 815c57d4a..79db80cee 100644 --- a/indra/newview/rlvhandler.h +++ b/indra/newview/rlvhandler.h @@ -96,6 +96,7 @@ public: bool canShowHoverText(const LLViewerObject* pObj) const; // @showhovertext* command family bool canSendIM(const LLUUID& idRecipient) const; // @sendim and @sendimto bool canSit(LLViewerObject* pObj, const LLVector3& posOffset = LLVector3::zero) const; + bool canStartIM(const LLUUID& idRecipient) const; // @startim and @startimto bool canStand() const; bool canTeleportViaLure(const LLUUID& idAgent) const; bool canTouch(const LLViewerObject* pObj, const LLVector3& posOffset = LLVector3::zero) const; // @touch @@ -276,6 +277,15 @@ inline bool RlvHandler::canShowHoverText(const LLViewerObject *pObj) const (isException(RLV_BHVR_SHOWHOVERTEXT, pObj->getID(), RLV_CHECK_PERMISSIVE)) ) ); } +inline bool RlvHandler::canStartIM(const LLUUID& idRecipient) const +{ + // User can start an IM session with "recipient" (could be an agent or a group) if: + // - not generally restricted from starting IM sessions (or the recipient is an exception) + // - not specifically restricted from starting an IM session with the recipient + return + ( (!hasBehaviour(RLV_BHVR_STARTIM)) || (isException(RLV_BHVR_STARTIM, idRecipient)) ) && + ( (!hasBehaviour(RLV_BHVR_STARTIMTO)) || (!isException(RLV_BHVR_STARTIMTO, idRecipient)) ); +} // Checked: 2010-12-11 (RLVa-1.2.2c) | Added: RLVa-1.2.2c inline bool RlvHandler::canTeleportViaLure(const LLUUID& idAgent) const diff --git a/indra/newview/rlvui.cpp b/indra/newview/rlvui.cpp index 8ade9762c..aadfc20ed 100644 --- a/indra/newview/rlvui.cpp +++ b/indra/newview/rlvui.cpp @@ -16,6 +16,7 @@ #include "llviewerprecompiledheaders.h" #include "llagent.h" +#include "llavataractions.h" // LLAvatarActions::profileVisible() #include "llavatarnamecache.h" #include "llenvmanager.h" #include "llhudtext.h" // LLHUDText::refreshAllObjectText() @@ -471,10 +472,10 @@ bool RlvUIEnabler::canViewRegionProperties() } // Checked: 2010-04-20 (RLVa-1.2.0f) | Added: RLVa-1.2.0f -/*bool RlvUIEnabler::hasOpenIM(const LLUUID& idAgent) +bool RlvUIEnabler::hasOpenIM(const LLUUID& idAgent) { LLUUID idSession = LLIMMgr::computeSessionID(IM_NOTHING_SPECIAL, idAgent); - return (NULL != LLFloaterReg::findInstance("impanel", idSession)); + return gIMMgr->hasSession(idSession); } // Checked: 2011-11-04 (RLVa-1.4.4a) | Modified: RLVa-1.4.4a @@ -486,7 +487,7 @@ bool RlvUIEnabler::hasOpenProfile(const LLUUID& idAgent) // Check if the user has the specified agent's profile open return LLAvatarActions::profileVisible(idAgent); -}*/ +} // Checked: 2010-09-11 (RLVa-1.2.1d) | Added: RLVa-1.2.1d bool RlvUIEnabler::isBuildEnabled() diff --git a/indra/newview/rlvui.h b/indra/newview/rlvui.h index 988a7f2c8..11eb75e28 100644 --- a/indra/newview/rlvui.h +++ b/indra/newview/rlvui.h @@ -80,8 +80,8 @@ protected: public: static bool canViewParcelProperties(); // showloc static bool canViewRegionProperties(); // showloc - //static bool hasOpenIM(const LLUUID& idAgent); // shownames - //static bool hasOpenProfile(const LLUUID& idAgent); // shownames + static bool hasOpenIM(const LLUUID& idAgent); // shownames + static bool hasOpenProfile(const LLUUID& idAgent); // shownames static bool isBuildEnabled(); // edit and rez /* diff --git a/indra/newview/skins/default/xui/en-us/floater_directory.xml b/indra/newview/skins/default/xui/en-us/floater_directory.xml index 3a3983bb1..78391be16 100644 --- a/indra/newview/skins/default/xui/en-us/floater_directory.xml +++ b/indra/newview/skins/default/xui/en-us/floater_directory.xml @@ -157,9 +157,6 @@