当前位置: 首页>>代码示例>>C++>>正文


C++ GetUser函数代码示例

本文整理汇总了C++中GetUser函数的典型用法代码示例。如果您正苦于以下问题:C++ GetUser函数的具体用法?C++ GetUser怎么用?C++ GetUser使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了GetUser函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: GetFixColoursPalette

void Battle::FixColours()
{
    if ( !IsFounderMe() )return;
    std::vector<wxColour> &palette = GetFixColoursPalette( m_teams_sizes.size() + 1 );
    std::vector<int> palette_use( palette.size(), 0 );

    wxColour my_col = GetMe().BattleStatus().colour; // Never changes color of founder (me) :-)
    int my_diff = 0;
    int my_col_i = GetClosestFixColour( my_col, palette_use,my_diff );
    palette_use[my_col_i]++;
    std::set<int> parsed_teams;

    for ( user_map_t::size_type i = 0; i < GetNumUsers(); i++ )
    {
        User &user=GetUser(i);
        if ( &user == &GetMe() ) continue; // skip founder ( yourself )
        UserBattleStatus& status = user.BattleStatus();
        if ( status.spectator ) continue;
        if ( parsed_teams.find( status.team ) != parsed_teams.end() ) continue; // skip duplicates
        parsed_teams.insert( status.team );

        wxColour &user_col=status.colour;
        int user_col_i=GetClosestFixColour(user_col,palette_use, 60);
        palette_use[user_col_i]++;
				for ( user_map_t::size_type j = 0; j < GetNumUsers(); j++ )
				{
					User &usr=GetUser(j);
					if ( usr.BattleStatus().team == status.team )
					{
						 ForceColour( usr, palette[user_col_i]);
					}
				}
    }
}
开发者ID:tvo,项目名称:springlobby,代码行数:34,代码来源:battle.cpp

示例2: GetUser

bool
PeerIdentity::Equals(const nsAString& aOtherString) const
{
  nsString user;
  GetUser(mPeerIdentity, user);
  nsString otherUser;
  GetUser(aOtherString, otherUser);
  if (user != otherUser) {
    return false;
  }

  nsString host;
  GetHost(mPeerIdentity, host);
  nsString otherHost;
  GetHost(aOtherString, otherHost);

  nsresult rv;
  nsCOMPtr<nsIIDNService> idnService
    = do_GetService("@mozilla.org/network/idn-service;1", &rv);
  if (NS_WARN_IF(NS_FAILED(rv))) {
    return host == otherHost;
  }

  nsCString normHost;
  GetNormalizedHost(idnService, host, normHost);
  nsCString normOtherHost;
  GetNormalizedHost(idnService, otherHost, normOtherHost);
  return normHost == normOtherHost;
}
开发者ID:MichaelKohler,项目名称:gecko-dev,代码行数:29,代码来源:PeerIdentity.cpp

示例3: IsOnlineModNick

    bool IsOnlineModNick(const CString& sNick) {
        const CString& sPrefix = GetUser()->GetStatusPrefix();
        if (!sNick.StartsWith(sPrefix)) return false;

        CString sModNick = sNick.substr(sPrefix.length());
        if (sModNick.Equals("status") ||
            GetNetwork()->GetModules().FindModule(sModNick) ||
            GetUser()->GetModules().FindModule(sModNick) ||
            CZNC::Get().GetModules().FindModule(sModNick))
            return true;
        return false;
    }
开发者ID:GLolol,项目名称:znc,代码行数:12,代码来源:modules_online.cpp

