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


C++ CIRCSock类代码示例

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


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

示例1: Block

    bool Block(const CString& sUser) {
        CUser *pUser = CZNC::Get().FindUser(sUser);

        if (!pUser)
            return false;

        // Disconnect all clients
        vector<CClient*> vpClients = pUser->GetAllClients();
        vector<CClient*>::iterator it;
        for (it = vpClients.begin(); it != vpClients.end(); ++it) {
            (*it)->PutStatusNotice(MESSAGE);
            (*it)->Close(Csock::CLT_AFTERWRITE);
        }

        // Disconnect all networks from irc
        vector<CIRCNetwork*> vNetworks = pUser->GetNetworks();
        for (vector<CIRCNetwork*>::iterator it2 = vNetworks.begin(); it2 != vNetworks.end(); ++it2) {
            CIRCNetwork *pNetwork = *it2;
            CIRCSock *pIRCSock = pNetwork->GetIRCSock();
            if (pIRCSock) {
                pIRCSock->Quit();
            }
        }

        // ...and don't reconnect
        pUser->SetIRCConnectEnabled(false);

        SetNV(pUser->GetUserName(), "");
        return true;
    }
开发者ID:reuben,项目名称:znc,代码行数:30,代码来源:blockuser.cpp

示例2: RunJob

	virtual void RunJob() {
		vector<CIRCNetwork*> vNetworks = m_pUser->GetNetworks();

		for (size_t a = 0; a < vNetworks.size(); a++) {
			CIRCNetwork* pNetwork = vNetworks[a];
			CIRCSock* pIRCSock = pNetwork->GetIRCSock();

			if (pIRCSock && pIRCSock->GetTimeSinceLastDataTransaction() >= 270) {
				pIRCSock->PutIRC("PING :ZNC");
			}

			if (pNetwork->IsIRCConnected()) {
				pNetwork->JoinChans();
			}

			vector<CClient*>& vClients = pNetwork->GetClients();
			for (size_t b = 0; b < vClients.size(); b++) {
				CClient* pClient = vClients[b];

				if (pClient->GetTimeSinceLastDataTransaction() >= 270) {
					pClient->PutClient("PING :ZNC");
				}
			}
		}
	}
开发者ID:b3rend,项目名称:znc,代码行数:25,代码来源:User.cpp

示例3: GetNick

    CString GetNick() {
        CString sConfNick = GetNetwork()->GetNick();
        CIRCSock* pIRCSock = GetNetwork()->GetIRCSock();

        if (pIRCSock) sConfNick = sConfNick.Left(pIRCSock->GetMaxNickLen());

        return sConfNick;
    }
开发者ID:Un1matr1x,项目名称:znc,代码行数:8,代码来源:keepnick.cpp

示例4: GetIRCSock

bool CIRCNetwork::PutIRC(const CString& sLine) {
	CIRCSock* pIRCSock = GetIRCSock();

	if (!pIRCSock) {
		return false;
	}

	pIRCSock->PutIRC(sLine);
	return true;
}
开发者ID:Hasimir,项目名称:znc,代码行数:10,代码来源:IRCNetwork.cpp

示例5: GetAwayNick

	CString GetAwayNick() {
		size_t uLen = 9;
		CIRCSock* pIRCSock = m_pUser->GetIRCSock();

		if (pIRCSock) {
			uLen = pIRCSock->GetMaxNickLen();
		}

		m_sAwayNick = m_pUser->ExpandString(m_sFormat).Left(uLen);
		return m_sAwayNick;
	}
开发者ID:BGCX261,项目名称:znc-msvc-svn-to-git,代码行数:11,代码来源:awaynick.cpp

示例6: GetAwayNick

	CString GetAwayNick() {
		unsigned int uLen = 9;
		CIRCSock* pIRCSock = m_pNetwork->GetIRCSock();

		if (pIRCSock) {
			uLen = pIRCSock->GetMaxNickLen();
		}

		m_sAwayNick = m_pNetwork->ExpandString(m_sFormat).Left(uLen);
		return m_sAwayNick;
	}
