void LLPanelFriends::confirmModifyRights(rights_map_t& ids, EGrantRevoke command)
{
	if (ids.empty()) return;
	
	LLSD args;
	if(ids.size() > 0)
	{
		rights_map_t* rights = new rights_map_t(ids);

		// for single friend, show their name
		if(ids.size() == 1)
		{
			LLUUID agent_id = ids.begin()->first;
			std::string first, last;
			if(gCacheName->getName(agent_id, first, last))
			{
				args["FIRST_NAME"] = first;
				args["LAST_NAME"] = last;	
			}
			if (command == GRANT)
			{
				LLNotifications::instance().add("GrantModifyRights", 
					args, 
					LLSD(), 
					boost::bind(&LLPanelFriends::modifyRightsConfirmation, this, _1, _2, rights));
			}
			else
			{
				LLNotifications::instance().add("RevokeModifyRights", 
					args, 
					LLSD(), 
					boost::bind(&LLPanelFriends::modifyRightsConfirmation, this, _1, _2, rights));
			}
		}
		else
		{
			if (command == GRANT)
			{
				LLNotifications::instance().add("GrantModifyRightsMultiple", 
					args, 
					LLSD(), 
					boost::bind(&LLPanelFriends::modifyRightsConfirmation, this, _1, _2, rights));
			}
			else
			{
				LLNotifications::instance().add("RevokeModifyRightsMultiple", 
					args, 
					LLSD(), 
					boost::bind(&LLPanelFriends::modifyRightsConfirmation, this, _1, _2, rights));
			}
		}
	}
}
Beispiel #2
0
void LLFloaterFriends::confirmModifyRights(rights_map_t& ids, EGrantRevoke command)
{
	if (ids.empty()) return;
	
	LLStringBase<char>::format_map_t args;
	if(ids.size() > 0)
	{
		// copy map of ids onto heap
		rights_map_t* rights = new rights_map_t(ids); 
		// package with panel pointer
		std::pair<LLFloaterFriends*, rights_map_t*>* user_data = new std::pair<LLFloaterFriends*, rights_map_t*>(this, rights);

		// for single friend, show their name
		if(ids.size() == 1)
		{
			LLUUID agent_id = ids.begin()->first;
			char first[DB_FIRST_NAME_BUF_SIZE];		/*Flawfinder: ignore*/
			char last[DB_LAST_NAME_BUF_SIZE];		/*Flawfinder: ignore*/
			if(gCacheName->getName(agent_id, first, last))
			{
				args["[FIRST_NAME]"] = first;
				args["[LAST_NAME]"] = last;	
			}
			if (command == GRANT)
			{
				gViewerWindow->alertXml("GrantModifyRights", args, modifyRightsConfirmation, user_data);
			}
			else
			{
				gViewerWindow->alertXml("RevokeModifyRights", args, modifyRightsConfirmation, user_data);
			}
		}
		else
		{
			if (command == GRANT)
			{
				gViewerWindow->alertXml("GrantModifyRightsMultiple", args, modifyRightsConfirmation, user_data);
			}
			else
			{
				gViewerWindow->alertXml("RevokeModifyRightsMultiple", args, modifyRightsConfirmation, user_data);
			}
		}
	}
}
void LLPanelFriends::confirmModifyRights(rights_map_t& rights, EGrantRevoke command)
{
	if (rights.empty()) return;

	// Make a copy on the heap: rights is allocated on the stack.
	// This copy will be deleted in LLPanelFriends::modifyRightsConfirmation.
	rights_map_t* heap_rights = new rights_map_t(rights);

	// for single friend, show their name
	if (rights.size() == 1)
	{
		LLSD args;
		std::string fullname;
		if (LLAvatarNameCache::getPNSName(rights.begin()->first, fullname, friend_name_system()))
			args["NAME"] = fullname;

		if (command == GRANT)
		{
			LLNotificationsUtil::add("GrantModifyRights",
					args,
					LLSD(),
					boost::bind(&LLPanelFriends::modifyRightsConfirmation, this, _1, _2, heap_rights));
		}
		else
		{
			LLNotificationsUtil::add("RevokeModifyRights",
					args,
					LLSD(),
					boost::bind(&LLPanelFriends::modifyRightsConfirmation, this, _1, _2, heap_rights));
		}
	}
	else
	{
		if (command == GRANT)
		{
			LLNotificationsUtil::add("GrantModifyRightsMultiple",
					LLSD(),
					LLSD(),
					boost::bind(&LLPanelFriends::modifyRightsConfirmation, this, _1, _2, heap_rights));
		}
		else
		{
			LLNotificationsUtil::add("RevokeModifyRightsMultiple",
					LLSD(),
					LLSD(),
					boost::bind(&LLPanelFriends::modifyRightsConfirmation, this, _1, _2, heap_rights));
		}
	}
}
Beispiel #4
0
void LLFloaterFriends::sendRightsGrant(rights_map_t& ids)
{
	if (ids.empty()) return;

	LLMessageSystem* msg = gMessageSystem;

	// setup message header
	msg->newMessageFast(_PREHASH_GrantUserRights);
	msg->nextBlockFast(_PREHASH_AgentData);
	msg->addUUID(_PREHASH_AgentID, gAgent.getID());
	msg->addUUID(_PREHASH_SessionID, gAgent.getSessionID());

	rights_map_t::iterator id_it;
	rights_map_t::iterator end_it = ids.end();
	for(id_it = ids.begin(); id_it != end_it; ++id_it)
	{
		msg->nextBlockFast(_PREHASH_Rights);
		msg->addUUID(_PREHASH_AgentRelated, id_it->first);
		msg->addS32(_PREHASH_RelatedRights, id_it->second);
	}

	mNumRightsChanged = ids.size();
	gAgent.sendReliableMessage();
}
void LLPanelFriends::confirmModifyRights(rights_map_t& ids, EGrantRevoke command)
{
	if (ids.empty()) return;
	
	LLSD args;
	if(ids.size() > 0)
	{
		rights_map_t* rights = new rights_map_t(ids);

		// for single friend, show their name
		if(ids.size() == 1)
		{
			LLUUID agent_id = ids.begin()->first;
			std::string first, last;
			if(gCacheName->getName(agent_id, first, last))
			{
				if (LLAvatarNameCache::useDisplayNames() && !gSavedSettings.getBOOL("LegacyNamesForFriends"))
				{
					LLAvatarName avatar_name;
					if (LLAvatarNameCache::get(agent_id, &avatar_name))
					{
						// Always show "Display Name [Legacy Name]" for security reasons
						first = avatar_name.getNames();
						size_t i = first.find(" ");
						if (i != std::string::npos)
						{
							last = first.substr(i + 1);
							first = first.substr(0, i);
						}
						else
						{
							last = "";
						}
					}
				}
				args["FIRST_NAME"] = first;
				args["LAST_NAME"] = last;	
			}
			if (command == GRANT)
			{
				LLNotifications::instance().add("GrantModifyRights", 
					args, 
					LLSD(), 
					boost::bind(&LLPanelFriends::modifyRightsConfirmation, this, _1, _2, rights));
			}
			else
			{
				LLNotifications::instance().add("RevokeModifyRights", 
					args, 
					LLSD(), 
					boost::bind(&LLPanelFriends::modifyRightsConfirmation, this, _1, _2, rights));
			}
		}
		else
		{
			if (command == GRANT)
			{
				LLNotifications::instance().add("GrantModifyRightsMultiple", 
					args, 
					LLSD(), 
					boost::bind(&LLPanelFriends::modifyRightsConfirmation, this, _1, _2, rights));
			}
			else
			{
				LLNotifications::instance().add("RevokeModifyRightsMultiple", 
					args, 
					LLSD(), 
					boost::bind(&LLPanelFriends::modifyRightsConfirmation, this, _1, _2, rights));
			}
		}
	}
}
Beispiel #6
0
void LLPanelFriends::confirmModifyRights(rights_map_t& ids, EGrantRevoke command)
{
	if (ids.empty()) return;
	
	LLSD args;
	if(ids.size() > 0)
	{
		rights_map_t* rights = new rights_map_t(ids);

		// for single friend, show their name
		if(ids.size() == 1)
		{
			LLUUID agent_id = ids.begin()->first;
			//std::string first, last;
			//if(gCacheName->getName(agent_id, first, last))
			//{
			//	args["FIRST_NAME"] = first;
			//	args["LAST_NAME"] = last;	
			//}

			LLAvatarName avatar_name;
			if (LLAvatarNameCache::get(agent_id, &avatar_name))
			{
				std::string fullname;
				static const LLCachedControl<S32> phoenix_name_system("PhoenixNameSystem", 0);
				switch (phoenix_name_system)
				{
					case 0 : fullname = avatar_name.getLegacyName(); break;
					case 1 : fullname = (avatar_name.mIsDisplayNameDefault ? avatar_name.mDisplayName : avatar_name.getCompleteName()); break;
					case 2 : fullname = avatar_name.mDisplayName; break;
					default : fullname = avatar_name.getCompleteName(); break;
				}
				
				args["NAME"] = fullname;
			}

			if (command == GRANT)
			{
				LLNotifications::instance().add("GrantModifyRights", 
					args, 
					LLSD(), 
					boost::bind(&LLPanelFriends::modifyRightsConfirmation, this, _1, _2, rights));
			}
			else
			{
				LLNotifications::instance().add("RevokeModifyRights", 
					args, 
					LLSD(), 
					boost::bind(&LLPanelFriends::modifyRightsConfirmation, this, _1, _2, rights));
			}
		}
		else
		{
			if (command == GRANT)
			{
				LLNotifications::instance().add("GrantModifyRightsMultiple", 
					args, 
					LLSD(), 
					boost::bind(&LLPanelFriends::modifyRightsConfirmation, this, _1, _2, rights));
			}
			else
			{
				LLNotifications::instance().add("RevokeModifyRightsMultiple", 
					args, 
					LLSD(), 
					boost::bind(&LLPanelFriends::modifyRightsConfirmation, this, _1, _2, rights));
			}
		}
	}
}