1
0
mirror of https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git synced 2025-07-17 10:52:46 +00:00

Convert server name stuff to plString

This commit is contained in:
2015-01-03 00:42:29 -05:00
parent 5b0a8f62e6
commit 2039d88025
16 changed files with 124 additions and 149 deletions

View File

@ -871,7 +871,7 @@ void StatusCallback(void *param)
HWND hwnd = (HWND)param;
const char *statusUrl = GetServerStatusUrl();
plString statusUrl = GetServerStatusUrl();
CURL *hCurl = curl_easy_init();
// For reporting errors
@ -880,14 +880,14 @@ void StatusCallback(void *param)
while(s_loginDlgRunning)
{
curl_easy_setopt(hCurl, CURLOPT_URL, statusUrl);
curl_easy_setopt(hCurl, CURLOPT_URL, statusUrl.c_str());
curl_easy_setopt(hCurl, CURLOPT_USERAGENT, "UruClient/1.0");
curl_easy_setopt(hCurl, CURLOPT_WRITEFUNCTION, &CurlCallback);
curl_easy_setopt(hCurl, CURLOPT_WRITEDATA, param);
if (statusUrl[0] && curl_easy_perform(hCurl) != 0) // only perform request if there's actually a URL set
if (!statusUrl.IsEmpty() && curl_easy_perform(hCurl) != 0) // only perform request if there's actually a URL set
PostMessage(hwnd, WM_USER_SETSTATUSMSG, 0, (LPARAM) curlError);
for(unsigned i = 0; i < UPDATE_STATUSMSG_SECONDS && s_loginDlgRunning; ++i)
{
Sleep(1000);
@ -1033,8 +1033,8 @@ BOOL CALLBACK UruLoginDialogProc( HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM
}
else if (HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) == IDC_URULOGIN_NEWACCTLINK)
{
const char* signupurl = GetServerSignupUrl();
ShellExecuteA(NULL, "open", signupurl, NULL, NULL, SW_SHOWNORMAL);
plString signupurl = GetServerSignupUrl();
ShellExecuteW(NULL, L"open", signupurl.ToWchar(), NULL, NULL, SW_SHOWNORMAL);
return TRUE;
}

View File

@ -103,13 +103,13 @@ static size_t ICurlCallback(void* buffer, size_t size, size_t nmemb, void* threa
hsError plShardStatus::Run()
{
{
const char* url = GetServerStatusUrl();
plString url = GetServerStatusUrl();
// initialize CURL
std::unique_ptr<CURL, std::function<void(CURL*)>> curl(curl_easy_init(), curl_easy_cleanup);
curl_easy_setopt(curl.get(), CURLOPT_ERRORBUFFER, fCurlError);
curl_easy_setopt(curl.get(), CURLOPT_USERAGENT, "UruClient/1.0");
curl_easy_setopt(curl.get(), CURLOPT_URL, url);
curl_easy_setopt(curl.get(), CURLOPT_URL, url.c_str());
curl_easy_setopt(curl.get(), CURLOPT_WRITEDATA, this);
curl_easy_setopt(curl.get(), CURLOPT_WRITEFUNCTION, ICurlCallback);
@ -123,7 +123,7 @@ hsError plShardStatus::Run()
if (!fRunning)
break;
if (url[0] && curl_easy_perform(curl.get()))
if (!url.IsEmpty() && curl_easy_perform(curl.get()))
fShardFunc(fCurlError);
fLastUpdate = hsTimer::GetSysSeconds();
} while (fRunning);
@ -334,16 +334,15 @@ bool plClientLauncher::CompleteSelfPatch(std::function<void(void)> waitProc) con
// ===================================================
static void IGotFileServIPs(ENetError result, void* param, const wchar_t* addr)
static void IGotFileServIPs(ENetError result, void* param, const plString& addr)
{
plClientLauncher* launcher = static_cast<plClientLauncher*>(param);
NetCliGateKeeperDisconnect();
if (IS_NET_SUCCESS(result)) {
// bah... why do I even bother
plString eapSucks = plString::FromWchar(addr);
const char* eapReallySucks[] = { eapSucks.c_str() };
NetCliFileStartConnect(eapReallySucks, 1, true);
plString eapSucks[] = { addr };
NetCliFileStartConnect(eapSucks, 1, true);
// Who knows if we will actually connect. So let's start updating.
launcher->PatchClient();
@ -373,8 +372,8 @@ void plClientLauncher::InitializeNetCore()
NetClientSetTransTimeoutMs(kNetTransTimeout);
// Gotta grab the filesrvs from the gate
const char** addrs;
uint32_t num = GetGateKeeperSrvHostnames(&addrs);
const plString* addrs;
uint32_t num = GetGateKeeperSrvHostnames(addrs);
NetCliGateKeeperStartConnect(addrs, num);
NetCliGateKeeperFileSrvIpAddressRequest(IGotFileServIPs, this, true);