• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ GetUser函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: GetMe

void IBattle::OnSelfLeftBattle()
{
	GetMe().BattleStatus().spectator = false; // always reset back yourself to player when rejoining
	if ( m_timer ) m_timer->Stop();
	delete m_timer;
	m_timer = 0;
    m_is_self_in = false;
	for( size_t j = 0; j < GetNumUsers(); ++j  )
	{
		User& u = GetUser( j );
		if ( u.GetBattleStatus().IsBot() )
		{
			OnUserRemoved( u );
			ui().OnUserLeftBattle( *this, u, true );
			j--;
		}
	}
    ClearStartRects();
    m_teams_sizes.clear();
    m_ally_sizes.clear();
    m_players_ready = 0;
    m_players_sync = 0;
	m_players_ok = 0;
	usync().UnSetCurrentMod(); //left battle
}
开发者ID:johnjianfang,项目名称:springlobby,代码行数:25,代码来源:ibattle.cpp


示例17: List

	void List(const CString& sCommand) {
		CTable Table;
		unsigned int index = 1;
		CString sExpanded;

		Table.AddColumn("Id");
		Table.AddColumn("Perform");
		Table.AddColumn("Expanded");

		for (VCString::const_iterator it = m_vPerform.begin(); it != m_vPerform.end(); it++, index++) {
			Table.AddRow();
			Table.SetCell("Id", CString(index));
			Table.SetCell("Perform", *it);

			if (m_pNetwork) {
				sExpanded = m_pNetwork->ExpandString(*it);
			} else {
				sExpanded = GetUser()->ExpandString(*it);
			}

			if (sExpanded != *it) {
				Table.SetCell("Expanded", sExpanded);
			}
		}

		if (PutModule(Table) == 0) {
			PutModule("No commands in your perform list.");
		}
	}
开发者ID:HaleBob,项目名称:znc,代码行数:29,代码来源:perform.cpp


示例18: OnModCommand

	void OnModCommand(const CString& sCommand) override {
		if (!GetUser()->IsAdmin()) {
			PutModule("Access denied");
		} else {
			HandleCommand(sCommand);
		}
	}
开发者ID:jpnurmi,项目名称:znc,代码行数:7,代码来源:adminlog.cpp


示例19: OnModuleLoading

	virtual EModRet OnModuleLoading(const CString& sModName, const CString& sArgs,
			bool& bSuccess, CString& sRetMsg) {
		if (!GetUser()) {
			return CONTINUE;
		}
		EModRet result = HALT;
		PSTART;
		PUSH_STR(sModName);
		PUSH_STR(sArgs);
		PUSH_PTR(CUser*, GetUser());
		PCALL("ZNC::Core::LoadModule");

		if (SvTRUE(ERRSV)) {
			sRetMsg = PString(ERRSV);
			bSuccess = false;
			result = HALT;
			DEBUG("Perl ZNC::Core::LoadModule died: " << sRetMsg);
		} else if (ret < 1 || 2 < ret) {
			sRetMsg = "Error: Perl ZNC::Core::LoadModule returned " + CString(ret) + " values.";
			bSuccess = false;
			result = HALT;
		} else {
			ELoadPerlMod eLPM = static_cast<ELoadPerlMod>(SvUV(ST(0)));
			if (Perl_NotFound == eLPM) {
				result = CONTINUE; // Not a Perl module
			} else {
				sRetMsg = PString(ST(1));
				result = HALT;
				bSuccess = eLPM == Perl_Loaded;
			}
		}

		PEND;
		return result;
	}
开发者ID:bpcampbe,项目名称:znc,代码行数:35,代码来源:modperl.cpp


示例20: LoadMap

UserPosition IBattle::GetFreePosition()
{
	UserPosition ret;
	LSL::UnitsyncMap map = LoadMap();
	for ( int i = 0; i < int(map.info.positions.size()); i++ ) {
		bool taken = false;
		for ( unsigned int bi = 0; bi < GetNumUsers(); bi++ ) {
			User& user = GetUser( bi );
			UserBattleStatus& status = user.BattleStatus();
			if ( status.spectator ) continue;
			if ( ( map.info.positions[i].x == status.pos.x ) && ( map.info.positions[i].y == status.pos.y ) ) {
				taken = true;
				break;
			}
		}
		if ( !taken ) {
			ret.x = LSL::Util::Clamp(map.info.positions[i].x, 0, map.info.width);
			ret.y = LSL::Util::Clamp(map.info.positions[i].y, 0, map.info.height);
			return ret;
		}
	}
	ret.x = map.info.width / 2;
	ret.y = map.info.height / 2;
	return ret;
}
开发者ID:cleanrock,项目名称:springlobby,代码行数:25,代码来源:ibattle.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ GetUserDefaultLCID函数代码示例发布时间:2022-05-30
下一篇:
C++ GetUpdateRect函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap