Esempio n. 1
0
		/*virtual*/ void httpCompleted()
		{
			LLSD experiences = getContent()["experience_keys"];
			LLSD::array_const_iterator it = experiences.beginArray();
			for( /**/ ; it != experiences.endArray(); ++it)
			{
				const LLSD& row = *it;
				LLUUID public_key = row[EXPERIENCE_ID].asUUID();


				LL_DEBUGS("ExperienceCache") << "Received result for " << public_key 
					<< " display '" << row[LLExperienceCache::NAME].asString() << "'" << LL_ENDL ;

				processExperience(public_key, row);
			}

			LLSD error_ids = getContent()["error_ids"];
			LLSD::array_const_iterator errIt = error_ids.beginArray();
			for( /**/ ; errIt != error_ids.endArray() ; ++errIt )
			{
				LLUUID id = errIt->asUUID();		
				LLSD exp;
				exp[EXPIRES]=DEFAULT_EXPIRATION;
				exp[EXPERIENCE_ID] = id;
				exp[PROPERTIES]=PROPERTY_INVALID;
				exp[MISSING]=true;
                exp[QUOTA] = DEFAULT_QUOTA;

				processExperience(id, exp);
				LL_WARNS("ExperienceCache") << "LLExperienceResponder::result() error result for " << id << LL_ENDL ;
			}

			LL_DEBUGS("ExperienceCache") << sCache.size() << " cached experiences" << LL_ENDL;
		}
