From 0bbdc1dbe38965efa0de8cc3147935e62898849a Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Tue, 18 Oct 2011 01:46:07 +0300 Subject: =?UTF-8?q?=D1=80=D0=B0=D0=B1=D0=BE=D1=87=D0=B8=D0=B9=20=D0=BB?= =?UTF-8?q?=D0=BE=D0=B0=D0=B4=D0=B5=D1=80=20=D1=81=D0=BF=D0=B8=D1=81=D0=BA?= =?UTF-8?q?=D0=B0=20=D0=BF=D1=80=D0=BE=D0=BA=D1=81=D0=B5=D0=B9=20)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/server/config.cpp | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/server/server/config.cpp b/server/server/config.cpp index 2cea241..264ba22 100644 --- a/server/server/config.cpp +++ b/server/server/config.cpp @@ -19,6 +19,7 @@ config::config(const char *pth) vars.ls_host = get_string(cfg_str, "LSServerHost=", "ls.aionlegend.ru"); vars.log_path = get_string(cfg_str, "LogPath=", "./server.log"); vars.dos_log_path = get_string(cfg_str, "DosLogPath=", "./server_dos.log"); + load_proxy_list(); } const int config::get_int(const std::string& data, const char* var, int default_) { @@ -65,51 +66,52 @@ void config::load_proxy_list(char *pth) while(p2 != std::string::npos) { std::string line = cfg_str.substr(p1, p2-p1); + p1 = p2+1; std::string::size_type lp1 = 0, lp2 = 0; std::string host, login, password, country, state, city; int port = 0; if(line.find('@') != std::string::npos) { - lp2 = line.find(':'); + lp2 = line.find(':', lp1); login = line.substr(lp1, lp2-lp1); lp1 = lp2+1; - lp2 = line.find('@'); + lp2 = line.find('@', lp1); password = line.substr(lp1, lp2-lp1); lp1 = lp2+1; - lp2 = line.find(':'); + lp2 = line.find(':', lp1); host = line.substr(lp1, lp2-lp1); lp1 = lp2+1; - lp2 = line.find("\x20"); + lp2 = line.find("\x20", lp1); port = atoi(line.substr(lp1, lp2-lp1).c_str()); lp1 = lp2+2; - lp2 = line.find('"'); + lp2 = line.find('"', lp1); country = line.substr(lp1, lp2-lp1).c_str(); lp1 = lp2+3; - lp2 = line.find('"'); + lp2 = line.find('"', lp1); state = line.substr(lp1, lp2-lp1).c_str(); lp1 = lp2+3; - lp2 = line.find('"'); + lp2 = line.find('"', lp1); city = line.substr(lp1, lp2-lp1).c_str(); - proxy_list.push_back(proxy_entry(login, password, host, port, country, state, city)); } else { - lp2 = line.find(':'); + lp2 = line.find(':'), lp1; host = line.substr(lp1, lp2-lp1); lp1 = lp2+1; - lp2 = line.find("\x20"); + lp2 = line.find("\x20", lp1); port = atoi(line.substr(lp1, lp2-lp1).c_str()); lp1 = lp2+2; - lp2 = line.find('"'); + lp2 = line.find('"', lp1); country = line.substr(lp1, lp2-lp1).c_str(); lp1 = lp2+3; - lp2 = line.find('"'); + lp2 = line.find('"', lp1); state = line.substr(lp1, lp2-lp1).c_str(); lp1 = lp2+3; - lp2 = line.find('"'); + lp2 = line.find('"', lp1); city = line.substr(lp1, lp2-lp1).c_str(); - proxy_list.push_back(proxy_entry(login, password, host, port, country, state, city)); } + proxy_list.push_back(proxy_entry(login, password, host, port, country, state, city)); + p2 = cfg_str.find(';', p1); } } } -- cgit v1.2.3