void LLFloaterAvatarList::doCommand(void (*func)(const LLUUID &avatar, const std::string &name))
{
	LLDynamicArray<LLUUID> ids = mAvatarList->getSelectedIDs();

	for (LLDynamicArray<LLUUID>::iterator itr = ids.begin(); itr != ids.end(); ++itr)
	{
		LLUUID avid = *itr;
		LLAvatarListEntry *entry = getAvatarEntry(avid);
		if (entry != NULL)
		{
			llinfos << "Executing command on " << entry->getName() << llendl;
			func(avid, entry->getName());
		}
	}
}
Example #2
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;
}
//static
void LLFloaterAvatarList::onClickMark(void *userdata)
{
	LLFloaterAvatarList *self = (LLFloaterAvatarList*)userdata;
	LLDynamicArray<LLUUID> ids = self->mAvatarList->getSelectedIDs();

	for (LLDynamicArray<LLUUID>::iterator itr = ids.begin(); itr != ids.end(); ++itr)
	{
		LLUUID avid = *itr;
		LLAvatarListEntry *entry = self->getAvatarEntry(avid);
		if (entry != NULL)
		{
			entry->toggleMark();
		}
	}
}
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);
}
// static
void LLAvatarActions::offerTeleport(const LLUUID& invitee)
{
	if (invitee.isNull())
		return;

	//waiting until Name Cache gets updated with corresponding avatar name
	std::string just_to_request_name;
	if (!gCacheName->getFullName(invitee, just_to_request_name))
	{
		gCacheName->get(invitee, FALSE, boost::bind((void (*)(const LLUUID&)) &LLAvatarActions::offerTeleport, invitee));
		return;
	}

	LLDynamicArray<LLUUID> ids;
	ids.push_back(invitee);
	offerTeleport(ids);
}
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);
}
std::string LLFloaterAvatarList::getSelectedNames(const std::string& separator)
{
	std::string ret = "";
	
	LLDynamicArray<LLUUID> ids = mAvatarList->getSelectedIDs();
	for (LLDynamicArray<LLUUID>::iterator itr = ids.begin(); itr != ids.end(); ++itr)
	{
		LLUUID avid = *itr;
		LLAvatarListEntry *entry = getAvatarEntry(avid);
		if (entry != NULL)
		{
			if (!ret.empty()) ret += separator;
			ret += entry->getName();
		}
	}

	return ret;
}
void LLInventoryClipboard::store(const LLDynamicArray<LLUUID>& inv_objects)
{
    reset();
    S32 count = inv_objects.count();
    for(S32 i = 0; i < count; i++)
    {
        mObjects.put(inv_objects[i]);
    }
}
Example #9
0
bool LLFloaterIMPanel::inviteToSession(const LLDynamicArray<LLUUID>& ids)
{
	LLViewerRegion* region = gAgent.getRegion();
	if (!region)
	{
		return FALSE;
	}
	
	S32 count = ids.count();

	if( isInviteAllowed() && (count > 0) )
	{
		llinfos << "LLFloaterIMPanel::inviteToSession() - inviting participants" << llendl;

		std::string url = region->getCapability("ChatSessionRequest");

		LLSD data;

		data["params"] = LLSD::emptyArray();
		for (int i = 0; i < count; i++)
		{
			data["params"].append(ids.get(i));
		}

		data["method"] = "invite";
		data["session-id"] = mSessionUUID;
		LLHTTPClient::post(
			url,
			data,
			new LLSessionInviteResponder(
				mSessionUUID));		
	}
	else
	{
		llinfos << "LLFloaterIMPanel::inviteToSession -"
				<< " no need to invite agents for "
				<< mDialog << llendl;
		// successful add, because everyone that needed to get added
		// was added.
	}

	return TRUE;
}
Example #10
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();
}
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();
		}
	}
}
// static
void LLPanelFriends::onClickRemove(void* user_data)
{
	LLPanelFriends* panelp = (LLPanelFriends*)user_data;

	//llinfos << "LLPanelFriends::onClickRemove()" << llendl;
	LLDynamicArray<LLUUID> ids = panelp->getSelectedIDs();
	LLSD args;
	if(ids.size() > 0)
	{
		std::string msgType = "RemoveFromFriends";
		if(ids.size() == 1)
		{
			LLUUID agent_id = ids[0];
			std::string first, last;
			if(gCacheName->getName(agent_id, first, last))
			{
				args["FIRST_NAME"] = first;
				args["LAST_NAME"] = last;	
			}
		}
		else
		{
			msgType = "RemoveMultipleFromFriends";
		}
		LLSD payload;

		for (LLDynamicArray<LLUUID>::iterator it = ids.begin();
			it != ids.end();
			++it)
		{
			payload["ids"].append(*it);
		}

		LLNotifications::instance().add(msgType,
			args,
			payload,
			&handleRemove);
	}
}
void LLIMMgr::noteMutedUsers(LLFloaterIMPanel* floater,
								  const LLDynamicArray<LLUUID>& ids)
{
	// Don't do this if we don't have a mute list.
	LLMuteList *ml = LLMuteList::getInstance();
	if( !ml )
	{
		return;
	}

	S32 count = ids.count();
	if(count > 0)
	{
		for(S32 i = 0; i < count; ++i)
		{
			if( ml->isMuted(ids.get(i)) )
			{
				LLUIString muted = sMutedMessage;
				floater->addHistoryLine(muted);
				break;
			}
		}
	}
}
// Adds a session using the given session_id.  If the session already exists 
// the dialog type is assumed correct. Returns the uuid of the session.
LLUUID LLIMMgr::addSession(
	const std::string& name,
	EInstantMessage dialog,
	const LLUUID& other_participant_id,
	const LLDynamicArray<LLUUID>& ids)
{
	if (0 == ids.getLength())
	{
		return LLUUID::null;
	}

	LLUUID session_id = computeSessionID(
		dialog,
		other_participant_id);

	LLFloaterIMPanel* floater = findFloaterBySession(session_id);
	if(!floater)
	{
		// On creation, use the first element of ids as the
		// "other_participant_id"
		floater = createFloater(
			session_id,
			other_participant_id,
			name,
			ids,
			dialog,
			TRUE);

		if ( !floater ) return LLUUID::null;

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

		// Only warn for regular IMs - not group IMs
		if( dialog == IM_NOTHING_SPECIAL )
		{
			noteMutedUsers(floater, ids);
		}
	}
	else
	{
		floater->open();
	}
	//mTabContainer->selectTabPanel(panel);
	floater->setInputFocus(TRUE);
	return floater->getSessionID();
}
Example #15
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;
	}
