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


C++ GetNetwork函数代码示例

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


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

示例1: 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

示例2: GetNetwork

bool CAI_Pathfinder::IsLinkStillStale(int moveType, CAI_Link *nodeLink)
{
	if ( m_bIgnoreStaleLinks )
		return false;

	if ( !(nodeLink->m_LinkInfo & bits_LINK_STALE_SUGGESTED ) )
		return false;

	if ( gpGlobals->curtime < nodeLink->m_timeStaleExpires )
		return true;

	// NPC should only check one stale link per think
	if (gpGlobals->curtime == m_flLastStaleLinkCheckTime)
	{
		return true;
	}
	else
	{
		m_flLastStaleLinkCheckTime = gpGlobals->curtime;
	}
	
	// Test movement, if suceeds, clear the stale bit
	if (CheckStaleRoute(GetNetwork()->GetNode(nodeLink->m_iSrcID)->GetPosition(GetHullType()),
		GetNetwork()->GetNode(nodeLink->m_iDestID)->GetPosition(GetHullType()), moveType))
	{
		nodeLink->m_LinkInfo &= ~bits_LINK_STALE_SUGGESTED;
		return false;
	}

	nodeLink->m_timeStaleExpires = gpGlobals->curtime + 1.0;

	return true;
}
开发者ID:KissLick,项目名称:sourcemod-npc-in-css,代码行数:33,代码来源:CAI_pathfinder.cpp

示例3: OnLoad

	bool OnLoad(const CString& sArgs, CString& sMessage) override {
		CString sReasonArg;

		// Load AwayWait
		CString sFirstArg = sArgs.Token(0);
		if (sFirstArg.Equals("-notimer")) {
			SetAwayWait(0);
			sReasonArg = sArgs.Token(1, true);
		} else if (sFirstArg.Equals("-timer")) {
			SetAwayWait(sArgs.Token(1).ToUInt());
			sReasonArg = sArgs.Token(2, true);
		} else {
			CString sAwayWait = GetNV("awaywait");
			if (!sAwayWait.empty())
				SetAwayWait(sAwayWait.ToUInt(), false);
			sReasonArg = sArgs;
		}

		// Load Reason
		if (!sReasonArg.empty()) {
			SetReason(sReasonArg);
		} else {
			CString sSavedReason = GetNV("reason");
			if (!sSavedReason.empty())
				SetReason(sSavedReason, false);
		}

		// Set away on load, required if loaded via webadmin
		if (GetNetwork()->IsIRCConnected() && !GetNetwork()->IsUserAttached())
			SetAway(false);

		return true;
	}
开发者ID:KielBNC,项目名称:znc,代码行数:33,代码来源:simple_away.cpp

示例4: Round

  BaseBulkRound::BaseBulkRound(const Group &group,
      const PrivateIdentity &ident,
      const Id &round_id,
      const QSharedPointer<Network> &network,
      GetDataCallback &get_data,
      const QSharedPointer<BuddyMonitor> &bm,
      CreateRound create_shuffle) :
    Round(group, ident, round_id, network, get_data, bm),
    _get_shuffle_data(this, &BaseBulkRound::GetShuffleData)
  {
    QVariantHash headers = GetNetwork()->GetHeaders();
    headers["bulk"] = true;
    GetNetwork()->SetHeaders(headers);

    QSharedPointer<Network> net(GetNetwork()->Clone());
    headers["bulk"] = false;
    net->SetHeaders(headers);

    Id sr_id(Hash().ComputeHash(GetRoundId().GetByteArray()));

    _shuffle_round = create_shuffle(GetGroup(), GetPrivateIdentity(), sr_id, net,
        _get_shuffle_data, bm);
    _shuffle_round->SetSink(&_shuffle_sink);

    QObject::connect(_shuffle_round.data(), SIGNAL(Finished()),
        this, SLOT(SlotShuffleFinished()));
  }
开发者ID:ASchurman,项目名称:Dissent,代码行数:27,代码来源:BaseBulkRound.cpp

示例5: cJSON_Parse

