本文整理汇总了C++中CChan::AddNicks方法的典型用法代码示例。如果您正苦于以下问题:C++ CChan::AddNicks方法的具体用法?C++ CChan::AddNicks怎么用?C++ CChan::AddNicks使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CChan
的用法示例。
在下文中一共展示了CChan::AddNicks方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ReadLine
//.........这里部分代码省略.........
case 352: {
// :irc.yourserver.com 352 yournick #chan ident theirhost.com irc.theirserver.com theirnick H :0 Real Name
sServer = sLine.Token(0);
sNick = sLine.Token(7);
CString sIdent = sLine.Token(4);
CString sHost = sLine.Token(5);
sServer.LeftChomp();
if (sNick.Equals(GetNick())) {
m_Nick.SetIdent(sIdent);
m_Nick.SetHost(sHost);
}
m_pNetwork->SetIRCNick(m_Nick);
m_pNetwork->SetIRCServer(sServer);
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
}
示例2: ReadLine
//.........这里部分代码省略.........
CString sIdent = sLine.Token(4);
CString sHost = sLine.Token(5);
sServer.LeftChomp();
if (sNick.Equals(GetNick())) {
m_Nick.SetIdent(sIdent);
m_Nick.SetHost(sHost);
}
m_pUser->SetIRCNick(m_Nick);
m_pUser->SetIRCServer(sServer);
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
}
示例3: OnNumericMessage
//.........这里部分代码省略.........
CString sChan = Message.GetParam(1);
CString sIdent = Message.GetParam(2);
CString sHost = Message.GetParam(3);
if (sNick.Equals(GetNick())) {
m_Nick.SetIdent(sIdent);
m_Nick.SetHost(sHost);
}
m_pNetwork->SetIRCNick(m_Nick);
m_pNetwork->SetIRCServer(sServer);
const vector<CChan*>& vChans = m_pNetwork->GetChans();
for (CChan* pChan : vChans) {
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;
}
}