Esempio n. 1
0
void LLXmlImport::finish_link()
{
	std::map<std::string, U8>::iterator at_iter = sId2attachpt.begin();
	std::map<std::string, U8>::iterator at_end = sId2attachpt.end();
	for( ; at_iter != at_end; ++at_iter)
	{
		LLUUID tid;
		tid.generate();
		U32 at_localid = sId2localid[(*at_iter).first];
		gMessageSystem->newMessageFast(_PREHASH_DeRezObject);
		gMessageSystem->nextBlockFast(_PREHASH_AgentData);
		gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
		gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
		gMessageSystem->nextBlockFast(_PREHASH_AgentBlock);
		gMessageSystem->addUUIDFast(_PREHASH_GroupID, LLUUID::null);
		gMessageSystem->addU8Fast(_PREHASH_Destination, DRD_TAKE_INTO_AGENT_INVENTORY);
		gMessageSystem->addUUIDFast(_PREHASH_DestinationID, sFolderID);
		gMessageSystem->addUUIDFast(_PREHASH_TransactionID, tid);
		gMessageSystem->addU8Fast(_PREHASH_PacketCount, 1);
		gMessageSystem->addU8Fast(_PREHASH_PacketNumber, 0);
		gMessageSystem->nextBlockFast(_PREHASH_ObjectData);
		gMessageSystem->addU32Fast(_PREHASH_ObjectLocalID, at_localid);
		gMessageSystem->sendReliable(gAgent.getRegionHost());
	}
}
Esempio n. 2
0
LLViewerObject *LLViewerObjectList::createObjectViewer(const LLPCode pcode, LLViewerRegion *regionp)
{
	LLMemType mt(LLMemType::MTYPE_OBJECT);
	LLUUID fullid;
	fullid.generate();

	LLViewerObject *objectp = LLViewerObject::createObject(fullid, pcode, regionp);
	if (!objectp)
	{
// 		llwarns << "Couldn't create object of type " << LLPrimitive::pCodeToString(pcode) << llendl;
		return NULL;
	}

	mUUIDObjectMap[fullid] = objectp;
	if(objectp->isAvatar())
	{
		LLVOAvatar *pAvatar = dynamic_cast<LLVOAvatar*>(objectp);
		if(pAvatar)
			mUUIDAvatarMap[fullid] = pAvatar;
	}

	mObjects.push_back(objectp);

	updateActive(objectp);

	return objectp;
}
//static
void FloaterHop::onClickHop(void* userdata)
{
	FloaterHop* instance = (FloaterHop*) userdata;

	std::vector<std::string> args;
	if(gSavedSettings.getBOOL("HopAutoLogin"))
	{
		args.push_back("-autologin");
	}

	bool keepalive = gSavedSettings.getBOOL("HopKeepOldSessionAlive");
	if(keepalive)
	{
		args.push_back("-multiple");
	}
	else
	{
		LLUUID cookie;
		cookie.generate();
		instance->mHopTimer = new HopTimer(cookie.asString(), instance);
		args.push_back("-isrelogsession");
		args.push_back(cookie.asString());
	}

	args.push_back(instance->mSLURL.getSLURLString());

	// this is under development and likely changing
	if(Teapot::getInstance()->launchNewViewer(args))
	{
		if(keepalive)
		{
			instance->closeFloater();
		}
	}
}
Esempio n. 4
0
void hash_index_object_t::test<3>()
{
    LLUUIDHashMap<UUIDTableEntry, 5>	hashTable(UUIDTableEntry::uuidEq, UUIDTableEntry());
    const int numElementsToCheck = 10;
    std::vector<LLUUID> idList(numElementsToCheck);
    int i;

    for (i = 0; i < numElementsToCheck; i++)
    {
        LLUUID id;
        id.generate();
        UUIDTableEntry entry(id, i);
        hashTable.set(id, entry);
        idList[i] = id;
    }

    for (i = 0; i < numElementsToCheck; i++)
    {
        LLUUID id = idList[i];
        // set new entry with value = i+numElementsToCheck
        UUIDTableEntry entry(id, i+numElementsToCheck);
        hashTable.set(id, entry);
    }

    for (i = 0; i < numElementsToCheck; i++)
    {
        LLUUID idToCheck = idList[i];
        UUIDTableEntry entryToCheck = hashTable.get(idToCheck);
        ensure("set/get did not work", entryToCheck.getID() == idToCheck && entryToCheck.getValue() == (size_t)(i+numElementsToCheck));
    }
}
Esempio n. 5
0
void hash_index_object_t::test<6>()
{
    LLUUIDHashMap<UUIDTableEntry, 2>	hashTable(UUIDTableEntry::uuidEq, UUIDTableEntry());
    LLUUIDHashMapIter<UUIDTableEntry, 2> hashIter(&hashTable);
    const int numElementsToCheck = 256;
    std::vector<LLUUID> idList(numElementsToCheck);
    int i;

    for (i = 0; i < numElementsToCheck; i++)
    {
        LLUUID id;
        id.generate();
        // LLUUIDHashMap uses mData[0] to pick the bucket
        // overwrite mData[0] so that it ranges from 0 to 255
        // to create a sparse map
        id.mData[0] = i;
        UUIDTableEntry entry(id, i);
        hashTable.set(id, entry);
        idList[i] = id;
    }

    hashIter.first();
    int numElementsIterated = 0;
    while(!hashIter.done())
    {
        numElementsIterated++;
        UUIDTableEntry tableEntry = *hashIter;
        LLUUID id = tableEntry.getID();
        hashIter.next();
        ensure("Iteration failed for sparse map", tableEntry.getValue() < (size_t)numElementsToCheck && idList[tableEntry.getValue()] ==  tableEntry.getID());
    }

    ensure("iteration count failed", numElementsIterated == numElementsToCheck);
}
CopyLibraryCategoryCommand::CopyLibraryCategoryCommand(const LLUUID& source_id,
													   const LLUUID& dest_id,
													   LLPointer<LLInventoryCallback> callback,
													   bool copy_subfolders):
	AISCommand(callback)
{
	std::string cap;
	if (!getLibCap(cap))
	{
		LL_WARNS() << "No cap found" << LL_ENDL;
		return;
	}
	LL_DEBUGS("Inventory") << "Copying library category: " << source_id << " => " << dest_id << LL_ENDL;
	LLUUID tid;
	tid.generate();
	std::string url = cap + std::string("/category/") + source_id.asString() + "?tid=" + tid.asString();
	if (!copy_subfolders)
	{
		url += ",depth=0";
	}
	LL_INFOS() << url << LL_ENDL;
	LLCurl::ResponderPtr responder = this;
	LLSD headers;
	F32 timeout = HTTP_REQUEST_EXPIRY_SECS;
	command_func_type cmd = boost::bind(&LLHTTPClient::copy, url, dest_id.asString(), responder, headers, timeout);
	setCommandFunc(cmd);
}
static void send_estate_message(
	const char* request,
	const LLUUID &target)
{

	LLMessageSystem* msg = gMessageSystem;
	LLUUID invoice;

	// This seems to provide an ID so that the sim can say which request it's
	// replying to. I think this can be ignored for now.
	invoice.generate();

	llinfos << "Sending estate request '" << request << "'" << llendl;
	msg->newMessage("EstateOwnerMessage");
	msg->nextBlockFast(_PREHASH_AgentData);
	msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
	msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
	msg->addUUIDFast(_PREHASH_TransactionID, LLUUID::null); //not used
	msg->nextBlock("MethodData");
	msg->addString("Method", request);
	msg->addUUID("Invoice", invoice);

	// Agent id
	msg->nextBlock("ParamList");
	msg->addString("Parameter", gAgent.getID().asString().c_str());

	// Target
	msg->nextBlock("ParamList");
	msg->addString("Parameter", target.asString().c_str());

	msg->sendReliable(gAgent.getRegion()->getHost());
}
Esempio n. 8
0
LLViewerObject *LLViewerObjectList::createObject(const LLPCode pcode, LLViewerRegion *regionp,
												 const LLUUID &uuid, const U32 local_id, const LLHost &sender)
{
	LLMemType mt(LLMemType::MTYPE_OBJECT);
	LLFastTimer t(LLFastTimer::FTM_CREATE_OBJECT);
	
	LLUUID fullid;
	if (uuid == LLUUID::null)
	{
		fullid.generate();
	}
	else
	{
		fullid = uuid;
	}

	LLViewerObject *objectp = LLViewerObject::createObject(fullid, pcode, regionp);
	if (!objectp)
	{
// 		llwarns << "Couldn't create object of type " << LLPrimitive::pCodeToString(pcode) << " id:" << fullid << llendl;
		return NULL;
	}

	mUUIDObjectMap[fullid] = objectp;
	setUUIDAndLocal(fullid,
					local_id,
					gMessageSystem->getSenderIP(),
					gMessageSystem->getSenderPort());

	mObjects.put(objectp);

	updateActive(objectp);

	return objectp;
}
Esempio n. 9
0
void LLFloaterAuction::clearParcelAccessList(LLParcel* parcel, LLViewerRegion* region, U32 list)
{
	if (!region || !parcel) return;

	LLUUID transactionUUID;
	transactionUUID.generate();

	LLMessageSystem* msg = gMessageSystem;

	msg->newMessageFast(_PREHASH_ParcelAccessListUpdate);
	msg->nextBlockFast(_PREHASH_AgentData);
	msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
	msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID() );
	msg->nextBlockFast(_PREHASH_Data);
	msg->addU32Fast(_PREHASH_Flags, list);
	msg->addS32(_PREHASH_LocalID, parcel->getLocalID() );
	msg->addUUIDFast(_PREHASH_TransactionID, transactionUUID);
	msg->addS32Fast(_PREHASH_SequenceID, 1);			// sequence_id
	msg->addS32Fast(_PREHASH_Sections, 0);				// num_sections

	// pack an empty block since there will be no data
	msg->nextBlockFast(_PREHASH_List);
	msg->addUUIDFast(_PREHASH_ID,  LLUUID::null );
	msg->addS32Fast(_PREHASH_Time, 0 );
	msg->addU32Fast(_PREHASH_Flags,	0 );

	msg->sendReliable( region->getHost() );
}
//static
void LLFloaterWebContent::create( const std::string &url, const std::string& target, const std::string& uuid )
{
	lldebugs << "url = " << url << ", target = " << target << ", uuid = " << uuid << llendl;

	std::string tag = target;

	if(target.empty() || target == "_blank")
	{
		if(!uuid.empty())
		{
			tag = uuid;
		}
		else
		{
			// create a unique tag for this instance
			LLUUID id;
			id.generate();
			tag = id.asString();
		}
	}

	S32 browser_window_limit = gSavedSettings.getS32("WebContentWindowLimit");

	if(LLFloaterReg::findInstance("web_content", tag) != NULL)
	{
		// There's already a web browser for this tag, so we won't be opening a new window.
	}
	else if(browser_window_limit != 0)
	{
		// showInstance will open a new window.  Figure out how many web browsers are already open,
		// and close the least recently opened one if this will put us over the limit.

		LLFloaterReg::const_instance_list_t &instances = LLFloaterReg::getFloaterList("web_content");
		lldebugs << "total instance count is " << instances.size() << llendl;

		for(LLFloaterReg::const_instance_list_t::const_iterator iter = instances.begin(); iter != instances.end(); iter++)
		{
			lldebugs << "    " << (*iter)->getKey() << llendl;
		}

		if(instances.size() >= (size_t)browser_window_limit)
		{
			// Destroy the least recently opened instance
			(*instances.begin())->closeFloater();
		}
	}

	LLFloaterWebContent *browser = dynamic_cast<LLFloaterWebContent*> (LLFloaterReg::showInstance("web_content", tag));
	llassert(browser);
	if(browser)
	{
		browser->mUUID = uuid;

		// tell the browser instance to load the specified URL
		browser->open_media(url, target);
		LLViewerMedia::proxyWindowOpened(target, uuid);
	}
}
	void SDTestObject::test<2>()
		// setting and fetching scalar types
	{
		SDCleanupCheck check;
		
		LLSD v;

		v = true;		ensureTypeAndValue("set true", v, true);
		v = false;		ensureTypeAndValue("set false", v, false);
		v = true;		ensureTypeAndValue("set true again", v, true);
		
		v = 42;			ensureTypeAndValue("set to 42", v, 42);
		v = 0;			ensureTypeAndValue("set to zero", v, 0);
		v = -12345;		ensureTypeAndValue("set to neg", v, -12345);
		v = 2000000000;	ensureTypeAndValue("set to big", v, 2000000000);
		
		v = 3.14159265359;
						ensureTypeAndValue("set to pi", v, 3.14159265359);
						ensure_not_equals("isn't float", v.asReal(),
							(float)3.14159265359);
		v = 6.7e256;	ensureTypeAndValue("set to big", v, 6.7e256);
		
		LLUUID nullUUID;
		LLUUID newUUID;
		newUUID.generate();
		
		v = nullUUID;	ensureTypeAndValue("set to null UUID", v, nullUUID);
		v = newUUID;	ensureTypeAndValue("set to new UUID", v, newUUID);
		v = nullUUID;	ensureTypeAndValue("set to null again", v, nullUUID);
		
		// strings must be tested with two types of string objects
		std::string s = "now is the time";
		const char* cs = "for all good zorks";

		v = s;			ensureTypeAndValue("set to std::string", v, s);		
		v = cs;			ensureTypeAndValue("set to const char*", v, cs);
	
		LLDate epoch;
		LLDate aDay("2001-10-22T10:11:12.00Z");
		
		v = epoch;		ensureTypeAndValue("set to epoch", v, epoch);
		v = aDay;		ensureTypeAndValue("set to a day", v, aDay);
		
		LLURI path("http://slurl.com/secondlife/Ambleside/57/104/26/");
		
		v = path;		ensureTypeAndValue("set to a uri", v, path);
		
		const char source[] = "once in a blue moon";
		std::vector<U8> data;
		copy(&source[0], &source[sizeof(source)], back_inserter(data));
		
		v = data;		ensureTypeAndValue("set to data", v, data);
		
		v.clear();
		ensure("reset to undefined", v.type() == LLSD::TypeUndefined);
	}
