Browse Source

Follow up to 2d2991a. Fixed the set property function for login_codepage and login_case_sensitive configs.

aleos89 10 năm trước cách đây
mục cha
commit
531b89e6b0
1 tập tin đã thay đổi với 14 bổ sung8 xóa
  1. 14 8
      src/login/account.c

+ 14 - 8
src/login/account.c

@@ -224,8 +224,7 @@ static bool account_db_sql_set_property(AccountDB* self, const char* key, const
 	const char* signature;
 
 	signature = "login_server_";
-	if( strncmp(key, signature, strlen(signature)) == 0 )
-	{
+	if( strncmp(key, signature, strlen(signature)) == 0 ) {
 		key += strlen(signature);
 		if( strcmpi(key, "ip") == 0 )
 			safestrncpy(db->db_hostname, value, sizeof(db->db_hostname));
@@ -242,12 +241,6 @@ static bool account_db_sql_set_property(AccountDB* self, const char* key, const
 		if( strcmpi(key, "db") == 0 )
 			safestrncpy(db->db_database, value, sizeof(db->db_database));
 		else
-		if( strcmpi(key, "codepage") == 0 )
-			safestrncpy(db->codepage, value, sizeof(db->codepage));
-		else
-		if( strcmpi(key, "case_sensitive") == 0 )
-			db->case_sensitive = config_switch(value);
-		else
 		if( strcmpi(key, "account_db") == 0 )
 			safestrncpy(db->account_db, value, sizeof(db->account_db));
 		else
@@ -258,6 +251,19 @@ static bool account_db_sql_set_property(AccountDB* self, const char* key, const
 		return true;
 	}
 
+	signature = "login_";
+	if( strncmpi(key, signature, strlen(signature)) == 0 ) {
+		key += strlen(signature);
+		if( strcmpi(key, "codepage") == 0 )
+			safestrncpy(db->codepage, value, sizeof(db->codepage));
+		else
+		if( strcmpi(key, "case_sensitive") == 0 )
+			db->case_sensitive = config_switch(value);
+		else
+			return false;// not found
+		return true;
+	}
+
 	return false;// not found
 }