示例4: OnModuleLoading

	virtual EModRet OnModuleLoading(const CString& sModName, const CString& sArgs,
			bool& bSuccess, CString& sRetMsg) {
		if (!GetUser()) {
			return CONTINUE;
		}
		PyObject* pyFunc = PyObject_GetAttrString(m_PyZNCModule, "load_module");
		if (!pyFunc) {
			sRetMsg = GetPyExceptionStr();
			DEBUG("modpython: " << sRetMsg);
			bSuccess = false;
			return HALT;
		}
		PyObject* pyRes = PyObject_CallFunction(pyFunc, const_cast<char*>("ssNNN"),
				sModName.c_str(),
				sArgs.c_str(),
				SWIG_NewInstanceObj(GetUser(), SWIG_TypeQuery("CUser*"), 0),
				CPyRetString::wrap(sRetMsg),
				SWIG_NewInstanceObj(reinterpret_cast<CGlobalModule*>(this), SWIG_TypeQuery("CGlobalModule*"), 0));
		if (!pyRes) {
			sRetMsg = GetPyExceptionStr();
			DEBUG("modpython: " << sRetMsg);
			bSuccess = false;
			Py_CLEAR(pyFunc);
			return HALT;
		}
		Py_CLEAR(pyFunc);
		long int ret = PyLong_AsLong(pyRes);
		if (PyErr_Occurred()) {
			sRetMsg = GetPyExceptionStr();
			DEBUG("modpython: " << sRetMsg);
			Py_CLEAR(pyRes);
			return HALT;
		}
		Py_CLEAR(pyRes);
		switch (ret) {
			case 0:
				// Not found
				return CONTINUE;
			case 1:
				// Error
				bSuccess = false;
				return HALT;
			case 2:
				// Success
				bSuccess = true;
				return HALT;
		}
		bSuccess = false;
		sRetMsg += " unknown value returned by modperl.load_module";
		return HALT;
	}
开发者ID:ZachBeta,项目名称:znc,代码行数:51,代码来源:modpython.cpp

示例5: FixTeamIDs

void Battle::StartHostedBattle()
{
	if ( UserExists( GetMe().GetNick() ) )
	{
		if ( IsFounderMe() )
		{
			if ( sett().GetBattleLastAutoControlState() )
			{
				FixTeamIDs( (IBattle::BalanceType)sett().GetFixIDMethod(), sett().GetFixIDClans(), sett().GetFixIDStrongClans(), sett().GetFixIDGrouping() );
				Autobalance( (IBattle::BalanceType)sett().GetBalanceMethod(), sett().GetBalanceClans(), sett().GetBalanceStrongClans(), sett().GetBalanceGrouping() );
				FixColours();
			}
			if ( IsProxy() )
			{
				if ( UserExists( GetProxy()) && !GetUser(GetProxy()).Status().in_game )
				{
					// DON'T set m_generating_script here, it will trick the script generating code to think we're the host
					wxString hostscript = spring().WriteScriptTxt( *this );
					try
					{
						wxString path = TowxString(SlPaths::GetDataDir()) + _T("relayhost_script.txt");
						if ( !wxFile::Access( path, wxFile::write ) ) {
								wxLogError( _T("Access denied to script.txt.") );
						}

						wxFile f( path, wxFile::write );
						f.Write( hostscript );
						f.Close();

					} catch (...) {}
					m_serv.SendScriptToProxy( hostscript );
				}
			}
			if( GetAutoLockOnStart() )
			{
				SetIsLocked( true );
				SendHostInfo( IBattle::HI_Locked );
			}
			sett().SetLastHostMap(TowxString(GetServer().GetCurrentBattle()->GetHostMapName()));
			sett().SaveSettings();
			if ( !IsProxy() ) GetServer().StartHostedBattle();
			else if ( UserExists( GetProxy() ) && GetUser(GetProxy()).Status().in_game ) // relayhost is already ingame, let's try to join it
			{
				StartSpring();
			}
		}
	}
}
开发者ID:renemilk,项目名称:springlobby,代码行数:48,代码来源:battle.cpp

示例6: FormatHost

wxString CServer::FormatServer(const bool always_include_prefix /*=false*/) const
{
	wxString server = FormatHost();

	if (m_logonType != ANONYMOUS)
		server = GetUser() + _T("@") + server;

	switch (m_protocol)
	{
	default:
		{
			wxString prefix = GetPrefixFromProtocol(m_protocol);
			if (prefix != _T(""))
				server = prefix + _T("://") + server;
			else if (always_include_prefix)
				server = prefix + _T("://") + server;
		}
		break;
	case FTP:
		if (always_include_prefix ||
			(GetProtocolFromPort(m_port) != FTP && GetProtocolFromPort(m_port) != UNKNOWN))
			server = _T("ftp://") + server;
		break;
	}

	return server;
}
开发者ID:idgaf,项目名称:FileZilla3,代码行数:27,代码来源:server.cpp