Esempio n. 12
0
void hash_index_object_t::test<7>()
{
    LLUUIDHashMap<UUIDTableEntry, 2>	hashTable(UUIDTableEntry::uuidEq, UUIDTableEntry());
    LLUUIDHashMapIter<UUIDTableEntry, 2> hashIter(&hashTable);
    const int numElementsToCheck = 256;
    std::vector<LLUUID> idList(numElementsToCheck);
    int i;

    LLUUID uuidtoSearch;
    for (i = 0; i < numElementsToCheck; i++)
    {
        LLUUID id;
        id.generate();
        // LLUUIDHashMap uses mData[0] to pick the bucket
        // overwrite mData[0] so that it ranges from 0 to 255
        // to create a sparse map
        id.mData[0] = i;
        UUIDTableEntry entry(id, i);
        hashTable.set(id, entry);
        idList[i] = id;

        // pick uuid somewhere in the middle
        if (i == 5)
        {
            uuidtoSearch = id;
        }
    }

    hashIter.first();
    int numElementsIterated = 0;
    while(!hashIter.done())
    {
        numElementsIterated++;
        UUIDTableEntry tableEntry = *hashIter;
        LLUUID id = tableEntry.getID();
        if (uuidtoSearch == id)
        {
            break;
        }
        hashIter.next();
    }

    // current iterator implementation will not allow any remove operations
    // until ALL elements have been iterated over. this seems to be
    // an unnecessary restriction. Iterator should have a method to
    // reset() its state so that further operations (inckuding remove)
    // can be performed on the HashMap without having to iterate thru
    // all the remaining nodes.

//		 hashIter.reset();
//		 hashTable.remove(uuidtoSearch);
//		 ensure("remove after iteration reset failed", hashTable.check(uuidtoSearch) == FALSE);
}
Esempio n. 13
0
		LLMessageConfigTestData()
		{
			LLUUID random;
			random.generate();
			// generate temp dir
			std::ostringstream oStr;
#if LL_WINDOWS 
			oStr << "llmessage-config-test-" << random;
#else
			oStr << "/tmp/llmessage-config-test-" << random;
#endif
			mTestConfigDir = oStr.str();
			LLFile::mkdir(mTestConfigDir);
			writeConfigFile(LLSD());
			LLMessageConfig::initClass("simulator", mTestConfigDir);
		}
	void SDTestObject::test<3>()
		// construction via scalar values
		// tests both constructor and initialize forms
	{
		SDCleanupCheck check;
		
		LLSD b1(true);	ensureTypeAndValue("construct boolean", b1, true);
		LLSD b2 = true;	ensureTypeAndValue("initialize  boolean", b2, true);
		LLSD i1(42);	ensureTypeAndValue("construct int", i1, 42);
		LLSD i2 =42;	ensureTypeAndValue("initialize  int", i2, 42);
		LLSD d1(1.2);	ensureTypeAndValue("construct double", d1, 1.2);
		LLSD d2 = 1.2;	ensureTypeAndValue("initialize double", d2, 1.2);
		
		LLUUID newUUID;
		newUUID.generate();
		LLSD u1(newUUID);
						ensureTypeAndValue("construct UUID", u1, newUUID);
		LLSD u2 = newUUID;
						ensureTypeAndValue("initialize UUID", u2, newUUID);
		
		LLSD ss1(std::string("abc"));
						ensureTypeAndValue("construct std::string", ss1, "abc");
		LLSD ss2 = std::string("abc");
						ensureTypeAndValue("initialize std::string",ss2, "abc");
		LLSD sl1(std::string("def"));
						ensureTypeAndValue("construct std::string", sl1, "def");
		LLSD sl2 = std::string("def");
						ensureTypeAndValue("initialize std::string", sl2, "def");
		LLSD sc1("ghi");
						ensureTypeAndValue("construct const char*", sc1, "ghi");
		LLSD sc2 = "ghi";
						ensureTypeAndValue("initialize const char*",sc2, "ghi");

		LLDate aDay("2001-10-22T10:11:12.00Z");
		LLSD t1(aDay);	ensureTypeAndValue("construct LLDate", t1, aDay);
		LLSD t2 = aDay;	ensureTypeAndValue("initialize LLDate", t2, aDay);

		LLURI path("http://slurl.com/secondlife/Ambleside/57/104/26/");
		LLSD p1(path);	ensureTypeAndValue("construct LLURI", p1, path);
		LLSD p2 = path;	ensureTypeAndValue("initialize LLURI", p2, path);

		const char source[] = "once in a blue moon";
		std::vector<U8> data;
		copy(&source[0], &source[sizeof(source)], back_inserter(data));
		LLSD x1(data);	ensureTypeAndValue("construct vector<U8>", x1, data);
		LLSD x2 = data;	ensureTypeAndValue("initialize vector<U8>", x2, data);
	}
