summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rw-r--r--server/server/config.cpp30
1 files 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);
}
}
}