bool KCWindlightInterface::LoadFromPacel(LLParcel *parcel)
{
	if (!parcel)
		return false;

	LLSD payload;
	if (ParsePacelForWLSettings(parcel->getDesc(), payload))
	{
		const LLUUID owner_id = getOwnerID(parcel);
		//basic auth for now
		if (AllowedLandOwners(owner_id))
		{
			ApplySettings(payload);
		}
		else
		{
			LLSD args;
			args["PARCEL_NAME"] = parcel->getName();
			args["OWNER_NAME"] = getOwnerName(parcel);
			payload["parcel_name"] = parcel->getName();
			payload["local_id"] = parcel->getLocalID();
			payload["land_owner"] = owner_id;

			mSetWLNotification = LLNotifications::instance().add("PhoenixWL", args, payload, boost::bind(&KCWindlightInterface::callbackParcelWL, this, _1, _2));
		}
		return true;
	}
	
	//if nothing defined, reset to region settings
	ResetToRegion();

	return false;
}
void KCWindlightInterface::onClickWLStatusButton()
{
	//clear the last notification if its still open
	if (mClearWLNotification && !mClearWLNotification->isRespondedTo())
	{
		LLSD response = mClearWLNotification->getResponseTemplate();
		response["Ignore"] = true;
		mClearWLNotification->respond(response);
	}

	if (WLset)
	{
		LLParcel *parcel = NULL;
 		parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
 		if (parcel)
		{
			//TODO: this could be better
			LLSD payload;
			payload["local_id"] = parcel->getLocalID();
			payload["land_owner"] = getOwnerID(parcel);

			LLSD args;
			args["PARCEL_NAME"] = parcel->getName();
			
			mClearWLNotification = LLNotifications::instance().add("PhoenixWLClear", args, payload, boost::bind(&KCWindlightInterface::callbackParcelWLClear, this, _1, _2));
		}
	}
}
Exemplo n.º 3
0
BOOL LLParcel::addToBanList(const LLUUID& agent_id, S32 time)
{
	if (mBanList.size() >= (U32) PARCEL_MAX_ACCESS_LIST)
	{
		// Not using ban list, so not a rational thing to do
		return FALSE;
	}
	if (agent_id == getOwnerID())
	{
		// Can't add owner to these lists
		return FALSE;
	}
    
    access_map_iterator itor = mBanList.begin();
    while (itor != mBanList.end())
    {
        const LLAccessEntry& entry = (*itor).second;
        if (entry.mID == agent_id)
        {
            if (time == 0 || (entry.mTime != 0 && entry.mTime < time))
            {
                mBanList.erase(itor++);
            }
            else
            {
                // existing one expires later
                return FALSE;
            }
        }
        else
        {
            ++itor;
        }
    }
    
    removeFromAccessList(agent_id);
    
    LLAccessEntry new_entry;
    new_entry.mID			 = agent_id;
    new_entry.mTime	 = time;
    new_entry.mFlags = 0x0;
    mBanList[new_entry.mID] = new_entry;
    return TRUE;
}
BOOL LLParcel::addToAccessList(const LLUUID& agent_id, S32 time)
{
	if (mAccessList.size() >= (U32) PARCEL_MAX_ACCESS_LIST)
	{
		return FALSE;
	}
	if (agent_id == getOwnerID())
	{
		// Can't add owner to these lists
		return FALSE;
	}
	LLAccessEntry::map::iterator itor = mAccessList.begin();
	while (itor != mAccessList.end())
	{
		const LLAccessEntry& entry = (*itor).second;
		if (entry.mID == agent_id)
		{
			if (time == 0 || (entry.mTime != 0 && entry.mTime < time))
			{
				mAccessList.erase(itor++);
			}
			else
			{
				// existing one expires later
				return FALSE;
			}
		}
		else
		{
			++itor;
		}
	}
    
    LLAccessEntry new_entry;
    new_entry.mID			 = agent_id;
    new_entry.mTime	 = time;
    new_entry.mFlags = 0x0;
    mAccessList[new_entry.mID] = new_entry;
    return TRUE;
}