示例7: Cloak

	void Cloak() {
		if (m_bCloaked)
			return;

		PutModule("Cloak: Trying to cloak your hostname, setting +x...");
		PutIRC("MODE " + GetUser()->GetIRCSock()->GetNick() + " +x");
	}
开发者ID:ZachBeta,项目名称:znc,代码行数:7,代码来源:q.cpp

示例8: OnLoad

	virtual bool OnLoad(const CString& sArgs, CString& sMessage) {
		if (!sArgs.empty()) {
			SetUsername(sArgs.Token(0));
			SetPassword(sArgs.Token(1));
		} else {
			m_sUsername = GetNV("Username");
			m_sPassword = GetNV("Password");
		}

		CString sTmp;
		m_bUseCloakedHost = (sTmp = GetNV("UseCloakedHost")).empty() ? true : sTmp.ToBool();
		m_bUseChallenge   = (sTmp = GetNV("UseChallenge")).empty()  ? true : sTmp.ToBool();
		m_bRequestPerms   = GetNV("RequestPerms").ToBool();

		OnIRCDisconnected(); // reset module's state

		if (IsIRCConnected()) {
			// check for usermode +x if we are already connected
			set<unsigned char> scUserModes = GetUser()->GetIRCSock()->GetUserModes();
			if (scUserModes.find('x') != scUserModes.end())
				m_bCloaked = true;

			OnIRCConnected();
		}

		return true;
	}
开发者ID:ZachBeta,项目名称:znc,代码行数:27,代码来源:q.cpp

示例9: GetUser

// 检测离线车辆
bool CVechileMgr::CheckOfflineUser( void )
{
	list<_stVechile*> lst ;
	int nsize = GetUser( lst, OFF_LINE ) ;
	if ( nsize == 0 ) {
		return false ;
	}

	time_t now = share::Util::currentTimeUsec() ;

	list<_stVechile*>::iterator it ;

	for ( it = lst.begin(); it != lst.end(); ++ it ) {
		// 简单遍历算法
		_stVechile *temp = *it ;
		if ( now - temp->last_conn_ < MAX_USECOND ){
			continue ;
		}
		temp->last_conn_ = now ;
		// 如果登陆不服务器就直接返回了
		if ( ! LoginServer( temp ) ) {
			return false ;
		}
	}
	return true ;
}
开发者ID:caocf,项目名称:workspace-kepler,代码行数:27,代码来源:vechilemgr.cpp

示例10: OnLoad

	virtual bool OnLoad(const CString& sArgs, CString& sErrorMsg) {
		user = GetUser();
		HighScore = sArgs.Token(0).ToInt();
		PutModule("HighScore: "+CString(HighScore));
		lastturn = false;
		return true;
	}
开发者ID:ravomavain,项目名称:uselessness,代码行数:7,代码来源:znc-dice.cpp

示例11: SSLSRPServerParamCallback

static int SSLSRPServerParamCallback(SSL *s, int *ad, void *arg)
{
	const char* userName = SSL_get_srp_username(s);

	LOG(INFO) << "User " << userName;

	const User* user = GetUser(userName);

	if (!user)
	{
		LOG(ERROR) << "User " << userName << " doesn't exist";
		*ad = SSL_AD_UNKNOWN_PSK_IDENTITY;
		return SSL3_AL_FATAL;
	}

	SRP_gN *GN = SRP_get_default_gN(FLAGS_srp_default_gN.c_str());
	if(GN == NULL)
	{
		*ad = SSL_AD_INTERNAL_ERROR;
        return SSL3_AL_FATAL;
	}

    if (!SSL_set_srp_server_param(s, GN->N, GN->g, user->GetSalt(), user->GetVerifier(), NULL))
    {
        *ad = SSL_AD_INTERNAL_ERROR;
        return SSL3_AL_FATAL;
    }

	return SSL_ERROR_NONE;
}
开发者ID:barsnadcat,项目名称:steelandconcrete,代码行数:30,代码来源:ConnectionManager.cpp

