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


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

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


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

示例1: Handle_NewLSInfo


//.........这里部分代码省略.........
					}
				}
				else
				{
					server_log->Log(log_world, "Server %s(%s) attempted to log in but account and password did not match the entry in the database, and only"
						" registered servers are allowed.", long_name.c_str(), short_name.c_str());
					return;
				}
			}
			else
			{
				server_log->Log(log_world, "Server %s(%s) attempted to log in but database couldn't find an entry and only registered servers are allowed.",
					long_name.c_str(), short_name.c_str());
				return;
			}
		}
		else
		{
			server_log->Log(log_world, "Server %s(%s) did not attempt to log in but only registered servers are allowed.",
				long_name.c_str(), short_name.c_str());
			return;
		}
	}
	else
	{
		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(account_name.size() > 0 && account_password.size() > 0)
			{
				if(s_acct_name.compare(account_name) == 0 && s_acct_pass.compare(account_password) == 0)
				{
					server_log->Log(log_world, "Server %s(%s) successfully logged in.", long_name.c_str(), short_name.c_str());
					authorized = true;
					SetRuntimeID(s_id);
					server_list_type = s_list_type;
					desc = s_desc;
					if(s_trusted)
					{
						server_log->Log(log_network_trace, "ServerOP_LSAccountUpdate sent to world");
						trusted = true;
						ServerPacket *outapp = new ServerPacket(ServerOP_LSAccountUpdate, 0);
						connection->SendPacket(outapp);
					}
				}
				else
				{
					// this is the first of two cases where we should deny access even if unregistered is allowed
					server_log->Log(log_world, "Server %s(%s) attempted to log in but account and password did not match the entry in the database.",
						long_name.c_str(), short_name.c_str());
				}
			}
			else
			{
				if(s_acct_name.size() > 0 || s_acct_pass.size() > 0)
				{
					// this is the second of two cases where we should deny access even if unregistered is allowed
					server_log->Log(log_world, "Server %s(%s) did not attempt to log in but this server requires a password.",
						long_name.c_str(), short_name.c_str());
				}
				else
				{
					server_log->Log(log_world, "Server %s(%s) did not attempt to log in but unregistered servers are allowed.",
						long_name.c_str(), short_name.c_str());
					authorized = true;
					SetRuntimeID(s_id);
					server_list_type = 0;
				}
			}
		}
		else
		{
			s_id = 0;
			server_log->Log(log_world, "Server %s(%s) attempted to log in but database couldn't find an entry but unregistered servers are allowed.",
				long_name.c_str(), short_name.c_str());
			if(db.CreateWorldRegistration(long_name, short_name, s_id))
			{
				authorized = true;
				SetRuntimeID(s_id);
				server_list_type = 0;
			}
		}
	}

	in_addr in;
	in.s_addr = connection->GetrIP();
	db.UpdateWorldRegistration(GetRuntimeID(), long_name, string(inet_ntoa(in)));

	if(authorized)
	{
		server.CM->UpdateServerList();
	}
}
开发者ID:jcon321,项目名称:Server,代码行数:101,代码来源:world_server.cpp


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