Exemplo n.º 1
0
void ServerUserInfo::GetLocation(std::wstring &location)
{
	if(user_offline == state)
	{
		location = L"ÀëÏß";
		return;
	}
	else
	{
		ServerList *sList = ServerList::Instance();

		Handle<ServerInfo> server;
		if(sList->GetServer(serverid, server))
		{
			location = server->GetName();
		}
		else
			location = L"δ֪À´Ô´";
	}
}
Exemplo n.º 2
0
int LuaV6Chat3App::GetServerInfoByID(lua_State *luaState)
{
	V6Chat3App *App = GetV6Chat3App(luaState);
	if (App)
	{
		int id = lua_tointeger(luaState, 2);
		ServerList *list = ServerList::Instance();
		Handle<ServerInfo> server;

		if(list->GetServer(id, server))
		{
			lua_newtable(luaState);
			lua_pushstring(luaState, "id");
			lua_pushnumber(luaState, server->GetId());
			lua_settable(luaState,-3);   // 弹出key,value,并设置到subtable里面去
			lua_pushstring(luaState, "server_name");
			lua_pushstring(luaState, V6Util::UnicodeToUtf8(server->GetName().c_str()).c_str());
			lua_settable(luaState,-3);   // 弹出key,value,并设置到subtable里面去
			lua_pushstring(luaState, "account");
			lua_pushstring(luaState, server->GetUid().c_str());
			lua_settable(luaState,-3);   // 弹出key,value,并设置到subtable里面去
			lua_pushstring(luaState, "password");
			lua_pushstring(luaState, server->GetUpassword().c_str());
			lua_settable(luaState,-3);   // 弹出key,value,并设置到subtable里面去
			lua_pushstring(luaState, "introduction");
			lua_pushstring(luaState, V6Util::UnicodeToUtf8(server->GetDescription().c_str()).c_str());
			lua_settable(luaState,-3);   // 弹出key,value,并设置到subtable里面去
			lua_pushstring(luaState, "domain");
			lua_pushstring(luaState, server->GetIp().c_str());
			lua_settable(luaState,-3);   // 弹出key,value,并设置到subtable里面去
			lua_pushstring(luaState, "state");
			lua_pushnumber(luaState, server->GetState());
			lua_settable(luaState,-3);   // 弹出key,value,并设置到subtable里面去
			return 1;
		}
	}
	lua_pushnil(luaState);
	return 1;
}