示例12: OnUserNotice

	EModRet OnUserNotice(CString& sTarget, CString& sMessage) override {
		sTarget.TrimPrefix(NickPrefix());

		if (sMessage.TrimPrefix("``")) {
			return CONTINUE;
		}

		MCString::iterator it = FindNV(sTarget.AsLower());

		if (it != EndNV()) {
			CChan* pChan = GetNetwork()->FindChan(sTarget);
			CString sNickMask = GetNetwork()->GetIRCNick().GetNickMask();
			if (pChan) {
				if (!pChan->AutoClearChanBuffer())
					pChan->AddBuffer(":" + NickPrefix() + _NAMEDFMT(sNickMask) + " NOTICE " + _NAMEDFMT(sTarget) + " :{text}", sMessage);
				GetUser()->PutUser(":" + NickPrefix() + sNickMask + " NOTICE " + sTarget + " :" + sMessage, NULL, GetClient());
			}

			CString sMsg = MakeIvec() + sMessage;
			sMsg.Encrypt(it->second);
			sMsg.Base64Encode();
			sMsg = "+OK *" + sMsg;

			PutIRC("NOTICE " + sTarget + " :" + sMsg);
			return HALTCORE;
		}

		return CONTINUE;
	}
开发者ID:jpnurmi,项目名称:znc,代码行数:29,代码来源:crypt.cpp

示例13: GetUser

// Get users list with info.
void meth::GetOnlineUsers(LogicalConnections::iterator conn, String &response) {
	OnlineUsersList online_users = ::GetOnlineUsers();
	bool first_user = true;
	User user;

	response = "[";
	for (OnlineUsersList::iterator online_user = online_users.begin(); online_user != online_users.end(); online_user++) {
		// Add comma before each user except first.
		if (!first_user) {
			response += ",";
		} else {
			first_user = false;
		}
		response += "{";

		user = GetUser(online_user->user_ref);
		AddPair(response, "name", user.name, true, true);
		AddPair(response, "sex", (int) user.sex, false, true);
		AddPair(response, "ip", (user.hidden_ip) ? String("N/A") : user.ip, true, true);
		AddPair(response, "state", online_user->state, true, false);
		response += "}";
	}

	response += "]";
}
开发者ID:PaulAnnekov,项目名称:commfort-webchat,代码行数:26,代码来源:methods.cpp

示例14: GetUser

bool BFCPFloorControlServer::SetChair(int userId)
{
	if (this->ending) { return false; }

	BFCPUser* user = GetUser(userId);

	if (! user) {
		::Error("BFCPFloorControlServer::SetChair() | user '%d' does not exist\n", userId);
		return false;
	}

	//As we are setting also the chair, lock for writting
	users.WaitUnusedAndLock();

	// Unset the current chair.
	for (BFCPFloorControlServer::Users::iterator it=this->users.begin(); it!=this->users.end(); ++it) {
		BFCPUser* otherUser = it->second;
		otherUser->UnsetChair();
	}

	::Log("BFCPFloorControlServer::SetChair() | user '%d' becomes chair\n", userId);
	user->SetChair();

	//Unlock after chair is set
	users.Unlock();

	return true;
}
开发者ID:crubia,项目名称:wt,代码行数:28,代码来源:BFCPFloorControlServer.cpp

示例15: swish_pidl

apidl_t PidlFixture::directory_pidl(const wpath& directory)
{
    return swish_pidl() + create_host_itemid(
        Utf8StringToWideString(GetHost()),
        Utf8StringToWideString(GetUser()),
        directory, GetPort());
}
开发者ID:alamaison,项目名称:swish,代码行数:7,代码来源:PidlFixture.cpp


注:本文中的GetUser函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。