LLHUDEffect *LLHUDManager::createViewerEffect(const U8 type, BOOL send_to_sim, BOOL originated_here)
{
	// SJB: DO NOT USE addHUDObject!!! Not all LLHUDObjects are LLHUDEffects!
	LLHUDEffect *hep = LLHUDObject::addHUDEffect(type);
	if (!hep)
	{
		return NULL;
	}

	LLUUID tmp;
	tmp.generate();
	hep->setID(tmp);
	hep->setNeedsSendToSim(send_to_sim);
	hep->setOriginatedHere(originated_here);

	mHUDEffects.put(hep);
	return hep;
}
Esempio n. 16
0
		control_group()
		{
			mCG = new LLControlGroup;
			LLUUID random;
			random.generate();
			// generate temp dir
			std::ostringstream oStr;
			oStr << "/tmp/llcontrol-test-" << random << "/";
			mTestConfigDir = oStr.str();
			mTestConfigFile = mTestConfigDir + "settings.xml";
			LLFile::mkdir(mTestConfigDir);
			LLSD config;
			config["TestSetting"]["Comment"] = "Dummy setting used for testing";
			config["TestSetting"]["Persist"] = 1;
			config["TestSetting"]["Type"] = "U32";
			config["TestSetting"]["Value"] = 12;
			writeSettingsFile(config);
		}