开发者ID:HaleBob,项目名称:znc,代码行数:11,代码来源:awaynick.cpp

示例7: StartBackNickTimer

	void StartBackNickTimer() {
		CIRCSock* pIRCSock = m_pUser->GetIRCSock();

		if (pIRCSock) {
			CString sConfNick = m_pUser->GetNick();

			if (pIRCSock->GetNick().Equals(m_sAwayNick.Left(pIRCSock->GetNick().length()))) {
				RemTimer("BackNickTimer");
				AddTimer(new CBackNickTimer(*this));
			}
		}
	}
开发者ID:BGCX261,项目名称:znc-msvc-svn-to-git,代码行数:12,代码来源:awaynick.cpp

示例8: GetCurrentServer

bool CIRCNetwork::DelServer(const CString& sName, unsigned short uPort, const CString& sPass) {
	if (sName.empty()) {
		return false;
	}

	unsigned int a = 0;
	bool bSawCurrentServer = false;
	CServer* pCurServer = GetCurrentServer();

	for (vector<CServer*>::iterator it = m_vServers.begin(); it != m_vServers.end(); ++it, a++) {
		CServer* pServer = *it;

		if (pServer == pCurServer)
			bSawCurrentServer = true;

		if (!pServer->GetName().Equals(sName))
			continue;

		if (uPort != 0 && pServer->GetPort() != uPort)
			continue;

		if (!sPass.empty() && pServer->GetPass() != sPass)
			continue;

		m_vServers.erase(it);

		if (pServer == pCurServer) {
			CIRCSock* pIRCSock = GetIRCSock();

			// Make sure we don't skip the next server in the list!
			if (m_uServerIdx) {
				m_uServerIdx--;
			}

			if (pIRCSock) {
				pIRCSock->Quit();
				PutStatus("Your current server was removed, jumping...");
			}
		} else if (!bSawCurrentServer) {
			// Our current server comes after the server which we
			// are removing. This means that it now got a different
			// index in m_vServers!
			m_uServerIdx--;
		}

		delete pServer;

		return true;
	}

	return false;
}
开发者ID:Hasimir,项目名称:znc,代码行数:52,代码来源:IRCNetwork.cpp

示例9: GetPermChar

unsigned char CNick::GetPermChar() const {
	CIRCSock* pIRCSock = (!m_pNetwork) ? NULL : m_pNetwork->GetIRCSock();
	const CString& sChanPerms = (!pIRCSock) ? "@+" : pIRCSock->GetPerms();

	for (unsigned int a = 0; a < sChanPerms.size(); a++) {
		const unsigned char& c = sChanPerms[a];
		if (HasPerm(c)) {
			return c;
		}
	}

	return '\0';
}
开发者ID:jimloco,项目名称:znc,代码行数:13,代码来源:Nick.cpp

示例10: GetIRCSock

CString CUser::GetLocalIP() {
	CIRCSock* pIRCSock = GetIRCSock();

	if (pIRCSock) {
		return pIRCSock->GetLocalIP();
	}

	if (!m_vClients.empty()) {
		return m_vClients[0]->GetLocalIP();
	}

	return "";
}
开发者ID:bpcampbe,项目名称:znc,代码行数:13,代码来源:User.cpp

示例11: GetNextServer

