Adds user agent.
@param userAgent host name
558494
public void addUserAgent(String userAgent) {
    if (userAgent.equals("*")) {
      anyAgent = true;
    } else {
      this.userAgents.add(userAgent);
    }
  }
1012395
public function setUserAgent($userAgent)
    {
        if (isset(self::$predefinedUserAgents[$userAgent])) {
            $this->addOption(CURLOPT_USERAGENT, self::$predefinedUserAgents[$userAgent]);
        } else {
            $this->addOption(CURLOPT_USERAGENT, $userAgent);
        }
    }
120527
public function setDefaultUserAgent()
    {
        $user_agent = 'PHP-Curl-Class/' . self::VERSION . ' (+https://github.com/php-curl-class/php-curl-class)';
        $user_agent .= ' PHP/' . PHP_VERSION;
        $curl_version = curl_version();
        $user_agent .= ' curl/' . $curl_version['version'];
        $this->setUserAgent($user_agent);
    }
459005
public void addUser(User user){
		this.users.add(user);
		this.fireTableRowsInserted(this.users.size()-1, this.users.size()-1);
	}
1276018
@Override
    public void loadAgent(String agent, String options)
        throws AgentLoadException, AgentInitializationException, IOException
    {
        String args = agent;
        if (options != null) {
            args = args + "=" + options;
        }
        try {
            loadAgentLibrary("instrument", args);
        } catch (AgentLoadException x) {
            throw new InternalError("instrument library is missing in target VM");
        } catch (AgentInitializationException x) {
            /*
             * Translate interesting errors into the right exception and
             * message (FIXME: create a better interface to the instrument
             * implementation so this isn't necessary)
             */
            int rc = x.returnValue();
            switch (rc) {
                case JNI_ENOMEM:
                    throw new AgentLoadException("Insuffient memory");
                case ATTACH_ERROR_BADJAR:
                    throw new AgentLoadException("Agent JAR not found or no Agent-Class attribute");
                case ATTACH_ERROR_NOTONCP:
                    throw new AgentLoadException("Unable to add JAR file to system class path");
                case ATTACH_ERROR_STARTFAIL:
                    throw new AgentInitializationException("Agent JAR loaded but agent failed to initialize");
                default :
                    throw new AgentLoadException("Failed to load agent - unknown reason: " + rc);
            }
        }
    }
1172746
public void addActiveParticipant(String userId)
	{
		addActiveParticipant(
				userId, 
				null, 
				null, 
				false, 
				null, 
				null);
	}
911379
private void addAgents() throws ShanksException {
        for (Entry<String, ShanksAgent> agentEntry : this.agents.entrySet()) {
            stoppables.put(agentEntry.getKey(), schedule.scheduleRepeating(Schedule.EPOCH, 2, agentEntry.getValue(), 1));
        }
    }
746047
public void addOwner(String owner) {
        if (this.owners == null) {
            this.owners = new Hashtable<String, String>();
        }
        this.owners.put(owner, owner);
    }
290656
public void setUsers(Set<PrincipalUser> users) {
        SystemAssert.requireArgument(users != null && !users.isEmpty(), "Users associated with a namespace cannot be null or empty.");
        this.users.clear();
        if (users != null && !users.isEmpty()) {
            this.users.addAll(users);
        }
    }
830944
@Override
    public boolean add(RepositoryConnection repoConnection) {
        boolean ret = super.add(repoConnection);
        if (repoConnection instanceof RestRepositoryConnection) {
            ((RestRepositoryConnection) repoConnection).setUserAgent(_userAgent);
        }
        return ret;
    }
497937
function formatUserAgent(userAgent) {
	var formattedUserAgent = userAgent.toLowerCase();

	// Strip the version number from robot/1.0 user agents
	var idx = formattedUserAgent.indexOf('/');
	if (idx > -1) {
		formattedUserAgent = formattedUserAgent.substr(0, idx);
	}

	return formattedUserAgent.trim();
}
1328451
public function BD_CheckBotAgentAdvanced($UserAgent = false)
    {
        if ($UserAgent === false)
        {
                $UserAgent = trim(\Environment::get('httpUserAgent'));
        }
        return \BugBuster\BotDetection\CheckBotAgentExtended::checkAgentName( $UserAgent );
    }