Esempio n. 17
0
void hash_index_object_t::test<4>()
{
    LLUUIDHashMap<UUIDTableEntry, 5>	hashTable(UUIDTableEntry::uuidEq, UUIDTableEntry());
    const int numElementsToCheck = 10;
    std::vector<LLUUID> idList(numElementsToCheck);
    int i;

    for (i = 0; i < numElementsToCheck; i++)
    {
        LLUUID id;
        id.generate();
        UUIDTableEntry entry(id, i);
        hashTable.set(id, entry);
        idList[i] = id;
    }

    hashTable.removeAll();
    ensure("removeAll failed", hashTable.getLength() == 0);
}
//static
void LLFloaterMessageLog::updateGlobalNetList(bool starting)
{
	//something tells me things aren't deallocated properly here, but
	//valgrind isn't complaining

	// Update circuit data of net list items
	std::vector<LLCircuitData*> circuits = gMessageSystem->getCircuit()->getCircuitDataList();
	std::vector<LLCircuitData*>::iterator circuits_end = circuits.end();
	for(std::vector<LLCircuitData*>::iterator iter = circuits.begin(); iter != circuits_end; ++iter)
	{
		LLNetListItem* itemp = findNetListItem((*iter)->getHost());
		if(!itemp)
		{
			LLUUID id; id.generate();
			itemp = new LLNetListItem(id);
			sNetListItems.push_back(itemp);
		}
		itemp->mCircuitData = (*iter);
	}
	// Clear circuit data of items whose circuits are gone
	std::list<LLNetListItem*>::iterator items_end = sNetListItems.end();
	for(std::list<LLNetListItem*>::iterator iter = sNetListItems.begin(); iter != items_end; ++iter)
	{
		if(std::find(circuits.begin(), circuits.end(), (*iter)->mCircuitData) == circuits.end())
			(*iter)->mCircuitData = NULL;
	}
	// Remove net list items that are totally useless now
	for(std::list<LLNetListItem*>::iterator iter = sNetListItems.begin(); iter != sNetListItems.end();)
	{
		if((*iter)->mCircuitData == NULL)
		{
			delete *iter;
			iter = sNetListItems.erase(iter);
		}
		else ++iter;
	}

	if(!starting)
	{
		sInstance->refreshNetList();
		sInstance->refreshNetInfo(FALSE);
	}
}
Esempio n. 19
0
		LLMessageSystemTestData()
		{
			static bool init = false;
			if(!init)
			{
				ll_init_apr();
				//init_prehash_data();
				init = true;
			}
			const F32 circuit_heartbeat_interval=5;
			const F32 circuit_timeout=100;


			// currently test disconnected message system
			start_messaging_system("notafile", 13035,
								   LL_VERSION_MAJOR,
								   LL_VERSION_MINOR,        
								   LL_VERSION_PATCH,        
								   FALSE,        
								   "notasharedsecret",
								   NULL,
								   false,
								   circuit_heartbeat_interval,
								   circuit_timeout
								   );
			// generate temp dir
			std::ostringstream ostr;
#if LL_WINDOWS
			mSep = "\\";
			ostr << "C:" << mSep;
#else
			mSep = "/";
			ostr << mSep << "tmp" << mSep;
#endif
			LLUUID random;
			random.generate();
			ostr << "message-test-" << random;
			mTestConfigDir = ostr.str();
			LLFile::mkdir(mTestConfigDir);
			writeConfigFile(LLSD());
			LLMessageConfig::initClass("simulator", ostr.str());
		}