// static
bool LLAvatarActions::handleRemove(const LLSD& notification, const LLSD& response)
{
	S32 option = LLNotificationsUtil::getSelectedOption(notification, response);

	const LLSD& ids = notification["payload"]["ids"];
	for (LLSD::array_const_iterator itr = ids.beginArray(); itr != ids.endArray(); ++itr)
	{
		LLUUID id = itr->asUUID();
		const LLRelationship* ip = LLAvatarTracker::instance().getBuddyInfo(id);
		if (ip)
		{
			switch (option)
			{
			case 0: // YES
				if( ip->isRightGrantedTo(LLRelationship::GRANT_MODIFY_OBJECTS))
				{
					LLAvatarTracker::instance().empower(id, FALSE);
					LLAvatarTracker::instance().notifyObservers();
				}
				LLAvatarTracker::instance().terminateBuddy(id);
				LLAvatarTracker::instance().notifyObservers();
				gInventory.addChangedMask(LLInventoryObserver::LABEL | LLInventoryObserver::CALLING_CARD, LLUUID::null);
				gInventory.notifyObservers();
				break;

			case 1: // NO
			default:
				LL_INFOS() << "No removal performed." << LL_ENDL;
				break;
			}
		}
	}
	return false;
}
void LLIMMgr::loadIgnoreGroup()
{
	std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, "ignore_groups.xml");

	LLSD settings_llsd;
	llifstream file;
	file.open(filename);
	if (file.is_open())
	{
		// llinfos << "loading group chat ignore from " << filename << "..." << llendl;
		LLSDSerialize::fromXML(settings_llsd, file);

		mIgnoreGroupList.clear();

		for(LLSD::array_const_iterator iter = settings_llsd.beginArray();
		    iter != settings_llsd.endArray(); ++iter)
		{
			// llinfos << "added " << iter->asUUID()
			//         << " to group chat ignore list" << llendl;
			mIgnoreGroupList.push_back( iter->asUUID() );
		}
	}
	else
	{
		// llinfos << "can't load " << filename
		//         << " (probably it doesn't exist yet)" << llendl;
	}
}
//static
void LLFloaterReg::registerControlVariables()
{
	// Iterate through alll registered instance names and register rect and visibility control variables
	for (build_map_t::iterator iter = sBuildMap.begin(); iter != sBuildMap.end(); ++iter)
	{
		const std::string& name = iter->first;
		// <FS:Zi> Save rects even when the floater wasn't opened this session
		// if (LLFloater::getControlGroup()->controlExists(getRectControlName(name)))
		// </FS:Zi>
		if (!LLFloater::getControlGroup()->controlExists(getRectControlName(name)))
		{
			declareRectControl(name);
		}
		// <FS:Zi> Save rects even when the floater wasn't opened this session
		// if (LLFloater::getControlGroup()->controlExists(getVisibilityControlName(name)))
		// </FS:Zi>
		if (!LLFloater::getControlGroup()->controlExists(getVisibilityControlName(name)))
		{
			declareVisibilityControl(name);
		}
	}

	const LLSD& exclude_list = LLUI::sSettingGroups["config"]->getLLSD("always_showable_floaters");
	for (LLSD::array_const_iterator iter = exclude_list.beginArray();
		iter != exclude_list.endArray();
		iter++)
	{
		sAlwaysShowableList.insert(iter->asString());
	}
}
std::string LLSLURL::getSLURLString() const
{
	switch(mType)
	{
	case HOME_LOCATION:
		return SIM_LOCATION_HOME;
	case LAST_LOCATION:
		return SIM_LOCATION_LAST;
	case LOCATION:
	{
		// lookup the grid
		S32 x = llround( (F32)mPosition[VX] );
		S32 y = llround( (F32)mPosition[VY] );
		S32 z = llround( (F32)mPosition[VZ] );
		std::string ret = LLGridManager::getInstance()->getSLURLBase(mGrid);
		// <FS:CR>
		std::string region = mRegion;
		std::size_t pos;
		pos = region.find(mGrid);
		if (pos != std::string::npos)
		{
			region.erase(pos, pos + mGrid.length() + 1);
		}
		// </FS:CR>
// 				ret.append(LLURI::escape(mRegion));
// 				ret.append(llformat("/%d/%d/%d",x,y,z));
// [RLVa:KB] - Checked: 2010-04-05 (RLVa-1.2.0d) | Added: RLVa-1.2.0d
		ret.append(	( ((!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) || (!RlvUtil::isNearbyRegion(region)))
		              ? (LLURI::escape(region) + llformat("/%d/%d/%d",x,y,z)) : RlvStrings::getString(RLV_STRING_HIDDEN_REGION) ));

// [/RLVa:KB]
		LL_DEBUGS("SLURL") << "Location: " << ret << LL_ENDL;
		return ret;

	}

	case APP:
	{
		std::ostringstream app_url;
		app_url << LLGridManager::getInstance()->getAppSLURLBase() << "/" << mAppCmd;
		for(LLSD::array_const_iterator i = mAppPath.beginArray();
		        i != mAppPath.endArray();
		        i++)
		{
			app_url << "/" << i->asString();
		}
		if(mAppQuery.length() > 0)
		{
			app_url << "?" << mAppQuery;
		}
		return app_url.str();
	}
	default:
		LL_WARNS("AppInit") << "Unexpected SLURL type for SLURL string" << (int)mType << LL_ENDL;
		return std::string();
	}
}
Esempio n. 6
0
LLSavedLogins::LLSavedLogins(const LLSD& history_data)
{
	if (!history_data.isArray()) throw std::invalid_argument("Invalid history data.");
	for (LLSD::array_const_iterator i = history_data.beginArray();
		 i != history_data.endArray(); ++i)
	{
	  	// Put the last used grids first.
		if (!i->isUndefined()) mEntries.push_front(LLSavedLoginEntry(*i));
	}
}
Esempio n. 7
0
void LLExperienceCache::mapKeys( const LLSD& legacyKeys )
{
	LLSD::array_const_iterator exp = legacyKeys.beginArray();
	for(/**/ ; exp != legacyKeys.endArray() ; ++exp)
	{
		if(exp->has(LLExperienceCache::EXPERIENCE_ID) && exp->has(LLExperienceCache::PRIVATE_KEY))
		{
            privateToPublicKeyMap[(*exp)[LLExperienceCache::PRIVATE_KEY].asUUID()]=(*exp)[LLExperienceCache::EXPERIENCE_ID].asUUID();
		}
	}
}
Esempio n. 8
0
// static
LLURI LLURI::buildHTTP(const std::string& prefix,
					   const LLSD& path)
{
	LLURI result;
	
	// TODO: deal with '/' '?' '#' in host_port
	if (prefix.find("://") != prefix.npos)
	{
		// it is a prefix
		result = LLURI(prefix);
	}
	else
	{
		// it is just a host and optional port
		result.mScheme = "http";
		result.mEscapedAuthority = escapeHostAndPort(prefix);
	}

	if (path.isArray())
	{
		// break out and escape each path component
		for (LLSD::array_const_iterator it = path.beginArray();
			 it != path.endArray();
			 ++it)
		{
			lldebugs << "PATH: inserting " << it->asString() << llendl;
			result.mEscapedPath += "/" + escapePathComponent(it->asString());
		}
	}
	else if(path.isString())
	{
		result.mEscapedPath += "/" + escapePathComponent(path.asString());
	} 
	else if(path.isUndefined())
	{
	  // do nothing
	}
    else
	{
	  llwarns << "Valid path arguments to buildHTTP are array, string, or undef, you passed type" 
			  << path.type() << llendl;
	}
	result.mEscapedOpaque = "//" + result.mEscapedAuthority +
		result.mEscapedPath;
	return result;
}
Esempio n. 9
0
void LLViewerLogin::getLoginURIs(std::vector<std::string>& uris) const
{
	// return the login uri set on the command line.
	LLControlVariable* c = gSavedSettings.getControl("CmdLineLoginURI");
	if(c && !LLStartUp::shouldAutoLogin())
	{
		LLSD v = c->getValue();
		if(v.isArray())
		{
			for(LLSD::array_const_iterator itr = v.beginArray();
				itr != v.endArray(); ++itr)
			{
				std::string uri = itr->asString();
				if(!uri.empty())
				{
					uris.push_back(uri);
				}
			}
		}
		else
		{
			std::string uri = v.asString();
			if(!uri.empty())
			{
				uris.push_back(uri);
			}
		}
	}
	
	// If there was no command line uri...
	if(uris.empty())
	{
		uris.push_back(gHippoGridManager->getConnectedGrid()->getLoginUri());
		/*
		// If its a known grid choice, get the uri from the table,
		// else try the grid name.
		if(mGridChoice > GRID_INFO_NONE && mGridChoice < GRID_INFO_OTHER)
		{
			uris.push_back(gGridInfo[mGridChoice].mLoginURI);
		}
		else
		{
			uris.push_back(mGridName);
		} */
	}
}
void LLPanelGroupExperiences::setExperienceList(const LLSD& experiences)
{
	if (hasString("no_experiences"))
	{
		mExperiencesList->setNoItemsCommentText(getString("no_experiences"));
	}
    mExperiencesList->clear();

    LLSD::array_const_iterator it = experiences.beginArray();
    for ( /**/ ; it != experiences.endArray(); ++it)
    {
        LLUUID public_key = it->asUUID();
        LLExperienceItem* item = new LLExperienceItem();

        item->init(public_key);
        mExperiencesList->addItem(item, public_key);
    }
}
void LLFloaterAutoReplaceSettings::updateListNames()
{
	mListNames->deleteAllItems(); // start from scratch

	LLSD listNames = mSettings.getListNames(); // Array of Strings
   
	for ( LLSD::array_const_iterator entry = listNames.beginArray(), end = listNames.endArray();
		  entry != end;
		  ++entry
		 )
	{
		const std::string& listName = entry->asString();
		mListNames->addSimpleElement(listName);
	}

	if (!mSelectedListName.empty())
	{
		mListNames->setSelectedByValue( LLSD(mSelectedListName), true );
	}
}
Esempio n. 12
0
	virtual void uploadComplete(const LLSD& content)
	{
		// Bytecode save completed
		if (content["compiled"])
		{
			mSupplier->log("Compilation succeeded");
			llinfos << "Compiled!" << llendl;
		}
		else
		{
			LLSD compile_errors = content["errors"];
			for(LLSD::array_const_iterator line	= compile_errors.beginArray();
				line < compile_errors.endArray(); line++)
			{
				mSupplier->log(line->asString());
				llinfos << content["errors"] << llendl;
			}
		}
		LLUpdateTaskInventoryResponder::uploadComplete(content);
	}
