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


C++ CChan::GetNickCount方法代码示例

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


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

示例1: AutoCycle

	void AutoCycle(CChan& Channel) {
		if (!IsAutoCycle(Channel.GetName()))
			return;

		// Did we recently annoy opers via cycling of an empty channel?
		if (m_recentlyCycled.HasItem(Channel.GetName()))
			return;

		// Is there only one person left in the channel?
		if (Channel.GetNickCount() != 1)
			return;

		// Is that person us and we don't have op?
		const CNick& pNick = Channel.GetNicks().begin()->second;
		if (!pNick.HasPerm(CChan::Op) && pNick.GetNick().Equals(m_pNetwork->GetCurNick())) {
			Channel.Cycle();
			m_recentlyCycled.AddItem(Channel.GetName());
		}
	}
开发者ID:jimloco,项目名称:znc,代码行数:19,代码来源:autocycle.cpp

示例2: ReadLine


//.........这里部分代码省略.........
				const vector<CChan*>& vChans = m_pNetwork->GetChans();

				for (unsigned int a = 0; a < vChans.size(); a++) {
					vChans[a]->OnWho(sNick, sIdent, sHost);
				}

				break;
			}
			case 353: {  // NAMES
				sRest.Trim();
				// Todo: allow for non @+= server msgs
				CChan* pChan = m_pNetwork->FindChan(sRest.Token(1));
				// If we don't know that channel, some client might have
				// requested a /names for it and we really should forward this.
				if (pChan) {
					CString sNicks = sRest.Token(2, true).TrimPrefix_n();
					pChan->AddNicks(sNicks);
				}

				ForwardRaw353(sLine);

				// We forwarded it already, so return
				return;
			}
			case 366: {  // end of names list
				m_pNetwork->PutUser(sLine);  // First send them the raw

				// :irc.server.com 366 nick #chan :End of /NAMES list.
				CChan* pChan = m_pNetwork->FindChan(sRest.Token(0));

				if (pChan) {
					if (pChan->IsOn()) {
						// If we are the only one in the chan, set our default modes
						if (pChan->GetNickCount() == 1) {
							CString sModes = pChan->GetDefaultModes();

							if (sModes.empty()) {
								sModes = m_pNetwork->GetUser()->GetDefaultChanModes();
							}

							if (!sModes.empty()) {
								PutIRC("MODE " + pChan->GetName() + " " + sModes);
							}
						}
					}
				}

				return;  // return so we don't send them the raw twice
			}
			case 375:  // begin motd
			case 422:  // MOTD File is missing
				m_pNetwork->ClearMotdBuffer();
			case 372:  // motd
			case 376:  // end motd
				m_pNetwork->AddMotdBuffer(":" + sServer + " " + sCmd + " ", " " + sRest);
				break;
			case 437:
				// :irc.server.net 437 * badnick :Nick/channel is temporarily unavailable
				// :irc.server.net 437 mynick badnick :Nick/channel is temporarily unavailable
				// :irc.server.net 437 mynick badnick :Cannot change nickname while banned on channel
				if (m_pNetwork->IsChan(sRest.Token(0)) || sNick != "*")
					break;
			case 432: // :irc.server.com 432 * nick :Erroneous Nickname: Illegal characters
			case 433: {
				CString sBadNick = sRest.Token(0);
开发者ID:jimloco,项目名称:znc,代码行数:66,代码来源:IRCSock.cpp

示例3: ReadLine


//.........这里部分代码省略.........
				const vector<CChan*>& vChans = m_pUser->GetChans();

				for (unsigned int a = 0; a < vChans.size(); a++) {
					vChans[a]->OnWho(sNick, sIdent, sHost);
				}

				break;
			}
			case 353: {  // NAMES
				sRest.Trim();
				// Todo: allow for non @+= server msgs
				CChan* pChan = m_pUser->FindChan(sRest.Token(1));
				// If we don't know that channel, some client might have
				// requested a /names for it and we really should forward this.
				if (pChan) {
					CString sNicks = sRest.Token(2, true);
					if (sNicks.Left(1) == ":") {
						sNicks.LeftChomp();
					}

					pChan->AddNicks(sNicks);
				}

				ForwardRaw353(sLine);

				// We forwarded it already, so return
				return;
			}
			case 366: {  // end of names list
				m_pUser->PutUser(sLine);  // First send them the raw

				// :irc.server.com 366 nick #chan :End of /NAMES list.
				CChan* pChan = m_pUser->FindChan(sRest.Token(0));

				if (pChan) {
					if (pChan->IsOn()) {
						// If we are the only one in the chan, set our default modes
						if (pChan->GetNickCount() == 1) {
							CString sModes = pChan->GetDefaultModes();

							if (sModes.empty()) {
								sModes = m_pUser->GetDefaultChanModes();
							}

							if (!sModes.empty()) {
								PutIRC("MODE " + pChan->GetName() + " " + sModes);
							}
						}
					}
				}

				return;  // return so we don't send them the raw twice
			}
			case 375:  // begin motd
			case 422:  // MOTD File is missing
				m_pUser->ClearMotdBuffer();
			case 372:  // motd
			case 376:  // end motd
				m_pUser->AddMotdBuffer(":" + sServer + " " + sCmd + " ", " " + sRest);
				break;
			case 437:
				// :irc.server.net 437 * badnick :Nick/channel is temporarily unavailable
				// :irc.server.net 437 mynick badnick :Nick/channel is temporarily unavailable
				// :irc.server.net 437 mynick badnick :Cannot change nickname while banned on channel
				if (m_pUser->IsChan(sRest.Token(0)) || sNick != "*")
					break;
			case 432: // :irc.server.com 432 * nick :Erroneous Nickname: Illegal characters
			case 433: {
				CString sBadNick = sRest.Token(0);

				if (!m_bAuthed) {
					SendAltNick(sBadNick);
					return;
				}
				break;
			}
			case 451:
				// :irc.server.com 451 CAP :You have not registered
				// Servers that dont support CAP will give us this error, dont send it to the client
				if (sNick.Equals("CAP"))
					return;
			case 470: {
				// :irc.unreal.net 470 mynick [Link] #chan1 has become full, so you are automatically being transferred to the linked channel #chan2
				// :mccaffrey.freenode.net 470 mynick #electronics ##electronics :Forwarding to another channel

				// freenode style numeric
				CChan* pChan = m_pUser->FindChan(sRest.Token(0));
				if (!pChan) {
					// unreal style numeric
					pChan = m_pUser->FindChan(sRest.Token(1));
				}
				if (pChan) {
					pChan->Disable();
					m_pUser->PutStatus("Channel [" + pChan->GetName() + "] is linked to "
							"another channel and was thus disabled.");
				}
				break;
			}
		}
	} else {
开发者ID:stevestreza,项目名称:ZNC-Node,代码行数:101,代码来源:IRCSock.cpp

示例4: OnNumericMessage


//.........这里部分代码省略.........
            pChan->OnWho(sNick, sIdent, sHost);
        }

        CChan* pChan = m_pNetwork->FindChan(sChan);
        if (pChan && pChan->IsDetached()) {
            return true;
        }

        break;
    }
    case 353: {  // NAMES
        // :irc.server.com 353 nick @ #chan :nick1 nick2
        // Todo: allow for non @+= server msgs
        CChan* pChan = m_pNetwork->FindChan(Message.GetParam(2));
        // If we don't know that channel, some client might have
        // requested a /names for it and we really should forward this.
        if (pChan) {
            CString sNicks = Message.GetParam(3);
            pChan->AddNicks(sNicks);
            if (pChan->IsDetached()) {
                return true;
            }
        }

        break;
    }
    case 366: {  // end of names list
        // :irc.server.com 366 nick #chan :End of /NAMES list.
        CChan* pChan = m_pNetwork->FindChan(Message.GetParam(1));

        if (pChan) {
            if (pChan->IsOn()) {
                // If we are the only one in the chan, set our default modes
                if (pChan->GetNickCount() == 1) {
                    CString sModes = pChan->GetDefaultModes();

                    if (sModes.empty()) {
                        sModes =
                            m_pNetwork->GetUser()->GetDefaultChanModes();
                    }

                    if (!sModes.empty()) {
                        PutIRC("MODE " + pChan->GetName() + " " + sModes);
                    }
                }
            }
            if (pChan->IsDetached()) {
                // don't put it to clients
                return true;
            }
        }

        break;
    }
    case 375:  // begin motd
    case 422:  // MOTD File is missing
        if (m_pNetwork->GetIRCServer().Equals(sServer)) {
            m_pNetwork->ClearMotdBuffer();
        }
    case 372:  // motd
    case 376:  // end motd
        if (m_pNetwork->GetIRCServer().Equals(sServer)) {
            m_pNetwork->AddMotdBuffer(BufferMessage(Message));
        }
        break;
    case 437:
开发者ID:fnordcordia,项目名称:znc,代码行数:67,代码来源:IRCSock.cpp


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