void CMyV8Handler::setTransInfo( CString strContent )
{
	string content=slnhelper::wchar2utf8(wstring(strContent));
	int dtm=0;
	int dpm=0;
	int utm=0;
	int upm=0;
	cJSON *root;
	root = cJSON_Parse(content.c_str());
	if(root!=NULL)
	{
		cJSON *j = root->child;
		while (j != NULL) 
		{
			string key= string(j->string);
			if (key=="download_task_max")
			{
				dtm=j->valueint;
			}
			else if (key=="download_peer_max")
			{
				dpm=j->valueint;
			}
			else if (key=="upload_task_max")
			{
				utm=j->valueint;
			}
			else if (key=="upload_peer_max")
			{
				upm=j->valueint;
			}
			else
			{
			} 
			j=j->next;
		}
		cJSON_Delete(root);
	}
	if (dtm>0)
	{
		GetUserDb()->SetDownloadMax(dtm);
		GetNetwork()->SetDTaskMax(dtm);
	}
	if (utm>0)
	{
		GetUserDb()->SetUploadMax(utm);
		GetNetwork()->SetUTaskMax(utm);
	}
	if (dpm>0)
	{
		GetUserDb()->SetDownloadPeerMax(dpm);
		GetNetwork()->SetDPeerMax(dpm);
	}
	if (upm>0)
	{
		GetUserDb()->SetUploadPeerMax(upm);
		GetNetwork()->SetUPeerMax(upm);
	}
}
开发者ID:gokuai,项目名称:oss-client-win,代码行数:59,代码来源:MyV8Handler.cpp

示例6: DevWarning

int CAI_TacticalServices::FindBackAwayNode(const Vector &vecThreat )
{
	if ( !CAI_NetworkManager::NetworksLoaded() )
	{
		DevWarning( 2, "Graph not ready for FindBackAwayNode!\n" );
		return NO_NODE;
	}

	int iMyNode			= GetPathfinder()->NearestNodeToNPC();
	int iThreatNode		= GetPathfinder()->NearestNodeToPoint( vecThreat );

	if ( iMyNode == NO_NODE )
	{
		DevWarning( 2, "FindBackAwayNode() - %s has no nearest node!\n", GetEntClassname());
		return NO_NODE;
	}
	if ( iThreatNode == NO_NODE )
	{
		// DevWarning( 2, "FindBackAwayNode() - Threat has no nearest node!\n" );
		iThreatNode = iMyNode;
		// return false;
	}

	// A vector pointing to the threat.
	Vector vecToThreat;
	vecToThreat = vecThreat - GetLocalOrigin();

	// Get my current distance from the threat
	float flCurDist = VectorNormalize( vecToThreat );

	// Check my neighbors to find a node that's further away
	for (int link = 0; link < GetNetwork()->GetNode(iMyNode)->NumLinks(); link++) 
	{
		CAI_Link *nodeLink = GetNetwork()->GetNode(iMyNode)->GetLinkByIndex(link);

		if ( !m_pPathfinder->IsLinkUsable( nodeLink, iMyNode ) )
			continue;

		int destID = nodeLink->DestNodeID(iMyNode);

		float flTestDist = ( vecThreat - GetNetwork()->GetNode(destID)->GetPosition(GetHullType()) ).Length();

		if ( flTestDist > flCurDist )
		{
			// Make sure this node doesn't take me past the enemy's position.
			Vector vecToNode;
			vecToNode = GetNetwork()->GetNode(destID)->GetPosition(GetHullType()) - GetLocalOrigin();
			VectorNormalize( vecToNode );
		
			if( DotProduct( vecToNode, vecToThreat ) < 0.0 )
			{
				return destID;
			}
		}
	}
	return NO_NODE;
}
开发者ID:Au-heppa,项目名称:source-sdk-2013,代码行数:57,代码来源:ai_tacticalservices.cpp