529968
def add_agent(self, agent):
        """"""
        agent_id = self.add_node(agent.name)
        self.add_typing(agent_id, 'agent')
        # Handle bound conditions
        for bc in agent.bound_conditions:
            # Here we make the assumption that the binding site
            # is simply named after the binding partner
            if bc.is_bound:
                test_type = 'is_bnd'
            else:
                test_type = 'is_free'
            bound_name = bc.agent.name
            agent_bs = get_binding_site_name(bc.agent)
            test_name = '%s_bound_to_%s_test' % (agent_id, bound_name)
            agent_bs_id = self.add_node(agent_bs)
            test_id = self.add_node(test_name)
            self.add_edge(agent_bs_id, agent_id)
            self.add_edge(agent_bs_id, test_id)
            self.add_typing(agent_bs_id, 'locus')
            self.add_typing(test_id, test_type)

        for mod in agent.mods:
            mod_site_str = abbrevs[mod.mod_type]
            if mod.residue is not None:
                mod_site_str = mod.residue
            mod_pos_str = mod.position if mod.position is not None else ''
            mod_site = ('%s%s' % (mod_site_str, mod_pos_str))
            site_states = states[mod.mod_type]
            if mod.is_modified:
                val = site_states[1]
            else:
                val = site_states[0]
            mod_site_id = self.add_node(mod_site, {'val': val})
            self.add_edge(mod_site_id, agent_id)
            self.add_typing(mod_site_id, 'state')
        return agent_id
483549
def set_user_agent(self, user_agent):
        """"""
        # set a default user_agent if not specified
        if user_agent is None:
            requests_ua = requests.utils.default_user_agent()
            user_agent = '%s (%s/%s)' % (requests_ua, __title__, __version__)

        # the requests module uses a case-insensitive dict for session headers
        self.session.headers['User-agent'] = user_agent
718095
public function setUserAgent($agentString = '')
    {
        if (!is_string($agentString) || trim($agentString) == '') {
            //https://bugs.php.net/bug.php?id=49184
            if (filter_has_var(INPUT_SERVER, 'HTTP_USER_AGENT')) {
                $agentString = filter_input(INPUT_SERVER, 'HTTP_USER_AGENT', FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_LOW);
            } else if (array_key_exists('HTTP_USER_AGENT', $_SERVER) && is_string($_SERVER['HTTP_USER_AGENT'])) {
                $agentString = filter_var($_SERVER['HTTP_USER_AGENT'], FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_LOW);
            } else {
                $agentString = '';
            }

            if ($agentString === false || $agentString === NULL) {
                //filter_input or filter_var failed
                $agentString = '';
            }
        }

        $this->reset();
        $this->_agent = $agentString;
        $this->detect();
    }
659988
public function setUserAgent($userAgent = null)
    {
        if (!empty($userAgent)) {
            $this->userAgent = $userAgent;
        } else {
            $this->userAgent = $this->getHttpHeader('User-Agent');

            if (empty($this->userAgent)) {
                $this->userAgent = $this->getHttpHeader('X-Device-User-Agent');
            }

            //Header can occur on devices using Opera Mini (can expose the real device type).
            //Let's concatenate it (we need this extra info in the regexes).
            if ($operaMiniUa = $this->getHttpHeader('X-OperaMini-Phone-UA')) {
                $this->userAgent .= ' ' . $operaMiniUa;
            }
        }
    }
1326062
private static HeaderProvider buildHeaderProvider(String userAgent){
    return FixedHeaderProvider.create(USER_AGENT_KEY.name(), VENEER_ADAPTER + userAgent);
  }