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


C++ Database::LoadServerSettings方法代码示例

本文整理汇总了C++中Database::LoadServerSettings方法的典型用法代码示例。如果您正苦于以下问题:C++ Database::LoadServerSettings方法的具体用法?C++ Database::LoadServerSettings怎么用?C++ Database::LoadServerSettings使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Database的用法示例。


在下文中一共展示了Database::LoadServerSettings方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: TracePacket

void ErrorLog::TracePacket(const char *packetlog, size_t size, ...)
{
	std::string trace = db.LoadServerSettings("options", "trace").c_str();
	std::transform(trace.begin(), trace.end(), trace.begin(), ::toupper);
	if (trace == "TRUE")
	{
		LogPacket(log_network_trace, packetlog, size);
	}
}
开发者ID:jcon321,项目名称:Server,代码行数:9,代码来源:error_log.cpp

示例2: Trace

void ErrorLog::Trace(const char *message, ...)
{
	std::string trace = db.LoadServerSettings("options", "trace").c_str();
	std::transform(trace.begin(), trace.end(), trace.begin(), ::toupper);
	if (trace == "TRUE")
	{
		Log(log_network_trace, message);
	}
}
开发者ID:jcon321,项目名称:Server,代码行数:9,代码来源:error_log.cpp

示例3: DumpOut

bool ErrorLog::DumpOut()
{
	std::string dumpout = db.LoadServerSettings("options", "dump_packets_in").c_str();
	std::transform(dumpout.begin(), dumpout.end(), dumpout.begin(), ::toupper);
	if (dumpout == "TRUE")
	{
		return true;
	}
	return false;
}
开发者ID:jcon321,项目名称:Server,代码行数:10,代码来源:error_log.cpp

示例4: SendClientAuth

void WorldServer::SendClientAuth(unsigned int ip, string account, string key, unsigned int account_id, uint8 version)
{
	ServerPacket *outapp = new ServerPacket(ServerOP_LSClientAuth, sizeof(ServerLSClientAuth));
	ServerLSClientAuth* slsca = (ServerLSClientAuth*)outapp->pBuffer;

	slsca->lsaccount_id = account_id;
	strncpy(slsca->name, account.c_str(), account.size() > 30 ? 30 : account.size());
	strncpy(slsca->key, key.c_str(), 10);
	slsca->lsadmin = 0;
	slsca->worldadmin = 0;
	slsca->ip = ip;
	slsca->version = version;

	in_addr in;
	in.s_addr = ip;connection->GetrIP();
	string client_address(inet_ntoa(in));
	in.s_addr = connection->GetrIP();
	string world_address(inet_ntoa(in));

	if(client_address.compare(world_address) == 0)
	{
		slsca->local = 1;
	}
	else if (client_address.find(db.LoadServerSettings("options", "local_network").c_str()) != string::npos)
	{
		slsca->local = 1;
	}
	else
	{
		slsca->local = 0;
	}

	connection->SendPacket(outapp);

	if (server_log->DumpIn())
	{
		DumpPacket(outapp);
	}
	delete outapp;
}
开发者ID:jcon321,项目名称:Server,代码行数:40,代码来源:world_server.cpp

示例5: Salt

std::string Saltme::Salt(std::string password)
{
	std::string salt;
	std::string presalt;
	// for database value of salt.
#ifdef DBSALT
	if (db.CheckExtraSettings("salt"))
	{
		presalt += db.LoadServerSettings("options", "salt").c_str();
	}
#endif
	// for ini based salt.
#ifdef INISALT
	bool saltini = std::ifstream("salt.ini").good();
	bool loginini = std::ifstream("login.ini").good();
	std::string loadINIvalue = "12345678";
	if (!saltini)
	{
		if (loginini)
		{
			loadINIvalue = cfg.LoadOption("options", "salt", "login.ini");
		}
		std::ofstream dbini("salt.ini");
		dbini << "[Salt]\n";
		dbini << "salt = " + loadINIvalue + "\n";
		dbini.close();
	}
	if (saltini)
	{
		presalt += cfg.LoadOption("Salt", "salt", "salt.ini");
	}
#endif
	// if you want to hard code a salt in code.
#ifdef HARDSALT
	presalt += "12345678";
#endif
	salt = password + presalt;
	return salt;
}
开发者ID:jcon321,项目名称:Server,代码行数:39,代码来源:salt.cpp

示例6: Handle_NewLSInfo


//.........这里部分代码省略.........
		}
	}
	else
	{
		in_addr in;
		in.s_addr = GetConnection()->GetrIP();
		remote_ip = inet_ntoa(in);
		server_log->Log(log_network_error, "Handle_NewLSInfo error, remote address was too long, defaulting to stream address %s.", remote_ip.c_str());
	}

	if(strlen(i->serverversion) <= 64)
	{
		version = i->serverversion;
	}
	else
	{
		server_log->Log(log_network_error, "Handle_NewLSInfo error, server version was too long.");
		return;
	}

	if(strlen(i->protocolversion) <= 25)
	{
		protocol = i->protocolversion;
	}
	else
	{
		server_log->Log(log_network_error, "Handle_NewLSInfo error, protocol version was too long.");
		return;
	}

	server_type = i->servertype;
	logged_in = true;

	if (db.LoadServerSettings("options", "reject_duplicate_servers") == "TRUE")
	{
		if(server.SM->ServerExists(long_name, short_name, this))
		{
			server_log->Log(log_world_error, "World tried to login but there already exists a server that has that name.");
			return;
		}
	}
	else
	{
		if(server.SM->ServerExists(long_name, short_name, this))
		{
			server_log->Log(log_world_error, "World tried to login but there already exists a server that has that name.");
			server.SM->DestroyServerByName(long_name, short_name, this);
		}
	}

	if (db.LoadServerSettings("options", "unregistered_allowed") == "FALSE")
	{
		if(account_name.size() > 0 && account_password.size() > 0)
		{
			unsigned int s_id = 0;
			unsigned int s_list_type = 0;
			unsigned int s_trusted = 0;
			string s_desc;
			string s_list_desc;
			string s_acct_name;
			string s_acct_pass;
			if(db.GetWorldRegistration(s_id, s_desc, s_trusted, s_list_type, s_acct_name, s_acct_pass, long_name, short_name))
			{
				if(s_acct_name.size() == 0 || s_acct_pass.size() == 0)
				{
					server_log->Log(log_world, "Server %s(%s) successfully logged into account that had no user/password requirement.",
开发者ID:jcon321,项目名称:Server,代码行数:67,代码来源:world_server.cpp


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