bool CIRCNetwork::Connect() {
    if (!GetIRCConnectEnabled() || m_pIRCSock || !HasServers()) return false;

    CServer* pServer = GetNextServer();
    if (!pServer) return false;

    if (CZNC::Get().GetServerThrottle(pServer->GetName())) {
        // Can't connect right now, schedule retry later
        CZNC::Get().AddNetworkToQueue(this);
        return false;
    }

    CZNC::Get().AddServerThrottle(pServer->GetName());

    bool bSSL = pServer->IsSSL();
#ifndef HAVE_LIBSSL
    if (bSSL) {
        PutStatus("Cannot connect to [" + pServer->GetString(false) +
                  "], ZNC is not compiled with SSL.");
        CZNC::Get().AddNetworkToQueue(this);
        return false;
    }
#endif

    CIRCSock* pIRCSock = new CIRCSock(this);
    pIRCSock->SetPass(pServer->GetPass());
    pIRCSock->SetSSLTrustedPeerFingerprints(m_ssTrustedFingerprints);
    pIRCSock->SetTrustAllCerts(GetTrustAllCerts());
    pIRCSock->SetTrustPKI(GetTrustPKI());

    DEBUG("Connecting user/network [" << m_pUser->GetUserName() << "/"
                                      << m_sName << "]");

    bool bAbort = false;
    NETWORKMODULECALL(OnIRCConnecting(pIRCSock), m_pUser, this, nullptr,
                      &bAbort);
    if (bAbort) {
        DEBUG("Some module aborted the connection attempt");
        PutStatus("Some module aborted the connection attempt");
        delete pIRCSock;
        CZNC::Get().AddNetworkToQueue(this);
        return false;
    }

    CString sSockName = "IRC::" + m_pUser->GetUserName() + "::" + m_sName;
    CZNC::Get().GetManager().Connect(pServer->GetName(), pServer->GetPort(),
                                     sSockName, 120, bSSL, GetBindHost(),
                                     pIRCSock);

    return true;
}
开发者ID:torksrevol,项目名称:znc,代码行数:51,代码来源:IRCNetwork.cpp

示例12: KeepNick

    void KeepNick() {
        if (!m_pTimer)
            // No timer means we are turned off
            return;

        CIRCSock* pIRCSock = GetNetwork()->GetIRCSock();

        if (!pIRCSock) return;

        // Do we already have the nick we want?
        if (pIRCSock->GetNick().Equals(GetNick())) return;

        PutIRC("NICK " + GetNick());
    }
开发者ID:Un1matr1x,项目名称:znc,代码行数:14,代码来源:keepnick.cpp

示例13: RunJob

	void RunJob() override {
		CIRCSock* pIRCSock = m_pNetwork->GetIRCSock();

		if (pIRCSock && pIRCSock->GetTimeSinceLastDataTransaction() >= CIRCNetwork::PING_FREQUENCY) {
			pIRCSock->PutIRC("PING :ZNC");
		}

		const vector<CClient*>& vClients = m_pNetwork->GetClients();
		for (CClient* pClient : vClients) {
			if (pClient->GetTimeSinceLastDataTransaction() >= CIRCNetwork::PING_FREQUENCY) {
				pClient->PutClient("PING :ZNC");
			}
		}
	}
开发者ID:Hasimir,项目名称:znc,代码行数:14,代码来源:IRCNetwork.cpp

示例14: GetPermStr

CString CNick::GetPermStr() const {
	CIRCSock* pIRCSock = (!m_pUser) ? NULL : m_pUser->GetIRCSock();
	const CString& sChanPerms = (!pIRCSock) ? "@+" : pIRCSock->GetPerms();
	CString sRet;

	for (unsigned int a = 0; a < sChanPerms.size(); a++) {
		const unsigned char& c = sChanPerms[a];

		if (HasPerm(c)) {
			sRet += c;
		}
	}

	return sRet;
}
开发者ID:BGCX261,项目名称:znc-msvc-svn-to-git,代码行数:15,代码来源:Nick.cpp

示例15: GetTwitchNetwork

CModule::EModRet TwitchGroupChat::OnRawMessage(CMessage &msg)
{
    if(msg.GetCommand().Equals("WHISPER"))
        msg.SetCommand("PRIVMSG");

    CString realNick = msg.GetTag("display-name").Trim_n();
    if(realNick != "")
        msg.GetNick().SetNick(realNick);

    CIRCSock *twnw = GetTwitchNetwork();
    if(twnw)
        twnw->ReadLine(msg.ToString());

    return CModule::CONTINUE;
}
开发者ID:carriercomm,项目名称:ZncTwitchTMI,代码行数:15,代码来源:twitchwhisp.cpp


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