示例7: OnRaw

	EModRet OnRaw(CString& sLine) override {
		if (sLine.StartsWith("ERROR ")) {
			//ERROR :Closing Link: nick[24.24.24.24] (Excess Flood)
			//ERROR :Closing Link: nick[24.24.24.24] Killer (Local kill by Killer (reason))
			CString sError(sLine.substr(6));
			if (sError.Left(1) == ":")
				sError.LeftChomp();
			Log("[" + GetUser()->GetUserName() + "/" + GetNetwork()->GetName() + "] disconnected from IRC: " +
			    GetNetwork()->GetCurrentServer()->GetName() + " [" + sError + "]", LOG_NOTICE);
		}
		return CONTINUE;
        }
开发者ID:jpnurmi,项目名称:znc,代码行数:12,代码来源:adminlog.cpp

示例8: GetNetwork

void CUploadTask::Finish()
{
	if(m_bStop)
		return;
	m_bStop=true;
	GetNetwork()->m_TransDb.Update_UploadStatus(m_Item.strPathhash,TRANSTASK_FINISH);
	DeleteMultipartFile();
	RegularItem item;
	if (GetNetwork()->m_Regular.CheckRegular(m_Item.strBucket,m_Item.strObject,item))
	{
		CallbackUrlInfo(item);
	}
	m_Item.nStatus=TRANSTASK_FINISH;
	GetCallbackUploadThread()->SendCallbackInfo(m_Item);
}
开发者ID:gokuai,项目名称:oss-client-win,代码行数:15,代码来源:UploadTask.cpp

示例9: OnUserRaw

    EModRet OnUserRaw(CString& sLine) override {
        // Handle ISON
        if (sLine.Token(0).Equals("ison")) {
            VCString vsNicks;

            // Get the list of nicks which are being asked for
            sLine.Token(1, true).TrimLeft_n(":").Split(" ", vsNicks, false);

            CString sBNCNicks;
            for (const CString& sNick : vsNicks) {
                if (IsOnlineModNick(sNick)) {
                    sBNCNicks += " " + sNick;
                }
            }
            // Remove the leading space
            sBNCNicks.LeftChomp();

            if (!GetNetwork()->GetIRCSock()) {
                // if we are not connected to any IRC server, send
                // an empty or module-nick filled response.
                PutUser(":irc.znc.in 303 " + GetClient()->GetNick() + " :" +
                        sBNCNicks);
            } else {
                // We let the server handle this request and then act on
                // the 303 response from the IRC server.
                m_ISONRequests.push_back(sBNCNicks);
            }
        }

        // Handle WHOIS
        if (sLine.Token(0).Equals("whois")) {
            CString sNick = sLine.Token(1);

            if (IsOnlineModNick(sNick)) {
                CIRCNetwork* pNetwork = GetNetwork();
                PutUser(":znc.in 311 " + pNetwork->GetCurNick() + " " + sNick +
                        " znc znc.in * :" + sNick);
                PutUser(":znc.in 312 " + pNetwork->GetCurNick() + " " + sNick +
                        " *.znc.in :Bouncer");
                PutUser(":znc.in 318 " + pNetwork->GetCurNick() + " " + sNick +
                        " :End of /WHOIS list.");

                return HALT;
            }
        }

        return CONTINUE;
    }
开发者ID:GLolol,项目名称:znc,代码行数:48,代码来源:modules_online.cpp

示例10: HandleMessage

 void HandleMessage(CNick& Nick, const CString& sMessage) {
     CString sNickServName = (!GetNV("NickServName").empty())
                                 ? GetNV("NickServName")
                                 : "NickServ";
     if (!GetNV("Password").empty() && Nick.NickEquals(sNickServName) &&
         (sMessage.find("msg") != CString::npos ||
          sMessage.find("authenticate") != CString::npos ||
          sMessage.find("choose a different nickname") != CString::npos ||
          sMessage.find("please choose a different nick") != CString::npos ||
          sMessage.find("If this is your nick, identify yourself with") !=
              CString::npos ||
          sMessage.find("If this is your nick, type") != CString::npos ||
          sMessage.find("This is a registered nickname, please identify") !=
              CString::npos ||
          sMessage.StripControls_n().find(
              "type /NickServ IDENTIFY password") != CString::npos ||
          sMessage.StripControls_n().find(
              "type /msg NickServ IDENTIFY password") != CString::npos) &&
         sMessage.AsUpper().find("IDENTIFY") != CString::npos &&
         sMessage.find("help") == CString::npos) {
         MCString msValues;
         msValues["password"] = GetNV("Password");
         PutIRC(CString::NamedFormat(GetNV("IdentifyCmd"), msValues));
     } else if(Nick.NickEquals(sNickServName) && m_bJoinAfterIdentified &&
              (sMessage.find("Password accepted") != CString::npos ||
               sMessage.find("now recognized") != CString::npos ||
               sMessage.find("now identified") != CString::npos ||
               sMessage.find("now logged in as") != CString::npos)) {
         m_bIdentified = true;
         GetNetwork()->JoinChans();
     }
 }
