本文整理汇总了C++中ModeHandler::GetUserParameter方法的典型用法代码示例。如果您正苦于以下问题:C++ ModeHandler::GetUserParameter方法的具体用法?C++ ModeHandler::GetUserParameter怎么用?C++ ModeHandler::GetUserParameter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ModeHandler
的用法示例。
在下文中一共展示了ModeHandler::GetUserParameter方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DisplayCurrentModes
void CommandMode::DisplayCurrentModes(User* user, User* targetuser, Channel* targetchannel)
{
if (targetchannel)
{
// Display channel's current mode string
user->WriteNumeric(RPL_CHANNELMODEIS, targetchannel->name, (std::string("+") + targetchannel->ChanModes(targetchannel->HasUser(user))));
user->WriteNumeric(RPL_CHANNELCREATED, targetchannel->name, (unsigned long)targetchannel->age);
}
else
{
if (targetuser == user || user->HasPrivPermission("users/auspex"))
{
// Display user's current mode string
// XXX: Use WriteServ() because WriteNumeric() assumes the target (i.e. next word after the number)
// is 'user' and puts his nick there which is not what we want
user->WriteServ("%03d %s :+%s", RPL_UMODEIS, targetuser->nick.c_str(), targetuser->FormatModes());
if (targetuser->IsOper())
{
ModeHandler* snomask = ServerInstance->Modes->FindMode('s', MODETYPE_USER);
std::string snomaskstr = snomask->GetUserParameter(user);
// snomaskstr is empty if the snomask mode isn't set, otherwise it begins with a '+'.
// In the former case output a "+", not an empty string.
user->WriteServ("%03d %s %s%s :Server notice mask", RPL_SNOMASKIS, targetuser->nick.c_str(), (snomaskstr.empty() ? "+" : ""), snomaskstr.c_str());
}
}
else
{
user->WriteNumeric(ERR_USERSDONTMATCH, "Can't view modes for other users");
}
}
}
示例2: DisplayCurrentModes
void ModeParser::DisplayCurrentModes(User *user, User* targetuser, Channel* targetchannel, const char* text)
{
if (targetchannel)
{
/* Display channel's current mode string */
user->WriteNumeric(RPL_CHANNELMODEIS, "%s +%s", targetchannel->name.c_str(), targetchannel->ChanModes(targetchannel->HasUser(user)));
user->WriteNumeric(RPL_CHANNELCREATED, "%s %lu", targetchannel->name.c_str(), (unsigned long)targetchannel->age);
return;
}
else
{
if (targetuser == user || user->HasPrivPermission("users/auspex"))
{
/* Display user's current mode string */
user->WriteNumeric(RPL_UMODEIS, ":+%s", targetuser->FormatModes());
if ((targetuser->IsOper()))
{
ModeHandler* snomask = FindMode('s', MODETYPE_USER);
user->WriteNumeric(RPL_SNOMASKIS, "%s :Server notice mask", snomask->GetUserParameter(user).c_str());
}
return;
}
else
{
user->WriteNumeric(ERR_USERSDONTMATCH, ":Can't view modes for other users");
return;
}
}
}
示例3: DoSaveUsers
void DataKeeper::DoSaveUsers()
{
ModesExts currdata;
const user_hash& users = ServerInstance->Users->GetUsers();
for (user_hash::const_iterator i = users.begin(); i != users.end(); ++i)
{
User* const user = i->second;
// Serialize user modes
for (size_t j = 0; j < handledmodes[MODETYPE_USER].size(); j++)
{
ModeHandler* mh = handledmodes[MODETYPE_USER][j].mh;
if (user->IsModeSet(mh))
currdata.modelist.push_back(InstanceData(j, mh->GetUserParameter(user)));
}
// Serialize all extensions attached to the User
SaveExtensions(user, currdata.extlist);
// Add to list if the user has any modes or extensions set that we are interested in, otherwise we don't
// have to do anything with this user when restoring
if (!currdata.empty())
{
userdatalist.push_back(UserData(user->uuid));
userdatalist.back().swap(currdata);
}
}
}
示例4: FormatModes
const char* User::FormatModes(bool showparameters)
{
static std::string data;
std::string params;
data.clear();
for (unsigned char n = 0; n < 64; n++)
{
ModeHandler* mh = ServerInstance->Modes->FindMode(n + 65, MODETYPE_USER);
if (mh && IsModeSet(mh))
{
data.push_back(n + 65);
if (showparameters && mh->GetNumParams(true))
{
std::string p = mh->GetUserParameter(this);
if (p.length())
params.append(" ").append(p);
}
}
}
data += params;
return data.c_str();
}
示例5: FormatModes
const char* User::FormatModes(bool showparameters)
{
static char data[MAXBUF];
std::string params;
int offset = 0;
for (unsigned char n = 0; n < 64; n++)
{
if (modes[n])
{
data[offset++] = n + 65;
ModeHandler* mh = ServerInstance->Modes->FindMode(n + 65, MODETYPE_USER);
if (showparameters && mh && mh->GetNumParams(true))
{
std::string p = mh->GetUserParameter(this);
if (p.length())
params.append(" ").append(p);
}
}
}
data[offset] = 0;
strlcat(data, params.c_str(), MAXBUF);
return data;
}