コード例 #1
0
ファイル: room.cpp プロジェクト: ajalkane/rvhouse
void 
room::generate_id() {
    // Generate an id for the created room... just use the id of the
    // owner and timestamp to generate a reasonably unique ID
    std::ostringstream room_id;
    room_id << time(NULL) << ":" << owner_id().id_str();
    ACE_DEBUG((LM_DEBUG, "chat_gaming::room: generated id: %s\n",
              room_id.str().c_str()));

    super::id(room_id.str());
}
コード例 #2
0
ファイル: llinventory.cpp プロジェクト: AlexRa/Kirstens-clone
void LLInventoryItem::unpackBinaryBucket(U8* bin_bucket, S32 bin_bucket_size)
{	
	// Early exit on an empty binary bucket.
	if (bin_bucket_size <= 1) return;

	// Convert the bin_bucket into a string.
	char* item_buffer = new char[bin_bucket_size+1];
	if ((item_buffer != NULL) && (bin_bucket != NULL))
	{
		memcpy(item_buffer, bin_bucket, bin_bucket_size);	/* Flawfinder: ignore */
	}
	else
	{
		llerrs << "unpackBinaryBucket failed. item_buffer or bin_bucket is Null." << llendl;
		delete[] item_buffer;
		return;
	}
	item_buffer[bin_bucket_size] = '\0';
	std::string str(item_buffer);

	lldebugs << "item buffer: " << item_buffer << llendl;
	delete[] item_buffer;

	// Tokenize the string.
	typedef boost::tokenizer<boost::char_separator<char> > tokenizer;
	boost::char_separator<char> sep("|", "", boost::keep_empty_tokens);
	tokenizer tokens(str, sep);
	tokenizer::iterator iter = tokens.begin();

	// Extract all values.
	LLUUID item_id;
	item_id.generate();
	setUUID(item_id);

	LLAssetType::EType type;
	type = (LLAssetType::EType)(atoi((*(iter++)).c_str()));
	setType( type );
	
	LLInventoryType::EType inv_type;
	inv_type = (LLInventoryType::EType)(atoi((*(iter++)).c_str()));
	setInventoryType( inv_type );

	std::string name((*(iter++)).c_str());
	rename( name );
	
	LLUUID creator_id((*(iter++)).c_str());
	LLUUID owner_id((*(iter++)).c_str());
	LLUUID last_owner_id((*(iter++)).c_str());
	LLUUID group_id((*(iter++)).c_str());
	PermissionMask mask_base = strtoul((*(iter++)).c_str(), NULL, 16);
	PermissionMask mask_owner = strtoul((*(iter++)).c_str(), NULL, 16);
	PermissionMask mask_group = strtoul((*(iter++)).c_str(), NULL, 16);
	PermissionMask mask_every = strtoul((*(iter++)).c_str(), NULL, 16);
	PermissionMask mask_next = strtoul((*(iter++)).c_str(), NULL, 16);
	LLPermissions perm;
	perm.init(creator_id, owner_id, last_owner_id, group_id);
	perm.initMasks(mask_base, mask_owner, mask_group, mask_every, mask_next);
	setPermissions(perm);
	//lldebugs << "perm: " << perm << llendl;

	LLUUID asset_id((*(iter++)).c_str());
	setAssetUUID(asset_id);

	std::string desc((*(iter++)).c_str());
	setDescription(desc);
	
	LLSaleInfo::EForSale sale_type;
	sale_type = (LLSaleInfo::EForSale)(atoi((*(iter++)).c_str()));
	S32 price = atoi((*(iter++)).c_str());
	LLSaleInfo sale_info(sale_type, price);
	setSaleInfo(sale_info);
	
	U32 flags = strtoul((*(iter++)).c_str(), NULL, 16);
	setFlags(flags);

	time_t now = time(NULL);
	setCreationDate(now);
}
コード例 #3
0
void LLInventoryItem::unpackBinaryBucket(U8* bin_bucket, S32 bin_bucket_size)
{	
	// Early exit on an empty binary bucket.
	if (bin_bucket_size <= 1) return;

	if (NULL == bin_bucket)
	{
		LL_ERRS() << "unpackBinaryBucket failed.  bin_bucket is NULL." << LL_ENDL;
		return;
	}

	// Convert the bin_bucket into a string.
	std::vector<char> item_buffer(bin_bucket_size+1);
	memcpy(&item_buffer[0], bin_bucket, bin_bucket_size);	/* Flawfinder: ignore */
	item_buffer[bin_bucket_size] = '\0';
	std::string str(&item_buffer[0]);

	LL_DEBUGS() << "item buffer: " << str << LL_ENDL;

	// Tokenize the string.
	typedef boost::tokenizer<boost::char_separator<char> > tokenizer;
	boost::char_separator<char> sep("|", "", boost::keep_empty_tokens);
	tokenizer tokens(str, sep);
	tokenizer::iterator iter = tokens.begin();

	// Extract all values.
	LLUUID item_id;
	item_id.generate();
	setUUID(item_id);

	LLAssetType::EType type;
	type = static_cast<LLAssetType::EType>(std::stoi((*(iter++))));
	setType( type );
	
	LLInventoryType::EType inv_type;
	inv_type = static_cast<LLInventoryType::EType>(std::stoi((*(iter++))));
	setInventoryType( inv_type );

	std::string name((*(iter++)).c_str());
	rename( name );
	
	LLUUID creator_id((*(iter++)).c_str());
	LLUUID owner_id((*(iter++)).c_str());
	LLUUID last_owner_id((*(iter++)).c_str());
	LLUUID group_id((*(iter++)).c_str());
	PermissionMask mask_base = strtoul((*(iter++)).c_str(), NULL, 16);
	PermissionMask mask_owner = strtoul((*(iter++)).c_str(), NULL, 16);
	PermissionMask mask_group = strtoul((*(iter++)).c_str(), NULL, 16);
	PermissionMask mask_every = strtoul((*(iter++)).c_str(), NULL, 16);
	PermissionMask mask_next = strtoul((*(iter++)).c_str(), NULL, 16);
	LLPermissions perm;
	perm.init(creator_id, owner_id, last_owner_id, group_id);
	perm.initMasks(mask_base, mask_owner, mask_group, mask_every, mask_next);
	setPermissions(perm);
	//LL_DEBUGS() << "perm: " << perm << LL_ENDL;

	LLUUID asset_id((*(iter++)).c_str());
	setAssetUUID(asset_id);

	std::string desc((*(iter++)).c_str());
	setDescription(desc);
	
	LLSaleInfo::EForSale sale_type;
	sale_type = static_cast<LLSaleInfo::EForSale>(std::stoi((*(iter++))));
	S32 price = std::stoi(*(iter++));
	LLSaleInfo sale_info(sale_type, price);
	setSaleInfo(sale_info);
	
	U32 flags = strtoul((*(iter++)).c_str(), NULL, 16);
	setFlags(flags);

	time_t now = time(NULL);
	setCreationDate(now);
}
コード例 #4
0
//LLScrollListCtrl::getSelectedIDs();
void JCFloaterAnimList::refresh()
{
	LLDynamicArray<LLUUID> selected = mAnimList->getSelectedIDs();
	S32 scrollpos = mAnimList->getScrollPos();
	mAnimList->deleteAllItems();
	LLVOAvatar* avatarp = gAgent.getAvatarObject();		
	if (avatarp)
	{
		LLVOAvatar::AnimSourceIterator ai;

		for(ai = avatarp->mAnimationSources.begin(); ai != avatarp->mAnimationSources.end(); ++ai)
		{
			LLSD element;
			const LLUUID &aifirst = ai->first;
			LLViewerInventoryItem* item = gInventory.getItem(findItemID(ai->second,0));

			// *NOTE: conceal id to prevent bugs, use
			// item->getColumn(LIST_ANIMATION_UUID)->getValue().asUUID()
			// instead
			element["id"] = LLUUID::null.combine(ai->second);
			element["columns"][LIST_ANIMATION_NAME]["column"] = "Anim Name";
			element["columns"][LIST_ANIMATION_NAME]["type"] = "text";
			element["columns"][LIST_ANIMATION_NAME]["color"] = gColors.getColor("DefaultListText").getValue();
			if(item)
			{
				element["columns"][LIST_ANIMATION_NAME]["value"] = item->getName();//ai->second//"avatar_icon";
			}else
			{
				element["columns"][LIST_ANIMATION_NAME]["value"] = "Not in Inventory";
			}
			element["columns"][LIST_ANIMATION_UUID]["column"] = "Animation UUID";
			element["columns"][LIST_ANIMATION_UUID]["type"] = "text";
			element["columns"][LIST_ANIMATION_UUID]["color"] = gColors.getColor("DefaultListText").getValue();
			element["columns"][LIST_ANIMATION_UUID]["value"] = ai->second;
			element["columns"][LIST_OBJECT_UUID]["column"] = "Source Object UUID";
			element["columns"][LIST_OBJECT_UUID]["type"] = "text";
			element["columns"][LIST_OBJECT_UUID]["color"] = gColors.getColor("DefaultListText").getValue();
			element["columns"][LIST_OBJECT_UUID]["value"] = aifirst;
			element["columns"][LIST_OBJECT_OWNER]["column"] = "Source Owner";
			element["columns"][LIST_OBJECT_OWNER]["type"] = "text";
			element["columns"][LIST_OBJECT_OWNER]["color"] = gColors.getColor("DefaultListText").getValue();
			std::string name("?");
			LLViewerObject *object = gObjectList.findObject(aifirst);
			bool is_first = ( mObjectOwners.count( aifirst ) == 0 );
			bool just_shown = false;
			LLUUID owner_id(LLUUID::null);

			if( !is_first )
			{
				name = mObjectOwners[aifirst].owner_name;
				owner_id = mObjectOwners[aifirst].owner_id;
			}

			if( object )
			{
				if( object->permYouOwner() )
				{
					owner_id = gAgent.getID();
					gAgent.getName(name);
				}
				else
				{
					object = (LLViewerObject *) object->getRoot();
					if( object->isAvatar() )
					{
						owner_id = object->getID();
						name = ((LLVOAvatar *)object)->getFullname();
					}
				}
			}

			{
				AObjectData &data = mObjectOwners[aifirst];
				if( object )
				{
					if( !data.in_object_list )
					{
						just_shown = true;
						data.in_object_list = true;
					}
					data.root_id = ( (LLViewerObject*)object->getRoot() )->getID();
				}
				data.owner_name = name;
				data.owner_id = owner_id;
			}

			if( is_first || just_shown ) {
				if( name == "?" && !aifirst.isNull()) {
					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 );
					if( object )
					{
						LL_INFOS("Avatar List") << "Sending RequestObjectPropertiesFamily packet for id( " << aifirst.asString() << " ) on object( " << object->getID().asString() << " )" << LL_ENDL;
						msg->addUUIDFast(_PREHASH_ObjectID, object->getID());
					}
					else
					{
						LL_INFOS("Avatar List") << "Sending RequestObjectPropertiesFamily packet for id( " << aifirst.asString() << " )" << LL_ENDL;
						msg->addUUIDFast(_PREHASH_ObjectID, aifirst);
					}
					gAgent.sendReliableMessage();
				}
			}
			element["columns"][LIST_OBJECT_OWNER]["value"] = name;
			mAnimList->addElement(element, ADD_BOTTOM);
			//LLViewerObject* objectp = gObjectList.findObject(ai->first);
			//if(objectp)
			//{
			//	//objectp->
			//}

			//object_ids.insert(ai->first);
			//animation_ids.insert(ai->second);
		}
	}

	mAnimList->sortItems();
	mAnimList->selectMultiple(selected);
	mAnimList->setScrollPos(scrollpos);
}