Browse Source

* Allowed people to enable/disable using the online column via 'register_users_online' in the login_athena.conf [Codemaster]

git-svn-id: https://svn.code.sf.net/p/rathena/svn/branches/stable@1380 54d463be-8e91-2dee-dedb-b68131a5f0ec
codemaster 20 years ago
parent
commit
e704e3278b
3 changed files with 16 additions and 1 deletions
  1. 2 0
      Changelog-SVN.txt
  2. 3 0
      conf-tmpl/login_athena.conf
  3. 11 1
      src/login_sql/login.c

+ 2 - 0
Changelog-SVN.txt

@@ -1,6 +1,8 @@
 
 
 Date	Added
 Date	Added
 04/02
 04/02
+	* Allowed people to enable/disable using the online column via 
+	  'register_users_online' in the login_athena.conf [Codemaster]
 	* Added the 3 baby skills WE_BABY, CALLBABY and CALLPARENT [celest]
 	* Added the 3 baby skills WE_BABY, CALLBABY and CALLPARENT [celest]
 	* Some tidying up in skill.c [celest]
 	* Some tidying up in skill.c [celest]
 
 

+ 3 - 0
conf-tmpl/login_athena.conf

@@ -147,6 +147,9 @@ client_version_to_connect: 20
 //Passwords in Login DB are MD5 - <passwordencrypt> cannot b used on client with this on
 //Passwords in Login DB are MD5 - <passwordencrypt> cannot b used on client with this on
 use_MD5_passwords: no
 use_MD5_passwords: no
 
 
+// Use the 'online' column to set users online and offline [MySQL only]
+register_users_online: 0
+
 //Ban features: read readme for more info if you dont know this.
 //Ban features: read readme for more info if you dont know this.
 ipban: 1
 ipban: 1
 dynamic_pass_failure_ban: 1
 dynamic_pass_failure_ban: 1

+ 11 - 1
src/login_sql/login.c

@@ -99,6 +99,7 @@ int min_level_to_connect = 0; // minimum level of player/GM (0: player, 1-99: gm
 int check_ip_flag = 1; // It's to check IP of a player between login-server and char-server (part of anti-hacking system)
 int check_ip_flag = 1; // It's to check IP of a player between login-server and char-server (part of anti-hacking system)
 int check_client_version = 0; //Client version check ON/OFF .. (sirius)
 int check_client_version = 0; //Client version check ON/OFF .. (sirius)
 int client_version_to_connect = 20; //Client version needed to connect ..(sirius)
 int client_version_to_connect = 20; //Client version needed to connect ..(sirius)
+int register_users_online = 1;
 
 
 MYSQL mysql_handle;
 MYSQL mysql_handle;
 
 
@@ -154,6 +155,8 @@ struct dbt *online_db;
 //-----------------------------------------------------
 //-----------------------------------------------------
 
 
 void add_online_user(int account_id) {
 void add_online_user(int account_id) {
+    if(register_users_online <= 0)
+	return;
     int *p;
     int *p;
     p = (int*)aMalloc(sizeof(int));
     p = (int*)aMalloc(sizeof(int));
     if (p == NULL) {
     if (p == NULL) {
@@ -165,6 +168,8 @@ void add_online_user(int account_id) {
 }
 }
 
 
 int is_user_online(int account_id) {
 int is_user_online(int account_id) {
+    if(register_users_online <= 0)
+	return 0;
     int *p;
     int *p;
 
 
 	p = (int*)numdb_search(online_db, account_id);
 	p = (int*)numdb_search(online_db, account_id);
@@ -175,6 +180,8 @@ int is_user_online(int account_id) {
 }
 }
 
 
 void remove_online_user(int account_id) {
 void remove_online_user(int account_id) {
+    if(register_users_online <= 0)
+	return;
     int *p;
     int *p;
     p = (int*)numdb_erase(online_db,account_id);
     p = (int*)numdb_erase(online_db,account_id);
     aFree(p);
     aFree(p);
@@ -600,7 +607,7 @@ int mmo_auth( struct mmo_account* account , int fd){
 		return 2; // 2 = This ID is expired
 		return 2; // 2 = This ID is expired
 	}
 	}
 
 
-	if ( is_user_online(atol(sql_row[0])) ) {
+	if ( is_user_online(atol(sql_row[0])) && register_users_online > 0) {
 	        printf("User [%s] is already online - Rejected.\n",sql_row[1]);
 	        printf("User [%s] is already online - Rejected.\n",sql_row[1]);
 #ifndef TWILIGHT
 #ifndef TWILIGHT
 		return 3; // Rejected
 		return 3; // Rejected
@@ -1735,6 +1742,9 @@ int login_config_read(const char *cfgName){
 			    if(strcmpi(w2,"off") == 0 || strcmpi(w2,"no") == 0 )
 			    if(strcmpi(w2,"off") == 0 || strcmpi(w2,"no") == 0 )
 			        case_sensitive = 0;
 			        case_sensitive = 0;
         }
         }
+		else if(strcmpi(w1, "register_users_online") == 0) {
+			register_users_online = config_switch(w2);
+		}
  	}
  	}
 	fclose(fp);
 	fclose(fp);
 	printf ("End reading configuration...\n");
 	printf ("End reading configuration...\n");