Example #16
0
void WavefrontSaver::Add(const LLVOAvatar* av_vo) //adds attachments, too!
{
	offset = -av_vo->getRenderPosition();
	avatar_joint_list_t vjv = av_vo->mMeshLOD;
	for (avatar_joint_list_t::const_iterator itervj = vjv.begin(); itervj != vjv.end(); ++itervj)
	{
		const LLViewerJoint* vj = dynamic_cast<LLViewerJoint*>(*itervj);
		if (!vj || vj->mMeshParts.empty()) continue;

		LLViewerJointMesh* vjm = dynamic_cast<LLViewerJointMesh*>(vj->mMeshParts[0]); //highest LOD
		if (!vjm) continue;

		vjm->updateJointGeometry();
		LLFace* face = vjm->mFace;
		if (!face) continue;

		//Beware: this is a hack because LLFace has multiple LODs
		//'pm' supplies the right number of vertices and triangles!
		LLPolyMesh* pm = vjm->getMesh();
		if (!pm) continue;
		LLXform normfix;
		normfix.setRotation(pm->getRotation());

		//Special case for balls...I mean eyeballs!
		static const std::string eyeLname = LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::getInstance()->getMeshEntry(LLAvatarAppearanceDefines::MESH_ID_EYEBALL_LEFT)->mName;
		static const std::string eyeRname = LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::getInstance()->getMeshEntry(LLAvatarAppearanceDefines::MESH_ID_EYEBALL_RIGHT)->mName;
		const std::string name = vj->getName();
		if (name == eyeLname || name == eyeRname)
		{
			LLXform lol;
			lol.setPosition(-offset);
			Add(Wavefront(face, pm, &lol, &normfix));
		}
		else
			Add(Wavefront(face, pm, NULL, &normfix));
	}

	for (LLVOAvatar::attachment_map_t::const_iterator iter = av_vo->mAttachmentPoints.begin(); iter != av_vo->mAttachmentPoints.end(); ++iter)
	{
		LLViewerJointAttachment* ja = iter->second;
		if (!ja) continue;

		for (LLViewerJointAttachment::attachedobjs_vec_t::iterator itero = ja->mAttachedObjects.begin(); itero != ja->mAttachedObjects.end(); ++itero)
		{
			LLViewerObject* o = *itero;
			if (!o) continue;

			LLDynamicArray<LLViewerObject*> prims = LLDynamicArray<LLViewerObject*>();
			o->addThisAndAllChildren(prims);
			for (LLDynamicArray<LLViewerObject*>::iterator iterc = prims.begin(); iterc != prims.end(); ++iterc)
			{
				const LLViewerObject* c = *iterc;
				if (!c) continue;
				if (LLSelectNode* n = LLSelectMgr::getInstance()->getSelection()->findNode(const_cast<LLViewerObject*>(c)))
				{
				}
				else continue;
				const LLVolume* vol = c->getVolume();
				if (!vol) continue;

				LLXform v_form;
				v_form.setScale(c->getScale());
				v_form.setPosition(c->getRenderPosition());
				v_form.setRotation(c->getRenderRotation());

				LLXform normfix;
				normfix.setRotation(v_form.getRotation());

				if (c->isHUDAttachment())
				{
					v_form.addPosition(-offset);
					//Normals of HUD elements are funky
					//TO-DO: fix 'em!
				}
				Add(vol, &v_form, &normfix);
			}
		}
	}
}
Example #17
0
// Returns true if any messages were sent, false otherwise.
// Is sort of equivalent to "does the server need to do anything?"
bool send_start_session_messages(
	const LLUUID& temp_session_id,
	const LLUUID& other_participant_id,
	const LLDynamicArray<LLUUID>& ids,
	EInstantMessage dialog)
{
	if ( dialog == IM_SESSION_GROUP_START )
	{
		session_starter_helper(
			temp_session_id,
			other_participant_id,
			dialog);

		gMessageSystem->addBinaryDataFast(
			_PREHASH_BinaryBucket,
			EMPTY_BINARY_BUCKET,
			EMPTY_BINARY_BUCKET_SIZE);
		gAgent.sendReliableMessage();

		return true;
	}
	else if ( dialog == IM_SESSION_CONFERENCE_START )
	{
		if (ids.empty()) return true;
		LLSD agents;
		for (int i = 0; i < (S32) ids.size(); i++)
		{
			agents.append(ids.get(i));
		}

		//we have a new way of starting conference calls now
		LLViewerRegion* region = gAgent.getRegion();
		std::string url(region ? region->getCapability("ChatSessionRequest") : "");
		if (!url.empty())
		{
			LLSD data;
			data["method"] = "start conference";
			data["session-id"] = temp_session_id;

			data["params"] = agents;

			LLHTTPClient::post(
				url,
				data,
				new LLStartConferenceChatResponder(
					temp_session_id,
					gAgent.getID(),
					other_participant_id,
					data["params"]));
		}
		else
		{
			start_deprecated_conference_chat(
				temp_session_id,
				gAgent.getID(),
				other_participant_id,
				agents);
		}
	}

	return false;
}
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) );
}
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);
	}
}
Example #20
0
void LLPanelFriends::refreshRightsChangeList()
{

	LLDynamicArray<LLUUID> friends = getSelectedIDs();
	
	S32 num_selected = friends.size();
	bool can_offer_teleport = num_selected >= 1;
	bool selected_friends_online = true;

	/*LLTextBox* processing_label = getChild<LLTextBox>("process_rights_label");

	if(!mAllowRightsChange)
	{
		if(processing_label)
		{
			processing_label->setVisible(true);
			// ignore selection for now
			friends.clear();
			num_selected = 0;
		}
	}
	else if(processing_label)
	{
		processing_label->setVisible(false);
	} Making Dummy View -HgB */
	const LLRelationship* friend_status = NULL;
	for(LLDynamicArray<LLUUID>::iterator itr = friends.begin(); itr != friends.end(); ++itr)
	{
		friend_status = LLAvatarTracker::instance().getBuddyInfo(*itr);
		if (friend_status)
		{
			if(!friend_status->isOnline())
			{
				can_offer_teleport = false;
				selected_friends_online = false;
			}
		}
		else // missing buddy info, don't allow any operations
		{
			can_offer_teleport = false;
		}
	}

	//Stuff for the online/total/select counts.
	
	getChild<LLTextBox>("s_num")->setValue(llformat("%d", num_selected));
	getChild<LLTextBox>("f_num")->setValue(llformat("%d / %d", mNumOnline, mFriendsList->getItemCount()));
	
	if (num_selected == 0)  // nothing selected
	{
		childSetEnabled("im_btn", FALSE);
		childSetEnabled("assign_btn", FALSE);
		childSetEnabled("offer_teleport_btn", FALSE);
	}
	else // we have at least one friend selected...
	{
		// only allow IMs to groups when everyone in the group is online
		// to be consistent with context menus in inventory and because otherwise
		// offline friends would be silently dropped from the session
		childSetEnabled("im_btn", selected_friends_online || num_selected == 1);
		childSetEnabled("assign_btn", num_selected == 1);
		childSetEnabled("offer_teleport_btn", can_offer_teleport);
	}
}