diff options
-rw-r--r-- | conf/Changelog.txt | 2 | ||||
-rw-r--r-- | conf/inter_athena.conf | 16 | ||||
-rw-r--r-- | src/login/loginlog_sql.c | 38 | ||||
-rw-r--r-- | src/map/map.c | 14 |
4 files changed, 26 insertions, 44 deletions
diff --git a/conf/Changelog.txt b/conf/Changelog.txt index d5371167f..353e9ceb3 100644 --- a/conf/Changelog.txt +++ b/conf/Changelog.txt @@ -1,6 +1,8 @@ Date Added 2008/07/27 + * Removed the unused login and txt->sql options in inter_athena.conf + * Renamed config option log_db to log_db_db in inter_athena.conf * Conf file adjustments for the loginmerge branch - added new login and ipban db config options to login_athena.conf - login database options are no longer in inter_athena.conf! diff --git a/conf/inter_athena.conf b/conf/inter_athena.conf index ddb7c5e1b..8fa68a3ca 100644 --- a/conf/inter_athena.conf +++ b/conf/inter_athena.conf @@ -51,13 +51,6 @@ scdata_txt: save/scdata.txt // "Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)" // and you have localhost, switch it to 127.0.0.1 -// MySQL Login SQL Server -login_server_ip: 127.0.0.1 -login_server_port: 3306 -login_server_id: ragnarok -login_server_pw: ragnarok -login_server_db: ragnarok - // MySQL Character SQL server char_server_ip: 127.0.0.1 char_server_port: 3306 @@ -77,14 +70,7 @@ log_db_ip: 127.0.0.1 log_db_port: 3306 log_db_id: ragnarok log_db_pw: ragnarok -log_db: log - -// for TXT -> SQL convertors -db_server_ip: 127.0.0.1 -db_server_port: 3306 -db_server_id: ragnarok -db_server_pw: ragnarok -db_server_logindb: ragnarok +log_db_db: log // DO NOT CHANGE ANYTHING BEYOND THIS LINE UNLESS YOU KNOW YOUR DATABASE DAMN WELL // this is meant for people who KNOW their stuff, and for some reason want to change their diff --git a/src/login/loginlog_sql.c b/src/login/loginlog_sql.c index 69a1c1910..1443abff9 100644 --- a/src/login/loginlog_sql.c +++ b/src/login/loginlog_sql.c @@ -9,14 +9,13 @@ #include <string.h> #include <stdlib.h> // exit -char log_db_ip[32] = "127.0.0.1"; +char log_db_hostname[32] = "127.0.0.1"; uint16 log_db_port = 3306; -char log_db_id[32] = "ragnarok"; -char log_db_pw[32] = "ragnarok"; -char log_db_db[32] = "ragnarok"; -char log_db[32] = "log"; +char log_db_username[32] = "ragnarok"; +char log_db_password[32] = "ragnarok"; +char log_db_database[32] = "log"; +char loginlog_table[256] = "loginlog"; -char loginlog_db[256] = "loginlog"; Sql* sql_handle; bool enabled = false; @@ -38,7 +37,7 @@ void login_log(uint32 ip, const char* username, int rcode, const char* message) retcode = Sql_Query(sql_handle, "INSERT INTO `%s`(`time`,`ip`,`user`,`rcode`,`log`) VALUES (NOW(), '%s', '%s', '%d', '%s')", - loginlog_db, ip2str(ip,NULL), esc_username, rcode, message); + loginlog_table, ip2str(ip,NULL), esc_username, rcode, message); if( retcode != SQL_SUCCESS ) Sql_ShowDebug(sql_handle); @@ -48,7 +47,7 @@ bool loginlog_init(void) { sql_handle = Sql_Malloc(); - if( SQL_ERROR == Sql_Connect(sql_handle, log_db_id, log_db_pw, log_db_ip, log_db_port, log_db_db) ) + if( SQL_ERROR == Sql_Connect(sql_handle, log_db_username, log_db_password, log_db_hostname, log_db_port, log_db_database) ) { Sql_ShowDebug(sql_handle); Sql_Free(sql_handle); @@ -69,26 +68,23 @@ bool loginlog_final(void) bool loginlog_config_read(const char* key, const char* value) { - if( strcmpi(key, "log_db_ip") == 0 ) - safestrncpy(log_db_ip, value, sizeof(log_db_ip)); + if( strcmpi(key, "log_db_hostname") == 0 ) + safestrncpy(log_db_hostname, value, sizeof(log_db_hostname)); else if( strcmpi(key, "log_db_port") == 0 ) log_db_port = (uint16)strtoul(value, NULL, 10); else - if( strcmpi(key, "log_db_id") == 0 ) - safestrncpy(log_db_id, value, sizeof(log_db_id)); + if( strcmpi(key, "log_db_username") == 0 ) + safestrncpy(log_db_username, value, sizeof(log_db_username)); else - if( strcmpi(key, "log_db_pw") == 0 ) - safestrncpy(log_db_pw, value, sizeof(log_db_pw)); + if( strcmpi(key, "log_db_password") == 0 ) + safestrncpy(log_db_password, value, sizeof(log_db_password)); else - if( strcmpi(key, "log_db_db") == 0 ) - safestrncpy(log_db_db, value, sizeof(log_db_db)); + if( strcmpi(key, "log_db_database") == 0 ) + safestrncpy(log_db_database, value, sizeof(log_db_database)); else - if( strcmpi(key, "log_db") == 0 ) - safestrncpy(log_db, value, sizeof(log_db)); - else - if( strcmpi(key, "loginlog_db") == 0 ) - safestrncpy(loginlog_db, value, sizeof(loginlog_db)); + if( strcmpi(key, "loginlog_table") == 0 ) + safestrncpy(loginlog_table, value, sizeof(loginlog_table)); else return false; diff --git a/src/map/map.c b/src/map/map.c index 8c80644d0..3f34f9661 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -74,7 +74,7 @@ char log_db_ip[32] = "127.0.0.1"; int log_db_port = 3306; char log_db_id[32] = "ragnarok"; char log_db_pw[32] = "ragnarok"; -char log_db[32] = "log"; +char log_db_db[32] = "log"; Sql* logmysql_handle; #endif /* not TXT_ONLY */ @@ -2984,18 +2984,16 @@ int inter_config_read(char *cfgName) } else if(strcmpi(w1,"use_sql_db")==0){ db_use_sqldbs = config_switch(w2); ShowStatus ("Using SQL dbs: %s\n",w2); - } else if(strcmpi(w1,"log_db")==0) { - strcpy(log_db, w2); } else if(strcmpi(w1,"log_db_ip")==0) { strcpy(log_db_ip, w2); - } else if(strcmpi(w1,"log_db")==0) { - strcpy(log_db, w2); } else if(strcmpi(w1,"log_db_id")==0) { strcpy(log_db_id, w2); } else if(strcmpi(w1,"log_db_pw")==0) { strcpy(log_db_pw, w2); } else if(strcmpi(w1,"log_db_port")==0) { log_db_port = atoi(w2); + } else if(strcmpi(w1,"log_db_db")==0) { + strcpy(log_db_db, w2); #endif //support the import command, just like any other config } else if(strcmpi(w1,"import")==0){ @@ -3049,10 +3047,10 @@ int log_sql_init(void) // log db connection logmysql_handle = Sql_Malloc(); - ShowInfo(""CL_WHITE"[SQL]"CL_RESET": Connecting to the Log Database "CL_WHITE"%s"CL_RESET" At "CL_WHITE"%s"CL_RESET"...\n",log_db,log_db_ip); - if ( SQL_ERROR == Sql_Connect(logmysql_handle, log_db_id, log_db_pw, log_db_ip, log_db_port, log_db) ) + ShowInfo(""CL_WHITE"[SQL]"CL_RESET": Connecting to the Log Database "CL_WHITE"%s"CL_RESET" At "CL_WHITE"%s"CL_RESET"...\n",log_db_db,log_db_ip); + if ( SQL_ERROR == Sql_Connect(logmysql_handle, log_db_id, log_db_pw, log_db_ip, log_db_port, log_db_db) ) exit(EXIT_FAILURE); - ShowStatus(""CL_WHITE"[SQL]"CL_RESET": Successfully '"CL_GREEN"connected"CL_RESET"' to Database '"CL_WHITE"%s"CL_RESET"'.\n", log_db); + ShowStatus(""CL_WHITE"[SQL]"CL_RESET": Successfully '"CL_GREEN"connected"CL_RESET"' to Database '"CL_WHITE"%s"CL_RESET"'.\n", log_db_db); if( strlen(default_codepage) > 0 ) if ( SQL_ERROR == Sql_SetEncoding(logmysql_handle, default_codepage) ) |