[mw-devel] MW3 r1385 - trunk/src/client

arthur at sucs.org arthur at sucs.org
Thu Sep 10 14:29:11 BST 2015


Author: arthur
Date: 2015-09-10 14:29:11 +0100 (Thu, 10 Sep 2015)
New Revision: 1385

Modified:
   trunk/src/client/main.c
   trunk/src/client/user.c
Log:
Default to autochat mode, auto register bbs users by default


Modified: trunk/src/client/main.c
===================================================================
--- trunk/src/client/main.c	2015-07-30 15:32:08 UTC (rev 1384)
+++ trunk/src/client/main.c	2015-09-10 13:29:11 UTC (rev 1385)
@@ -69,7 +69,7 @@
 
 int currentfolder=0,last_mesg=0;
 int internet=0;
-int autochat=0;
+int autochat=1;
 int autowho=0;
 const char *autoexec_arg;
 const char *targethost = NULL;
@@ -401,6 +401,7 @@
 	{
 		/* standalone modifier arguments */
 		if (match_arg_str(argv[al], "autochat")) autochat = 1;
+		if (match_arg_str(argv[al], "noautochat")) autochat = 0;
 		if (match_arg_str(argv[al], "autowho")) autowho = 1;
 		if (match_arg_str(argv[al], "quiet")) qflag = 1;
 		if (match_arg_str(argv[al], "new")) view_new = 1;
@@ -471,6 +472,7 @@
 		printf(_("\nMilliways accepts the optional arguments of:\n\n"));
 		printf(_("  -ae_arg <a> Pass the string 'a' in to all 'initfunc' functions as $*\n"));
 		printf(_("  -autochat   Automatically use SUCS username to log onto talker\n"));
+		printf(_("  -noautochat Disable -autochat mode.\n"));
 		printf(_("  -autowho    Show a 'who' list automatically on log on to talker\n"));
 		printf(_("  -i          Internet mode (no readline)\n"));
 		printf(_("  -new        Summary of new messages and quit\n"));
@@ -641,7 +643,7 @@
 
 	/* show login banner, and version info */
 	/* allow disabling of banner in release version */
-	if (!autochat) printfile(makepath(LOGIN_BANNER,"",""));
+	if (!qflag) printfile(makepath(LOGIN_BANNER,"",""));
 	printf("%s\n",version);
 
 	/* log the user in by asking for their name (and details) */
@@ -697,21 +699,21 @@
 		}	
 	}	
 			
-	if (!autochat) {
-		time_t when = user->lastlogout;
-		printf(_("\nLast logged out %s\n\n"),ctime(&when));
-		if (u_reg(user->status)) {
-			printf(_("Type 'talker' to enter chat mode.\n"));
+	time_t when = user->lastlogout;
+	printf(_("\nLast logged out %s\n\n"),ctime(&when));
+	if (u_reg(user->status)) {
+		if (!autochat) {
+		printf(_("Type 'talker' to enter chat mode.\n"));
 		}
-		else
-		{
-			/* Must be an unregistered guest */
-			printf(_("You must register before being able to use this system fully.\n"));
-			printf(_("Until then you will not be able to write in most folders or use chat mode.\n"));
-			printf(_("Wait here for a few minutes and an administrator might register you.\n"));
-		}
-		printf(_("Type 'help' for help.\n"));
 	}
+	else
+	{
+		/* Must be an unregistered guest */
+		printf(_("You must register before being able to use this system fully.\n"));
+		printf(_("Until then you will not be able to write in most folders or use chat mode.\n"));
+		printf(_("Wait here for a few minutes and an administrator might register you.\n"));
+	}
+	if (!autochat) printf(_("Type 'help' for help.\n"));
 	loggedin=time(0);
 
 	/* initialise script variables */

Modified: trunk/src/client/user.c
===================================================================
--- trunk/src/client/user.c	2015-07-30 15:32:08 UTC (rev 1384)
+++ trunk/src/client/user.c	2015-09-10 13:29:11 UTC (rev 1385)
@@ -122,14 +122,20 @@
 {
 	char *lname = getmylogin();
 	fflush(stdin);
-gstart:	if (autochat) 
-		name[0]=0;
-	else {
-		if (lname == NULL)
-			printf(_("Please enter username: "));
-		else
+gstart:	
+	if (lname == NULL) {
+		/* cant find you, or you are bbs, MUST tell us name */
+		printf(_("Please enter username: "));
+		get_str(name,NAMESIZE);
+	} else {
+		/* we got a name from the system,
+		 * prompt only if not autochat mode */
+		if (autochat) {
+			name[0]=0;
+		} else {
 			printf(_("Please enter username [%s]: "), lname);
-		get_str(name,NAMESIZE);
+			get_str(name,NAMESIZE);
+		}
 	}
 	strip_name(name);
 	if (feof(stdin))
@@ -260,11 +266,13 @@
 		show_user_stats(tmp->status,buff,false);
 		printf(_("Status set to [%s]\n"),buff);
 	/* if you have a SUCS account, allow auto-registering if the logon name matches the sucs name */
-	}else if (!internet && getmylogin()!=NULL && !strcasecmp(getmylogin(),tmp->name))
+	}else if (!internet || getmylogin()==NULL || (getmylogin()!=NULL && strcasecmp(getmylogin(),tmp->name)==0))
 	{
 		tmp->status|=1;
-		tmp->groups|=1;
-		tmp->chatprivs|=CP_SCRIPT;
+		if (getmylogin() != NULL) {
+			tmp->groups|=1;
+			tmp->chatprivs|=CP_SCRIPT;
+		}
 		mwlog("AUTOREGISTER %s",getmylogin());
 		broadcast(3, "AutoRegister for %s",getmylogin());
 	}




More information about the mw-devel mailing list