Modern C++ thank you! Kokua can yoink the old stuff...

master
Ansariel 2023-09-03 19:35:23 +02:00
parent a746460321
commit b064b04077
8 changed files with 91 additions and 98 deletions

View File

@ -28,11 +28,6 @@
#include "linden_common.h"
#include "fsregistrarutils.h"
FSRegistrarUtils::FSRegistrarUtils() :
mEnableCheckFunction(NULL)
{
}
bool FSRegistrarUtils::checkIsEnabled(LLUUID av_id, EFSRegistrarFunctionActionType action)
{
if (mEnableCheckFunction)

View File

@ -28,9 +28,7 @@
#ifndef FS_REGISTRARUTILS_H
#define FS_REGISTRARUTILS_H
#include <boost/function.hpp>
enum EFSRegistrarFunctionActionType
enum class EFSRegistrarFunctionActionType
{
FS_RGSTR_ACT_ADD_FRIEND,
FS_RGSTR_ACT_REMOVE_FRIEND,
@ -55,10 +53,10 @@ enum EFSRegistrarFunctionActionType
class FSRegistrarUtils
{
public:
FSRegistrarUtils();
~FSRegistrarUtils() { };
FSRegistrarUtils() = default;
~FSRegistrarUtils() = default;
typedef boost::function<bool(const LLUUID&, EFSRegistrarFunctionActionType)> enable_check_function_t;
using enable_check_function_t = std::function<bool(const LLUUID&, EFSRegistrarFunctionActionType)>;
void setEnableCheckFunction(const enable_check_function_t& func)
{
mEnableCheckFunction = func;
@ -67,7 +65,7 @@ public:
bool checkIsEnabled(LLUUID av_id, EFSRegistrarFunctionActionType action);
private:
enable_check_function_t mEnableCheckFunction;
enable_check_function_t mEnableCheckFunction{ nullptr };
};
extern FSRegistrarUtils gFSRegistrarUtils;

View File

@ -2216,44 +2216,44 @@ BOOL LLScrollListCtrl::handleRightMouseDown(S32 x, S32 y, MASK mask)
registrar.add("Url.CopyUrl", boost::bind(&LLScrollListCtrl::copySLURLToClipboard, id, is_group));
// <FS:Ansariel> Additional convenience options
registrar.add("FS.ZoomIn", boost::bind(&LLUrlAction::executeSLURL, "secondlife:///app/firestorm/" + id + "/zoom", true));
registrar.add("FS.TeleportToTarget", boost::bind(&LLUrlAction::executeSLURL, "secondlife:///app/firestorm/" + id + "/teleportto", true));
registrar.add("FS.OfferTeleport", boost::bind(&LLUrlAction::executeSLURL, "secondlife:///app/firestorm/" + id + "/offerteleport", true));
registrar.add("FS.RequestTeleport", boost::bind(&LLUrlAction::executeSLURL, "secondlife:///app/firestorm/" + id + "/requestteleport", true));
registrar.add("FS.TrackAvatar", boost::bind(&LLUrlAction::executeSLURL, "secondlife:///app/firestorm/" + id + "/track", true));
registrar.add("FS.AddToContactSet", boost::bind(&LLUrlAction::executeSLURL, "secondlife:///app/firestorm/" + id + "/addtocontactset", true)); // [FS:CR]
registrar.add("FS.BlockAvatar", boost::bind(&LLUrlAction::executeSLURL, "secondlife:///app/firestorm/" + id + "/blockavatar", true));
registrar.add("FS.ViewLog", boost::bind(&LLUrlAction::executeSLURL, "secondlife:///app/firestorm/" + id + "/viewlog", true));
registrar.add("FS.ZoomIn", std::bind(&LLUrlAction::executeSLURL, "secondlife:///app/firestorm/" + id + "/zoom", true));
registrar.add("FS.TeleportToTarget", std::bind(&LLUrlAction::executeSLURL, "secondlife:///app/firestorm/" + id + "/teleportto", true));
registrar.add("FS.OfferTeleport", std::bind(&LLUrlAction::executeSLURL, "secondlife:///app/firestorm/" + id + "/offerteleport", true));
registrar.add("FS.RequestTeleport", std::bind(&LLUrlAction::executeSLURL, "secondlife:///app/firestorm/" + id + "/requestteleport", true));
registrar.add("FS.TrackAvatar", std::bind(&LLUrlAction::executeSLURL, "secondlife:///app/firestorm/" + id + "/track", true));
registrar.add("FS.AddToContactSet", std::bind(&LLUrlAction::executeSLURL, "secondlife:///app/firestorm/" + id + "/addtocontactset", true)); // [FS:CR]
registrar.add("FS.BlockAvatar", std::bind(&LLUrlAction::executeSLURL, "secondlife:///app/firestorm/" + id + "/blockavatar", true));
registrar.add("FS.ViewLog", std::bind(&LLUrlAction::executeSLURL, "secondlife:///app/firestorm/" + id + "/viewlog", true));
// </FS:Ansariel> Additional convenience options
// <FS:Ansariel> Add enable checks for menu items
LLUICtrl::EnableCallbackRegistry::ScopedRegistrar enable_registrar;
enable_registrar.add("Url.EnableShowProfile", boost::bind(&FSRegistrarUtils::checkIsEnabled, gFSRegistrarUtils, uuid, FS_RGSTR_ACT_SHOW_PROFILE));
enable_registrar.add("Url.EnableAddFriend", boost::bind(&FSRegistrarUtils::checkIsEnabled, gFSRegistrarUtils, uuid, FS_RGSTR_ACT_ADD_FRIEND));
enable_registrar.add("Url.EnableRemoveFriend", boost::bind(&FSRegistrarUtils::checkIsEnabled, gFSRegistrarUtils, uuid, FS_RGSTR_ACT_REMOVE_FRIEND));
enable_registrar.add("Url.EnableSendIM", boost::bind(&FSRegistrarUtils::checkIsEnabled, gFSRegistrarUtils, uuid, FS_RGSTR_ACT_SEND_IM));
enable_registrar.add("FS.EnableZoomIn", boost::bind(&FSRegistrarUtils::checkIsEnabled, gFSRegistrarUtils, uuid, FS_RGSTR_ACT_ZOOM_IN));
enable_registrar.add("FS.EnableOfferTeleport", boost::bind(&FSRegistrarUtils::checkIsEnabled, gFSRegistrarUtils, uuid, FS_RGSTR_ACT_OFFER_TELEPORT));
enable_registrar.add("FS.EnableTrackAvatar", boost::bind(&FSRegistrarUtils::checkIsEnabled, gFSRegistrarUtils, uuid, FS_RGSTR_ACT_TRACK_AVATAR));
enable_registrar.add("FS.EnableTeleportToTarget", boost::bind(&FSRegistrarUtils::checkIsEnabled, gFSRegistrarUtils, uuid, FS_RGSTR_ACT_TELEPORT_TO));
enable_registrar.add("FS.EnableRequestTeleport", boost::bind(&FSRegistrarUtils::checkIsEnabled, gFSRegistrarUtils, uuid, FS_RGSTR_ACT_REQUEST_TELEPORT));
enable_registrar.add("FS.CheckIsAgentBlocked", boost::bind(&FSRegistrarUtils::checkIsEnabled, gFSRegistrarUtils, uuid, FS_RGSTR_CHK_AVATAR_BLOCKED));
enable_registrar.add("FS.EnableBlockAvatar", boost::bind(&FSRegistrarUtils::checkIsEnabled, gFSRegistrarUtils, uuid, FS_RGSTR_CHK_IS_NOT_SELF));
enable_registrar.add("FS.EnableViewLog", boost::bind(&FSRegistrarUtils::checkIsEnabled, gFSRegistrarUtils, uuid, FS_RGSTR_ACT_VIEW_TRANSCRIPT));
enable_registrar.add("Url.EnableShowProfile", std::bind(&FSRegistrarUtils::checkIsEnabled, gFSRegistrarUtils, uuid, EFSRegistrarFunctionActionType::FS_RGSTR_ACT_SHOW_PROFILE));
enable_registrar.add("Url.EnableAddFriend", std::bind(&FSRegistrarUtils::checkIsEnabled, gFSRegistrarUtils, uuid, EFSRegistrarFunctionActionType::FS_RGSTR_ACT_ADD_FRIEND));
enable_registrar.add("Url.EnableRemoveFriend", std::bind(&FSRegistrarUtils::checkIsEnabled, gFSRegistrarUtils, uuid, EFSRegistrarFunctionActionType::FS_RGSTR_ACT_REMOVE_FRIEND));
enable_registrar.add("Url.EnableSendIM", std::bind(&FSRegistrarUtils::checkIsEnabled, gFSRegistrarUtils, uuid, EFSRegistrarFunctionActionType::FS_RGSTR_ACT_SEND_IM));
enable_registrar.add("FS.EnableZoomIn", std::bind(&FSRegistrarUtils::checkIsEnabled, gFSRegistrarUtils, uuid, EFSRegistrarFunctionActionType::FS_RGSTR_ACT_ZOOM_IN));
enable_registrar.add("FS.EnableOfferTeleport", std::bind(&FSRegistrarUtils::checkIsEnabled, gFSRegistrarUtils, uuid, EFSRegistrarFunctionActionType::FS_RGSTR_ACT_OFFER_TELEPORT));
enable_registrar.add("FS.EnableTrackAvatar", std::bind(&FSRegistrarUtils::checkIsEnabled, gFSRegistrarUtils, uuid, EFSRegistrarFunctionActionType::FS_RGSTR_ACT_TRACK_AVATAR));
enable_registrar.add("FS.EnableTeleportToTarget", std::bind(&FSRegistrarUtils::checkIsEnabled, gFSRegistrarUtils, uuid, EFSRegistrarFunctionActionType::FS_RGSTR_ACT_TELEPORT_TO));
enable_registrar.add("FS.EnableRequestTeleport", std::bind(&FSRegistrarUtils::checkIsEnabled, gFSRegistrarUtils, uuid, EFSRegistrarFunctionActionType::FS_RGSTR_ACT_REQUEST_TELEPORT));
enable_registrar.add("FS.CheckIsAgentBlocked", std::bind(&FSRegistrarUtils::checkIsEnabled, gFSRegistrarUtils, uuid, EFSRegistrarFunctionActionType::FS_RGSTR_CHK_AVATAR_BLOCKED));
enable_registrar.add("FS.EnableBlockAvatar", std::bind(&FSRegistrarUtils::checkIsEnabled, gFSRegistrarUtils, uuid, EFSRegistrarFunctionActionType::FS_RGSTR_CHK_IS_NOT_SELF));
enable_registrar.add("FS.EnableViewLog", std::bind(&FSRegistrarUtils::checkIsEnabled, gFSRegistrarUtils, uuid, EFSRegistrarFunctionActionType::FS_RGSTR_ACT_VIEW_TRANSCRIPT));
// </FS:Ansariel>
// <FS:Zi> FIRE-30725 - Add more group functions to group URL context menu
std::string uuid_str = uuid.asString();
registrar.add("FS.JoinGroup", boost::bind(&LLUrlAction::executeSLURL, "secondlife:///app/firestorm/" + uuid_str + "/groupjoin", true));
registrar.add("FS.LeaveGroup", boost::bind(&LLUrlAction::executeSLURL, "secondlife:///app/firestorm/" + uuid_str + "/groupleave", true));
registrar.add("FS.ActivateGroup", boost::bind(&LLUrlAction::executeSLURL, "secondlife:///app/firestorm/" + uuid_str + "/groupactivate", true));
registrar.add("FS.JoinGroup", std::bind(&LLUrlAction::executeSLURL, "secondlife:///app/firestorm/" + uuid_str + "/groupjoin", true));
registrar.add("FS.LeaveGroup", std::bind(&LLUrlAction::executeSLURL, "secondlife:///app/firestorm/" + uuid_str + "/groupleave", true));
registrar.add("FS.ActivateGroup", std::bind(&LLUrlAction::executeSLURL, "secondlife:///app/firestorm/" + uuid_str + "/groupactivate", true));
enable_registrar.add("FS.WaitingForGroupData", boost::bind(&FSRegistrarUtils::checkIsEnabled, gFSRegistrarUtils, uuid, FS_RGSTR_CHK_WAITING_FOR_GROUP_DATA));
enable_registrar.add("FS.HaveGroupData", boost::bind(&FSRegistrarUtils::checkIsEnabled, gFSRegistrarUtils, uuid, FS_RGSTR_CHK_HAVE_GROUP_DATA));
enable_registrar.add("FS.EnableJoinGroup", boost::bind(&FSRegistrarUtils::checkIsEnabled, gFSRegistrarUtils, uuid, FS_RGSTR_CHK_CAN_JOIN_GROUP));
enable_registrar.add("FS.EnableLeaveGroup", boost::bind(&FSRegistrarUtils::checkIsEnabled, gFSRegistrarUtils, uuid, FS_RGSTR_CHK_CAN_LEAVE_GROUP));
enable_registrar.add("FS.EnableActivateGroup", boost::bind(&FSRegistrarUtils::checkIsEnabled, gFSRegistrarUtils, uuid, FS_RGSTR_CHK_GROUP_NOT_ACTIVE));
enable_registrar.add("FS.WaitingForGroupData", std::bind(&FSRegistrarUtils::checkIsEnabled, gFSRegistrarUtils, uuid, EFSRegistrarFunctionActionType::FS_RGSTR_CHK_WAITING_FOR_GROUP_DATA));
enable_registrar.add("FS.HaveGroupData", std::bind(&FSRegistrarUtils::checkIsEnabled, gFSRegistrarUtils, uuid, EFSRegistrarFunctionActionType::FS_RGSTR_CHK_HAVE_GROUP_DATA));
enable_registrar.add("FS.EnableJoinGroup", std::bind(&FSRegistrarUtils::checkIsEnabled, gFSRegistrarUtils, uuid, EFSRegistrarFunctionActionType::FS_RGSTR_CHK_CAN_JOIN_GROUP));
enable_registrar.add("FS.EnableLeaveGroup", std::bind(&FSRegistrarUtils::checkIsEnabled, gFSRegistrarUtils, uuid, EFSRegistrarFunctionActionType::FS_RGSTR_CHK_CAN_LEAVE_GROUP));
enable_registrar.add("FS.EnableActivateGroup", std::bind(&FSRegistrarUtils::checkIsEnabled, gFSRegistrarUtils, uuid, EFSRegistrarFunctionActionType::FS_RGSTR_CHK_GROUP_NOT_ACTIVE));
// </FS:Zi>
// create the context menu from the XUI file and display it

View File

@ -2265,51 +2265,51 @@ void LLTextBase::createUrlContextMenu(S32 x, S32 y, const std::string &in_url)
// <FS:Ansariel> Additional convenience options
std::string target_id_str = LLUrlAction::extractUuidFromSlurl(url).asString();
registrar.add("FS.ZoomIn", boost::bind(&LLUrlAction::executeSLURL, "secondlife:///app/firestorm/" + target_id_str + "/zoom", true));
registrar.add("FS.TeleportToTarget", boost::bind(&LLUrlAction::executeSLURL, "secondlife:///app/firestorm/" + target_id_str + "/teleportto", true));
registrar.add("FS.OfferTeleport", boost::bind(&LLUrlAction::executeSLURL, "secondlife:///app/firestorm/" + target_id_str + "/offerteleport", true));
registrar.add("FS.RequestTeleport", boost::bind(&LLUrlAction::executeSLURL, "secondlife:///app/firestorm/" + target_id_str + "/requestteleport", true));
registrar.add("FS.TrackAvatar", boost::bind(&LLUrlAction::executeSLURL, "secondlife:///app/firestorm/" + target_id_str + "/track", true));
registrar.add("FS.AddToContactSet", boost::bind(&LLUrlAction::executeSLURL, "secondlife:///app/firestorm/" + target_id_str + "/addtocontactset", true)); // [FS:CR]
registrar.add("FS.BlockAvatar", boost::bind(&LLUrlAction::executeSLURL, "secondlife:///app/firestorm/" + target_id_str + "/blockavatar", true));
registrar.add("FS.ViewLog", boost::bind(&LLUrlAction::executeSLURL, "secondlife:///app/firestorm/" + target_id_str + "/viewlog", true));
registrar.add("FS.ZoomIn", std::bind(&LLUrlAction::executeSLURL, "secondlife:///app/firestorm/" + target_id_str + "/zoom", true));
registrar.add("FS.TeleportToTarget", std::bind(&LLUrlAction::executeSLURL, "secondlife:///app/firestorm/" + target_id_str + "/teleportto", true));
registrar.add("FS.OfferTeleport", std::bind(&LLUrlAction::executeSLURL, "secondlife:///app/firestorm/" + target_id_str + "/offerteleport", true));
registrar.add("FS.RequestTeleport", std::bind(&LLUrlAction::executeSLURL, "secondlife:///app/firestorm/" + target_id_str + "/requestteleport", true));
registrar.add("FS.TrackAvatar", std::bind(&LLUrlAction::executeSLURL, "secondlife:///app/firestorm/" + target_id_str + "/track", true));
registrar.add("FS.AddToContactSet", std::bind(&LLUrlAction::executeSLURL, "secondlife:///app/firestorm/" + target_id_str + "/addtocontactset", true)); // [FS:CR]
registrar.add("FS.BlockAvatar", std::bind(&LLUrlAction::executeSLURL, "secondlife:///app/firestorm/" + target_id_str + "/blockavatar", true));
registrar.add("FS.ViewLog", std::bind(&LLUrlAction::executeSLURL, "secondlife:///app/firestorm/" + target_id_str + "/viewlog", true));
// </FS:Ansariel>
// <FS:Ansariel> Add enable checks for menu items
LLUICtrl::EnableCallbackRegistry::ScopedRegistrar enable_registrar;
LLUUID target_id(target_id_str);
enable_registrar.add("Url.EnableShowProfile", boost::bind(&FSRegistrarUtils::checkIsEnabled, gFSRegistrarUtils, target_id, FS_RGSTR_ACT_SHOW_PROFILE));
enable_registrar.add("Url.EnableAddFriend", boost::bind(&FSRegistrarUtils::checkIsEnabled, gFSRegistrarUtils, target_id, FS_RGSTR_ACT_ADD_FRIEND));
enable_registrar.add("Url.EnableRemoveFriend", boost::bind(&FSRegistrarUtils::checkIsEnabled, gFSRegistrarUtils, target_id, FS_RGSTR_ACT_REMOVE_FRIEND));
enable_registrar.add("Url.EnableSendIM", boost::bind(&FSRegistrarUtils::checkIsEnabled, gFSRegistrarUtils, target_id, FS_RGSTR_ACT_SEND_IM));
enable_registrar.add("FS.EnableZoomIn", boost::bind(&FSRegistrarUtils::checkIsEnabled, gFSRegistrarUtils, target_id, FS_RGSTR_ACT_ZOOM_IN));
enable_registrar.add("FS.EnableOfferTeleport", boost::bind(&FSRegistrarUtils::checkIsEnabled, gFSRegistrarUtils, target_id, FS_RGSTR_ACT_OFFER_TELEPORT));
enable_registrar.add("FS.EnableTrackAvatar", boost::bind(&FSRegistrarUtils::checkIsEnabled, gFSRegistrarUtils, target_id, FS_RGSTR_ACT_TRACK_AVATAR));
enable_registrar.add("FS.EnableTeleportToTarget", boost::bind(&FSRegistrarUtils::checkIsEnabled, gFSRegistrarUtils, target_id, FS_RGSTR_ACT_TELEPORT_TO));
enable_registrar.add("FS.EnableRequestTeleport", boost::bind(&FSRegistrarUtils::checkIsEnabled, gFSRegistrarUtils, target_id, FS_RGSTR_ACT_REQUEST_TELEPORT));
enable_registrar.add("FS.CheckIsAgentBlocked", boost::bind(&FSRegistrarUtils::checkIsEnabled, gFSRegistrarUtils, target_id, FS_RGSTR_CHK_AVATAR_BLOCKED));
enable_registrar.add("FS.EnableBlockAvatar", boost::bind(&FSRegistrarUtils::checkIsEnabled, gFSRegistrarUtils, target_id, FS_RGSTR_CHK_IS_NOT_SELF));
enable_registrar.add("FS.EnableViewLog", boost::bind(&FSRegistrarUtils::checkIsEnabled, gFSRegistrarUtils, target_id, FS_RGSTR_ACT_VIEW_TRANSCRIPT));
enable_registrar.add("Url.EnableShowProfile", std::bind(&FSRegistrarUtils::checkIsEnabled, gFSRegistrarUtils, target_id, EFSRegistrarFunctionActionType::FS_RGSTR_ACT_SHOW_PROFILE));
enable_registrar.add("Url.EnableAddFriend", std::bind(&FSRegistrarUtils::checkIsEnabled, gFSRegistrarUtils, target_id, EFSRegistrarFunctionActionType::FS_RGSTR_ACT_ADD_FRIEND));
enable_registrar.add("Url.EnableRemoveFriend", std::bind(&FSRegistrarUtils::checkIsEnabled, gFSRegistrarUtils, target_id, EFSRegistrarFunctionActionType::FS_RGSTR_ACT_REMOVE_FRIEND));
enable_registrar.add("Url.EnableSendIM", std::bind(&FSRegistrarUtils::checkIsEnabled, gFSRegistrarUtils, target_id, EFSRegistrarFunctionActionType::FS_RGSTR_ACT_SEND_IM));
enable_registrar.add("FS.EnableZoomIn", std::bind(&FSRegistrarUtils::checkIsEnabled, gFSRegistrarUtils, target_id, EFSRegistrarFunctionActionType::FS_RGSTR_ACT_ZOOM_IN));
enable_registrar.add("FS.EnableOfferTeleport", std::bind(&FSRegistrarUtils::checkIsEnabled, gFSRegistrarUtils, target_id, EFSRegistrarFunctionActionType::FS_RGSTR_ACT_OFFER_TELEPORT));
enable_registrar.add("FS.EnableTrackAvatar", std::bind(&FSRegistrarUtils::checkIsEnabled, gFSRegistrarUtils, target_id, EFSRegistrarFunctionActionType::FS_RGSTR_ACT_TRACK_AVATAR));
enable_registrar.add("FS.EnableTeleportToTarget", std::bind(&FSRegistrarUtils::checkIsEnabled, gFSRegistrarUtils, target_id, EFSRegistrarFunctionActionType::FS_RGSTR_ACT_TELEPORT_TO));
enable_registrar.add("FS.EnableRequestTeleport", std::bind(&FSRegistrarUtils::checkIsEnabled, gFSRegistrarUtils, target_id, EFSRegistrarFunctionActionType::FS_RGSTR_ACT_REQUEST_TELEPORT));
enable_registrar.add("FS.CheckIsAgentBlocked", std::bind(&FSRegistrarUtils::checkIsEnabled, gFSRegistrarUtils, target_id, EFSRegistrarFunctionActionType::FS_RGSTR_CHK_AVATAR_BLOCKED));
enable_registrar.add("FS.EnableBlockAvatar", std::bind(&FSRegistrarUtils::checkIsEnabled, gFSRegistrarUtils, target_id, EFSRegistrarFunctionActionType::FS_RGSTR_CHK_IS_NOT_SELF));
enable_registrar.add("FS.EnableViewLog", std::bind(&FSRegistrarUtils::checkIsEnabled, gFSRegistrarUtils, target_id, EFSRegistrarFunctionActionType::FS_RGSTR_ACT_VIEW_TRANSCRIPT));
// </FS:Ansariel>
// <FS:Zi> FIRE-30725 - Add more group functions to group URL context menu
registrar.add("FS.JoinGroup", boost::bind(&LLUrlAction::executeSLURL, "secondlife:///app/firestorm/" + target_id_str + "/groupjoin", true));
registrar.add("FS.LeaveGroup", boost::bind(&LLUrlAction::executeSLURL, "secondlife:///app/firestorm/" + target_id_str + "/groupleave", true));
registrar.add("FS.ActivateGroup", boost::bind(&LLUrlAction::executeSLURL, "secondlife:///app/firestorm/" + target_id_str + "/groupactivate", true));
registrar.add("FS.JoinGroup", std::bind(&LLUrlAction::executeSLURL, "secondlife:///app/firestorm/" + target_id_str + "/groupjoin", true));
registrar.add("FS.LeaveGroup", std::bind(&LLUrlAction::executeSLURL, "secondlife:///app/firestorm/" + target_id_str + "/groupleave", true));
registrar.add("FS.ActivateGroup", std::bind(&LLUrlAction::executeSLURL, "secondlife:///app/firestorm/" + target_id_str + "/groupactivate", true));
// hook up moderation tools
// if someone knows how to pass a parameter to these, let me know! - Zi
// also, I wish I could pass the group session id through these calls, but LLTextBase does not know it - Zi
registrar.add("FS.AllowGroupChat", boost::bind(&LLUrlAction::executeSLURL, "secondlife:///app/firestorm/" + target_id_str + "/groupchatallow", true));
registrar.add("FS.ForbidGroupChat", boost::bind(&LLUrlAction::executeSLURL, "secondlife:///app/firestorm/" + target_id_str + "/groupchatforbid", true));
registrar.add("FS.EjectGroupMember", boost::bind(&LLUrlAction::executeSLURL, "secondlife:///app/firestorm/" + target_id_str + "/groupeject", true));
registrar.add("FS.BanGroupMember", boost::bind(&LLUrlAction::executeSLURL, "secondlife:///app/firestorm/" + target_id_str + "/groupban", true));
registrar.add("FS.AllowGroupChat", std::bind(&LLUrlAction::executeSLURL, "secondlife:///app/firestorm/" + target_id_str + "/groupchatallow", true));
registrar.add("FS.ForbidGroupChat", std::bind(&LLUrlAction::executeSLURL, "secondlife:///app/firestorm/" + target_id_str + "/groupchatforbid", true));
registrar.add("FS.EjectGroupMember", std::bind(&LLUrlAction::executeSLURL, "secondlife:///app/firestorm/" + target_id_str + "/groupeject", true));
registrar.add("FS.BanGroupMember", std::bind(&LLUrlAction::executeSLURL, "secondlife:///app/firestorm/" + target_id_str + "/groupban", true));
enable_registrar.add("FS.WaitingForGroupData", boost::bind(&FSRegistrarUtils::checkIsEnabled, gFSRegistrarUtils, target_id, FS_RGSTR_CHK_WAITING_FOR_GROUP_DATA));
enable_registrar.add("FS.HaveGroupData", boost::bind(&FSRegistrarUtils::checkIsEnabled, gFSRegistrarUtils, target_id, FS_RGSTR_CHK_HAVE_GROUP_DATA));
enable_registrar.add("FS.EnableJoinGroup", boost::bind(&FSRegistrarUtils::checkIsEnabled, gFSRegistrarUtils, target_id, FS_RGSTR_CHK_CAN_JOIN_GROUP));
enable_registrar.add("FS.EnableLeaveGroup", boost::bind(&FSRegistrarUtils::checkIsEnabled, gFSRegistrarUtils, target_id, FS_RGSTR_CHK_CAN_LEAVE_GROUP));
enable_registrar.add("FS.EnableActivateGroup", boost::bind(&FSRegistrarUtils::checkIsEnabled, gFSRegistrarUtils, target_id, FS_RGSTR_CHK_GROUP_NOT_ACTIVE));
enable_registrar.add("FS.WaitingForGroupData", std::bind(&FSRegistrarUtils::checkIsEnabled, gFSRegistrarUtils, target_id, EFSRegistrarFunctionActionType::FS_RGSTR_CHK_WAITING_FOR_GROUP_DATA));
enable_registrar.add("FS.HaveGroupData", std::bind(&FSRegistrarUtils::checkIsEnabled, gFSRegistrarUtils, target_id, EFSRegistrarFunctionActionType::FS_RGSTR_CHK_HAVE_GROUP_DATA));
enable_registrar.add("FS.EnableJoinGroup", std::bind(&FSRegistrarUtils::checkIsEnabled, gFSRegistrarUtils, target_id, EFSRegistrarFunctionActionType::FS_RGSTR_CHK_CAN_JOIN_GROUP));
enable_registrar.add("FS.EnableLeaveGroup", std::bind(&FSRegistrarUtils::checkIsEnabled, gFSRegistrarUtils, target_id, EFSRegistrarFunctionActionType::FS_RGSTR_CHK_CAN_LEAVE_GROUP));
enable_registrar.add("FS.EnableActivateGroup", std::bind(&FSRegistrarUtils::checkIsEnabled, gFSRegistrarUtils, target_id, EFSRegistrarFunctionActionType::FS_RGSTR_CHK_GROUP_NOT_ACTIVE));
// </FS:Zi>
// create and return the context menu from the XUI file

View File

@ -1100,12 +1100,12 @@ protected:
{
menu->setItemVisible("Send IM", false);
}
menu->setItemEnabled("Teleport to", FSCommon::checkIsActionEnabled(mAvatarID, FS_RGSTR_ACT_TELEPORT_TO));
menu->setItemEnabled("Teleport to", FSCommon::checkIsActionEnabled(mAvatarID, EFSRegistrarFunctionActionType::FS_RGSTR_ACT_TELEPORT_TO));
menu->setItemEnabled("Offer Teleport", LLAvatarActions::canOfferTeleport(mAvatarID));
menu->setItemEnabled("Request Teleport", LLAvatarActions::canRequestTeleport(mAvatarID));
menu->setItemEnabled("Voice Call", LLAvatarActions::canCall());
menu->setItemEnabled("Zoom In", FSCommon::checkIsActionEnabled(mAvatarID, FS_RGSTR_ACT_ZOOM_IN));
menu->setItemEnabled("track", FSCommon::checkIsActionEnabled(mAvatarID, FS_RGSTR_ACT_TRACK_AVATAR));
menu->setItemEnabled("Zoom In", FSCommon::checkIsActionEnabled(mAvatarID, EFSRegistrarFunctionActionType::FS_RGSTR_ACT_ZOOM_IN));
menu->setItemEnabled("track", FSCommon::checkIsActionEnabled(mAvatarID, EFSRegistrarFunctionActionType::FS_RGSTR_ACT_TRACK_AVATAR));
menu->setItemEnabled("Block Unblock", LLAvatarActions::canBlock(mAvatarID));
menu->setItemEnabled("Mute Text", LLAvatarActions::canBlock(mAvatarID));
menu->setItemEnabled("Chat History", LLLogChat::isTranscriptExist(mAvatarID));

View File

@ -333,67 +333,67 @@ bool FSCommon::checkIsActionEnabled(const LLUUID& av_id, EFSRegistrarFunctionAct
{
bool isSelf = (av_id == gAgentID);
if (action == FS_RGSTR_ACT_ADD_FRIEND)
if (action == EFSRegistrarFunctionActionType::FS_RGSTR_ACT_ADD_FRIEND)
{
return (!isSelf && !LLAvatarActions::isFriend(av_id));
}
else if (action == FS_RGSTR_ACT_REMOVE_FRIEND)
else if (action == EFSRegistrarFunctionActionType::FS_RGSTR_ACT_REMOVE_FRIEND)
{
return (!isSelf && LLAvatarActions::isFriend(av_id));
}
else if (action == FS_RGSTR_ACT_SEND_IM)
else if (action == EFSRegistrarFunctionActionType::FS_RGSTR_ACT_SEND_IM)
{
return (!isSelf && RlvActions::canStartIM(av_id));
}
else if (action == FS_RGSTR_ACT_VIEW_TRANSCRIPT)
else if (action == EFSRegistrarFunctionActionType::FS_RGSTR_ACT_VIEW_TRANSCRIPT)
{
return (!isSelf && LLLogChat::isTranscriptExist(av_id));
}
else if (action == FS_RGSTR_ACT_ZOOM_IN)
else if (action == EFSRegistrarFunctionActionType::FS_RGSTR_ACT_ZOOM_IN)
{
return (!isSelf && !gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES) && LLAvatarActions::canZoomIn(av_id));
}
else if (action == FS_RGSTR_ACT_OFFER_TELEPORT)
else if (action == EFSRegistrarFunctionActionType::FS_RGSTR_ACT_OFFER_TELEPORT)
{
return (!isSelf && LLAvatarActions::canOfferTeleport(av_id));
}
else if (action == FS_RGSTR_ACT_REQUEST_TELEPORT)
else if (action == EFSRegistrarFunctionActionType::FS_RGSTR_ACT_REQUEST_TELEPORT)
{
return (!isSelf && LLAvatarActions::canRequestTeleport(av_id));
}
else if (action == FS_RGSTR_ACT_SHOW_PROFILE)
else if (action == EFSRegistrarFunctionActionType::FS_RGSTR_ACT_SHOW_PROFILE)
{
return (isSelf || !gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES));
}
else if (action == FS_RGSTR_ACT_TRACK_AVATAR)
else if (action == EFSRegistrarFunctionActionType::FS_RGSTR_ACT_TRACK_AVATAR)
{
return (!isSelf && FSRadar::getInstance()->getEntry(av_id) != NULL);
}
else if (action == FS_RGSTR_ACT_TELEPORT_TO)
else if (action == EFSRegistrarFunctionActionType::FS_RGSTR_ACT_TELEPORT_TO)
{
return (!isSelf && FSRadar::getInstance()->getEntry(av_id) != NULL);
}
else if (action == FS_RGSTR_CHK_AVATAR_BLOCKED)
else if (action == EFSRegistrarFunctionActionType::FS_RGSTR_CHK_AVATAR_BLOCKED)
{
return (!isSelf && LLMuteList::getInstance()->isMuted(av_id));
}
else if (action == FS_RGSTR_CHK_IS_SELF)
else if (action == EFSRegistrarFunctionActionType::FS_RGSTR_CHK_IS_SELF)
{
return isSelf;
}
else if (action == FS_RGSTR_CHK_IS_NOT_SELF)
else if (action == EFSRegistrarFunctionActionType::FS_RGSTR_CHK_IS_NOT_SELF)
{
return !isSelf;
}
else if (action == FS_RGSTR_CHK_WAITING_FOR_GROUP_DATA)
else if (action == EFSRegistrarFunctionActionType::FS_RGSTR_CHK_WAITING_FOR_GROUP_DATA)
{
return !requestGroupData(av_id);
}
else if (action == FS_RGSTR_CHK_HAVE_GROUP_DATA)
else if (action == EFSRegistrarFunctionActionType::FS_RGSTR_CHK_HAVE_GROUP_DATA)
{
return requestGroupData(av_id);
}
else if (action == FS_RGSTR_CHK_CAN_LEAVE_GROUP)
else if (action == EFSRegistrarFunctionActionType::FS_RGSTR_CHK_CAN_LEAVE_GROUP)
{
if (gAgent.getGroupID() == av_id && !RlvActions::canChangeActiveGroup())
{
@ -402,7 +402,7 @@ bool FSCommon::checkIsActionEnabled(const LLUUID& av_id, EFSRegistrarFunctionAct
return gAgent.isInGroup(av_id);
}
else if (action == FS_RGSTR_CHK_CAN_JOIN_GROUP)
else if (action == EFSRegistrarFunctionActionType::FS_RGSTR_CHK_CAN_JOIN_GROUP)
{
if (!gAgent.canJoinGroups())
{
@ -422,7 +422,7 @@ bool FSCommon::checkIsActionEnabled(const LLUUID& av_id, EFSRegistrarFunctionAct
return !gAgent.isInGroup(av_id);
}
else if (action == FS_RGSTR_CHK_GROUP_NOT_ACTIVE)
else if (action == EFSRegistrarFunctionActionType::FS_RGSTR_CHK_GROUP_NOT_ACTIVE)
{
if (!RlvActions::canChangeActiveGroup())
{

View File

@ -2226,12 +2226,12 @@ void LLNetMap::performDoubleClickAction(LLVector3d pos_global)
bool LLNetMap::canAddFriend()
{
return FSCommon::checkIsActionEnabled(mClosestAgentRightClick, FS_RGSTR_ACT_ADD_FRIEND);
return FSCommon::checkIsActionEnabled(mClosestAgentRightClick, EFSRegistrarFunctionActionType::FS_RGSTR_ACT_ADD_FRIEND);
}
bool LLNetMap::canRemoveFriend()
{
return FSCommon::checkIsActionEnabled(mClosestAgentRightClick, FS_RGSTR_ACT_REMOVE_FRIEND);
return FSCommon::checkIsActionEnabled(mClosestAgentRightClick, EFSRegistrarFunctionActionType::FS_RGSTR_ACT_REMOVE_FRIEND);
}
bool LLNetMap::canCall()
@ -2251,13 +2251,13 @@ bool LLNetMap::canShare()
bool LLNetMap::canOfferTeleport()
{
return FSCommon::checkIsActionEnabled(mClosestAgentRightClick, FS_RGSTR_ACT_OFFER_TELEPORT);
return FSCommon::checkIsActionEnabled(mClosestAgentRightClick, EFSRegistrarFunctionActionType::FS_RGSTR_ACT_OFFER_TELEPORT);
}
// <FS:Ansariel> Extra request teleport
bool LLNetMap::canRequestTeleport()
{
return FSCommon::checkIsActionEnabled(mClosestAgentRightClick, FS_RGSTR_ACT_REQUEST_TELEPORT);
return FSCommon::checkIsActionEnabled(mClosestAgentRightClick, EFSRegistrarFunctionActionType::FS_RGSTR_ACT_REQUEST_TELEPORT);
}
// </FS:Ansariel>

View File

@ -2206,7 +2206,7 @@ bool idle_startup()
// </FS:Ansariel>
// <FS:Ansariel> Register check function for registrar enable checks
gFSRegistrarUtils.setEnableCheckFunction(boost::bind(&FSCommon::checkIsActionEnabled, _1, _2));
gFSRegistrarUtils.setEnableCheckFunction(std::bind(&FSCommon::checkIsActionEnabled, std::placeholders::_1, std::placeholders::_2));
// <FS:Techwolf Lupindo> fsdata support
FSData::instance().addAgents();