diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index 348e5e383..cee6f7500 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -1074,7 +1074,8 @@ void LLFloater::setForeground(BOOL front) releaseFocus(); } - setBackgroundOpaque( front ); + if (front || !LLUI::sConfigGroup->getBOOL("FloaterUnfocusedBackgroundOpaque")) // Singu Note: This can be removed when InactiveFloaterTransparency is added + setBackgroundOpaque( front ); } } diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 78b3c9ddb..2635ad46b 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -92,6 +92,7 @@ set(viewer_SOURCE_FILES floatervoicelicense.cpp generichandlers.cpp hbfloatergrouptitles.cpp + groupchatlistener.cpp hippofloaterxml.cpp hippogridmanager.cpp hippolimits.cpp @@ -119,6 +120,7 @@ set(viewer_SOURCE_FILES llassetuploadresponders.cpp llattachmentsmgr.cpp llaudiosourcevo.cpp + llavataractions.cpp llavatarpropertiesprocessor.cpp llbox.cpp llcallbacklist.cpp @@ -272,6 +274,7 @@ set(viewer_SOURCE_FILES llgiveinventory.cpp llgivemoney.cpp llglsandbox.cpp + llgroupactions.cpp llgroupmgr.cpp llgroupnotify.cpp llhomelocationresponder.cpp @@ -588,6 +591,7 @@ set(viewer_HEADER_FILES floaterlocalassetbrowse.h floatervoicelicense.h generichandlers.h + groupchatlistener.h hbfloatergrouptitles.h hippofloaterxml.h hippogridmanager.h @@ -617,6 +621,7 @@ set(viewer_HEADER_FILES llassetuploadresponders.h llattachmentsmgr.h llaudiosourcevo.h + llavataractions.h llavatarpropertiesprocessor.h llbox.h llcallbacklist.h @@ -770,6 +775,7 @@ set(viewer_HEADER_FILES llgesturemgr.h llgiveinventory.h llgivemoney.h + llgroupactions.h llgroupmgr.h llgroupnotify.h llhomelocationresponder.h @@ -1056,7 +1062,6 @@ set(viewer_HEADER_FILES noise.h pipeline.h qtoolalign.h - randgauss.h rlvcommon.h rlvdefines.h rlvextensions.h diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 377ee5cf1..5b0beb4e7 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -729,6 +729,17 @@ Found in Advanced->Rendering->Info Displays Value 0 + FloaterUnfocusedBackgroundOpaque + + Comment + Disables floaters going transparent when not in focus, may conflict with some skins, though. + Persist + 1 + Type + Boolean + Value + 0 + InstantMessageLogPathAnyAccount Comment diff --git a/indra/newview/ascentprefsvan.cpp b/indra/newview/ascentprefsvan.cpp index 34273a963..9802144ec 100644 --- a/indra/newview/ascentprefsvan.cpp +++ b/indra/newview/ascentprefsvan.cpp @@ -191,6 +191,7 @@ void LLPrefsAscentVan::refreshValues() mTurnAround = gSavedSettings.getBOOL("TurnAroundWhenWalkingBackwards"); mAnnounceSnapshots = gSavedSettings.getBOOL("AnnounceSnapshots"); mAnnounceStreamMetadata = gSavedSettings.getBOOL("AnnounceStreamMetadata"); + mUnfocusedFloatersOpaque = gSavedSettings.getBOOL("FloaterUnfocusedBackgroundOpaque"); //Tags\Colors ---------------------------------------------------------------------------- mAscentBroadcastTag = gSavedSettings.getBOOL("AscentBroadcastTag"); @@ -259,6 +260,7 @@ void LLPrefsAscentVan::cancel() gSavedSettings.setBOOL("TurnAroundWhenWalkingBackwards", mTurnAround); gSavedSettings.setBOOL("AnnounceSnapshots", mAnnounceSnapshots); gSavedSettings.setBOOL("AnnounceStreamMetadata", mAnnounceStreamMetadata); + gSavedSettings.setBOOL("FloaterUnfocusedBackgroundOpaque", mUnfocusedFloatersOpaque); //Tags\Colors ---------------------------------------------------------------------------- gSavedSettings.setBOOL("AscentBroadcastTag", mAscentBroadcastTag); diff --git a/indra/newview/ascentprefsvan.h b/indra/newview/ascentprefsvan.h index 25e789697..78984b3c5 100644 --- a/indra/newview/ascentprefsvan.h +++ b/indra/newview/ascentprefsvan.h @@ -62,6 +62,7 @@ protected: bool mTurnAround; bool mAnnounceSnapshots; bool mAnnounceStreamMetadata; + bool mUnfocusedFloatersOpaque; //Tags\Colors BOOL mAscentBroadcastTag; std::string mReportClientUUID; diff --git a/indra/newview/groupchatlistener.cpp b/indra/newview/groupchatlistener.cpp new file mode 100644 index 000000000..543032737 --- /dev/null +++ b/indra/newview/groupchatlistener.cpp @@ -0,0 +1,81 @@ +/** + * @file groupchatlistener.cpp + * @author Nat Goodspeed + * @date 2011-04-11 + * @brief Implementation for groupchatlistener. + * + * $LicenseInfo:firstyear=2011&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2011, 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$ + */ + +// Precompiled header +#include "llviewerprecompiledheaders.h" +// associated header +#include "groupchatlistener.h" +// STL headers +// std headers +// external library headers +// other Linden headers +#include "llgroupactions.h" +//#include "llimview.h" + + +namespace { + void startIm_wrapper(LLSD const & event) + { + LLUUID session_id = LLGroupActions::startIM(event["id"].asUUID()); + sendReply(LLSDMap("session_id", LLSD(session_id)), event); + } + + /* Singu TODO + void send_message_wrapper(const std::string& text, const LLUUID& session_id, const LLUUID& group_id) + { + LLIMModel::sendMessage(text, session_id, group_id, IM_SESSION_GROUP_START); + } + */ +} + + +GroupChatListener::GroupChatListener(): + LLEventAPI("GroupChat", + "API to enter, leave, send and intercept group chat messages") +{ + add("startIM", + "Enter a group chat in group with UUID [\"id\"]\n" + "Assumes the logged-in agent is already a member of this group.", + &startIm_wrapper); + add("endIM", + "Leave a group chat in group with UUID [\"id\"]\n" + "Assumes a prior successful startIM request.", + &LLGroupActions::endIM, + LLSDArray("id")); + /* Singu TODO + add("sendIM", + "send a groupchat IM", + &send_message_wrapper, + LLSDArray("text")("session_id")("group_id")); + */ +} +/* + static void sendMessage(const std::string& utf8_text, const LLUUID& im_session_id, + const LLUUID& other_participant_id, EInstantMessage dialog); +*/ + diff --git a/indra/newview/groupchatlistener.h b/indra/newview/groupchatlistener.h new file mode 100644 index 000000000..42d6a6adc --- /dev/null +++ b/indra/newview/groupchatlistener.h @@ -0,0 +1,41 @@ +/** + * @file groupchatlistener.h + * @author Nat Goodspeed + * @date 2011-04-11 + * @brief + * + * $LicenseInfo:firstyear=2011&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2011, 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$ + */ + +#if ! defined(LL_GROUPCHATLISTENER_H) +#define LL_GROUPCHATLISTENER_H + +#include "lleventapi.h" + +class GroupChatListener: public LLEventAPI +{ +public: + GroupChatListener(); +}; + +#endif /* ! defined(LL_GROUPCHATLISTENER_H) */ + diff --git a/indra/newview/hbfloatergrouptitles.cpp b/indra/newview/hbfloatergrouptitles.cpp index 7ef401146..f75211730 100644 --- a/indra/newview/hbfloatergrouptitles.cpp +++ b/indra/newview/hbfloatergrouptitles.cpp @@ -40,6 +40,7 @@ #include "hbfloatergrouptitles.h" #include "llagent.h" +#include "llgroupactions.h" #include "lluictrlfactory.h" #include "llviewercontrol.h" @@ -145,13 +146,7 @@ void HBFloaterGroupTitles::onActivate(void* userdata) LLUUID group_id = item->getColumn(LIST_GROUP_ID)->getValue().asUUID(); if (group_id != old_group_id) { - LLMessageSystem* msg = gMessageSystem; - msg->newMessageFast(_PREHASH_ActivateGroup); - msg->nextBlockFast(_PREHASH_AgentData); - msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); - msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); - msg->addUUIDFast(_PREHASH_GroupID, group_id); - gAgent.sendReliableMessage(); + LLGroupActions::activate(group_id); } // Set the title diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index b3e0eb56d..aa4717388 100644 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -43,6 +43,7 @@ #include "llfirstuse.h" #include "llfloatercamera.h" #include "llfloatertools.h" +#include "llgroupactions.h" #include "llgroupmgr.h" #include "llhomelocationresponder.h" #include "llhudmanager.h" @@ -3247,7 +3248,7 @@ BOOL LLAgent::downGrabbed() const void update_group_floaters(const LLUUID& group_id) { - LLFloaterGroupInfo::refreshGroup(group_id); + LLGroupActions::refresh(group_id); // update avatar info LLFloaterAvatarInfo* fa = LLFloaterAvatarInfo::getInstance(gAgent.getID()); @@ -3300,7 +3301,7 @@ void LLAgent::processAgentDropGroup(LLMessageSystem *msg, void **) LLGroupMgr::getInstance()->clearGroupData(group_id); // close the floater for this group, if any. - LLFloaterGroupInfo::closeGroup(group_id); + LLGroupActions::closeGroup(group_id); // refresh the group panel of the search window, if necessary. LLFloaterDirectory::refreshGroup(group_id); } @@ -3379,7 +3380,7 @@ class LLAgentDropGroupViewerNode : public LLHTTPNode LLGroupMgr::getInstance()->clearGroupData(group_id); // close the floater for this group, if any. - LLFloaterGroupInfo::closeGroup(group_id); + LLGroupActions::closeGroup(group_id); // refresh the group panel of the search window, //if necessary. LLFloaterDirectory::refreshGroup(group_id); 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/llfloaterdirectory.cpp b/indra/newview/llfloaterdirectory.cpp index 0bd358d4c..552406479 100644 --- a/indra/newview/llfloaterdirectory.cpp +++ b/indra/newview/llfloaterdirectory.cpp @@ -389,9 +389,7 @@ void* LLFloaterDirectory::createEventDetail(void* userdata) void* LLFloaterDirectory::createGroupDetail(void* userdata) { LLFloaterDirectory *self = (LLFloaterDirectory*)userdata; - self->mPanelGroupp = new LLPanelGroup("panel_group.xml", - "PanelGroup", - gAgent.getGroupID()); + self->mPanelGroupp = new LLPanelGroup(gAgent.getGroupID()); self->mPanelGroupp->setAllowEdit(FALSE || gAgent.isGodlike()); // Gods can always edit panels self->mPanelGroupp->setVisible(FALSE); return self->mPanelGroupp; 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/llfloatergroupinfo.cpp b/indra/newview/llfloatergroupinfo.cpp index 3e2e845e3..cbe1636ea 100644 --- a/indra/newview/llfloatergroupinfo.cpp +++ b/indra/newview/llfloatergroupinfo.cpp @@ -36,100 +36,30 @@ #include "llfloatergroupinfo.h" -#include "llagent.h" -#include "llcommandhandler.h" -#include "llfloaterchatterbox.h" -#include "llpanelgroup.h" -#include "llviewermessage.h" // for inventory_offer_callback -//#include "llviewerwindow.h" -#include "llnotifications.h" - #include "llcachename.h" +#include "llpanelgroup.h" const char FLOATER_TITLE[] = "Group Information"; -const LLRect FGI_RECT(0, 530, 420, 0); - -// -// Globals -// -std::map LLFloaterGroupInfo::sInstances; - -class LLGroupHandler : public LLCommandHandler -{ -public: - // requires trusted browser to trigger - LLGroupHandler() : LLCommandHandler("group", true) { } - bool handle(const LLSD& tokens, const LLSD& query_map, - LLMediaCtrl* web) - { - if (tokens.size() < 1) - { - return false; - } - - if (tokens[0].asString() == "create") - { - LLFloaterGroupInfo::showCreateGroup(NULL); - return true; - } - - if (tokens.size() < 2) - { - return false; - } - - if (tokens[0].asString() == "list") - { - if (tokens[1].asString() == "show") - { - // CP_TODO: get the value we pass in via the XUI name - // of the tab instead of using a literal like this - LLFloaterMyFriends::showInstance( 1 ); - - return true; - } - return false; - } - - LLUUID group_id; - if (!group_id.set(tokens[0], FALSE)) - { - return false; - } - - if ((tokens[1].asString() == "about") || (tokens[1].asString() == "inspect")) - { - LLFloaterGroupInfo::showFromUUID(group_id); - return true; - } - return false; - } -}; -LLGroupHandler gGroupHandler; //----------------------------------------------------------------------------- // Implementation //----------------------------------------------------------------------------- -LLFloaterGroupInfo::LLFloaterGroupInfo(const std::string& name, const LLRect &rect, const std::string& title, const LLUUID& group_id, const std::string& tab_name) -: LLFloater(name, rect, title), - mGroupID( group_id ) +LLFloaterGroupInfo::LLFloaterGroupInfo(const LLUUID& group_id) +: LLFloater(FLOATER_TITLE, LLRect(0, 530, 420, 0), FLOATER_TITLE), LLInstanceTracker(group_id) { - llinfos << name << " : " << title << llendl; - llinfos << rect << llendl; - llinfos << getRect() << llendl; - llinfos << getLocalRect() << llendl; // Construct the filename of the group panel xml definition file. - mPanelGroupp = new LLPanelGroup("panel_group.xml", - "PanelGroup", - group_id, - tab_name); + mPanelGroupp = new LLPanelGroup(group_id); addChild(mPanelGroupp); + if (group_id.notNull()) + { + // Look up the group name. The callback will insert it into the title. + gCacheName->get(group_id, true, boost::bind(&LLFloaterGroupInfo::callbackLoadGroupName, this, _2)); + } } // virtual LLFloaterGroupInfo::~LLFloaterGroupInfo() { - sInstances.erase(mGroupID); } BOOL LLFloaterGroupInfo::canClose() @@ -147,125 +77,11 @@ void LLFloaterGroupInfo::selectTabByName(std::string tab_name) mPanelGroupp->selectTab(tab_name); } -// static -void LLFloaterGroupInfo::showMyGroupInfo(void *) +void LLFloaterGroupInfo::callbackLoadGroupName(const std::string& full_name) { - showFromUUID( gAgent.getGroupID() ); + // Build a new title including the group name. + std::ostringstream title; + title << full_name << " - " << FLOATER_TITLE; + setTitle(title.str()); } -// static -void LLFloaterGroupInfo::showCreateGroup(void *) -{ - showFromUUID(LLUUID::null, "general_tab"); -} - -// static -void LLFloaterGroupInfo::closeGroup(const LLUUID& group_id) -{ - LLFloaterGroupInfo *fgi = get_if_there(sInstances, group_id, (LLFloaterGroupInfo*)NULL); - if (fgi) - { - if (fgi->mPanelGroupp) - { - fgi->mPanelGroupp->close(); - } - } -} - -// static -void LLFloaterGroupInfo::closeCreateGroup() -{ - closeGroup(LLUUID::null); -} - -// static -void LLFloaterGroupInfo::refreshGroup(const LLUUID& group_id) -{ - LLFloaterGroupInfo *fgi = get_if_there(sInstances, group_id, (LLFloaterGroupInfo*)NULL); - if (fgi) - { - if (fgi->mPanelGroupp) - { - fgi->mPanelGroupp->refreshData(); - } - } -} - -// static -void LLFloaterGroupInfo::callbackLoadGroupName(const LLUUID& id, const std::string& full_name, bool is_group) -{ - LLFloaterGroupInfo *fgi = get_if_there(sInstances, id, (LLFloaterGroupInfo*)NULL); - - if (fgi) - { - // Build a new title including the group name. - std::ostringstream title; - title << full_name << " - " << FLOATER_TITLE; - fgi->setTitle(title.str()); - } -} - -// static -void LLFloaterGroupInfo::showFromUUID(const LLUUID& group_id, - const std::string& tab_name) -{ - // If we don't have a floater for this group, create one. - LLFloaterGroupInfo *fgi = get_if_there(sInstances, group_id, (LLFloaterGroupInfo*)NULL); - if (!fgi) - { - fgi = new LLFloaterGroupInfo("groupinfo", - FGI_RECT, - FLOATER_TITLE, - group_id, - tab_name); - - sInstances[group_id] = fgi; - - if (group_id.notNull()) - { - // Look up the group name. - // The callback will insert it into the title. - gCacheName->get(group_id, true, boost::bind(&callbackLoadGroupName, _1, _2, _3)); - } - } - - fgi->selectTabByName(tab_name); - - fgi->center(); - fgi->open(); /*Flawfinder: ignore*/ -} - -// static -void LLFloaterGroupInfo::showNotice(const std::string& subject, - const std::string& message, - const LLUUID& group_id, - const bool& has_inventory, - const std::string& inventory_name, - LLOfferInfo* inventory_offer) -{ - llinfos << "LLFloaterGroupInfo::showNotice : " << subject << llendl; - - if (group_id.isNull()) - { - // We need to clean up that inventory offer. - if (inventory_offer) - { - inventory_offer->forceResponse(IOR_DECLINE); - } - return; - } - - // If we don't have a floater for this group, drop this packet on the floor. - LLFloaterGroupInfo *fgi = get_if_there(sInstances, group_id, (LLFloaterGroupInfo*)NULL); - if (!fgi) - { - // We need to clean up that inventory offer. - if (inventory_offer) - { - inventory_offer->forceResponse(IOR_DECLINE); - } - return; - } - - fgi->mPanelGroupp->showNotice(subject,message,has_inventory,inventory_name,inventory_offer); -} diff --git a/indra/newview/llfloatergroupinfo.h b/indra/newview/llfloatergroupinfo.h index ac1beecd2..fda3c348a 100644 --- a/indra/newview/llfloatergroupinfo.h +++ b/indra/newview/llfloatergroupinfo.h @@ -39,48 +39,29 @@ #define LL_LLFLOATERGROUPINFO_H #include "llfloater.h" -#include "lluuid.h" +#include "llinstancetracker.h" class LLPanelGroup; -struct LLOfferInfo; class LLFloaterGroupInfo -: public LLFloater +: public LLFloater, public LLInstanceTracker { public: + LLFloaterGroupInfo(const LLUUID& group_id); virtual ~LLFloaterGroupInfo(); - static void showCreateGroup(void *); - static void showMyGroupInfo(void *); - static void showFromUUID(const LLUUID &group_id, - const std::string& tab_name = std::string()); - static void closeCreateGroup(); - static void closeGroup(const LLUUID& group_id); - static void refreshGroup(const LLUUID& group_id); - - static void showNotice(const std::string& subject, - const std::string& message, - const LLUUID& group_id, - const bool& has_inventory, - const std::string& inventory_name, - LLOfferInfo* inventory_offer); - - LLUUID getGroupID() { return mGroupID;} - void selectTabByName(std::string tab_name); - // This allow us to block the user from closing the floater - // if there is information that needs to be applied. + // This allows us to block the user from closing the floater if there is information that needs to be applied. virtual BOOL canClose(); + protected: - LLFloaterGroupInfo(const std::string& name, const LLRect &rect, const std::string& title, const LLUUID& group_id = LLUUID::null, const std::string& tab_name = std::string()); + friend class LLGroupActions; + LLPanelGroup* mPanelGroupp; private: - static void callbackLoadGroupName(const LLUUID& id, const std::string& full_name, bool is_group); - static std::map sInstances; - - LLUUID mGroupID; - LLPanelGroup* mPanelGroupp; + void callbackLoadGroupName(const std::string& full_name); }; #endif + diff --git a/indra/newview/llfloatergroups.cpp b/indra/newview/llfloatergroups.cpp index a1b0f4ae9..1f5a9cf24 100644 --- a/indra/newview/llfloatergroups.cpp +++ b/indra/newview/llfloatergroups.cpp @@ -51,6 +51,7 @@ #include "llfloatergroupinfo.h" #include "llfloaterdirectory.h" #include "llfocusmgr.h" +#include "llgroupactions.h" #include "llselectmgr.h" #include "llscrolllistctrl.h" #include "llnotificationsutil.h" @@ -218,23 +219,23 @@ BOOL LLPanelGroups::postBuild() init_group_list(group_list, gAgent.getGroupID(), none_text); group_list->setCommitCallback(boost::bind(&LLPanelGroups::onGroupList,this)); group_list->setSortChangedCallback(boost::bind(&LLPanelGroups::onGroupSortChanged,this)); //Force 'none' to always be first entry. - group_list->setDoubleClickCallback(boost::bind(&LLPanelGroups::onBtnIM,this)); + group_list->setDoubleClickCallback(boost::bind(LLGroupActions::startIM, boost::bind(&LLScrollListCtrl::getCurrentID, group_list))); - childSetAction("Activate", onBtnActivate, this); + getChild("Activate")->setCommitCallback(boost::bind(LLGroupActions::activate, boost::bind(&LLScrollListCtrl::getCurrentID, group_list))); - childSetAction("Info", onBtnInfo, this); + getChild("Info")->setCommitCallback(boost::bind(LLGroupActions::show, boost::bind(&LLScrollListCtrl::getCurrentID, group_list))); - childSetAction("IM", onBtnIM, this); + getChild("IM")->setCommitCallback(boost::bind(LLGroupActions::startIM, boost::bind(&LLScrollListCtrl::getCurrentID, group_list))); - childSetAction("Leave", onBtnLeave, this); + getChild("Leave")->setCommitCallback(boost::bind(LLGroupActions::leave, boost::bind(&LLScrollListCtrl::getCurrentID, group_list))); - childSetAction("Create", onBtnCreate, this); + getChild("Create")->setCommitCallback(boost::bind(LLGroupActions::createGroup)); - childSetAction("Search...", onBtnSearch, this); + getChild("Search...")->setCommitCallback(boost::bind(LLGroupActions::search)); childSetAction("Invite...", onBtnInvite, this); - childSetAction("Titles...", onBtnTitles, this); + getChild("Titles...")->setCommitCallback(boost::bind(HBFloaterGroupTitles::toggle)); setDefaultBtn("IM"); @@ -291,148 +292,12 @@ void LLPanelGroups::enableButtons() } -void LLPanelGroups::onBtnCreate(void* userdata) -{ - LLPanelGroups* self = (LLPanelGroups*)userdata; - if(self) self->create(); -} - void LLPanelGroups::onBtnInvite(void* userdata) { LLPanelGroups* self = (LLPanelGroups*)userdata; if(self) self->invite(); } -void LLPanelGroups::onBtnActivate(void* userdata) -{ - LLPanelGroups* self = (LLPanelGroups*)userdata; - if(self) self->activate(); -} - -void LLPanelGroups::onBtnInfo(void* userdata) -{ - LLPanelGroups* self = (LLPanelGroups*)userdata; - if(self) self->info(); -} - -void LLPanelGroups::onBtnIM(void* userdata) -{ - LLPanelGroups* self = (LLPanelGroups*)userdata; - if(self) self->startIM(); -} - -void LLPanelGroups::onBtnLeave(void* userdata) -{ - LLPanelGroups* self = (LLPanelGroups*)userdata; - if(self) self->leave(); -} - -void LLPanelGroups::onBtnSearch(void* userdata) -{ - LLPanelGroups* self = (LLPanelGroups*)userdata; - if(self) self->search(); -} - -void LLPanelGroups::onBtnTitles(void* userdata) -{ - LLPanelGroups* self = (LLPanelGroups*)userdata; - if(self) self->titles(); -} - -void LLPanelGroups::create() -{ - llinfos << "LLPanelGroups::create" << llendl; - LLFloaterGroupInfo::showCreateGroup(NULL); -} - -void LLPanelGroups::activate() -{ - llinfos << "LLPanelGroups::activate" << llendl; - LLCtrlListInterface *group_list = childGetListInterface("group list"); - LLUUID group_id; - if (group_list) - { - group_id = group_list->getCurrentID(); - } - LLMessageSystem* msg = gMessageSystem; - msg->newMessageFast(_PREHASH_ActivateGroup); - msg->nextBlockFast(_PREHASH_AgentData); - msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); - msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); - msg->addUUIDFast(_PREHASH_GroupID, group_id); - gAgent.sendReliableMessage(); -} - -void LLPanelGroups::info() -{ - llinfos << "LLPanelGroups::info" << llendl; - LLCtrlListInterface *group_list = childGetListInterface("group list"); - LLUUID group_id; - if (group_list && (group_id = group_list->getCurrentID()).notNull()) - { - LLFloaterGroupInfo::showFromUUID(group_id); - } -} - -void LLPanelGroups::startIM() -{ - //llinfos << "LLPanelFriends::onClickIM()" << llendl; - LLCtrlListInterface *group_list = childGetListInterface("group list"); - LLUUID group_id; - - if (group_list && (group_id = group_list->getCurrentID()).notNull()) - { - LLGroupData group_data; - if (gAgent.getGroupData(group_id, group_data)) - { - static LLCachedControl tear_off("OtherChatsTornOff"); - if (!tear_off) - gIMMgr->setFloaterOpen(TRUE); - gIMMgr->addSession( - group_data.mName, - IM_SESSION_GROUP_START, - group_id); - make_ui_sound("UISndStartIM"); - } - else - { - // this should never happen, as starting a group IM session - // relies on you belonging to the group and hence having the group data - make_ui_sound("UISndInvalidOp"); - } - } -} - -void LLPanelGroups::leave() -{ - llinfos << "LLPanelGroups::leave" << llendl; - LLCtrlListInterface *group_list = childGetListInterface("group list"); - LLUUID group_id; - if (group_list && (group_id = group_list->getCurrentID()).notNull()) - { - S32 count = gAgent.mGroups.count(); - S32 i; - for(i = 0; i < count; ++i) - { - if(gAgent.mGroups.get(i).mID == group_id) - break; - } - if(i < count) - { - LLSD args; - args["GROUP"] = gAgent.mGroups.get(i).mName; - LLSD payload; - payload["group_id"] = group_id; - LLNotificationsUtil::add("GroupLeaveConfirmMember", args, payload, callbackLeaveGroup); - } - } -} - -void LLPanelGroups::search() -{ - LLFloaterDirectory::showGroups(); -} - void LLPanelGroups::invite() { LLCtrlListInterface *group_list = childGetListInterface("group list"); @@ -448,31 +313,6 @@ void LLPanelGroups::invite() LLFloaterGroupInvite::showForGroup(group_id); } -void LLPanelGroups::titles() -{ - HBFloaterGroupTitles::toggle(); -} - - -// static -bool LLPanelGroups::callbackLeaveGroup(const LLSD& notification, const LLSD& response) -{ - S32 option = LLNotification::getSelectedOption(notification, response); - LLUUID group_id = notification["payload"]["group_id"].asUUID(); - if(option == 0) - { - LLMessageSystem* msg = gMessageSystem; - msg->newMessageFast(_PREHASH_LeaveGroupRequest); - msg->nextBlockFast(_PREHASH_AgentData); - msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); - msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); - msg->nextBlockFast(_PREHASH_GroupData); - msg->addUUIDFast(_PREHASH_GroupID, group_id); - gAgent.sendReliableMessage(); - } - return false; -} - void LLPanelGroups::onGroupSortChanged() { LLScrollListCtrl *group_list = getChild("group list"); diff --git a/indra/newview/llfloatergroups.h b/indra/newview/llfloatergroups.h index ebf37acd7..b262b3f4a 100644 --- a/indra/newview/llfloatergroups.h +++ b/indra/newview/llfloatergroups.h @@ -52,7 +52,6 @@ class LLUICtrl; class LLTextBox; class LLScrollListCtrl; class LLButton; -class LLFloaterGroupPicker; class LLFloaterGroupPicker : public LLFloater, public LLUIFactory > { @@ -105,29 +104,8 @@ protected: void onGroupSortChanged(); void onGroupList(); - static void onBtnCreate(void* userdata); - static void onBtnActivate(void* userdata); - static void onBtnInfo(void* userdata); - static void onBtnIM(void* userdata); - static void onBtnLeave(void* userdata); - static void onBtnSearch(void* userdata); - static void onBtnVote(void* userdata); static void onBtnInvite(void* userdata); - static void onBtnTitles(void* userdata); - static void onDoubleClickGroup(void* userdata); - - void create(); - void activate(); - void info(); - void startIM(); - void leave(); - void search(); - void callVote(); void invite(); - void titles(); - - static bool callbackLeaveGroup(const LLSD& notification, const LLSD& response); - }; 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..e6f077863 100644 --- a/indra/newview/llfloaterland.cpp +++ b/indra/newview/llfloaterland.cpp @@ -47,17 +47,18 @@ #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" #include "llfloaterscriptlimits.h" +#include "llgroupactions.h" #include "lllineeditor.h" #include "llnamelistctrl.h" #include "llnotify.h" @@ -848,8 +849,7 @@ void LLPanelLandGeneral::onClickInfoGroup(void* userdata) LLPanelLandGeneral* panelp = (LLPanelLandGeneral*)userdata; LLParcel* parcel = panelp->mParcel->getParcel(); if (!parcel) return; - LLUUID id = parcel->getGroupID(); - if(id.notNull())LLFloaterGroupInfo::showFromUUID(parcel->getGroupID()); + LLGroupActions::show(parcel->getGroupID()); } void LLPanelLandGeneral::onClickProfile() @@ -859,13 +859,11 @@ void LLPanelLandGeneral::onClickProfile() if (parcel->getIsGroupOwned()) { - const LLUUID& group_id = parcel->getGroupID(); - LLFloaterGroupInfo::showFromUUID(group_id); + LLGroupActions::show(parcel->getGroupID()); } else { - const LLUUID& avatar_id = parcel->getOwnerID(); - LLFloaterAvatarInfo::showFromObject(avatar_id); + LLAvatarActions::showProfile(parcel->getOwnerID()); } } @@ -1179,11 +1177,11 @@ void LLPanelLandObjects::onDoubleClickOwner(void *userdata) BOOL is_group = cell->getValue().asString() == OWNER_GROUP; if (is_group) { - LLFloaterGroupInfo::showFromUUID(owner_id); + LLGroupActions::show(owner_id); } else { - LLFloaterAvatarInfo::showFromDirectory(owner_id); + LLAvatarActions::showProfile(owner_id); } } } diff --git a/indra/newview/llfloaterlandholdings.cpp b/indra/newview/llfloaterlandholdings.cpp index b60aab459..4949678c1 100644 --- a/indra/newview/llfloaterlandholdings.cpp +++ b/indra/newview/llfloaterlandholdings.cpp @@ -42,8 +42,8 @@ #include "llagent.h" #include "llbutton.h" -#include "llfloatergroupinfo.h" #include "llfloaterworldmap.h" +#include "llgroupactions.h" #include "llproductinforequest.h" #include "llscrolllistctrl.h" #include "llstatusbar.h" @@ -103,7 +103,7 @@ BOOL LLFloaterLandHoldings::postBuild() LLScrollListCtrl *grant_list = getChild("grant list"); // Grant list - grant_list->setDoubleClickCallback(boost::bind(&LLFloaterLandHoldings::onGrantList,this)); + grant_list->setDoubleClickCallback(boost::bind(LLGroupActions::show, boost::bind(&LLScrollListCtrl::getCurrentID, grant_list))); LLCtrlListInterface *list = grant_list->getListInterface(); if (!list) return TRUE; @@ -323,19 +323,6 @@ void LLFloaterLandHoldings::onClickMap(void* data) self->buttonCore(1); } -// static -void LLFloaterLandHoldings::onGrantList(void* data) -{ - LLFloaterLandHoldings* self = (LLFloaterLandHoldings*)data; - LLCtrlSelectionInterface *list = self->childGetSelectionInterface("grant list"); - if (!list) return; - LLUUID group_id = list->getCurrentID(); - if (group_id.notNull()) - { - LLFloaterGroupInfo::showFromUUID(group_id); - } -} - void LLFloaterLandHoldings::refreshAggregates() { S32 allowed_area = gStatusBar->getSquareMetersCredit(); diff --git a/indra/newview/llfloaterlandholdings.h b/indra/newview/llfloaterlandholdings.h index def77cf2a..447ebeb82 100644 --- a/indra/newview/llfloaterlandholdings.h +++ b/indra/newview/llfloaterlandholdings.h @@ -60,8 +60,6 @@ public: static void onClickMap(void*); static void onClickLandmark(void*); - static void onGrantList(void* data); - protected: LLFloaterLandHoldings(); virtual ~LLFloaterLandHoldings(); diff --git a/indra/newview/llfloaterobjectiminfo.cpp b/indra/newview/llfloaterobjectiminfo.cpp index 3ecc140b7..af4650d0c 100644 --- a/indra/newview/llfloaterobjectiminfo.cpp +++ b/indra/newview/llfloaterobjectiminfo.cpp @@ -35,17 +35,16 @@ #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 "llgroupactions.h" #include "llmutelist.h" #include "llsdutil.h" #include "lluictrlfactory.h" #include "llurldispatcher.h" -#include "llviewercontrol.h" // [RLVa:KB] - Version: 1.23.4 #include "rlvhandler.h" @@ -147,14 +146,14 @@ void LLFloaterObjectIMInfo::onClickOwner(void* data) LLFloaterObjectIMInfo* self = (LLFloaterObjectIMInfo*)data; if (self->mOwnerIsGroup) { - LLFloaterGroupInfo::showFromUUID(self->mOwnerID); + LLGroupActions::show(self->mOwnerID); } // else // [RLVa:KB] - Version: 1.23.4 | Checked: 2009-07-08 (RLVa-1.0.0e) | Added: RLVa-0.2.0g 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..5fcdc8bbf 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 "llgroupactions.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 @@ -606,16 +604,15 @@ void LLFloaterProperties::onClickOwner() if(!item) return; if(item->getPermissions().isGroupOwned()) { - LLFloaterGroupInfo::showFromUUID(item->getPermissions().getGroup()); + LLGroupActions::show(item->getPermissions().getGroup()); } 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/llgroupactions.cpp b/indra/newview/llgroupactions.cpp new file mode 100644 index 000000000..5efe05ccc --- /dev/null +++ b/indra/newview/llgroupactions.cpp @@ -0,0 +1,505 @@ +/** + * @file llgroupactions.cpp + * @brief Group-related actions (join, leave, new, delete, 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 "llgroupactions.h" + +#include "llagent.h" +#include "llcommandhandler.h" +#include "llfloaterchatterbox.h" // for LLFloaterMyFriends +#include "llfloaterdirectory.h" +#include "llfloatergroupinfo.h" +#include "llgroupmgr.h" +#include "llimview.h" // for gIMMgr +#include "llnotificationsutil.h" +#include "llpanelgroup.h" +#include "llviewermessage.h" +#include "groupchatlistener.h" +#include "hippolimits.h" // for getMaxAgentGroups +// [RLVa:KB] - Checked: 2011-03-28 (RLVa-1.3.0f) +//#include "llslurl.h" +#include "rlvhandler.h" +// [/RLVa:KB] + +// +// Globals +// +static GroupChatListener sGroupChatListener; + +class LLGroupHandler : public LLCommandHandler +{ +public: + // requires trusted browser to trigger + LLGroupHandler() : LLCommandHandler("group", true/*UNTRUSTED_THROTTLE*/) { } + bool handle(const LLSD& tokens, const LLSD& query_map, + LLMediaCtrl* web) + { + /*if (!LLUI::sSettingGroups["config"]->getBOOL("EnableGroupInfo")) + { + LLNotificationsUtil::add("NoGroupInfo", LLSD(), LLSD(), std::string("SwitchToStandardSkinAndQuit")); + return true; + }*/ + + if (tokens.size() < 1) + { + return false; + } + + if (tokens[0].asString() == "create") + { + LLGroupActions::createGroup(); + return true; + } + + if (tokens.size() < 2) + { + return false; + } + + if (tokens[0].asString() == "list") + { + if (tokens[1].asString() == "show") + { + // CP_TODO: get the value we pass in via the XUI name + // of the tab instead of using a literal like this + LLFloaterMyFriends::showInstance( 1 ); + + return true; + } + return false; + } + + LLUUID group_id; + if (!group_id.set(tokens[0], FALSE)) + { + return false; + } + + if (tokens[1].asString() == "about") + { + if (group_id.isNull()) + return true; + + LLGroupActions::show(group_id); + + return true; + } + if (tokens[1].asString() == "inspect") + { + if (group_id.isNull()) + return true; + LLGroupActions::inspect(group_id); + return true; + } + return false; + } +}; +LLGroupHandler gGroupHandler; + +// static +void LLGroupActions::search() +{ + //LLFloaterReg::showInstance("search", LLSD().with("category", "groups")); + LLFloaterDirectory::showGroups(); +} + +/* Singu TODO: Voice refactor +// static +void LLGroupActions::startCall(const LLUUID& group_id) +{ + // create a new group voice session + LLGroupData gdata; + + if (!gAgent.getGroupData(group_id, gdata)) + { + llwarns << "Error getting group data" << llendl; + return; + } + +// [RLVa:KB] - Checked: 2011-04-11 (RLVa-1.3.0h) | Added: RLVa-1.3.0h + if ( (rlv_handler_t::isEnabled()) && (!gRlvHandler.canStartIM(group_id)) && (!gIMMgr->hasSession(group_id)) ) + { + make_ui_sound("UISndInvalidOp"); + RlvUtil::notifyBlocked(RLV_STRING_BLOCKED_STARTIM, LLSD().with("RECIPIENT", LLSLURL("group", group_id, "about").getSLURLString())); + return; + } +// [/RLVa:KB] + + LLUUID session_id = gIMMgr->addSession(gdata.mName, IM_SESSION_GROUP_START, group_id, true); + if (session_id.isNull()) + { + llwarns << "Error adding session" << llendl; + return; + } + + // start the call + gIMMgr->autoStartCallOnStartup(session_id); + + make_ui_sound("UISndStartIM"); +} +*/ + +// static +void LLGroupActions::join(const LLUUID& group_id) +{ + if (gAgent.mGroups.count() >= gHippoLimits->getMaxAgentGroups()) //!gAgent.canJoinGroups() + { + LLNotificationsUtil::add("JoinedTooManyGroups"); + return; + } + + LLGroupMgrGroupData* gdatap = + LLGroupMgr::getInstance()->getGroupData(group_id); + + if (gdatap) + { + S32 cost = gdatap->mMembershipFee; + LLSD args; + args["COST"] = llformat("%d", cost); + args["NAME"] = gdatap->mName; + LLSD payload; + payload["group_id"] = group_id; + + if (can_afford_transaction(cost)) + { + if(cost > 0) + LLNotificationsUtil::add("JoinGroupCanAfford", args, payload, onJoinGroup); + else + LLNotificationsUtil::add("JoinGroupNoCost", args, payload, onJoinGroup); + } + else + { + LLNotificationsUtil::add("JoinGroupCannotAfford", args, payload); + } + } + else + { + llwarns << "LLGroupMgr::getInstance()->getGroupData(" << group_id + << ") was NULL" << llendl; + } +} + +// static +bool LLGroupActions::onJoinGroup(const LLSD& notification, const LLSD& response) +{ + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); + + if (option == 1) + { + // user clicked cancel + return false; + } + + LLGroupMgr::getInstance()-> + sendGroupMemberJoin(notification["payload"]["group_id"].asUUID()); + return false; +} + +// static +void LLGroupActions::leave(const LLUUID& group_id) +{ +// if (group_id.isNull()) +// return; +// [RLVa:KB] - Checked: 2011-03-28 (RLVa-1.4.1a) | Added: RLVa-1.3.0f + if ( (group_id.isNull()) || ((gAgent.getGroupID() == group_id) && (gRlvHandler.hasBehaviour(RLV_BHVR_SETGROUP))) ) + return; +// [/RLVa:KB] + + S32 count = gAgent.mGroups.count(); + S32 i; + for (i = 0; i < count; ++i) + { + if(gAgent.mGroups.get(i).mID == group_id) + break; + } + if (i < count) + { + LLSD args; + args["GROUP"] = gAgent.mGroups.get(i).mName; + LLSD payload; + payload["group_id"] = group_id; + LLNotificationsUtil::add("GroupLeaveConfirmMember", args, payload, onLeaveGroup); + } +} + +// static +void LLGroupActions::activate(const LLUUID& group_id) +{ +// [RLVa:KB] - Checked: 2011-03-28 (RLVa-1.4.1a) | Added: RLVa-1.3.0f + if ( (gRlvHandler.hasBehaviour(RLV_BHVR_SETGROUP)) && (gRlvHandler.getAgentGroup() != group_id) ) + { + return; + } +// [/RLVa:KB] + + LLMessageSystem* msg = gMessageSystem; + msg->newMessageFast(_PREHASH_ActivateGroup); + msg->nextBlockFast(_PREHASH_AgentData); + msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); + msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); + msg->addUUIDFast(_PREHASH_GroupID, group_id); + gAgent.sendReliableMessage(); +} + +/* Singu Note: this function serves no purpose to us, it is here as an honorable mention +static bool isGroupUIVisible() +{ + static LLPanel* panel = 0; + if(!panel) + panel = LLFloaterSidePanelContainer::getPanel("people", "panel_group_info_sidetray"); + if(!panel) + return false; + return panel->isInVisibleChain(); +} +*/ + +// static +void LLGroupActions::inspect(const LLUUID& group_id) +{ + //LLFloaterReg::showInstance("inspect_group", LLSD().with("group_id", group_id)); + openGroupProfile(group_id); +} + + +// static +void LLGroupActions::show(const LLUUID& group_id) +{ + if (group_id.isNull()) + return; + + /* + LLSD params; + params["group_id"] = group_id; + params["open_tab_name"] = "panel_group_info_sidetray"; + + LLFloaterSidePanelContainer::showPanel("people", "panel_group_info_sidetray", params); + */ + openGroupProfile(group_id); +} + +// static +void LLGroupActions::showTab(const LLUUID& group_id, const std::string& tab_name) +{ + if (group_id.isNull()) return; + + openGroupProfile(group_id)->selectTabByName(tab_name); +} + +// static +void LLGroupActions::showNotice(const std::string& subj, const std::string& mes, const LLUUID& group_id, const bool& has_inventory, const std::string& item_name, LLOfferInfo* info) +{ + if (LLFloaterGroupInfo* fgi = LLFloaterGroupInfo::getInstance(group_id)) + { + fgi->mPanelGroupp->showNotice(subj, mes, has_inventory, item_name, info); + } + else + { + // We need to clean up that inventory offer. + if (info) + { + info->forceResponse(IOR_DECLINE); + } + } +} + +/* Singu Note: How could this ever work with a null id, it's only used by llnotificationgrouphandler.cpp which we don't have +void LLGroupActions::refresh_notices() +{ + if(!isGroupUIVisible()) + return; + + LLSD params; + params["group_id"] = LLUUID::null; + params["open_tab_name"] = "panel_group_info_sidetray"; + params["action"] = "refresh_notices"; + + LLFloaterSidePanelContainer::showPanel("people", "panel_group_info_sidetray", params); +} +*/ + +//static +void LLGroupActions::refresh(const LLUUID& group_id) +{ + /* + if(!isGroupUIVisible()) + return; + + LLSD params; + params["group_id"] = group_id; + params["open_tab_name"] = "panel_group_info_sidetray"; + params["action"] = "refresh"; + + LLFloaterSidePanelContainer::showPanel("people", "panel_group_info_sidetray", params); + */ + if (LLFloaterGroupInfo* fgi = LLFloaterGroupInfo::getInstance(group_id)) + if (LLPanelGroup* pg = fgi->mPanelGroupp) + pg->refreshData(); +} + +//static +void LLGroupActions::createGroup() +{ + /* + LLSD params; + params["group_id"] = LLUUID::null; + params["open_tab_name"] = "panel_group_info_sidetray"; + params["action"] = "create"; + + LLFloaterSidePanelContainer::showPanel("people", "panel_group_info_sidetray", params); + */ + openGroupProfile(LLUUID::null); +} +//static +void LLGroupActions::closeGroup(const LLUUID& group_id) +{ + /* + if(!isGroupUIVisible()) + return; + + LLSD params; + params["group_id"] = group_id; + params["open_tab_name"] = "panel_group_info_sidetray"; + params["action"] = "close"; + + LLFloaterSidePanelContainer::showPanel("people", "panel_group_info_sidetray", params); + */ + if (LLFloaterGroupInfo* fgi = LLFloaterGroupInfo::getInstance(group_id)) + fgi->close(); +} + + +// static +LLUUID LLGroupActions::startIM(const LLUUID& group_id) +{ + if (group_id.isNull()) return LLUUID::null; + +// [RLVa:KB] - Checked: 2011-04-11 (RLVa-1.3.0h) | Added: RLVa-1.3.0h + if ( (rlv_handler_t::isEnabled()) && (!gRlvHandler.canStartIM(group_id)) && (!gIMMgr->hasSession(group_id)) ) + { + make_ui_sound("UISndInvalidOp"); + RlvUtil::notifyBlocked(RLV_STRING_BLOCKED_STARTIM, LLSD().with("RECIPIENT", group_id/*LLSLURL("group", group_id, "about").getSLURLString()*/)); + return LLUUID::null; + } +// [/RLVa:KB] + + LLGroupData group_data; + if (gAgent.getGroupData(group_id, group_data)) + { + static LLCachedControl tear_off("OtherChatsTornOff"); + if (!tear_off) gIMMgr->setFloaterOpen(TRUE); + LLUUID session_id = gIMMgr->addSession( + group_data.mName, + IM_SESSION_GROUP_START, + group_id); + make_ui_sound("UISndStartIM"); + return session_id; + } + else + { + // this should never happen, as starting a group IM session + // relies on you belonging to the group and hence having the group data + make_ui_sound("UISndInvalidOp"); + return LLUUID::null; + } +} + +// static +void LLGroupActions::endIM(const LLUUID& group_id) +{ + if (group_id.isNull()) + return; + + LLUUID session_id = gIMMgr->computeSessionID(IM_SESSION_GROUP_START, group_id); + if (session_id.notNull()) + { + gIMMgr->removeSession(session_id); + } +} + +// static +bool LLGroupActions::isInGroup(const LLUUID& group_id) +{ + // *TODO: Move all the LLAgent group stuff into another class, such as + // this one. + return gAgent.isInGroup(group_id); +} + +// static +bool LLGroupActions::isAvatarMemberOfGroup(const LLUUID& group_id, const LLUUID& avatar_id) +{ + if(group_id.isNull() || avatar_id.isNull()) + { + return false; + } + + LLGroupMgrGroupData* group_data = LLGroupMgr::getInstance()->getGroupData(group_id); + if(!group_data) + { + return false; + } + + if(group_data->mMembers.end() == group_data->mMembers.find(avatar_id)) + { + return false; + } + + return true; +} + +//-- Private methods ---------------------------------------------------------- + +// static +bool LLGroupActions::onLeaveGroup(const LLSD& notification, const LLSD& response) +{ + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); + LLUUID group_id = notification["payload"]["group_id"].asUUID(); + if(option == 0) + { + LLMessageSystem* msg = gMessageSystem; + msg->newMessageFast(_PREHASH_LeaveGroupRequest); + msg->nextBlockFast(_PREHASH_AgentData); + msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); + msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); + msg->nextBlockFast(_PREHASH_GroupData); + msg->addUUIDFast(_PREHASH_GroupID, group_id); + gAgent.sendReliableMessage(); + } + return false; +} + +// Singu helper function, open a profile and center it +// static +LLFloaterGroupInfo* LLGroupActions::openGroupProfile(const LLUUID& group_id) +{ + LLFloaterGroupInfo* fgi = LLFloaterGroupInfo::getInstance(group_id); + if (!fgi) fgi = new LLFloaterGroupInfo(group_id); + fgi->center(); + fgi->open(); + return fgi; +} + diff --git a/indra/newview/llgroupactions.h b/indra/newview/llgroupactions.h new file mode 100644 index 000000000..b59fbbe40 --- /dev/null +++ b/indra/newview/llgroupactions.h @@ -0,0 +1,131 @@ +/** + * @file llgroupactions.h + * @brief Group-related actions (join, leave, new, delete, 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_LLGROUPACTIONS_H +#define LL_LLGROUPACTIONS_H + +class LLFloaterGroupInfo; +class LLOfferInfo; + +/** + * Group-related actions (join, leave, new, delete, etc) + */ +class LLGroupActions +{ +public: + /** + * Invokes group search floater. + */ + static void search(); + + /// Join a group. Assumes LLGroupMgr has data for that group already. + static void join(const LLUUID& group_id); + + /** + * Invokes "Leave Group" floater. + */ + static void leave(const LLUUID& group_id); + + /** + * Activate group. + */ + static void activate(const LLUUID& group_id); + + /** + * Show group information panel. + */ + static void show(const LLUUID& group_id); + + /** + * Show group information panel, with specific tab open. + */ + static void showTab(const LLUUID& group_id, const std::string& tab_name); + + /** + * Show group notice that has come in. + */ + static void showNotice(const std::string& subj, const std::string& mes, const LLUUID& group_id, const bool& has_inventory, const std::string& item_name, LLOfferInfo* info); + + /** + * Show group inspector floater. + */ + static void inspect(const LLUUID& group_id); + + /** + * Refresh group information panel. + */ + static void refresh(const LLUUID& group_id); + + /** + * Refresh group notices panel. + */ + static void refresh_notices(); + + /** + * Refresh group information panel. + */ + static void createGroup(); + + /** + * Close group information panel. + */ + static void closeGroup(const LLUUID& group_id); + + /** + * Start group instant messaging session. + */ + static LLUUID startIM(const LLUUID& group_id); + + /** + * End group instant messaging session. + */ + static void endIM(const LLUUID& group_id); + + /// Returns if the current user is a member of the group + static bool isInGroup(const LLUUID& group_id); + + /** + * Start a group voice call. + */ + static void startCall(const LLUUID& group_id); + + /** + * Returns true if avatar is in group. + * + * Note that data about group members is loaded from server. + * If data has not been loaded yet, function will return inaccurate result. + * See LLGroupMgr::sendGroupMembersRequest + */ + static bool isAvatarMemberOfGroup(const LLUUID& group_id, const LLUUID& avatar_id); + +private: + static bool onJoinGroup(const LLSD& notification, const LLSD& response); + static bool onLeaveGroup(const LLSD& notification, const LLSD& response); + static LLFloaterGroupInfo* openGroupProfile(const LLUUID& group_id); +}; + +#endif // LL_LLGROUPACTIONS_H + diff --git a/indra/newview/llgroupmgr.cpp b/indra/newview/llgroupmgr.cpp index 8b7ef5c6f..70eddbcdc 100644 --- a/indra/newview/llgroupmgr.cpp +++ b/indra/newview/llgroupmgr.cpp @@ -44,11 +44,10 @@ #include "lltransactiontypes.h" #include "llstatusbar.h" #include "lleconomy.h" -#include "llviewercontrol.h" #include "llviewerregion.h" #include "llviewerwindow.h" #include "llfloaterdirectory.h" -#include "llfloatergroupinfo.h" +#include "llgroupactions.h" #include "llnotificationsutil.h" #include "lluictrlfactory.h" #include "lltrans.h" @@ -1361,7 +1360,7 @@ void LLGroupMgr::processEjectGroupMemberReply(LLMessageSystem* msg, void ** data // If we had a failure, the group panel needs to be updated. if (!success) { - LLFloaterGroupInfo::refreshGroup(group_id); + LLGroupActions::refresh(group_id); } } @@ -1381,7 +1380,7 @@ void LLGroupMgr::processJoinGroupReply(LLMessageSystem* msg, void ** data) LLGroupMgr::getInstance()->clearGroupData(group_id); // refresh the floater for this group, if any. - LLFloaterGroupInfo::refreshGroup(group_id); + LLGroupActions::refresh(group_id); // refresh the group panel of the search window, if necessary. LLFloaterDirectory::refreshGroup(group_id); } @@ -1403,7 +1402,7 @@ void LLGroupMgr::processLeaveGroupReply(LLMessageSystem* msg, void ** data) LLGroupMgr::getInstance()->clearGroupData(group_id); // close the floater for this group, if any. - LLFloaterGroupInfo::closeGroup(group_id); + LLGroupActions::closeGroup(group_id); // refresh the group panel of the search window, if necessary. LLFloaterDirectory::refreshGroup(group_id); } @@ -1439,8 +1438,8 @@ void LLGroupMgr::processCreateGroupReply(LLMessageSystem* msg, void ** data) gAgent.mGroups.push_back(gd); - LLFloaterGroupInfo::closeCreateGroup(); - LLFloaterGroupInfo::showFromUUID(group_id,"roles_tab"); + LLGroupActions::closeGroup(LLUUID::null); + LLGroupActions::showTab(group_id, "roles_tab"); } else { diff --git a/indra/newview/llgroupnotify.cpp b/indra/newview/llgroupnotify.cpp index dd0667288..ca9c834f8 100644 --- a/indra/newview/llgroupnotify.cpp +++ b/indra/newview/llgroupnotify.cpp @@ -39,13 +39,13 @@ #include "llbutton.h" #include "lliconctrl.h" #include "llfloaterchat.h" // for add_chat_history() +#include "llgroupactions.h" #include "llnotify.h" #include "lltextbox.h" #include "llviewertexteditor.h" #include "lluiconstants.h" #include "llui.h" #include "llviewercontrol.h" -#include "llfloatergroupinfo.h" #include "llinventoryicon.h" #include "llinventory.h" #include "lltrans.h" @@ -279,7 +279,7 @@ LLGroupNotifyBox::LLGroupNotifyBox(const std::string& subject, wide_btn_width, BTN_HEIGHT); - btn = new LLButton(LLTrans::getString("GroupNotifyGroupNotices"), btn_rect, LLStringUtil::null, boost::bind(&LLGroupNotifyBox::onClickGroupInfo,this)); + btn = new LLButton(LLTrans::getString("GroupNotifyGroupNotices"), btn_rect, LLStringUtil::null, boost::bind(LLGroupActions::showTab, mGroupID, "notices_tab")); btn->setToolTip(LLTrans::getString("GroupNotifyViewPastNotices")); addChild(btn, -1); @@ -457,12 +457,6 @@ void LLGroupNotifyBox::onClickOk() close(); } -void LLGroupNotifyBox::onClickGroupInfo() -{ - LLFloaterGroupInfo::showFromUUID(mGroupID, "notices_tab"); - //Leave notice open until explicitly closed -} - void LLGroupNotifyBox::onClickSaveInventory() { mInventoryOffer->forceResponse(IOR_ACCEPT); diff --git a/indra/newview/llgroupnotify.h b/indra/newview/llgroupnotify.h index 1a0819577..bd19ccd89 100644 --- a/indra/newview/llgroupnotify.h +++ b/indra/newview/llgroupnotify.h @@ -90,7 +90,6 @@ protected: // internal handler for button being clicked void onClickOk(); - void onClickGroupInfo(); void onClickSaveInventory(); // for "next" button diff --git a/indra/newview/llimpanel.cpp b/indra/newview/llimpanel.cpp index 9e9cd87c8..47c968056 100644 --- a/indra/newview/llimpanel.cpp +++ b/indra/newview/llimpanel.cpp @@ -45,13 +45,13 @@ #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 "llgroupactions.h" #include "llfloateractivespeakers.h" -#include "llfloateravatarinfo.h" #include "llfloaterchat.h" #include "llfloatergroupinfo.h" #include "llimview.h" @@ -1358,13 +1358,13 @@ 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)); + btn->setCommitCallback(boost::bind(LLGroupActions::show, mSessionUUID)); childSetAction("history_btn", onClickHistory, this); if (LLUICtrl* ctrl = findChild("rp_mode")) ctrl->setCommitCallback(boost::bind(&LLFloaterIMPanel::onRPMode, this, _2)); @@ -1375,9 +1375,6 @@ BOOL LLFloaterIMPanel::postBuild() if (LLButton* btn = findChild("toggle_active_speakers_btn")) btn->setCommitCallback(boost::bind(&LLFloaterIMPanel::onClickToggleActiveSpeakers, this, _2)); - //LLButton* close_btn = getChild("close_btn"); - //close_btn->setClickedCallback(&LLFloaterIMPanel::onClickClose, this); - mHistoryEditor = getChild("im_history"); mHistoryEditor->setParseHTML(TRUE); mHistoryEditor->setParseHighlights(TRUE); @@ -1876,25 +1873,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(); @@ -1919,22 +1897,6 @@ void LLFloaterIMPanel::onClickHistory( void* userdata ) } } -void LLFloaterIMPanel::onClickGroupInfo() -{ - // Bring up the Profile window - LLFloaterGroupInfo::showFromUUID(mSessionUUID); -} - -// static -void LLFloaterIMPanel::onClickClose( void* userdata ) -{ - LLFloaterIMPanel* self = (LLFloaterIMPanel*) userdata; - if(self) - { - self->close(); - } -} - // static void LLFloaterIMPanel::onClickStartCall(void* userdata) { diff --git a/indra/newview/llimpanel.h b/indra/newview/llimpanel.h index 95f5eb41e..3c42228ba 100644 --- a/indra/newview/llimpanel.h +++ b/indra/newview/llimpanel.h @@ -239,12 +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 ); static void onClickEndCall( void* userdata ); void onClickToggleActiveSpeakers(const LLSD& value); 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..7ba3bf859 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" @@ -2896,7 +2896,7 @@ void LLFolderBridge::performAction(LLInventoryModel* model, std::string action) restoreItem(); return; } -#ifndef LL_RELEASE_FOR_DOWNLOAD +#ifdef DELETE_SYSTEM_FOLDERS else if ("delete_system_folder" == action) { removeSystemFolder(); @@ -3455,7 +3455,7 @@ void LLFolderBridge::buildContextMenuFolderOptions(U32 flags) mDisabledItems.push_back(std::string("Delete")); } -#ifndef LL_RELEASE_FOR_DOWNLOAD +#ifdef DELETE_SYSTEM_FOLDERS if (LLFolderType::lookupIsProtectedType(type)) { mItems.push_back(std::string("Delete System Folder")); @@ -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/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp index b5a572c0c..1099c165d 100644 --- a/indra/newview/llinventoryfunctions.cpp +++ b/indra/newview/llinventoryfunctions.cpp @@ -409,10 +409,12 @@ BOOL get_is_category_removable(const LLInventoryModel* model, const LLUUID& id) const LLFolderType::EType folder_type = category->getPreferredType(); +#ifndef DELETE_SYSTEM_FOLDERS if (LLFolderType::lookupIsProtectedType(folder_type)) { return FALSE; } +#endif // Can't delete the outfit that is currently being worn. if (folder_type == LLFolderType::FT_OUTFIT) 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..524de0fb0 100644 --- a/indra/newview/llpanelavatar.cpp +++ b/indra/newview/llpanelavatar.cpp @@ -34,74 +34,48 @@ #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 "llgroupactions.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 +171,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 +389,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(); @@ -463,18 +431,14 @@ void LLPanelAvatarSecondLife::onClickImage(void* data) void LLPanelAvatarSecondLife::onDoubleClickGroup(void* data) { LLPanelAvatarSecondLife* self = (LLPanelAvatarSecondLife*)data; - LLScrollListCtrl* group_list = self->getChild("groups"); if(group_list) { LLScrollListItem* item = group_list->getFirstSelected(); - - if(item && item->getUUID().notNull()) + if (item) { - llinfos << "Show group info " << item->getUUID() << llendl; - - LLFloaterGroupInfo::showFromUUID(item->getUUID()); + LLGroupActions::show(item->getUUID()); } } } @@ -506,11 +470,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 +502,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 +514,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 +559,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 +578,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 +1381,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 +1403,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 +1455,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 +1475,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 +1494,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 +1536,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 +1554,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 +1633,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 +1645,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 +1719,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 +1730,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 +1738,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 +1844,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 +1967,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/llpanelgroup.cpp b/indra/newview/llpanelgroup.cpp index e45f0608a..619f89e84 100644 --- a/indra/newview/llpanelgroup.cpp +++ b/indra/newview/llpanelgroup.cpp @@ -125,18 +125,14 @@ void LLPanelGroupTab::handleClickHelp() } } -LLPanelGroup::LLPanelGroup(const std::string& filename, - const std::string& name, - const LLUUID& group_id, - const std::string& initial_tab_selected) -: LLPanel(name, LLRect(), FALSE), +LLPanelGroup::LLPanelGroup(const LLUUID& group_id) +: LLPanel("PanelGroup", LLRect(), FALSE), LLGroupMgrObserver( group_id ), mCurrentTab( NULL ), mRequestedTab( NULL ), mTabContainer( NULL ), mIgnoreTransition( FALSE ), mForceClose( FALSE ), - mInitialTab(initial_tab_selected), mAllowEdit( TRUE ), mShowingNotifyDialog( FALSE ) { @@ -159,18 +155,14 @@ LLPanelGroup::LLPanelGroup(const std::string& filename, LLGroupMgr::getInstance()->addObserver(this); // Pass on construction of this panel to the control factory. - LLUICtrlFactory::getInstance()->buildPanel(this, filename, &getFactoryMap()); - mFilename = filename; + LLUICtrlFactory::getInstance()->buildPanel(this, "panel_group.xml", &getFactoryMap()); } LLPanelGroup::~LLPanelGroup() { LLGroupMgr::getInstance()->removeObserver(this); - int i; - int tab_count = mTabContainer->getTabCount(); - - for (i = tab_count - 1; i >=0; --i) + for (int i = mTabContainer->getTabCount() - 1; i >=0; --i) { LLPanelGroupTab* panelp = (LLPanelGroupTab*) mTabContainer->getPanelByIndex(i); @@ -181,10 +173,7 @@ LLPanelGroup::~LLPanelGroup() void LLPanelGroup::updateTabVisibility() { - S32 i; - S32 tab_count = mTabContainer->getTabCount(); - - for (i = tab_count - 1; i >=0; --i) + for (int i = mTabContainer->getTabCount() - 1; i >=0; --i) { LLPanelGroupTab* panelp = (LLPanelGroupTab*) mTabContainer->getPanelByIndex(i); @@ -211,38 +200,23 @@ BOOL LLPanelGroup::postBuild() if (mTabContainer) { - // Select the initial tab specified via constructor - const BOOL recurse = TRUE; - LLPanelGroupTab* tabp = - getChild(mInitialTab, recurse); + //our initial tab selection was invalid, just select the + //first tab then or default to selecting the initial + //selected tab specified in the layout file + LLPanelGroupTab* tabp = (LLPanelGroupTab*) mTabContainer->getCurrentPanel(); + //no tab was initially selected through constructor + //or the XML, select the first tab if (!tabp) { - //our initial tab selection was invalid, just select the - //first tab then or default to selecting the initial - //selected tab specified in the layout file + mTabContainer->selectFirstTab(); tabp = (LLPanelGroupTab*) mTabContainer->getCurrentPanel(); - - //no tab was initially selected through constructor - //or the XML, select the first tab - if (!tabp) - { - mTabContainer->selectFirstTab(); - tabp = (LLPanelGroupTab*) mTabContainer->getCurrentPanel(); - } - } - else - { - mTabContainer->selectTabPanel(tabp); } mCurrentTab = tabp; // Add click callbacks. - S32 i; - S32 tab_count = mTabContainer->getTabCount(); - - for (i = tab_count - 1; i >=0; --i) + for (int i = mTabContainer->getTabCount() - 1; i >=0; --i) { LLPanel* tab_panel = mTabContainer->getPanelByIndex(i); LLPanelGroupTab* panelp =(LLPanelGroupTab*)tab_panel; // bit of a hack @@ -342,8 +316,6 @@ void LLPanelGroup::handleClickTab() void LLPanelGroup::setGroupID(const LLUUID& group_id) { - LLRect rect(getRect()); - LLGroupMgr::getInstance()->removeObserver(this); mID = group_id; LLGroupMgr::getInstance()->addObserver(this); @@ -355,7 +327,7 @@ void LLPanelGroup::setGroupID(const LLUUID& group_id) // For now, rebuild panel //delete children and rebuild panel deleteAllChildren(); - LLUICtrlFactory::getInstance()->buildPanel(this, mFilename, &getFactoryMap()); + LLUICtrlFactory::getInstance()->buildPanel(this, "panel_group.xml", &getFactoryMap()); } void LLPanelGroup::selectTab(std::string tab_name) diff --git a/indra/newview/llpanelgroup.h b/indra/newview/llpanelgroup.h index 7180799a4..e652b96b6 100644 --- a/indra/newview/llpanelgroup.h +++ b/indra/newview/llpanelgroup.h @@ -58,10 +58,7 @@ class LLPanelGroup : public LLPanel, public LLPanelGroupTabObserver { public: - LLPanelGroup(const std::string& filename, - const std::string& name, - const LLUUID& group_id, - const std::string& initial_tab_selected = std::string()); + LLPanelGroup(const LLUUID& group_id); virtual ~LLPanelGroup(); virtual BOOL postBuild(); @@ -119,9 +116,6 @@ protected: BOOL mForceClose; - std::string mInitialTab; - std::string mFilename; - std::string mDefaultNeedsApplyMesg; std::string mWantApplyMesg; diff --git a/indra/newview/llpanelgroupgeneral.cpp b/indra/newview/llpanelgroupgeneral.cpp index f215e8266..55b5b70ad 100644 --- a/indra/newview/llpanelgroupgeneral.cpp +++ b/indra/newview/llpanelgroupgeneral.cpp @@ -36,9 +36,10 @@ #include "lluictrlfactory.h" #include "llagent.h" +#include "llavataractions.h" +#include "llfloatergroups.h" +#include "llgroupactions.h" #include "roles_constants.h" -#include "llfloateravatarinfo.h" -#include "llfloatergroupinfo.h" // UI elements #include "llbutton.h" @@ -133,13 +134,13 @@ BOOL LLPanelGroupGeneral::postBuild() mBtnJoinGroup = getChild("join_button", recurse); if ( mBtnJoinGroup ) { - mBtnJoinGroup->setClickedCallback(boost::bind(&LLPanelGroupGeneral::onClickJoin, this)); + mBtnJoinGroup->setClickedCallback(boost::bind(LLGroupActions::join, mGroupID)); } mBtnInfo = getChild("info_button", recurse); if ( mBtnInfo ) { - mBtnInfo->setClickedCallback(boost::bind(&LLPanelGroupGeneral::onClickInfo, this)); + mBtnInfo->setClickedCallback(boost::bind(LLGroupActions::show, mGroupID)); } LLTextBox* founder = getChild("founder_name"); @@ -154,7 +155,7 @@ BOOL LLPanelGroupGeneral::postBuild() mListVisibleMembers = getChild("visible_members", recurse); if (mListVisibleMembers) { - mListVisibleMembers->setDoubleClickCallback(boost::bind(&LLPanelGroupGeneral::openProfile,this)); + mListVisibleMembers->setDoubleClickCallback(boost::bind(LLAvatarActions::showProfile, boost::bind(&LLScrollListCtrl::getCurrentID, mListVisibleMembers))); } // Options @@ -322,83 +323,6 @@ void LLPanelGroupGeneral::onCommitTitle() mComboActiveTitle->resetDirty(); } -// static -void LLPanelGroupGeneral::onClickInfo(void *userdata) -{ - LLPanelGroupGeneral *self = (LLPanelGroupGeneral *)userdata; - - if ( !self ) return; - - lldebugs << "open group info: " << self->mGroupID << llendl; - - LLFloaterGroupInfo::showFromUUID(self->mGroupID); -} - -// static -void LLPanelGroupGeneral::onClickJoin(void *userdata) -{ - LLPanelGroupGeneral *self = (LLPanelGroupGeneral *)userdata; - - if ( !self ) return; - - lldebugs << "joining group: " << self->mGroupID << llendl; - - LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(self->mGroupID); - - if (gdatap) - { - S32 cost = gdatap->mMembershipFee; - LLSD args; - args["COST"] = llformat("%d", cost); - LLSD payload; - payload["group_id"] = self->mGroupID; - - if (can_afford_transaction(cost)) - { - LLNotificationsUtil::add("JoinGroupCanAfford", args, payload, LLPanelGroupGeneral::joinDlgCB); - } - else - { - LLNotificationsUtil::add("JoinGroupCannotAfford", args, payload); - } - } - else - { - llwarns << "LLGroupMgr::getInstance()->getGroupData(" << self->mGroupID - << ") was NULL" << llendl; - } -} - -// static -bool LLPanelGroupGeneral::joinDlgCB(const LLSD& notification, const LLSD& response) -{ - S32 option = LLNotification::getSelectedOption(notification, response); - - if (option == 1) - { - // user clicked cancel - return false; - } - - LLGroupMgr::getInstance()->sendGroupMemberJoin(notification["payload"]["group_id"].asUUID()); - return false; -} - -// static -void LLPanelGroupGeneral::openProfile(void* data) -{ - LLPanelGroupGeneral* self = (LLPanelGroupGeneral*)data; - - if (self && self->mListVisibleMembers) - { - LLScrollListItem* selected = self->mListVisibleMembers->getFirstSelected(); - if (selected) - { - LLFloaterAvatarInfo::showFromDirectory( selected->getUUID() ); - } - } -} - bool LLPanelGroupGeneral::needsApply(std::string& mesg) { updateChanged(); diff --git a/indra/newview/llpanelgroupgeneral.h b/indra/newview/llpanelgroupgeneral.h index db400ad7c..84058ac84 100644 --- a/indra/newview/llpanelgroupgeneral.h +++ b/indra/newview/llpanelgroupgeneral.h @@ -75,14 +75,9 @@ private: void onCommitUserOnly(); void onCommitTitle(); void onCommitEnrollment(); - static void onClickJoin(void* userdata); - static void onClickInfo(void* userdata); static void onReceiveNotices(LLUICtrl* ctrl, void* data); - static void openProfile(void* data); void addMember(LLGroupMemberData* member); - static bool joinDlgCB(const LLSD& notification, const LLSD& response); - void updateMembers(); void updateChanged(); bool confirmMatureApply(const LLSD& notification, const LLSD& response); diff --git a/indra/newview/llpanelgroupinvite.cpp b/indra/newview/llpanelgroupinvite.cpp index c1c29be8d..6b4d0e680 100644 --- a/indra/newview/llpanelgroupinvite.cpp +++ b/indra/newview/llpanelgroupinvite.cpp @@ -39,6 +39,7 @@ #include "llbutton.h" #include "llcallingcard.h" #include "llcombobox.h" +#include "llgroupactions.h" #include "llgroupmgr.h" #include "llnamelistctrl.h" #include "llnotificationsutil.h" @@ -49,8 +50,6 @@ #include "lluictrlfactory.h" #include "llviewerwindow.h" -#include - class LLPanelGroupInvite::impl : public boost::signals2::trackable { public: @@ -183,7 +182,7 @@ void LLPanelGroupInvite::impl::submitInvitations() iter != items.end(); ++iter) { LLScrollListItem* item = *iter; - if(gdatap->mMembers.find(item->getUUID()) != gdatap->mMembers.end()) + if(LLGroupActions::isAvatarMemberOfGroup(mGroupID, item->getUUID())) { already_in_group = true; continue; 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..40a79bcef 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 "llfloatergroups.h" +#include "llgroupactions.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" @@ -155,7 +149,8 @@ BOOL LLPanelPermissions::postBuild() childSetCommitCallback("clickaction",LLPanelPermissions::onCommitClickAction,this); childSetCommitCallback("search_check",LLPanelPermissions::onCommitIncludeInSearch,this); - mLabelGroupName = getChild("Group Name Proxy"); + mLabelGroupName = new LLNameBox("Group Name", getChild("Group Name Proxy")->getRect()); + addChild(mLabelGroupName); if (!gHippoGridManager->getCurrentGrid()->isSecondLife()) LFSimFeatureHandler::instance().setSupportsExportCallback(boost::bind(&LLPanelPermissions::refresh, this)); @@ -267,7 +262,7 @@ void LLPanelPermissions::disableAll() combo_click_action->clear(); } getChildView("B:")->setVisible( FALSE); - getChildView("O:")->setVisible( FALSE); + //getChildView("O:")->setVisible( FALSE); getChildView("G:")->setVisible( FALSE); getChildView("E:")->setVisible( FALSE); getChildView("N:")->setVisible( FALSE); @@ -672,8 +667,8 @@ void LLPanelPermissions::refresh() perm_string = mask_to_string(owner_mask_on); if (!supports_export && owner_mask_on & PERM_EXPORT) // Hide Export when not available perm_string.erase(perm_string.find_last_of("E")); - getChild("O:")->setValue("O: " + perm_string); - getChildView("O:")->setVisible( TRUE); + //getChild("O:")->setValue("O: " + perm_string); + //getChildView("O:")->setVisible( TRUE); getChild("G:")->setValue("G: " + mask_to_string(group_mask_on)); getChildView("G:")->setVisible( TRUE); @@ -701,7 +696,7 @@ void LLPanelPermissions::refresh() { childSetVisible("perm_modify", true); getChildView("B:")->setVisible( FALSE); - getChildView("O:")->setVisible( FALSE); + //getChildView("O:")->setVisible( FALSE); getChildView("G:")->setVisible( FALSE); getChildView("E:")->setVisible( FALSE); getChildView("N:")->setVisible( FALSE); @@ -1007,7 +1002,7 @@ void LLPanelPermissions::onClickCreator(void *data) { LLPanelPermissions *self = (LLPanelPermissions *)data; - LLFloaterAvatarInfo::showFromObject(self->mCreatorID); + LLAvatarActions::showProfile(self->mCreatorID); } // static @@ -1019,25 +1014,24 @@ void LLPanelPermissions::onClickOwner(void *data) { LLUUID group_id; LLSelectMgr::getInstance()->selectGetGroup(group_id); - LLFloaterGroupInfo::showFromUUID(group_id); + LLGroupActions::show(group_id); } else { // [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) @@ -1071,7 +1065,7 @@ void LLPanelPermissions::onClickOpenGroup(void* data) LLUUID group_id; LLSelectMgr::getInstance()->selectGetGroup(group_id); - LLFloaterGroupInfo::showFromUUID(group_id); + LLGroupActions::show(group_id); } // static 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/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index 165e22201..5f347f8d8 100644 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -608,11 +608,13 @@ void LLViewerInventoryCategory::removeFromServer( void ) llinfos << "Removing inventory category " << mUUID << " from server." << llendl; // communicate that change with the server. +#ifndef DELETE_SYSTEM_FOLDERS if(LLFolderType::lookupIsProtectedType(mPreferredType)) { LLNotificationsUtil::add("CannotRemoveProtectedCategories"); return; } +#endif LLInventoryModel::LLCategoryUpdate up(mParentUUID, -1); gInventory.accountForUpdate(up); 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 8c06890ab..d9582da4f 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" @@ -3773,11 +3770,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); @@ -3795,9 +3787,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; @@ -3819,7 +3811,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 { @@ -6099,30 +6091,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) @@ -6133,7 +6101,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; } @@ -6144,9 +6112,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()); @@ -6628,7 +6596,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; } @@ -7279,28 +7247,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..4c72b4801 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -60,7 +60,6 @@ #include "llfloaterbuycurrency.h" #include "llfloaterbuyland.h" #include "llfloaterchat.h" -#include "llfloatergroupinfo.h" #include "llfloaterimagepreview.h" #include "llfloaterland.h" #include "llfloaterregioninfo.h" @@ -69,6 +68,7 @@ #include "llfloaterpostcard.h" #include "llfloaterpreference.h" #include "llfloaterteleporthistory.h" +#include "llgroupactions.h" #include "llhudeffecttrail.h" #include "llhudmanager.h" #include "llimpanel.h" @@ -639,7 +639,7 @@ bool join_group_response(const LLSD& notification, const LLSD& response) if (option == 2 && !group_id.isNull()) { - LLFloaterGroupInfo::showFromUUID(group_id); + LLGroupActions::show(group_id); LLSD args; args["MESSAGE"] = message; LLNotificationsUtil::add("JoinGroup", args, notification["payload"]); @@ -1780,7 +1780,7 @@ bool group_vote_callback(const LLSD& notification, const LLSD& response) case 0: // Vote Now // Open up the voting tab - LLFloaterGroupInfo::showFromUUID(group_id, "voting_tab"); + LLGroupActions::showTab(group_id, "voting_tab"); break; default: // Vote Later or @@ -2533,7 +2533,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) // Also send down the old path for now. if (IM_GROUP_NOTICE_REQUESTED == dialog) { - LLFloaterGroupInfo::showNotice(subj,mes,group_id,has_inventory,item_name,info); + LLGroupActions::showNotice(subj,mes,group_id,has_inventory,item_name,info); } else { @@ -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/randgauss.h b/indra/newview/randgauss.h deleted file mode 100644 index bc51d1567..000000000 --- a/indra/newview/randgauss.h +++ /dev/null @@ -1,111 +0,0 @@ -/** - * @file randgauss.h - * @brief randgauss class definition - * - * $LicenseInfo:firstyear=2003&license=viewergpl$ - * - * Copyright (c) 2003-2009, Linden Research, Inc. - * - * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 - * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/programs/open_source/licensing/flossexception - * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. - * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. - * $/LicenseInfo$ - */ - -const F32 table[][2] = { -{.00f, .5f}, -{.01f, .504f}, -{.02f, .508f}, -{.03f, .512f}, -{.06f, .5239f}, -{.08f, .5319f}, -{.11f, .5438f}, -{.13f, .5517f}, -{.16f, .5636f}, -{.18f, .5714f}, -{.21f, .5832f}, -{.23f, .5910f}, -{.26f, .6026f}, -{.28f, .6103f}, -{.31f, .6217f}, -{.34f, .6331f}, -{.36f, .6406f}, -{.39f, .6517f}, -{.42f, .6628f}, -{.44f, .6700f}, -{.47f, .6808f}, -{.50f, .6915f}, -{.53f, .7019f}, -{.56f, .7123f}, -{.59f, .7224f}, -{.62f, .7324f}, -{.65f, .7422f}, -{.68f, .7517f}, -{.71f, .7611f}, -{.74f, .7703f}, -{.78f, .7823f}, -{.81f, .7910f}, -{.85f, .8023f}, -{.88f, .8106f}, -{.92f, .8212f}, -{.96f, .8315f}, -{1.0f, .8413f}, -{1.04f, .8508f}, -{1.09f, .8621f}, -{1.13f, .8708f}, -{1.18f, .8810f}, -{1.23f, .8907f}, -{1.29f, .9015f}, -{1.35f, .9115f}, -{1.41f, .9207f}, -{1.48f, .9306f}, -{1.56f, .9406f}, -{1.65f, .9505f}, -{1.76f, .9608f}, -{1.89f, .9706f}, -{2.06f, .9803f}, -{2.33f, .9901f}, -{99.0f, 1.0f}}; - -inline F32 randGauss(F32 mean, F32 stdev) -{ - S32 i = 0; - F32 u = rand() / (F32) RAND_MAX; - F32 n; - - if (u >= 0.5) - { - while (u > table[i][1]) - i++; - - n = table[i-1][0]; - - } else { - u = 1 - u; - while (u > table[i][1]) - i++; - n = 1 - table[i-1][0]; - } - //printf("u: %f, n: %f, i: %d\n", u, n, i); //debug - - return (mean + stdev * n); -} - 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/rlvextensions.cpp b/indra/newview/rlvextensions.cpp index 8489de7ed..aa07dfcd2 100644 --- a/indra/newview/rlvextensions.cpp +++ b/indra/newview/rlvextensions.cpp @@ -495,10 +495,6 @@ bool RlvExtGetSet::findDebugSetting(std::string& strSetting, S16& flags) { LLStringUtil::toLower(strSetting); // Convenience for non-RLV calls - // HACK-RLVa: bad code but it's just a temporary measure to provide a smooth changeover from the old to the new rebranded settings - if ( (strSetting.length() >= 14) && (0 == strSetting.find("restrainedlife")) ) - strSetting = "restrainedlove" + strSetting.substr(14); - std::string strTemp; for (std::map::const_iterator itSetting = m_DbgAllowed.begin(); itSetting != m_DbgAllowed.end(); ++itSetting) { 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..b9a720981 100644 --- a/indra/newview/rlvhandler.cpp +++ b/indra/newview/rlvhandler.cpp @@ -18,9 +18,9 @@ #include "llagent.h" #include "llappearancemgr.h" #include "llappviewer.h" +#include "llgroupactions.h" #include "llhudtext.h" #include "llstartup.h" -#include "llviewermenu.h" #include "llviewermessage.h" #include "llviewerobjectlist.h" #include "llviewerparcelmgr.h" @@ -195,7 +195,7 @@ void RlvHandler::removeCommandHandler(RlvCommandHandler* pCmdHandler) m_CommandHandlers.remove(pCmdHandler); } -// Checked: 2009-10-26 (RLVa-1.1.0a) | Modified: RLVa-1.1.0a +// Checked: 2010-04-07 (RLVa-1.2.0d) | Modified: RLVa-1.1.0a void RlvHandler::clearCommandHandlers() { std::list::const_iterator itHandler = m_CommandHandlers.begin(); @@ -730,7 +730,6 @@ size_t utf8str_strlen(const std::string& utf8) return length; } -// TODO-RLV: works, but more testing won't hurt std::string utf8str_chtruncate(const std::string& utf8, size_t length) { if (0 == length) @@ -1113,7 +1112,7 @@ void RlvHandler::clearState() #define VERIFY_OPTION(x) { if (!(x)) { eRet = RLV_RET_FAILED_OPTION; break; } } #define VERIFY_OPTION_REF(x) { if (!(x)) { eRet = RLV_RET_FAILED_OPTION; break; } fRefCount = true; } -// Checked: 2010-03-03 (RLVa-1.1.3b) | Modified: RLVa-1.2.0a +// Checked: 2010-03-03 (RLVa-1.2.0a) | Modified: RLVa-1.2.0a ERlvCmdRet RlvHandler::processAddRemCommand(const RlvCommand& rlvCmd) { // NOTE: - at this point the command has already been: @@ -1154,8 +1153,8 @@ ERlvCmdRet RlvHandler::processAddRemCommand(const RlvCommand& rlvCmd) VERIFY_OPTION_REF(strOption.empty()); } break; - case RLV_BHVR_ADDOUTFIT: // @addoutfit[:]=n|y - Checked: 2010-08-29 (RLVa-1.1.3b) | Modified: RLVa-1.2.1c - case RLV_BHVR_REMOUTFIT: // @remoutfit[:]=n|y - Checked: 2010-08-29 (RLVa-1.1.3b) | Modified: RLVa-1.2.1c + case RLV_BHVR_ADDOUTFIT: // @addoutfit[:]=n|y - Checked: 2010-08-29 (RLVa-1.2.1c) | Modified: RLVa-1.2.1c + case RLV_BHVR_REMOUTFIT: // @remoutfit[:]=n|y - Checked: 2010-08-29 (RLVa-1.2.1c) | Modified: RLVa-1.2.1c { // If there's an option it should specify a wearable type name (reference count on no option *and* a valid option) RlvCommandOptionGeneric rlvCmdOption(rlvCmd.getOption()); @@ -1244,7 +1243,7 @@ ERlvCmdRet RlvHandler::processAddRemCommand(const RlvCommand& rlvCmd) VERIFY_OPTION_REF(strOption.empty()); } break; - case RLV_BHVR_NOTIFY: // @notify:=add|rem - Checked: 2010-03-03 (RLVa-1.1.3a) | Modified: RLVa-1.2.0a + case RLV_BHVR_NOTIFY: // @notify:=add|rem - Checked: 2010-03-03 (RLVa-1.2.0a) | Modified: RLVa-1.2.0a { // There should be an option that we can successfully parse (if there's an empty option the command is invalid) S32 nChannel; std::string strFilter; @@ -1277,10 +1276,10 @@ ERlvCmdRet RlvHandler::processAddRemCommand(const RlvCommand& rlvCmd) case RLV_BHVR_SHOWLOC: // @showloc=n|y - Checked: 2009-12-05 (RLVa-1.1.0h) | Modified: RLVa-1.1.0h case RLV_BHVR_SHOWNAMES: // @shownames=n|y - Checked: 2009-12-05 (RLVa-1.1.0h) | Modified: RLVa-1.1.0h case RLV_BHVR_EMOTE: // @emote=n|y - Checked: 2010-03-26 (RLVa-1.2.0b) - case RLV_BHVR_SENDCHAT: // @sendchat=n|y - Checked: 2009-12-05 (RLVa-1.1.0h) | Modified: RLVa-1.1.0h - case RLV_BHVR_CHATWHISPER: // @chatwhisper=n|y - Checked: 2009-12-05 (RLVa-1.1.0h) | Modified: RLVa-1.1.0h - case RLV_BHVR_CHATNORMAL: // @chatnormal=n|y - Checked: 2009-12-05 (RLVa-1.1.0h) | Modified: RLVa-1.1.0h - case RLV_BHVR_CHATSHOUT: // @chatshout=n|y - Checked: 2009-12-05 (RLVa-1.1.0h) | Modified: RLVa-1.1.0h + case RLV_BHVR_SENDCHAT: // @sendchat=n|y - Checked: 2010-03-26 (RLVa-1.2.0b) + case RLV_BHVR_CHATWHISPER: // @chatwhisper=n|y - Checked: 2010-03-26 (RLVa-1.2.0b) + case RLV_BHVR_CHATNORMAL: // @chatnormal=n|y - Checked: 2010-03-26 (RLVa-1.2.0b) + case RLV_BHVR_CHATSHOUT: // @chatshout=n|y - Checked: 2010-03-26 (RLVa-1.2.0b) case RLV_BHVR_PERMISSIVE: // @permissive=n|y - Checked: 2009-12-05 (RLVa-1.1.0h) | Modified: RLVa-1.1.0h case RLV_BHVR_SHOWINV: // @showinv=n|y - Checked: 2010-03-01 (RLVa-1.2.0a) case RLV_BHVR_SHOWMINIMAP: // @showminimap=n|y - Checked: 2010-02-28 (RLVa-1.2.0a) @@ -1291,12 +1290,12 @@ ERlvCmdRet RlvHandler::processAddRemCommand(const RlvCommand& rlvCmd) case RLV_BHVR_STANDTP: // @standtp=n|y - Checked: 2010-08-29 (RLVa-1.2.1c) case RLV_BHVR_TPLM: // @tplm=n|y - Checked: 2009-12-05 (RLVa-1.1.0h) | Modified: RLVa-1.1.0h case RLV_BHVR_TPLOC: // @tploc=n|y - Checked: 2009-12-05 (RLVa-1.1.0h) | Modified: RLVa-1.1.0h - case RLV_BHVR_VIEWNOTE: // @viewnote=n|y - Checked: 2009-12-05 (RLVa-1.1.0h) | Modified: RLVa-1.1.0h - case RLV_BHVR_VIEWSCRIPT: // @viewscript=n|y - Checked: 2009-12-05 (RLVa-1.1.0h) | Modified: RLVa-1.1.0h - case RLV_BHVR_VIEWTEXTURE: // @viewtexture=n|y - Checked: 2009-12-05 (RLVa-1.1.0h) | Modified: RLVa-1.1.0h + case RLV_BHVR_VIEWNOTE: // @viewnote=n|y - Checked: 2010-03-27 (RLVa-1.2.0b) + case RLV_BHVR_VIEWSCRIPT: // @viewscript=n|y - Checked: 2010-03-27 (RLVa-1.2.0b) + case RLV_BHVR_VIEWTEXTURE: // @viewtexture=n|y - Checked: 2010-03-27 (RLVa-1.2.0b) case RLV_BHVR_ACCEPTPERMISSION: // @acceptpermission=n|y - Checked: 2009-12-05 (RLVa-1.1.0h) | Modified: RLVa-1.1.0h #ifdef RLV_EXTENSION_CMD_ALLOWIDLE - case RLV_BHVR_ALLOWIDLE: // @allowidle=n|y - Checked: 2009-12-05 (RLVa-1.1.0h) | Modified: RLVa-1.1.0h + case RLV_BHVR_ALLOWIDLE: // @allowidle=n|y - Checked: 2010-05-03 (RLVa-1.2.0g) | Modified: RLVa-1.1.0h #endif // RLV_EXTENSION_CMD_ALLOWIDLE case RLV_BHVR_REZ: // @rez=n|y - Checked: 2009-12-05 (RLVa-1.1.0h) | Modified: RLVa-1.1.0h case RLV_BHVR_FARTOUCH: // @fartouch=n|y - Checked: 2009-12-05 (RLVa-1.1.0h) | Modified: RLVa-1.1.0h @@ -1318,10 +1317,11 @@ ERlvCmdRet RlvHandler::processAddRemCommand(const RlvCommand& rlvCmd) VERIFY_OPTION_REF(strOption.empty()); break; // The following block is only valid if there's no option (= restriction) or if it specifies a valid UUID (= behaviour exception) - case RLV_BHVR_RECVCHAT: // @recvchat[:]=n|y - Checked: 2009-12-05 (RLVa-1.1.0h) | Modified: RLVa-1.1.0h - case RLV_BHVR_RECVEMOTE: // @recvemote[:]=n|y - Checked: 2009-12-05 (RLVa-1.1.0h) | Modified: RLVa-1.1.0h + case RLV_BHVR_RECVCHAT: // @recvchat[:]=n|y - Checked: 2010-03-26 (RLVa-1.2.0b) + case RLV_BHVR_RECVEMOTE: // @recvemote[:]=n|y - Checked: 2010-03-26 (RLVa-1.2.0b) 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 +1350,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 { @@ -1399,7 +1400,7 @@ ERlvCmdRet RlvHandler::processAddRemCommand(const RlvCommand& rlvCmd) return eRet; } -// Checked: 2010-03-03 (RLVa-1.1.3b) | Modified: RLVa-1.2.0a +// Checked: 2010-03-03 (RLVa-1.2.0a) | Modified: RLVa-1.2.0a ERlvCmdRet RlvHandler::onAddRemAttach(const RlvCommand& rlvCmd, bool& fRefCount) { RLV_ASSERT( (RLV_TYPE_ADD == rlvCmd.getParamType()) || (RLV_TYPE_REMOVE == rlvCmd.getParamType()) ); @@ -1434,7 +1435,7 @@ ERlvCmdRet RlvHandler::onAddRemAttach(const RlvCommand& rlvCmd, bool& fRefCount) return RLV_RET_SUCCESS; } -// Checked: 2010-02-28 (RLVa-1.1.3b) | Modified: RLVa-1.2.0a +// Checked: 2010-02-28 (RLVa-1.2.0a) | Modified: RLVa-1.2.0a ERlvCmdRet RlvHandler::onAddRemDetach(const RlvCommand& rlvCmd, bool& fRefCount) { RLV_ASSERT( (RLV_TYPE_ADD == rlvCmd.getParamType()) || (RLV_TYPE_REMOVE == rlvCmd.getParamType()) ); @@ -1608,7 +1609,10 @@ ERlvCmdRet RlvHandler::processForceCommand(const RlvCommand& rlvCmd) const { F32 nValue = (rlvCmdOption.m_nPelvisToFoot - gAgentAvatarp->getPelvisToFoot()) * rlvCmdOption.m_nPelvisToFootDeltaMult; nValue += rlvCmdOption.m_nPelvisToFootOffset; - gSavedSettings.setF32(RLV_SETTING_AVATAROFFSET_Z, llclamp(nValue, -1.0f, 1.0f)); + if (!gAgentAvatarp->isUsingServerBakes()) + gSavedSettings.setF32(RLV_SETTING_AVATAROFFSET_Z, llclamp(nValue, -1.0f, 1.0f)); + else + eRet = RLV_RET_FAILED_DISABLED; } } break; @@ -1665,7 +1669,7 @@ ERlvCmdRet RlvHandler::processForceCommand(const RlvCommand& rlvCmd) const return eRet; } -// Checked: 2010-08-29 (RLVa-1.1.3b) | Modified: RLVa-1.2.1c +// Checked: 2010-08-29 (RLVa-1.2.1c) | Modified: RLVa-1.2.1c ERlvCmdRet RlvHandler::onForceRemAttach(const RlvCommand& rlvCmd) const { RLV_ASSERT(RLV_TYPE_FORCE == rlvCmd.getParamType()); @@ -1700,7 +1704,7 @@ ERlvCmdRet RlvHandler::onForceRemAttach(const RlvCommand& rlvCmd) const return RLV_RET_FAILED_OPTION; } -// Checked: 2010-08-29 (RLVa-1.1.3b) | Modified: RLVa-1.2.1c +// Checked: 2010-08-29 (RLVa-1.2.1c) | Modified: RLVa-1.2.1c ERlvCmdRet RlvHandler::onForceRemOutfit(const RlvCommand& rlvCmd) const { RlvCommandOptionGeneric rlvCmdOption(rlvCmd.getOption()); @@ -1739,14 +1743,7 @@ ERlvCmdRet RlvHandler::onForceGroup(const RlvCommand& rlvCmd) const if (fValid) { m_idAgentGroup = idGroup; - - LLMessageSystem* msg = gMessageSystem; - msg->newMessageFast(_PREHASH_ActivateGroup); - msg->nextBlockFast(_PREHASH_AgentData); - msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); - msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); - msg->addUUIDFast(_PREHASH_GroupID, idGroup); - gAgent.sendReliableMessage(); + LLGroupActions::activate(idGroup); } return (fValid) ? RLV_RET_SUCCESS : RLV_RET_FAILED_OPTION; @@ -1831,7 +1828,7 @@ void RlvHandler::onForceWearCallback(const uuid_vec_t& idItems, ERlvBehaviour eB // Command handlers (RLV_TYPE_REPLY) // -// Checked: 2009-11-26 (RLVa-1.1.0f) | Modified: RLVa-1.1.0f +// Checked: 2010-04-07 (RLVa-1.2.0d) | Modified: RLVa-1.1.0f ERlvCmdRet RlvHandler::processReplyCommand(const RlvCommand& rlvCmd) const { RLV_ASSERT(RLV_TYPE_REPLY == rlvCmd.getParamType()); @@ -1844,12 +1841,12 @@ ERlvCmdRet RlvHandler::processReplyCommand(const RlvCommand& rlvCmd) const ERlvCmdRet eRet = RLV_RET_SUCCESS; std::string strReply; switch (rlvCmd.getBehaviourType()) { - case RLV_BHVR_VERSION: // @version= - Checked: 2010-03-27 (RLVa-1.2.0b) - case RLV_BHVR_VERSIONNEW: // @versionnew= - Checked: 2010-03-27 (RLVa-1.2.0b) | Added: RLVa-1.2.0b + case RLV_BHVR_VERSION: // @version= - Checked: 2010-03-27 (RLVa-1.4.0a) + case RLV_BHVR_VERSIONNEW: // @versionnew= - Checked: 2010-03-27 (RLVa-1.4.0a) | Added: RLVa-1.2.0b // NOTE: RLV will respond even if there's an option strReply = RlvStrings::getVersion(RLV_BHVR_VERSION == rlvCmd.getBehaviourType()); break; - case RLV_BHVR_VERSIONNUM: // @versionnum= - Checked: 2009-11-26 (RLVa-1.1.0f) | Added: RLVa-1.0.4b + case RLV_BHVR_VERSIONNUM: // @versionnum= - Checked: 2010-03-27 (RLVa-1.4.0a) | Added: RLVa-1.0.4b // NOTE: RLV will respond even if there's an option strReply = RlvStrings::getVersionNum(); break; @@ -1886,7 +1883,7 @@ ERlvCmdRet RlvHandler::processReplyCommand(const RlvCommand& rlvCmd) const case RLV_BHVR_GETINV: // @getinv[:]= eRet = onGetInv(rlvCmd, strReply); break; - case RLV_BHVR_GETINVWORN: // @getinvworn[:path]= + case RLV_BHVR_GETINVWORN: // @getinvworn[:]= eRet = onGetInvWorn(rlvCmd, strReply); break; case RLV_BHVR_GETGROUP: // @getgroup= - Checked: 2011-03-28 (RLVa-1.4.1a) | Added: RLVa-1.3.0f @@ -1915,7 +1912,7 @@ ERlvCmdRet RlvHandler::processReplyCommand(const RlvCommand& rlvCmd) const } break; #endif // RLV_EXTENSION_CMD_GETCOMMAND - case RLV_BHVR_GETSTATUS: // @getstatus[: