本文整理汇总了C++中CNick::RemPerm方法的典型用法代码示例。如果您正苦于以下问题:C++ CNick::RemPerm方法的具体用法?C++ CNick::RemPerm怎么用?C++ CNick::RemPerm使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CNick
的用法示例。
在下文中一共展示了CNick::RemPerm方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ModeChange
void CChan::ModeChange(const CString& sModes, const CString& sOpNick) {
CString sModeArg = sModes.Token(0);
CString sArgs = sModes.Token(1, true);
bool bAdd = true;
#ifdef _MODULES
CNick* pOpNick = FindNick(sOpNick);
if (pOpNick) {
MODULECALL(OnRawMode(*pOpNick, *this, sModeArg, sArgs), m_pUser, NULL, );
}
#endif
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 (m_pUser->GetIRCSock()->IsPermMode(uMode)) {
CString sArg = GetModeArg(sArgs);
CNick* pNick = FindNick(sArg);
if (pNick) {
unsigned char uPerm = m_pUser->GetIRCSock()->GetPermFromMode(uMode);
if (uPerm) {
if (bAdd) {
pNick->AddPerm(uPerm);
if (pNick->GetNick().Equals(m_pUser->GetCurNick())) {
AddPerm(uPerm);
}
} else {
pNick->RemPerm(uPerm);
if (pNick->GetNick().Equals(m_pUser->GetCurNick())) {
RemPerm(uPerm);
}
}
#ifdef _MODULES
bool bNoChange = (pNick->HasPerm(uPerm) == bAdd);
if (uMode && pOpNick) {
MODULECALL(OnChanPermission(*pOpNick, *pNick, *this, uMode, bAdd, bNoChange), m_pUser, NULL, );
if (uMode == CChan::M_Op) {
if (bAdd) {
MODULECALL(OnOp(*pOpNick, *pNick, *this, bNoChange), m_pUser, NULL, );
} else {
MODULECALL(OnDeop(*pOpNick, *pNick, *this, bNoChange), m_pUser, NULL, );
}
} else if (uMode == CChan::M_Voice) {
if (bAdd) {
MODULECALL(OnVoice(*pOpNick, *pNick, *this, bNoChange), m_pUser, NULL, );
} else {
MODULECALL(OnDevoice(*pOpNick, *pNick, *this, bNoChange), m_pUser, NULL, );
}
}
}
示例2: ModeChange
void CChan::ModeChange(const CString& sModes, const CNick* pOpNick) {
CString sModeArg = sModes.Token(0);
CString sArgs = sModes.Token(1, true);
bool bAdd = true;
/* Try to find a CNick* from this channel so that pOpNick->HasPerm()
* works as expected. */
if (pOpNick) {
CNick* OpNick = FindNick(pOpNick->GetNick());
/* If nothing was found, use the original pOpNick, else use the
* CNick* from FindNick() */
if (OpNick)
pOpNick = OpNick;
}
if (pOpNick) {
NETWORKMODULECALL(OnRawMode(*pOpNick, *this, sModeArg, sArgs), m_pNetwork->GetUser(), m_pNetwork, NULL, NOTHING);
}
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 (m_pNetwork->GetIRCSock()->IsPermMode(uMode)) {
CString sArg = GetModeArg(sArgs);
CNick* pNick = FindNick(sArg);
if (pNick) {
unsigned char uPerm = m_pNetwork->GetIRCSock()->GetPermFromMode(uMode);
if (uPerm) {
if (bAdd) {
pNick->AddPerm(uPerm);
if (pNick->GetNick().Equals(m_pNetwork->GetCurNick())) {
AddPerm(uPerm);
}
} else {
pNick->RemPerm(uPerm);
if (pNick->GetNick().Equals(m_pNetwork->GetCurNick())) {
RemPerm(uPerm);
}
}
bool bNoChange = (pNick->HasPerm(uPerm) == bAdd);
if (uMode && pOpNick) {
NETWORKMODULECALL(OnChanPermission(*pOpNick, *pNick, *this, uMode, bAdd, bNoChange), m_pNetwork->GetUser(), m_pNetwork, NULL, NOTHING);
if (uMode == CChan::M_Op) {
if (bAdd) {
NETWORKMODULECALL(OnOp(*pOpNick, *pNick, *this, bNoChange), m_pNetwork->GetUser(), m_pNetwork, NULL, NOTHING);
} else {
NETWORKMODULECALL(OnDeop(*pOpNick, *pNick, *this, bNoChange), m_pNetwork->GetUser(), m_pNetwork, NULL, NOTHING);
}
} else if (uMode == CChan::M_Voice) {
if (bAdd) {
NETWORKMODULECALL(OnVoice(*pOpNick, *pNick, *this, bNoChange), m_pNetwork->GetUser(), m_pNetwork, NULL, NOTHING);
} else {
NETWORKMODULECALL(OnDevoice(*pOpNick, *pNick, *this, bNoChange), m_pNetwork->GetUser(), m_pNetwork, NULL, NOTHING);
}
}
}
}
}
} else {
bool bList = false;
CString sArg;
switch (m_pNetwork->GetIRCSock()->GetModeType(uMode)) {
case CIRCSock::ListArg:
bList = true;
sArg = GetModeArg(sArgs);
break;
case CIRCSock::HasArg:
sArg = GetModeArg(sArgs);
break;
case CIRCSock::NoArg:
break;
case CIRCSock::ArgWhenSet:
if (bAdd) {
sArg = GetModeArg(sArgs);
}
break;
}
bool bNoChange;
if (bList) {
bNoChange = false;
} else if (bAdd) {
bNoChange = HasMode(uMode) && GetModeArg(uMode) == sArg;
} else {
bNoChange = !HasMode(uMode);
}
NETWORKMODULECALL(OnMode(*pOpNick, *this, uMode, sArg, bAdd, bNoChange), m_pNetwork->GetUser(), m_pNetwork, NULL, NOTHING);
if (!bList) {
//.........这里部分代码省略.........
示例3: ModeChange
void CChan::ModeChange(const CString& sModes, const CNick* pOpNick) {
CString sModeArg = sModes.Token(0);
CString sArgs = sModes.Token(1, true);
bool bAdd = true;
/* Try to find a CNick* from this channel so that pOpNick->HasPerm()
* works as expected. */
if (pOpNick) {
CNick* OpNick = FindNick(pOpNick->GetNick());
/* If nothing was found, use the original pOpNick, else use the
* CNick* from FindNick() */
if (OpNick) pOpNick = OpNick;
}
NETWORKMODULECALL(OnRawMode2(pOpNick, *this, sModeArg, sArgs),
m_pNetwork->GetUser(), m_pNetwork, nullptr, NOTHING);
for (unsigned int a = 0; a < sModeArg.size(); a++) {
const char& cMode = sModeArg[a];
if (cMode == '+') {
bAdd = true;
} else if (cMode == '-') {
bAdd = false;
} else if (m_pNetwork->GetIRCSock()->IsPermMode(cMode)) {
CString sArg = GetModeArg(sArgs);
CNick* pNick = FindNick(sArg);
if (pNick) {
char cPerm =
m_pNetwork->GetIRCSock()->GetPermFromMode(cMode);
if (cPerm) {
bool bNoChange = (pNick->HasPerm(cPerm) == bAdd);
if (bAdd) {
pNick->AddPerm(cPerm);
if (pNick->NickEquals(m_pNetwork->GetCurNick())) {
AddPerm(cPerm);
}
} else {
pNick->RemPerm(cPerm);
if (pNick->NickEquals(m_pNetwork->GetCurNick())) {
RemPerm(cPerm);
}
}
NETWORKMODULECALL(OnChanPermission3(pOpNick, *pNick, *this,
cMode, bAdd, bNoChange),
m_pNetwork->GetUser(), m_pNetwork,
nullptr, NOTHING);
if (cMode == CChan::M_Op) {
if (bAdd) {
NETWORKMODULECALL(
OnOp2(pOpNick, *pNick, *this, bNoChange),
m_pNetwork->GetUser(), m_pNetwork, nullptr,
NOTHING);
} else {
NETWORKMODULECALL(
OnDeop2(pOpNick, *pNick, *this, bNoChange),
m_pNetwork->GetUser(), m_pNetwork, nullptr,
NOTHING);
}
} else if (cMode == CChan::M_Voice) {
if (bAdd) {
NETWORKMODULECALL(
OnVoice2(pOpNick, *pNick, *this, bNoChange),
m_pNetwork->GetUser(), m_pNetwork, nullptr,
NOTHING);
} else {
NETWORKMODULECALL(
OnDevoice2(pOpNick, *pNick, *this, bNoChange),
m_pNetwork->GetUser(), m_pNetwork, nullptr,
NOTHING);
}
}
}
}
} else {
bool bList = false;
CString sArg;
switch (m_pNetwork->GetIRCSock()->GetModeType(cMode)) {
case CIRCSock::ListArg:
bList = true;
sArg = GetModeArg(sArgs);
break;
case CIRCSock::HasArg:
sArg = GetModeArg(sArgs);
break;
case CIRCSock::NoArg:
break;
case CIRCSock::ArgWhenSet:
if (bAdd) {
sArg = GetModeArg(sArgs);
}
break;
//.........这里部分代码省略.........