开发者ID:jkhsjdhjs,项目名称:znc,代码行数:32,代码来源:nickserv.cpp

示例11: OnPart

 void OnPart(const CNick& Nick, CChan& Channel,
             const CString& sMessage) override {
     if (Channel.InConfig() &&
         GetNetwork()->GetIRCNick().NickEquals(Nick.GetNick())) {
         Channel.SetInConfig(false);
     }
 }
开发者ID:sctigercat1,项目名称:znc,代码行数:7,代码来源:chansaver.cpp

示例12: netMsg

void VisionApp::AddIgnoreNick(const char* network, const char* nick, bool exclude)
{
	// in case user has deleted the network in question, unlikely but better safe than sorry
	BMessage netMsg(GetNetwork(network));
	if (!netMsg.HasString("name")) return;

	char optype[8];
	memset(optype, 0, sizeof(optype));
	if (exclude) {
		strcpy(optype, "exclude");
	} else {
		strcpy(optype, "ignore");
	}

	type_code type;
	int32 attrCount;

	// make sure this nick hasn't already been added
	netMsg.GetInfo(optype, &type, &attrCount);
	for (int32 i = 0; i < attrCount; i++) {
		if (!strcmp(netMsg.FindString(optype, i), nick)) return;
	}

	netMsg.AddString(optype, nick);
	SetNetwork(network, &netMsg);
}
开发者ID:HaikuArchives,项目名称:Vision,代码行数:26,代码来源:Vision.cpp

示例13: Handle

	void Handle(const CString& sNick) {
		CIRCSock *pIRCSock = GetNetwork()->GetIRCSock();
		if (!pIRCSock)
			// WTF?
			return;
		if (sNick == pIRCSock->GetNick())
			return;
		if (m_Messaged.HasItem(sNick))
			return;

		if (GetNetwork()->IsUserAttached())
			return;

		m_Messaged.AddItem(sNick);
		PutIRC("NOTICE " + sNick + " :" + GetReply());
	}
开发者ID:Gunni,项目名称:znc,代码行数:16,代码来源:autoreply.cpp

示例14: CheckRequireAuth

 void CheckRequireAuth() {
     if (!m_bAuthenticated && GetNV(NV_REQUIRE_AUTH).ToBool()) {
         GetNetwork()->SetIRCConnectEnabled(false);
         PutModule("Disabling network, we require authentication.");
         PutModule("Use 'RequireAuth no' to disable.");
     }
 }
开发者ID:DreamBNC,项目名称:znc,代码行数:7,代码来源:sasl.cpp

示例15: sizeof

CUser* CUserManager::CreateUser( )
{

	/*
	CUserBuffer:

	We merge both classes of the internal server and the exe into one:

	1 'User'
	+-------------------+------------------------+
	|   sizeof( CUser ) |   sizeof( CTestUser )  |
	+-------------------+-------------------------
	*/

	auto pNetImpl = GetNetwork( )->GetNetImpl( );
	size_t nImplSize = pNetImpl->GetUserSize( );


	BYTE* pBuffer = new BYTE[ sizeof( CUser ) + nImplSize ];
	BYTE* pBufferPos = pBuffer;


	WSocket::IUserImpl* pUserImpl = pNetImpl->ConstructUser( pBufferPos + sizeof( CUser ) );
	CUser* pUser = new ( pBufferPos )CUser( pUserImpl );


	return pUser;
}
开发者ID:ItsClemi,项目名称:WSocket,代码行数:28,代码来源:UserManager.cpp


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