本文整理汇总了C++中CChan::ModeChange方法的典型用法代码示例。如果您正苦于以下问题:C++ CChan::ModeChange方法的具体用法?C++ CChan::ModeChange怎么用?C++ CChan::ModeChange使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CChan
的用法示例。
在下文中一共展示了CChan::ModeChange方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnModeMessage
bool CIRCSock::OnModeMessage(CModeMessage& Message) {
const CNick& Nick = Message.GetNick();
CString sTarget = Message.GetTarget();
CString sModes = Message.GetModes();
CChan* pChan = m_pNetwork->FindChan(sTarget);
if (pChan) {
pChan->ModeChange(sModes, &Nick);
if (pChan->IsDetached()) {
return true;
}
} else if (sTarget == m_Nick.GetNick()) {
CString sModeArg = sModes.Token(0);
bool bAdd = true;
/* no module call defined (yet?)
MODULECALL(OnRawUserMode(*pOpNick, *this, sModeArg, sArgs),
m_pNetwork->GetUser(), nullptr, );
*/
for (unsigned int a = 0; a < sModeArg.size(); a++) {
const unsigned char& uMode = sModeArg[a];
if (uMode == '+') {
bAdd = true;
} else if (uMode == '-') {
bAdd = false;
} else {
if (bAdd) {
m_scUserModes.insert(uMode);
} else {
m_scUserModes.erase(uMode);
}
}
}
}
return false;
}
示例2: ReadLine
//.........这里部分代码省略.........
CChan* pChan = m_pNetwork->FindChan(sChan);
bool bDetached = false;
if (pChan) {
pChan->RemNick(Nick.GetNick());
NETWORKMODULECALL(OnPart(Nick.GetNickMask(), *pChan, sMsg), m_pNetwork->GetUser(), m_pNetwork, NULL, NOTHING);
if (pChan->IsDetached())
bDetached = true;
}
// Todo: use nick compare function
if (Nick.GetNick().Equals(GetNick())) {
m_pNetwork->DelChan(sChan);
}
/*
* We use this boolean because
* m_pNetwork->DelChan() will delete this channel
* and thus we would dereference an
* already-freed pointer!
*/
if (bDetached) {
return;
}
} else if (sCmd.Equals("MODE")) {
CString sTarget = sRest.Token(0);
CString sModes = sRest.Token(1, true);
if (sModes.Left(1) == ":")
sModes = sModes.substr(1);
CChan* pChan = m_pNetwork->FindChan(sTarget);
if (pChan) {
pChan->ModeChange(sModes, &Nick);
if (pChan->IsDetached()) {
return;
}
} else if (sTarget == m_Nick.GetNick()) {
CString sModeArg = sModes.Token(0);
bool bAdd = true;
/* no module call defined (yet?)
MODULECALL(OnRawUserMode(*pOpNick, *this, sModeArg, sArgs), m_pNetwork->GetUser(), NULL, );
*/
for (unsigned int a = 0; a < sModeArg.size(); a++) {
const unsigned char& uMode = sModeArg[a];
if (uMode == '+') {
bAdd = true;
} else if (uMode == '-') {
bAdd = false;
} else {
if (bAdd) {
m_scUserModes.insert(uMode);
} else {
m_scUserModes.erase(uMode);
}
}
}
}
} else if (sCmd.Equals("KICK")) {
// :[email protected] KICK #chan nick :msg
CString sChan = sRest.Token(0);
CString sKickedNick = sRest.Token(1);
CString sMsg = sRest.Token(2, true);
sMsg.LeftChomp();