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


C++ CUser::GetBindHost方法代码示例

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


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

示例1: Connect

bool CSocket::Connect(const CString& sHostname, unsigned short uPort, bool bSSL, unsigned int uTimeout) {
    if (!m_pModule) {
        DEBUG("ERROR: CSocket::Connect called on instance without m_pModule handle!");
        return false;
    }

    CUser* pUser = m_pModule->GetUser();
    CString sSockName = "MOD::C::" + m_pModule->GetModName();
    CString sBindHost;

    if (pUser) {
        sSockName += "::" + pUser->GetUserName();
        sBindHost = pUser->GetBindHost();
        CIRCNetwork* pNetwork = m_pModule->GetNetwork();
        if (pNetwork) {
            sSockName += "::" + pNetwork->GetName();
            sBindHost = pNetwork->GetBindHost();
        }
    }

    // Don't overwrite the socket name if one is already set
    if (!GetSockName().empty()) {
        sSockName = GetSockName();
    }

    m_pModule->GetManager()->Connect(sHostname, uPort, sSockName, uTimeout, bSSL, sBindHost, this);
    return true;
}
开发者ID:TuffLuck,项目名称:znc,代码行数:28,代码来源:Socket.cpp

示例2: Clone

bool CUser::Clone(const CUser& User, CString& sErrorRet, bool bCloneChans) {
    unsigned int a = 0;
    sErrorRet.clear();

    if (!User.IsValid(sErrorRet, true)) {
        return false;
    }

    // user names can only specified for the constructor, changing it later
    // on breaks too much stuff (e.g. lots of paths depend on the user name)
    if (GetUserName() != User.GetUserName()) {
        DEBUG("Ignoring username in CUser::Clone(), old username [" << GetUserName()
                << "]; New username [" << User.GetUserName() << "]");
    }

    if (!User.GetPass().empty()) {
        SetPass(User.GetPass(), User.GetPassHashType(), User.GetPassSalt());
    }

    SetNick(User.GetNick(false));
    SetAltNick(User.GetAltNick(false));
    SetIdent(User.GetIdent(false));
    SetRealName(User.GetRealName());
    SetStatusPrefix(User.GetStatusPrefix());
    SetBindHost(User.GetBindHost());
    SetDCCBindHost(User.GetDCCBindHost());
    SetQuitMsg(User.GetQuitMsg());
    SetSkinName(User.GetSkinName());
    SetLanguage(User.GetLanguage());
    SetDefaultChanModes(User.GetDefaultChanModes());
    SetBufferCount(User.GetBufferCount(), true);
    SetJoinTries(User.JoinTries());
    SetMaxJoins(User.MaxJoins());

    // Allowed Hosts
    m_ssAllowedHosts.clear();
    const set<CString>& ssHosts = User.GetAllowedHosts();
    for (set<CString>::const_iterator it = ssHosts.begin(); it != ssHosts.end(); ++it) {
        AddAllowedHost(*it);
    }

    for (a = 0; a < m_vClients.size(); a++) {
        CClient* pSock = m_vClients[a];

        if (!IsHostAllowed(pSock->GetRemoteIP())) {
            pSock->PutStatusNotice("You are being disconnected because your IP is no longer allowed to connect to this user");
            pSock->Close();
        }
    }

    // !Allowed Hosts

    // Networks
    const vector<CIRCNetwork*>& vNetworks = User.GetNetworks();
    for (a = 0; a < vNetworks.size(); a++) {
        new CIRCNetwork(this, vNetworks[a], bCloneChans);
    }
    // !Networks

    // CTCP Replies
    m_mssCTCPReplies.clear();
    const MCString& msReplies = User.GetCTCPReplies();
    for (MCString::const_iterator it = msReplies.begin(); it != msReplies.end(); ++it) {
        AddCTCPReply(it->first, it->second);
    }
    // !CTCP Replies

    // Flags
    SetIRCConnectEnabled(User.GetIRCConnectEnabled());
    SetKeepBuffer(User.KeepBuffer());
    SetMultiClients(User.MultiClients());
    SetDenyLoadMod(User.DenyLoadMod());
    SetAdmin(User.IsAdmin());
    SetDenySetBindHost(User.DenySetBindHost());
    SetTimestampAppend(User.GetTimestampAppend());
    SetTimestampPrepend(User.GetTimestampPrepend());
    SetTimestampFormat(User.GetTimestampFormat());
    SetTimezoneOffset(User.GetTimezoneOffset());
    // !Flags

    // Modules
    set<CString> ssUnloadMods;
    CModules& vCurMods = GetModules();
    const CModules& vNewMods = User.GetModules();

    for (a = 0; a < vNewMods.size(); a++) {
        CString sModRet;
        CModule* pNewMod = vNewMods[a];
        CModule* pCurMod = vCurMods.FindModule(pNewMod->GetModName());

        if (!pCurMod) {
            vCurMods.LoadModule(pNewMod->GetModName(), pNewMod->GetArgs(), CModInfo::UserModule, this, NULL, sModRet);
        } else if (pNewMod->GetArgs() != pCurMod->GetArgs()) {
            vCurMods.ReloadModule(pNewMod->GetModName(), pNewMod->GetArgs(), this, NULL, sModRet);
        }
    }

    for (a = 0; a < vCurMods.size(); a++) {
        CModule* pCurMod = vCurMods[a];
        CModule* pNewMod = vNewMods.FindModule(pCurMod->GetModName());
//.........这里部分代码省略.........
开发者ID:b3rend,项目名称:znc,代码行数:101,代码来源:User.cpp

示例3: Clone

bool CUser::Clone(const CUser& User, CString& sErrorRet, bool bCloneChans) {
    unsigned int a = 0;
    sErrorRet.clear();

    if (!User.IsValid(sErrorRet, true)) {
        return false;
    }

    // user names can only specified for the constructor, changing it later
    // on breaks too much stuff (e.g. lots of paths depend on the user name)
    if (GetUserName() != User.GetUserName()) {
        DEBUG("Ignoring username in CUser::Clone(), old username [" << GetUserName()
                << "]; New username [" << User.GetUserName() << "]");
    }

    if (!User.GetPass().empty()) {
        SetPass(User.GetPass(), User.GetPassHashType(), User.GetPassSalt());
    }

    SetNick(User.GetNick(false));
    SetAltNick(User.GetAltNick(false));
    SetIdent(User.GetIdent(false));
    SetRealName(User.GetRealName());
    SetStatusPrefix(User.GetStatusPrefix());
    SetBindHost(User.GetBindHost());
    SetDCCBindHost(User.GetDCCBindHost());
    SetQuitMsg(User.GetQuitMsg());
    SetSkinName(User.GetSkinName());
    SetDefaultChanModes(User.GetDefaultChanModes());
    SetBufferCount(User.GetBufferCount(), true);
    SetJoinTries(User.JoinTries());
    SetMaxJoins(User.MaxJoins());

    // Allowed Hosts
    m_ssAllowedHosts.clear();
    const set<CString>& ssHosts = User.GetAllowedHosts();
    for (set<CString>::const_iterator it = ssHosts.begin(); it != ssHosts.end(); ++it) {
        AddAllowedHost(*it);
    }

    for (a = 0; a < m_vClients.size(); a++) {
        CClient* pSock = m_vClients[a];

        if (!IsHostAllowed(pSock->GetRemoteIP())) {
            pSock->PutStatusNotice("You are being disconnected because your IP is no longer allowed to connect to this user");
            pSock->Close();
        }
    }

    // !Allowed Hosts

    // Servers
    const vector<CServer*>& vServers = User.GetServers();
    CString sServer;
    CServer* pCurServ = GetCurrentServer();

    if (pCurServ) {
        sServer = pCurServ->GetName();
    }

    DelServers();

    for (a = 0; a < vServers.size(); a++) {
        CServer* pServer = vServers[a];
        AddServer(pServer->GetName(), pServer->GetPort(), pServer->GetPass(), pServer->IsSSL());
    }

    m_uServerIdx = 0;
    for (a = 0; a < m_vServers.size(); a++) {
        if (sServer.Equals(m_vServers[a]->GetName())) {
            m_uServerIdx = a + 1;
            break;
        }
    }
    if (m_uServerIdx == 0) {
        m_uServerIdx = m_vServers.size();
        CIRCSock* pSock = GetIRCSock();

        if (pSock) {
            PutStatus("Jumping servers because this server is no longer in the list");
            pSock->Quit();
        }
    }
    // !Servers

    // Chans
    const vector<CChan*>& vChans = User.GetChans();
    for (a = 0; a < vChans.size(); a++) {
        CChan* pNewChan = vChans[a];
        CChan* pChan = FindChan(pNewChan->GetName());

        if (pChan) {
            pChan->SetInConfig(pNewChan->InConfig());
        } else {
            AddChan(pNewChan->GetName(), pNewChan->InConfig());
        }
    }

    for (a = 0; a < m_vChans.size(); a++) {
        CChan* pChan = m_vChans[a];
//.........这里部分代码省略.........
开发者ID:bpcampbe,项目名称:znc,代码行数:101,代码来源:User.cpp

示例4: Clone

bool CUser::Clone(const CUser& User, CString& sErrorRet, bool bCloneNetworks) {
    sErrorRet.clear();

    if (!User.IsValid(sErrorRet, true)) {
        return false;
    }

    // user names can only specified for the constructor, changing it later
    // on breaks too much stuff (e.g. lots of paths depend on the user name)
    if (GetUserName() != User.GetUserName()) {
        DEBUG("Ignoring username in CUser::Clone(), old username ["
              << GetUserName() << "]; New username [" << User.GetUserName()
              << "]");
    }

    if (!User.GetPass().empty()) {
        SetPass(User.GetPass(), User.GetPassHashType(), User.GetPassSalt());
    }

    SetNick(User.GetNick(false));
    SetAltNick(User.GetAltNick(false));
    SetIdent(User.GetIdent(false));
    SetRealName(User.GetRealName());
    SetStatusPrefix(User.GetStatusPrefix());
    SetBindHost(User.GetBindHost());
    SetDCCBindHost(User.GetDCCBindHost());
    SetQuitMsg(User.GetQuitMsg());
    SetSkinName(User.GetSkinName());
    SetDefaultChanModes(User.GetDefaultChanModes());
    SetChanBufferSize(User.GetChanBufferSize(), true);
    SetQueryBufferSize(User.GetQueryBufferSize(), true);
    SetJoinTries(User.JoinTries());
    SetMaxNetworks(User.MaxNetworks());
    SetMaxQueryBuffers(User.MaxQueryBuffers());
    SetMaxJoins(User.MaxJoins());
    SetClientEncoding(User.GetClientEncoding());

    // Allowed Hosts
    m_ssAllowedHosts.clear();
    const set<CString>& ssHosts = User.GetAllowedHosts();
    for (const CString& sHost : ssHosts) {
        AddAllowedHost(sHost);
    }

    for (CClient* pSock : m_vClients) {
        if (!IsHostAllowed(pSock->GetRemoteIP())) {
            pSock->PutStatusNotice(
                "You are being disconnected because your IP is no longer "
                "allowed to connect to this user");
            pSock->Close();
        }
    }

    // !Allowed Hosts

    // Networks
    if (bCloneNetworks) {
        CloneNetworks(User);
    }
    // !Networks

    // CTCP Replies
    m_mssCTCPReplies.clear();
    const MCString& msReplies = User.GetCTCPReplies();
    for (const auto& it : msReplies) {
        AddCTCPReply(it.first, it.second);
    }
    // !CTCP Replies

    // Flags
    SetAutoClearChanBuffer(User.AutoClearChanBuffer());
    SetAutoClearQueryBuffer(User.AutoClearQueryBuffer());
    SetMultiClients(User.MultiClients());
    SetDenyLoadMod(User.DenyLoadMod());
    SetAdmin(User.IsAdmin());
    SetDenySetBindHost(User.DenySetBindHost());
    SetTimestampAppend(User.GetTimestampAppend());
    SetTimestampPrepend(User.GetTimestampPrepend());
    SetTimestampFormat(User.GetTimestampFormat());
    SetTimezone(User.GetTimezone());
    // !Flags

    // Modules
    set<CString> ssUnloadMods;
    CModules& vCurMods = GetModules();
    const CModules& vNewMods = User.GetModules();

    for (CModule* pNewMod : vNewMods) {
        CString sModRet;
        CModule* pCurMod = vCurMods.FindModule(pNewMod->GetModName());

        if (!pCurMod) {
            vCurMods.LoadModule(pNewMod->GetModName(), pNewMod->GetArgs(),
                                CModInfo::UserModule, this, nullptr, sModRet);
        } else if (pNewMod->GetArgs() != pCurMod->GetArgs()) {
            vCurMods.ReloadModule(pNewMod->GetModName(), pNewMod->GetArgs(),
                                  this, nullptr, sModRet);
        }
    }

//.........这里部分代码省略.........
开发者ID:Un1matr1x,项目名称:znc,代码行数:101,代码来源:User.cpp


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