diff options
author | ultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2008-07-27 12:40:29 +0000 |
---|---|---|
committer | ultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2008-07-27 12:40:29 +0000 |
commit | 807577cbc6c8e93e99ab4140789babaae10be279 (patch) | |
tree | 238efb9c21709092c71ab6a9fbf6c8a36126102d /src | |
parent | ecbb7655309ca4cda4b4cf2b92e1c52e250505e2 (diff) | |
download | hercules-807577cbc6c8e93e99ab4140789babaae10be279.tar.gz hercules-807577cbc6c8e93e99ab4140789babaae10be279.tar.bz2 hercules-807577cbc6c8e93e99ab4140789babaae10be279.tar.xz hercules-807577cbc6c8e93e99ab4140789babaae10be279.zip |
Cleaned up several poorly chosen loginlog variable names.
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.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@13005 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src')
-rw-r--r-- | src/login/loginlog_sql.c | 38 | ||||
-rw-r--r-- | src/map/map.c | 14 |
2 files changed, 23 insertions, 29 deletions
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) ) |