Esempio n. 13
0
	virtual void uploadComplete(const LLSD& content)
	{
		// Bytecode save completed
		if (content["compiled"])
		{
			mSupplier->log("Compilation succeeded");
			LL_INFOS() << "Compiled!" << LL_ENDL;
		}
		else
		{
			LLSD compile_errors = content["errors"];
			for(LLSD::array_const_iterator line	= compile_errors.beginArray();
				line < compile_errors.endArray(); line++)
			{
				std::string str = line->asString();
				str.erase(std::remove(str.begin(), str.end(), '\n'), str.end());
				mSupplier->log(str);
				LL_INFOS() << content["errors"] << LL_ENDL;
			}
		}
		LLUpdateTaskInventoryResponder::uploadComplete(content);
	}
Esempio n. 14
0
std::string LLSLURL::getSLURLString() const
{
    switch(mType)
    {
    case HOME_LOCATION:
        return SIM_LOCATION_HOME;
    case LAST_LOCATION:
        return SIM_LOCATION_LAST;
    case LOCATION:
    {
        // lookup the grid
        S32 x = llround( (F32)mPosition[VX] );
        S32 y = llround( (F32)mPosition[VY] );
        S32 z = llround( (F32)mPosition[VZ] );
        return LLGridManager::getInstance()->getSLURLBase(mGrid) +
               LLURI::escape(mRegion) + llformat("/%d/%d/%d",x,y,z);
    }
    case APP:
    {
        std::ostringstream app_url;
        app_url << LLGridManager::getInstance()->getAppSLURLBase() << "/" << mAppCmd;
        for(LLSD::array_const_iterator i = mAppPath.beginArray();
                i != mAppPath.endArray();
                i++)
        {
            app_url << "/" << i->asString();
        }
        if(mAppQuery.length() > 0)
        {
            app_url << "?" << mAppQuery;
        }
        return app_url.str();
    }
    default:
        LL_WARNS("AppInit") << "Unexpected SLURL type for SLURL string" << (int)mType << LL_ENDL;
        return std::string();
    }
}
// static
LLURI LLURI::buildHTTP(const std::string& prefix,
                       const LLSD& path)
{
    LLURI result;

    // TODO: deal with '/' '?' '#' in host_port
    if (prefix.find("://") != prefix.npos)
    {
        // it is a prefix
        result = LLURI(prefix);
    }
    else
    {
        // it is just a host and optional port
        result.mScheme = "http";
        result.mEscapedAuthority = escapeHostAndPort(prefix);
    }

    if (path.isArray())
    {
        // break out and escape each path component
        for (LLSD::array_const_iterator it = path.beginArray();
                it != path.endArray();
                ++it)
        {
            LL_DEBUGS() << "PATH: inserting " << it->asString() << LL_ENDL;
            result.mEscapedPath += "/" + escapePathComponent(it->asString());
        }
    }
    else if (path.isString())
    {
        std::string pathstr(path);
        // Trailing slash is significant in HTTP land. If caller specified,
        // make a point of preserving.
        std::string last_slash;
        std::string::size_type len(pathstr.length());
        if (len && pathstr[len-1] == '/')
        {
            last_slash = "/";
        }

        // Escape every individual path component, recombining with slashes.
        for (boost::split_iterator<std::string::const_iterator>
                ti(pathstr, boost::first_finder("/")), tend;
                ti != tend; ++ti)
        {
            // Eliminate a leading slash or duplicate slashes anywhere. (Extra
            // slashes show up here as empty components.) This test also
            // eliminates a trailing slash, hence last_slash above.
            if (! ti->empty())
            {
                result.mEscapedPath
                += "/" + escapePathComponent(std::string(ti->begin(), ti->end()));
            }
        }

        // Reinstate trailing slash, if any.
        result.mEscapedPath += last_slash;
    }
    else if(path.isUndefined())
    {
        // do nothing
    }
    else
    {
        LL_WARNS() << "Valid path arguments to buildHTTP are array, string, or undef, you passed type"
                   << path.type() << LL_ENDL;
    }
    result.mEscapedOpaque = "//" + result.mEscapedAuthority +
                            result.mEscapedPath;
    return result;
}