コード例 #1
0
void ScriptCounter::completechk()
{
	if(invqueries == 0)
	{
		if(reqObjectID.isNull())
		{
			if(sstr.str() == "")
			{
				if(foo->isAvatar())
				{
					int valid=1;
					LLVOAvatar *av=find_avatar_from_object(foo);
					LLNameValue *firstname;
					LLNameValue *lastname;
					if(!av)
					  valid=0;
					else
					{
					  firstname = av->getNVPair("FirstName");
					  lastname = av->getNVPair("LastName");
					  if(!firstname || !lastname)
						valid=0;
					  if(valid)
						  sstr << "Counted scripts from " << objectCount << " attachments on " << firstname->getString() << " " << lastname->getString() << ": ";
					}
					if(!valid)
						sstr << "Counted scripts from " << objectCount << " attachments on avatar: ";
				}
				else
				{
					if(doDelete)
						sstr << "Deleted scripts in " << objectCount << " objects: ";
					else
						sstr << "Counted scripts in " << objectCount << " objects: ";
				}
				F32 throttle = gSavedSettings.getF32("OutBandwidth");
				if(throttle != 0.f)
				{
					gMessageSystem->mPacketRing.setOutBandwidth(throttle);
					gMessageSystem->mPacketRing.setUseOutThrottle(TRUE);
				}
				else
				{
					gMessageSystem->mPacketRing.setOutBandwidth(0.0);
					gMessageSystem->mPacketRing.setUseOutThrottle(FALSE);
				}
			}
			showResult();
		}
		else
			countingDone=true;
	}
}
コード例 #2
0
// Add a message to a session. 
void LLIMMgr::addMessage(
	const LLUUID& session_id,
	const LLUUID& target_id,
	const std::string& from,
	const std::string& msg,
	const std::string& session_name,
	EInstantMessage dialog,
	U32 parent_estate_id,
	const LLUUID& region_id,
	const LLVector3& position,
	bool link_name) // If this is true, then we insert the name and link it to a profile
{
	LLUUID other_participant_id = target_id;

	// don't process muted IMs
	if (LLMuteList::getInstance()->isMuted(
			other_participant_id,
			LLMute::flagTextChat) && !LLMuteList::getInstance()->isLinden(from))
	{
		return;
	}

	LLUUID new_session_id = session_id;
	if (new_session_id.isNull())
	{
		//no session ID...compute new one
		new_session_id = computeSessionID(dialog, other_participant_id);
	}
	LLFloaterIMPanel* floater = findFloaterBySession(new_session_id);
	if (!floater)
	{
		floater = findFloaterBySession(other_participant_id);
		if (floater)
		{
			LL_INFOS() << "found the IM session " << new_session_id
				<< " by participant " << other_participant_id << LL_ENDL;
		}
	}

	if (LLVOAvatar* from_avatar = find_avatar_from_object(target_id)) from_avatar->mIdleTimer.reset(); // Not idle, message sent to somewhere

	// create IM window as necessary
	if(!floater)
	{
               // Return now if we're blocking this group's chat or conferences
               if (gAgent.isInGroup(session_id) ? getIgnoreGroup(session_id) : dialog != IM_NOTHING_SPECIAL && dialog != IM_SESSION_P2P_INVITE && block_conference(other_participant_id))
			return;

		std::string name = (session_name.size() > 1) ? session_name : from;

		floater = createFloater(new_session_id, other_participant_id, name, dialog);

		// When we get a new IM, and if you are a god, display a bit
		// of information about the source. This is to help liaisons
		// when answering questions.
		if(gAgent.isGodlike())
		{
			std::ostringstream bonus_info;
			bonus_info << LLTrans::getString("***")+ " "+ LLTrans::getString("IMParentEstate") + LLTrans::getString(":") + " "
				<< parent_estate_id
				<< ((parent_estate_id == 1) ? LLTrans::getString(",") + LLTrans::getString("IMMainland") : "")
				<< ((parent_estate_id == 5) ? LLTrans::getString(",") + LLTrans::getString ("IMTeen") : "");

			// once we have web-services (or something) which returns
			// information about a region id, we can print this out
			// and even have it link to map-teleport or something.
			//<< "*** region_id: " << region_id << std::endl
			//<< "*** position: " << position << std::endl;

			floater->addHistoryLine(bonus_info.str(), gSavedSettings.getColor4("SystemChatColor"));
		}

		make_ui_sound("UISndNewIncomingIMSession");
	}

	// now add message to floater
	LLColor4 color = agent_chat_color(other_participant_id, from, false);
	if (dialog == IM_BUSY_AUTO_RESPONSE)
	{
		color *= .75f;
		color += LLColor4::transparent*.25f;
	}

	if ( !link_name )
	{
		floater->addHistoryLine(msg,color); // No name to prepend, so just add the message normally
	}
	else
	{
		if( other_participant_id == session_id )
		{
			// The name can be bogus on InWorldz
			floater->addHistoryLine(msg, color, true, LLUUID::null, from);
		}
		else 
		{
			// Insert linked name to front of message
			floater->addHistoryLine(msg, color, true, other_participant_id, from);
		}
	}

	if (!gIMMgr->getFloaterOpen() && floater->getParent() != gFloaterView)
	{
		// If the chat floater is closed and not torn off) notify of a new IM
		mIMUnreadCount++;
	}
}
コード例 #3
0
ファイル: exporttracker.cpp プロジェクト: N3X15/Luna-Viewer
LLSD JCExportTracker::subserialize(LLViewerObject* linkset)
{
	//Chalice - Changed to support exporting linkset groups.
	LLViewerObject* object = linkset;
	//if(!linkset)return LLSD();
	
	// Create an LLSD object that will hold the entire tree structure that can be serialized to a file
	LLSD llsd;

	//if (!node)
	//	return llsd;

	//object = root_object = node->getObject();
	
	if (!object)
		return llsd;
	if(!(!object->isAvatar() && object->permYouOwner() && object->permModify() && object->permCopy() && object->permTransfer() && !gAgent.getGodLevel()))
		return llsd;
	// Build a list of everything that we'll actually be exporting
	LLDynamicArray<LLViewerObject*> export_objects;
	
	// Add the root object to the export list
	export_objects.put(object);
	
	// Iterate over all of this objects children
	LLViewerObject::child_list_t child_list = object->getChildren();
	
	for (LLViewerObject::child_list_t::iterator i = child_list.begin(); i != child_list.end(); ++i)
	{
		LLViewerObject* child = *i;
		if(!child->isAvatar())
		{
			// Put the child objects on the export list
			export_objects.put(child);
		}
	}
		
	S32 object_index = 0;
	
	while ((object_index < export_objects.count()))
	{
		object = export_objects.get(object_index++);
		LLUUID id = object->getID();
	
		llinfos << "Exporting prim " << object->getID().asString() << llendl;
	
		// Create an LLSD object that represents this prim. It will be injected in to the overall LLSD
		// tree structure
		LLSD prim_llsd;
	
		if (object_index == 1)
		{
			LLVOAvatar* avatar = find_avatar_from_object(object);
			if (avatar)
			{
				LLViewerJointAttachment* attachment = avatar->getTargetAttachmentPoint(object);
				U8 attachment_id = 0;
				
				if (attachment)
				{
					for (LLVOAvatar::attachment_map_t::iterator iter = avatar->mAttachmentPoints.begin();
										iter != avatar->mAttachmentPoints.end(); ++iter)
					{
						if (iter->second == attachment)
						{
							attachment_id = iter->first;
							break;
						}
					}
				}
				else
				{
					// interpret 0 as "default location"
					attachment_id = 0;
				}
				
				prim_llsd["Attachment"] = attachment_id;
				prim_llsd["attachpos"] = object->getPosition().getValue();
				prim_llsd["attachrot"] = ll_sd_from_quaternion(object->getRotation());
			}
			
			prim_llsd["position"] = LLVector3(0, 0, 0).getValue();
			prim_llsd["rotation"] = ll_sd_from_quaternion(object->getRotation());
		}
		else
		{
			prim_llsd["position"] = object->getPosition().getValue();
			prim_llsd["rotation"] = ll_sd_from_quaternion(object->getRotation());
		}
		//prim_llsd["name"] = "";//node->mName;
		//prim_llsd["description"] = "";//node->mDescription;
		// Transforms
		prim_llsd["scale"] = object->getScale().getValue();
		// Flags
		prim_llsd["shadows"] = object->flagCastShadows();
		prim_llsd["phantom"] = object->flagPhantom();
		prim_llsd["physical"] = (BOOL)(object->mFlags & FLAGS_USE_PHYSICS);
		LLVolumeParams params = object->getVolume()->getParams();
		prim_llsd["volume"] = params.asLLSD();
		if (object->isFlexible())
		{
			LLFlexibleObjectData* flex = (LLFlexibleObjectData*)object->getParameterEntry(LLNetworkData::PARAMS_FLEXIBLE);
			prim_llsd["flexible"] = flex->asLLSD();
		}
		if (object->getParameterEntryInUse(LLNetworkData::PARAMS_LIGHT))
		{
			LLLightParams* light = (LLLightParams*)object->getParameterEntry(LLNetworkData::PARAMS_LIGHT);
			prim_llsd["light"] = light->asLLSD();
		}
		if (object->getParameterEntryInUse(LLNetworkData::PARAMS_SCULPT))
		{
			LLSculptParams* sculpt = (LLSculptParams*)object->getParameterEntry(LLNetworkData::PARAMS_SCULPT);
			prim_llsd["sculpt"] = sculpt->asLLSD();
		}

		// Textures
		LLSD te_llsd;
		U8 te_count = object->getNumTEs();
		
		for (U8 i = 0; i < te_count; i++)
		{
			te_llsd.append(object->getTE(i)->asLLSD());
		}

		if(export_textures)
		{
			std::string path = asset_dir + gDirUtilp->getDirDelimiter();
			for (U8 i = 0; i < te_count; i++)
			{
				LLUUID asset_id = object->getTE(i)->getID();
				JCAssetInfo* info = new JCAssetInfo;
				info->path = path + asset_id.asString() + ".j2c";
				info->name = "Prim Texture";
				//gAssetStorage->getAssetData(asset_id, LLAssetType::AT_TEXTURE, JCAssetExportCallback, info,1);
				if(requested_textures.count(asset_id) == 0)
				{
					requested_textures.insert(asset_id);
					LLViewerImage* img = gImageList.getImage(asset_id, MIPMAP_TRUE, FALSE);
					img->setBoostLevel(LLViewerImageBoostLevel::BOOST_MAX_LEVEL);
					img->setLoadedCallback( JCExportTracker::onFileLoadedForSave, 
									0, TRUE, FALSE, info );
					llinfos << "Requesting texture " << asset_id.asString() << llendl;
				}
			}
		}

		//JCExportTracker::mirror(asset, obj, asset_dir, asset->getUUID().asString());
		
		prim_llsd["textures"] = te_llsd;

		prim_llsd["id"] = object->getID().asString();
		if(export_properties)
		{
			////cmdline_printchat(llformat("yes %d",export_properties));
			propertyqueries += 1;
			gMessageSystem->newMessageFast(_PREHASH_ObjectSelect);
			gMessageSystem->nextBlockFast(_PREHASH_AgentData);
			gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
			gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());

			gMessageSystem->nextBlockFast(_PREHASH_ObjectData);
            gMessageSystem->addU32Fast(_PREHASH_ObjectLocalID, object->getLocalID());
            
            gMessageSystem->sendReliable(gAgent.getRegionHost());

			if(export_inventory)
			{
				object->registerInventoryListener(sInstance,NULL);
				object->dirtyInventory();
				object->requestInventory();
				invqueries += 1;
			}
		}//else //cmdline_printchat(llformat("no %d",export_properties));
		totalprims += 1;

		// Changed to use link numbers zero-indexed.
		llsd[object_index - 1] = prim_llsd;
	}
	return llsd;
}
コード例 #4
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);
	}
}
コード例 #5
0
ファイル: scriptcounter.cpp プロジェクト: AGoodPerson/Ascent
void ScriptCounter::completechk()
{
	std::string user_msg;
	llinfos << "Completechk called." << llendl;
	if(invqueries == 0)
	{
		llinfos << "InvQueries = 0..." << llendl;
		if(reqObjectID.isNull())
		{
			llinfos << "reqObjectId is null..." << llendl;
			if(foo->isAvatar())
			{
				int valid=1;
				LLVOAvatar *av=find_avatar_from_object(foo);
				LLNameValue *firstname;
				LLNameValue *lastname;
				if(!av)
				  valid=0;
				else
				{
				  firstname = av->getNVPair("FirstName");
				  lastname = av->getNVPair("LastName");
				  if(!firstname || !lastname)
					valid=0;
				  if(valid)
				  {
					  user_msg = llformat("Counted %u scripts in %u attachments on %s %s.", scriptcount, objectCount, firstname->getString()  , lastname->getString());
					  //sstr << "Counted scripts from " << << " attachments on " << firstname->getString() << " " << lastname->getString() << ": ";
				  }
				}
				if(!valid)
				{
					user_msg = llformat("Counted %u scripts in %u attachments on selected avatar.", scriptcount, objectCount);
					//sstr << "Counted scripts from " << objectCount << " attachments on avatar: ";
				}
			}
			else
			{
				if(doDelete)
				{
					user_msg = llformat("Deleted %u scripts in %u objects.", scriptcount, objectCount);
					//sstr << "Deleted scripts in " << objectCount << " objects: ";
				}
				else
				{
					user_msg = llformat("Counted %u scripts in %u objects.", scriptcount, objectCount);
					//sstr << "Counted scripts in " << objectCount << " objects: ";
				}
			}
			F32 throttle = gSavedSettings.getF32("OutBandwidth");
			if(throttle != 0.f)
			{
				gMessageSystem->mPacketRing.setOutBandwidth(throttle);
				gMessageSystem->mPacketRing.setUseOutThrottle(TRUE);
			}
			else
			{
				gMessageSystem->mPacketRing.setOutBandwidth(0.0);
				gMessageSystem->mPacketRing.setUseOutThrottle(FALSE);
			}
			llinfos << "Sending readout to chat..." << llendl;
			showResult(user_msg);
		}
		else
			countingDone=true;
	}
}