本文整理汇总了C++中modes::ChangeList::push方法的典型用法代码示例。如果您正苦于以下问题:C++ ChangeList::push方法的具体用法?C++ ChangeList::push怎么用?C++ ChangeList::push使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类modes::ChangeList
的用法示例。
在下文中一共展示了ChangeList::push方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetOperPrefix
void SetOperPrefix(User* user, bool add)
{
Modes::ChangeList changelist;
changelist.push(&opm, add, user->nick);
for (User::ChanList::iterator v = user->chans.begin(); v != user->chans.end(); v++)
ServerInstance->Modes->Process(ServerInstance->FakeClient, (*v)->chan, NULL, changelist);
}
示例2: ModeParamsToChangeList
void ModeParser::ModeParamsToChangeList(User* user, ModeType type, const std::vector<std::string>& parameters, Modes::ChangeList& changelist, unsigned int beginindex, unsigned int endindex)
{
if (endindex > parameters.size())
endindex = parameters.size();
const std::string& mode_sequence = parameters[beginindex];
bool adding = true;
unsigned int param_at = beginindex+1;
for (std::string::const_iterator letter = mode_sequence.begin(); letter != mode_sequence.end(); letter++)
{
unsigned char modechar = *letter;
if (modechar == '+' || modechar == '-')
{
adding = (modechar == '+');
continue;
}
ModeHandler *mh = this->FindMode(modechar, type);
if (!mh)
{
/* No mode handler? Unknown mode character then. */
user->WriteNumeric(type == MODETYPE_CHANNEL ? ERR_UNKNOWNMODE : ERR_UNKNOWNSNOMASK, "%c :is unknown mode char to me", modechar);
continue;
}
std::string parameter;
if (mh->GetNumParams(adding) && param_at < endindex)
parameter = parameters[param_at++];
changelist.push(mh, adding, parameter);
}
}
示例3: HandleLocal
CmdResult HandleLocal(const std::vector<std::string>& parameters, LocalUser* src)
{
Channel* const chan = ServerInstance->FindChan(parameters[0]);
if (!chan)
{
src->WriteNumeric(Numerics::NoSuchNick(parameters[0]));
return CMD_FAILURE;
}
if (parameters.size() == 1)
{
DisplayList(src, chan);
return CMD_SUCCESS;
}
unsigned int i = 1;
Modes::ChangeList modes;
while (i < parameters.size())
{
std::string prop = parameters[i++];
if (prop.empty())
continue;
bool plus = prop[0] != '-';
if (prop[0] == '+' || prop[0] == '-')
prop.erase(prop.begin());
ModeHandler* mh = ServerInstance->Modes->FindMode(prop, MODETYPE_CHANNEL);
if (mh)
{
if (mh->NeedsParam(plus))
{
if (i != parameters.size())
modes.push(mh, plus, parameters[i++]);
}
else
modes.push(mh, plus);
}
}
ServerInstance->Modes->ProcessSingle(src, chan, NULL, modes, ModeParser::MODE_CHECKACCESS);
return CMD_SUCCESS;
}