Esempio n. 20
0
void hash_index_object_t::test<2>()
{
    LLUUIDHashMap<UUIDTableEntry, 2>	hashTable(UUIDTableEntry::uuidEq, UUIDTableEntry());
    const int numElementsToCheck = 5;
    std::vector<LLUUID> idList(numElementsToCheck*10);
    int i;

    for (i = 0; i < numElementsToCheck; i++)
    {
        LLUUID id;
        id.generate();
        UUIDTableEntry entry(id, i);
        hashTable.set(id, entry);
        idList[i] = id;
    }

    ensure("getLength failed", hashTable.getLength() == numElementsToCheck);

    // remove all but the last element
    for (i = 0; i < numElementsToCheck-1; i++)
    {
        LLUUID idToCheck = idList[i];
        hashTable.remove(idToCheck);
    }

    // there should only be one element left now.
    ensure("getLength failed", hashTable.getLength() == 1);

    for (i = 0; i < numElementsToCheck; i++)
    {
        LLUUID idToCheck = idList[i];
        if (i != numElementsToCheck - 1)
        {
            ensure("remove did not work", hashTable.check(idToCheck)  == FALSE);
        }
        else
        {
            UUIDTableEntry entryToCheck = hashTable.get(idToCheck);
            ensure("remove did not work", entryToCheck.getID() == idToCheck && entryToCheck.getValue() == (size_t)i);
        }
    }
}
Esempio n. 21
0
void hash_index_object_t::test<5>()
{
    LLUUIDHashMap<UUIDTableEntry, 2>	hashTable(UUIDTableEntry::uuidEq, UUIDTableEntry());
    const int numElementsToCheck = 256;
    std::vector<LLUUID> idList(numElementsToCheck);
    int i;

    for (i = 0; i < numElementsToCheck; i++)
    {
        LLUUID id;
        id.generate();
        // LLUUIDHashMap uses mData[0] to pick the bucket
        // overwrite mData[0] so that it ranges from 0 to 255
        id.mData[0] = i;
        UUIDTableEntry entry(id, i);
        hashTable.set(id, entry);
        idList[i] = id;
    }

    for (i = 0; i < numElementsToCheck; i++)
    {
        LLUUID idToCheck = idList[i];
        UUIDTableEntry entryToCheck = hashTable.get(idToCheck);
        ensure("set/get did not work for sparse map", entryToCheck.getID() == idToCheck && entryToCheck.getValue() == (size_t)i);
    }

    for (i = 0; i < numElementsToCheck; i++)
    {
        LLUUID idToCheck = idList[i];
        if (i % 2 != 0)
        {
            hashTable.remove(idToCheck);
        }
    }

    for (i = 0; i < numElementsToCheck; i++)
    {
        LLUUID idToCheck = idList[i];
        ensure("remove or check did not work for sparse map", (i % 2 == 0 && hashTable.check(idToCheck)) || (i % 2 != 0 && !hashTable.check(idToCheck)));
    }
}
Esempio n. 22
0
LLViewerObject *LLViewerObjectList::createObjectViewer(const LLPCode pcode, LLViewerRegion *regionp)
{
	LLMemType mt(LLMemType::MTYPE_OBJECT);
	LLUUID fullid;
	fullid.generate();

	LLViewerObject *objectp = LLViewerObject::createObject(fullid, pcode, regionp);
	if (!objectp)
	{
// 		llwarns << "Couldn't create object of type " << LLPrimitive::pCodeToString(pcode) << llendl;
		return NULL;
	}

	mUUIDObjectMap[fullid] = objectp;

	mObjects.put(objectp);

	updateActive(objectp);

	return objectp;
}
SlamFolderCommand::SlamFolderCommand(const LLUUID& folder_id, const LLSD& contents, LLPointer<LLInventoryCallback> callback):
	mContents(contents),
	AISCommand(callback)
{
	std::string cap;
	if (!getInvCap(cap))
	{
		LL_WARNS() << "No cap found" << LL_ENDL;
		return;
	}
	LLUUID tid;
	tid.generate();
	std::string url = cap + std::string("/category/") + folder_id.asString() + "/links?tid=" + tid.asString();
	LL_INFOS() << url << LL_ENDL;
	LLCurl::ResponderPtr responder = this;
	LLSD headers;
	headers["Content-Type"] = "application/llsd+xml";
	F32 timeout = HTTP_REQUEST_EXPIRY_SECS;
	command_func_type cmd = boost::bind(&LLHTTPClient::put, url, mContents, responder, headers, timeout);
	setCommandFunc(cmd);
}
Esempio n. 24
0
void LLXmlImport::finish_init()
{
	// Go ahead and upload wearables
	int num_wearables = sXmlImportOptions->mWearables.size();
	for(int i = 0; i < num_wearables; i++)
	{
		sXmlImportOptions->mWearables[i]->replaceTextures(sTextureReplace); //hack for importing weable textures
		LLAssetType::EType at = LLAssetType::AT_CLOTHING;
		if(sXmlImportOptions->mWearables[i]->mType < 4) at = LLAssetType::AT_BODYPART;
		LLUUID tid;
		tid.generate();
		// Create asset
		gMessageSystem->newMessageFast(_PREHASH_AssetUploadRequest);
		gMessageSystem->nextBlockFast(_PREHASH_AssetBlock);
		gMessageSystem->addUUIDFast(_PREHASH_TransactionID, tid);
		gMessageSystem->addS8Fast(_PREHASH_Type, (S8)at);
		gMessageSystem->addBOOLFast(_PREHASH_Tempfile, FALSE);
		gMessageSystem->addBOOLFast(_PREHASH_StoreLocal, FALSE);
		gMessageSystem->addStringFast(_PREHASH_AssetData, sXmlImportOptions->mWearables[i]->mData.c_str());
		gMessageSystem->sendReliable(gAgent.getRegionHost());
		// Create item
		gMessageSystem->newMessageFast(_PREHASH_CreateInventoryItem);
		gMessageSystem->nextBlockFast(_PREHASH_AgentData);
		gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
		gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
		gMessageSystem->nextBlockFast(_PREHASH_InventoryBlock);
		gMessageSystem->addU32Fast(_PREHASH_CallbackID, 0);
		gMessageSystem->addUUIDFast(_PREHASH_FolderID, sFolderID);
		gMessageSystem->addUUIDFast(_PREHASH_TransactionID, tid);
		gMessageSystem->addU32Fast(_PREHASH_NextOwnerMask, 532480);
		gMessageSystem->addS8Fast(_PREHASH_Type, at);
		gMessageSystem->addS8Fast(_PREHASH_InvType, 18);
		gMessageSystem->addS8Fast(_PREHASH_WearableType, sXmlImportOptions->mWearables[i]->mType);
		gMessageSystem->addStringFast(_PREHASH_Name, sXmlImportOptions->mWearables[i]->mName.c_str());
		gMessageSystem->addStringFast(_PREHASH_Description, "");
		gMessageSystem->sendReliable(gAgent.getRegionHost());
	}
	// Go ahead and upload asset data
	rez_supply();
}
Esempio n. 25
0
void LLTransferTargetChannel::requestTransfer(
	const LLTransferSourceParams& source_params,
	const LLTransferTargetParams& target_params,
	const F32 priority)
{
	LLUUID id;
	id.generate();
	LLTransferTarget* ttp = LLTransferTarget::createTarget(
		target_params.getType(),
		id,
		source_params.getType());
	if (!ttp)
	{
		llwarns << "LLTransferManager::requestTransfer aborting due to target creation failure!" << llendl;
		return;
	}

	ttp->applyParams(target_params);
	addTransferTarget(ttp);

	sendTransferRequest(ttp, source_params, priority);
}
Esempio n. 26
0
void lggIrcProfileFloater::onClickIM(void* data)
{
	lggIrcProfileFloater* self = (lggIrcProfileFloater*)data;

	LLUUID uid;
	uid.generate(self->myLLSDdata["NICK"].asString()+"lgg"+self->myLLSDdata["RCHANNEL"].asString());

	LLUUID computed_session_id=LLIMMgr::computeSessionID(IM_PRIVATE_IRC,uid);
			
	if(!gIMMgr->hasSession(computed_session_id))
	{
		make_ui_sound("UISndNewIncomingIMSession");
		gIMMgr->addSession(
		llformat("%s",self->myLLSDdata["NICK"].asString().c_str()),IM_PRIVATE_IRC,uid);
	}else
	{

		
	}
	
	self->close();
}
Esempio n. 27
0
void hash_index_object_t::test<1>()
{
    LLUUIDHashMap<UUIDTableEntry, 32>	hashTable(UUIDTableEntry::uuidEq, UUIDTableEntry());
    const int numElementsToCheck = 32*256*32;
    std::vector<LLUUID> idList(numElementsToCheck);
    int i;

    for (i = 0; i < numElementsToCheck; i++)
    {
        LLUUID id;
        id.generate();
        UUIDTableEntry entry(id, i);
        hashTable.set(id, entry);
        idList[i] = id;
    }

    for (i = 0; i < numElementsToCheck; i++)
    {
        LLUUID idToCheck = idList[i];
        UUIDTableEntry entryToCheck = hashTable.get(idToCheck);
        ensure("set/get did not work", entryToCheck.getID() == idToCheck && entryToCheck.getValue() == (size_t)i);
    }

    for (i = 0; i < numElementsToCheck; i++)
    {
        LLUUID idToCheck = idList[i];
        if (i % 2 != 0)
        {
            hashTable.remove(idToCheck);
        }
    }

    for (i = 0; i < numElementsToCheck; i++)
    {
        LLUUID idToCheck = idList[i];
        ensure("remove or check did not work", (i % 2 == 0 && hashTable.check(idToCheck)) || (i % 2 != 0 && !hashTable.check(idToCheck)));
    }
}
CreateInventoryCommand::CreateInventoryCommand(const LLUUID& parent_id,
							 				   const LLSD& new_inventory,
							 				   LLPointer<LLInventoryCallback> callback):
	mNewInventory(new_inventory),
	AISCommand(callback)
{
	std::string cap;
	if (!getInvCap(cap))
	{
		LL_WARNS() << "No cap found" << LL_ENDL;
		return;
	}
	LLUUID tid;
	tid.generate();
	std::string url = cap + std::string("/category/") + parent_id.asString() + "?tid=" + tid.asString();
	LL_DEBUGS("Inventory") << "url: " << url << LL_ENDL;
	LLCurl::ResponderPtr responder = this;
	LLSD headers;
	headers["Content-Type"] = "application/llsd+xml";
	F32 timeout = HTTP_REQUEST_EXPIRY_SECS;
	command_func_type cmd = boost::bind(&LLHTTPClient::post, url, mNewInventory, responder, headers, timeout);
	setCommandFunc(cmd);
}
	void SDTestObject::test<5>()
		// conversion of String to and from UUID, Date and URI.
	{
		SDCleanupCheck check;
		
		LLSD v;
		
		LLUUID nullUUID;
		LLUUID someUUID;
		someUUID.generate();
		
		v = nullUUID;	checkRoundTrip("null uuid", v,
							"00000000-0000-0000-0000-000000000000", nullUUID);
		v = someUUID;	checkRoundTrip("random uuid", v, 0, someUUID);
		
		LLDate epoch;
		LLDate beta("2003-04-30T04:00:00Z");
		LLDate oneOh("2003-06-23T04:00:00Z");
		
		v = epoch;		checkRoundTrip("epoch date", v, 0, epoch);
		v = beta;		checkRoundTrip("beta date", v,
							"2003-04-30T04:00:00Z", beta);
		v = oneOh;		checkRoundTrip("1.0 date", v,
							"2003-06-23T04:00:00Z", oneOh);
		
		LLURI empty;
		LLURI path("http://slurl.com/secondlife/Ambleside/57/104/26/");
		LLURI mail("mailto:[email protected]");
		
		v = empty;		checkRoundTrip("empty URI", v, 0, empty);
		v = path;		checkRoundTrip("path URI", v,
							"http://slurl.com/secondlife/Ambleside/57/104/26/",
							path);
		v = mail;		checkRoundTrip("mail URI", v,
							"mailto:[email protected]", mail);
	}
