本文整理汇总了C++中ModeHandler::DisplayList方法的典型用法代码示例。如果您正苦于以下问题:C++ ModeHandler::DisplayList方法的具体用法?C++ ModeHandler::DisplayList怎么用?C++ ModeHandler::DisplayList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ModeHandler
的用法示例。
在下文中一共展示了ModeHandler::DisplayList方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DisplayListModes
void ModeParser::DisplayListModes(User* user, Channel* chan, std::string &mode_sequence)
{
seq++;
for (std::string::const_iterator letter = mode_sequence.begin(); letter != mode_sequence.end(); letter++)
{
unsigned char mletter = *letter;
if (mletter == '+')
continue;
/* Ensure the user doesnt request the same mode twice,
* so they cant flood themselves off out of idiocy.
*/
if (sent[mletter] == seq)
continue;
sent[mletter] = seq;
ModeHandler *mh = this->FindMode(mletter, MODETYPE_CHANNEL);
if (!mh || !mh->IsListMode())
return;
ModResult MOD_RESULT;
FIRST_MOD_RESULT(OnRawMode, MOD_RESULT, (user, chan, mletter, "", true, 0));
if (MOD_RESULT == MOD_RES_DENY)
continue;
bool display = true;
if (!user->HasPrivPermission("channels/auspex") && ServerInstance->Config->HideModeLists[mletter] && (chan->GetPrefixValue(user) < HALFOP_VALUE))
{
user->WriteNumeric(ERR_CHANOPRIVSNEEDED, "%s %s :You do not have access to view the +%c list",
user->nick.c_str(), chan->name.c_str(), mletter);
display = false;
}
// Ask mode watchers whether it's OK to show the list
std::pair<ModeWatchIter, ModeWatchIter> itpair = modewatchermap.equal_range(mh->name);
for (ModeWatchIter i = itpair.first; i != itpair.second; ++i)
{
ModeWatcher* mw = i->second;
if (mw->GetModeType() == MODETYPE_CHANNEL)
{
std::string dummyparam;
if (!mw->BeforeMode(user, NULL, chan, dummyparam, true))
{
// A mode watcher doesn't want us to show the list
display = false;
break;
}
}
}
if (display)
mh->DisplayList(user, chan);
else
mh->DisplayEmptyList(user, chan);
}
}