Exemplo n.º 1
0
BOOL LLFloaterIMPanel::dropCategory(LLInventoryCategory* category, BOOL drop)
{
	if (category)
	{
		LLInventoryModel::cat_array_t cats;
		LLInventoryModel::item_array_t items;
		LLUniqueBuddyCollector buddies;
		gInventory.collectDescendentsIf(category->getUUID(),
										cats,
										items,
										LLInventoryModel::EXCLUDE_TRASH,
										buddies);
		S32 count = items.count();
		if(count == 0)
		{
			return false;
		}
		else if(drop)
		{
			LLDynamicArray<LLUUID> ids;
			for(S32 i = 0; i < count; ++i)
			{
				ids.put(items.get(i)->getCreatorUUID());
			}
			inviteToSession(ids);
		}
	}
	return true;
}
void JCFloaterAnimList::RevokeSelected(void *userdata )
{
	JCFloaterAnimList *self = (JCFloaterAnimList*)userdata;
	LLDynamicArray<LLUUID> ids;
	std::vector< LLScrollListItem * > items = self->mAnimList->getAllSelected();
	for( std::vector< LLScrollListItem * >::iterator itr = items.begin(); itr != items.end(); itr++ )
	{
		LLScrollListItem *item = *itr;
		const LLUUID &id = item->getColumn(LIST_OBJECT_UUID)->getValue().asUUID();
		if( ids.find(id) == LLDynamicArray<LLUUID>::FAIL )
		{
			ids.put(id);
		}
	}
	if( !ids.empty() )
	{
		for(LLDynamicArray<LLUUID>::iterator itr = ids.begin(); itr != ids.end(); ++itr)
		{
			LLUUID id = *itr;
			LLMessageSystem* msg = gMessageSystem;
			msg->newMessageFast(_PREHASH_RevokePermissions);
			msg->nextBlockFast(_PREHASH_AgentData);
			msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
			msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
			msg->nextBlockFast(_PREHASH_Data);
			msg->addUUIDFast(_PREHASH_ObjectID, id);
			msg->addU32Fast(_PREHASH_ObjectPermissions, U32_MAX);
			gAgent.sendReliableMessage();
		}
	}
}
void LLInventoryClipboard::retrieve(LLDynamicArray<LLUUID>& inv_objects) const
{
    inv_objects.reset();
    S32 count = mObjects.count();
    for(S32 i = 0; i < count; i++)
    {
        inv_objects.put(mObjects[i]);
    }
}
Exemplo n.º 4
0
BOOL LLFloaterIMPanel::dropCallingCard(LLInventoryItem* item, BOOL drop)
{
	if (item && item->getCreatorUUID().notNull())
	{
		if (drop)
		{
			LLDynamicArray<LLUUID> ids;
			ids.put(item->getCreatorUUID());
			inviteToSession(ids);
		}
		return true;
	}
	// return false if creator uuid is null.
	return false;
}
void JCFloaterAnimList::StopSelected(void *userdata )
{
	JCFloaterAnimList *self = (JCFloaterAnimList*)userdata;
	LLDynamicArray<LLUUID> ids;
	std::vector< LLScrollListItem * > items = self->mAnimList->getAllSelected();
	for( std::vector< LLScrollListItem * >::iterator itr = items.begin(); itr != items.end(); itr++ )
	{
		LLScrollListItem *item = *itr;
		const LLUUID &id = item->getColumn(LIST_ANIMATION_UUID)->getValue().asUUID();
		if( ids.find(id) == LLDynamicArray<LLUUID>::FAIL )
		{
			ids.put(id);
		}
	}
	gAgent.sendAnimationRequests(ids,ANIM_REQUEST_STOP);
}
void LLFloaterExploreAnimations::StopSelected(void *userdata )
{
	LLFloaterExploreAnimations *self = (LLFloaterExploreAnimations*)userdata;
	LLDynamicArray<LLUUID> ids;
	std::vector< LLScrollListItem * > items = self->getChild<LLScrollListCtrl>("anim_list")->getAllSelected();

	for( std::vector< LLScrollListItem * >::iterator itr = items.begin(); itr != items.end(); itr++ )
	{
		LLScrollListItem *item = *itr;
		const LLUUID &id = item->getValue().asUUID();
		if( ids.find(id) == LLDynamicArray<LLUUID>::FAIL )
		{
			ids.put(id);
		}
	}
	gAgent.sendAnimationRequests(ids,ANIM_REQUEST_STOP);
}
Exemplo n.º 7
0
// This adds a session to the talk view. The name is the local name of
// the session, dialog specifies the type of session. If the session
// exists, it is brought forward.  Specifying id = NULL results in an
// im session to everyone. Returns the uuid of the session.
LLUUID LLIMMgr::addSession(
	const std::string& name,
	EInstantMessage dialog,
	const LLUUID& other_participant_id)
{
	//lggtodo
	LLUUID session_id = computeSessionID(dialog, other_participant_id);

	LLFloaterIMPanel* floater = findFloaterBySession(session_id);
	if(!floater)
	{
		LLDynamicArray<LLUUID> ids;
		ids.put(other_participant_id);

		floater = createFloater(
			session_id,
			other_participant_id,
			name,
			ids,
			dialog,
			TRUE);

		noteOfflineUsers(floater, ids);
		LLFloaterChatterBox::showInstance(session_id);

		// Only warn for regular IMs - not group IMs
		if( dialog == IM_NOTHING_SPECIAL )
		{
			noteMutedUsers(floater, ids);
		}
		LLFloaterChatterBox::getInstance(LLSD())->showFloater(floater);
	}
	else
	{
		floater->open();
	}
	//mTabContainer->selectTabPanel(panel);
	floater->setInputFocus(TRUE);
	return floater->getSessionID();
}
Exemplo n.º 8
0
	bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
	{
		LLInventoryPanel *panel = mPtr;
		LLInventoryModel* model = panel->getModel();
		if(!model) return true;
		std::set<LLUUID> selected_items;
		panel->getRootFolder()->getSelectionList(selected_items);

		std::string name;
		static int session_num = 1;

		LLDynamicArray<LLUUID> members;
		EInstantMessage type = IM_SESSION_CONFERENCE_START;

		std::set<LLUUID>::const_iterator iter;
		for (iter = selected_items.begin(); iter != selected_items.end(); iter++)
		{

			LLUUID item = *iter;
			LLFolderViewItem* folder_item = panel->getRootFolder()->getItemByID(item);
			
			if(folder_item) 
			{
				LLFolderViewEventListener* fve_listener = folder_item->getListener();
				if (fve_listener && (fve_listener->getInventoryType() == LLInventoryType::IT_CATEGORY))
				{

					LLFolderBridge* bridge = (LLFolderBridge*)folder_item->getListener();
					if(!bridge) return true;
					LLViewerInventoryCategory* cat = bridge->getCategory();
					if(!cat) return true;
					name = cat->getName();
					LLUniqueBuddyCollector is_buddy;
					LLInventoryModel::cat_array_t cat_array;
					LLInventoryModel::item_array_t item_array;
					model->collectDescendentsIf(bridge->getUUID(),
												cat_array,
												item_array,
												LLInventoryModel::EXCLUDE_TRASH,
												is_buddy);
					S32 count = item_array.count();
					if(count > 0)
					{
						// create the session
						gIMMgr->setFloaterOpen(TRUE);
						S32 i;
						
						LLAvatarTracker& at = LLAvatarTracker::instance();
						LLUUID id;
						for(i = 0; i < count; ++i)
						{
							id = item_array.get(i)->getCreatorUUID();
							if(at.isBuddyOnline(id))
							{
								members.put(id);
							}
						}
					}
				}
				else
				{
					LLFolderViewItem* folder_item = panel->getRootFolder()->getItemByID(item);
					if(!folder_item) return true;
					LLInvFVBridge* listenerp = (LLInvFVBridge*)folder_item->getListener();

					if (listenerp->getInventoryType() == LLInventoryType::IT_CALLINGCARD)
					{
						LLInventoryItem* inv_item = gInventory.getItem(listenerp->getUUID());

						if (inv_item)
						{
							LLAvatarTracker& at = LLAvatarTracker::instance();
							LLUUID id = inv_item->getCreatorUUID();

							if(at.isBuddyOnline(id))
							{
								members.put(id);
							}
						}
					} //if IT_CALLINGCARD
				} //if !IT_CATEGORY
			}
		} //for selected_items	

		// the session_id is randomly generated UUID which will be replaced later
		// with a server side generated number

		if (name.empty())
		{
			name = llformat("Session %d", session_num++);
		}


		gIMMgr->addSession(
			name,
			type,
			members[0],
			members);
		
		return true;
	}