void LLNearbyChatHandler::processChat(const LLChat& chat_msg, const LLSD &args)
{
	if(chat_msg.mMuted == TRUE)
		return;
	if(chat_msg.mSourceType == CHAT_SOURCE_AGENT && chat_msg.mFromID.notNull())
         LLRecentPeople::instance().add(chat_msg.mFromID);

	if(chat_msg.mText.empty())
		return;//don't process empty messages

	LLChat& tmp_chat = const_cast<LLChat&>(chat_msg);

	LLNearbyChat* nearby_chat = LLFloaterReg::getTypedInstance<LLNearbyChat>("nearby_chat", LLSD());
	{
		//sometimes its usefull to have no name at all...
		//if(tmp_chat.mFromName.empty() && tmp_chat.mFromID!= LLUUID::null)
		//	tmp_chat.mFromName = tmp_chat.mFromID.asString();
	}
	nearby_chat->addMessage(chat_msg, true, args);
	if( nearby_chat->getVisible()
		|| ( chat_msg.mSourceType == CHAT_SOURCE_AGENT
			&& gSavedSettings.getBOOL("UseChatBubbles") ) )
		return;//no need in toast if chat is visible or if bubble chat is enabled

	// Handle irc styled messages for toast panel
	if (tmp_chat.mChatStyle == CHAT_STYLE_IRC)
	{
		if(!tmp_chat.mFromName.empty())
			tmp_chat.mText = tmp_chat.mFromName + tmp_chat.mText.substr(3);
		else
			tmp_chat.mText = tmp_chat.mText.substr(3);
	}

	// arrange a channel on a screen
	if(!mChannel->getVisible())
	{
		initChannel();
	}

	/*
	//comment all this due to EXT-4432
	..may clean up after some time...

	//only messages from AGENTS
	if(CHAT_SOURCE_OBJECT == chat_msg.mSourceType)
	{
		if(chat_msg.mChatType == CHAT_TYPE_DEBUG_MSG)
			return;//ok for now we don't skip messeges from object, so skip only debug messages
	}
	*/

	LLUUID id;
	id.generate();

	LLNearbyChatScreenChannel* channel = dynamic_cast<LLNearbyChatScreenChannel*>(mChannel);
	

	if(channel)
	{
		LLSD notification;
		notification["id"] = id;
		notification["message"] = chat_msg.mText;
		notification["from"] = chat_msg.mFromName;
		notification["from_id"] = chat_msg.mFromID;
		notification["time"] = chat_msg.mTime;
		notification["source"] = (S32)chat_msg.mSourceType;
		notification["chat_type"] = (S32)chat_msg.mChatType;
		notification["chat_style"] = (S32)chat_msg.mChatStyle;
		
		std::string r_color_name = "White";
		F32 r_color_alpha = 1.0f; 
		LLViewerChat::getChatColor( chat_msg, r_color_name, r_color_alpha);
		
		notification["text_color"] = r_color_name;
		notification["color_alpha"] = r_color_alpha;
		notification["font_size"] = (S32)LLViewerChat::getChatFontSize() ;
		channel->addNotification(notification);	
	}
	
}