当前位置: 首页>>代码示例>>C++>>正文


C++ ModeHandler::GetUserParameter方法代码示例

本文整理汇总了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");
		}
	}
}
开发者ID:GGXY,项目名称:inspircd,代码行数:31,代码来源:cmd_mode.cpp

示例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;
		}
	}
}
开发者ID:War3Evo,项目名称:inspircd,代码行数:29,代码来源:mode.cpp

示例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);
		}
	}
}
开发者ID:carriercomm,项目名称:inspircd,代码行数:29,代码来源:core_reloadmodule.cpp

示例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();
}
开发者ID:Canternet,项目名称:inspircd,代码行数:23,代码来源:users.cpp

示例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;
}
开发者ID:Shawn-Smith,项目名称:InspIRCd,代码行数:24,代码来源:users.cpp


注:本文中的ModeHandler::GetUserParameter方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。