void LLViewerParcelOverlay::addPropertyLine(
    LLDynamicArray<LLVector3, 256>& vertex_array,
    LLDynamicArray<LLColor4U, 256>& color_array,
    LLDynamicArray<LLVector2, 256>& coord_array,
    const F32 start_x, const F32 start_y,
    const U32 edge,
    const LLColor4U& color)
{
    LLColor4U underwater( color );
    underwater.mV[VALPHA] /= 2;

    LLSurface& land = mRegion->getLand();

    F32 dx;
    F32 dy;
    F32 tick_dx;
    F32 tick_dy;
    //const F32 LINE_WIDTH = 0.125f;
    const F32 LINE_WIDTH = 0.0625f;

    switch(edge)
    {
    case WEST:
        dx = 0.f;
        dy = 1.f;
        tick_dx = LINE_WIDTH;
        tick_dy = 0.f;
        break;

    case EAST:
        dx = 0.f;
        dy = 1.f;
        tick_dx = -LINE_WIDTH;
        tick_dy = 0.f;
        break;

    case NORTH:
        dx = 1.f;
        dy = 0.f;
        tick_dx = 0.f;
        tick_dy = -LINE_WIDTH;
        break;

    case SOUTH:
        dx = 1.f;
        dy = 0.f;
        tick_dx = 0.f;
        tick_dy = LINE_WIDTH;
        break;

    default:
        llerrs << "Invalid edge in addPropertyLine" << llendl;
        return;
    }

    F32 outside_x = start_x;
    F32 outside_y = start_y;
    F32 outside_z = 0.f;
    F32 inside_x  = start_x + tick_dx;
    F32 inside_y  = start_y + tick_dy;
    F32 inside_z  = 0.f;

    // First part, only one vertex
    outside_z = land.resolveHeightRegion( outside_x, outside_y );

    if (outside_z > 20.f) color_array.put( color );
    else color_array.put( underwater );

    vertex_array.put( LLVector3(outside_x, outside_y, outside_z) );
    coord_array.put(  LLVector2(outside_x - start_x, 0.f) );

    inside_x += dx * LINE_WIDTH;
    inside_y += dy * LINE_WIDTH;

    outside_x += dx * LINE_WIDTH;
    outside_y += dy * LINE_WIDTH;

    // Then the "actual edge"
    inside_z = land.resolveHeightRegion( inside_x, inside_y );
    outside_z = land.resolveHeightRegion( outside_x, outside_y );

    if (inside_z > 20.f) color_array.put( color );
    else color_array.put( underwater );

    if (outside_z > 20.f) color_array.put( color );
    else color_array.put( underwater );

    vertex_array.put( LLVector3(inside_x, inside_y, inside_z) );
    vertex_array.put( LLVector3(outside_x, outside_y, outside_z) );

    coord_array.put(  LLVector2(outside_x - start_x, 1.f) );
    coord_array.put(  LLVector2(outside_x - start_x, 0.f) );

    inside_x += dx * (dx - LINE_WIDTH);
    inside_y += dy * (dy - LINE_WIDTH);

    outside_x += dx * (dx - LINE_WIDTH);
    outside_y += dy * (dy - LINE_WIDTH);

    // Middle part, full width
    S32 i;
    const S32 GRID_STEP = S32( PARCEL_GRID_STEP_METERS );
    for (i = 1; i < GRID_STEP; i++)
    {
        inside_z = land.resolveHeightRegion( inside_x, inside_y );
        outside_z = land.resolveHeightRegion( outside_x, outside_y );

        if (inside_z > 20.f) color_array.put( color );
        else color_array.put( underwater );

        if (outside_z > 20.f) color_array.put( color );
        else color_array.put( underwater );

        vertex_array.put( LLVector3(inside_x, inside_y, inside_z) );
        vertex_array.put( LLVector3(outside_x, outside_y, outside_z) );

        coord_array.put(  LLVector2(outside_x - start_x, 1.f) );
        coord_array.put(  LLVector2(outside_x - start_x, 0.f) );

        inside_x += dx;
        inside_y += dy;

        outside_x += dx;
        outside_y += dy;
    }

    // Extra buffer for edge
    inside_x -= dx * LINE_WIDTH;
    inside_y -= dy * LINE_WIDTH;

    outside_x -= dx * LINE_WIDTH;
    outside_y -= dy * LINE_WIDTH;

    inside_z = land.resolveHeightRegion( inside_x, inside_y );
    outside_z = land.resolveHeightRegion( outside_x, outside_y );

    if (inside_z > 20.f) color_array.put( color );
    else color_array.put( underwater );

    if (outside_z > 20.f) color_array.put( color );
    else color_array.put( underwater );

    vertex_array.put( LLVector3(inside_x, inside_y, inside_z) );
    vertex_array.put( LLVector3(outside_x, outside_y, outside_z) );

    coord_array.put(  LLVector2(outside_x - start_x, 1.f) );
    coord_array.put(  LLVector2(outside_x - start_x, 0.f) );

    inside_x += dx * LINE_WIDTH;
    inside_y += dy * LINE_WIDTH;

    outside_x += dx * LINE_WIDTH;
    outside_y += dy * LINE_WIDTH;

    // Last edge is not drawn to the edge
    outside_z = land.resolveHeightRegion( outside_x, outside_y );

    if (outside_z > 20.f) color_array.put( color );
    else color_array.put( underwater );

    vertex_array.put( LLVector3(outside_x, outside_y, outside_z) );
    coord_array.put(  LLVector2(outside_x - start_x, 0.f) );
}
Exemplo n.º 10
0
void ScriptCounter::serializeSelection(bool delScript)
{
	LLDynamicArray<LLViewerObject*> catfayse;
	foo=LLSelectMgr::getInstance()->getSelection()->getPrimaryObject();
	sstr.str("");
	invqueries=0;
	doDelete=false;
	scriptcount=0;
	objIDS.clear();
	delUUIDS.clear();
	objectCount=0;
	countingDone=false;
	reqObjectID.setNull();
	if(foo)
	{
		if(foo->isAvatar())
		{
			LLVOAvatar* av=find_avatar_from_object(foo);
			if(av)
			{
				for (LLVOAvatar::attachment_map_t::iterator iter = av->mAttachmentPoints.begin();
					iter != av->mAttachmentPoints.end();
					++iter)
				{
					LLViewerJointAttachment* attachment = iter->second;
					if (!attachment->getValid())
						continue ;
					LLViewerObject* object = attachment->getObject();
					if(object)
					{
						catfayse.put(object);
						objectCount++;
					}
				}
			}
		}
		else
		{
			for (LLObjectSelection::valid_root_iterator iter = LLSelectMgr::getInstance()->getSelection()->valid_root_begin();
					 iter != LLSelectMgr::getInstance()->getSelection()->valid_root_end(); iter++)
			{
				LLSelectNode* selectNode = *iter;
				LLViewerObject* object = selectNode->getObject();
				if(object)
				{
					catfayse.put(object);
					objectCount++;
				}
			}
			doDelete=delScript;
		}
		F32 throttle = gSavedSettings.getF32("OutBandwidth");
		if((throttle == 0.f) || (throttle > 128000.f))
		{
			gMessageSystem->mPacketRing.setOutBandwidth(128000);
			gMessageSystem->mPacketRing.setUseOutThrottle(TRUE);
		}
		cmdline_printchat("Counting scripts. Please wait.");
		if((objectCount == 1) && !(foo->isAvatar()))
		{
			LLViewerObject *reqObject=((LLViewerObject*)foo->getRoot());
			if(reqObject->isAvatar())
			{
				for (LLObjectSelection::iterator iter = LLSelectMgr::getInstance()->getSelection()->begin();
					 iter != LLSelectMgr::getInstance()->getSelection()->end(); iter++ )
				{			
					LLSelectNode *nodep = *iter;
					LLViewerObject* objectp = nodep->getObject();
					if (objectp->isRootEdit())
					{
						reqObjectID=objectp->getID();
						LLMessageSystem* msg = gMessageSystem;
						msg->newMessageFast(_PREHASH_ObjectSelect);
						msg->nextBlockFast(_PREHASH_AgentData);
						msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
						msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
						msg->nextBlockFast(_PREHASH_ObjectData);
						msg->addU32Fast(_PREHASH_ObjectLocalID, objectp->getLocalID());
						msg->sendReliable(gAgent.getRegionHost());
						break;
					}
				}
			}
			else
			{
				reqObjectID=reqObject->getID();
				LLMessageSystem* msg = gMessageSystem;
				msg->newMessageFast(_PREHASH_RequestObjectPropertiesFamily);
				msg->nextBlockFast(_PREHASH_AgentData);
				msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
				msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
				msg->nextBlockFast(_PREHASH_ObjectData);
				msg->addU32Fast(_PREHASH_RequestFlags, 0 );
				msg->addUUIDFast(_PREHASH_ObjectID, reqObjectID);
				gAgent.sendReliableMessage();
			}
		}
		serialize(catfayse);
	}
}