From db83218bc7f12bef4b2db7bdb2d659f29b5e53f5 Mon Sep 17 00:00:00 2001 From: Michiel Broek Date: Mon, 11 Nov 2002 12:55:14 +0000 Subject: [PATCH] Update for lost areanumber --- mbsebbs/user.c | 63 ++++++++++++++++++++++++++------------------------ 1 file changed, 33 insertions(+), 30 deletions(-) diff --git a/mbsebbs/user.c b/mbsebbs/user.c index 48c0ae1e..596960ad 100644 --- a/mbsebbs/user.c +++ b/mbsebbs/user.c @@ -174,39 +174,34 @@ void SwapDate(char *Date3, char *Date4) void user() { - FILE *pUsrConfig, *pLimits; - int i, x; - int FoundName = FALSE, iFoundLimit = FALSE; - long l1, l2; - char *token; - char temp[PATH_MAX]; - char temp1[84]; - time_t LastLogin; - struct stat st; - char UserName[37]; - int IsNew = FALSE; + FILE *pUsrConfig, *pLimits; + int i, x, FoundName = FALSE, iFoundLimit = FALSE, IsNew = FALSE; + long l1, l2; + char *token, temp[PATH_MAX], temp1[84], UserName[37]; + time_t LastLogin; + struct stat st; - grecno = 0; - Syslog('+', "Unixmode login: %s", sUnixName); + grecno = 0; + Syslog('+', "Unixmode login: %s", sUnixName); - sprintf(temp, "%s/etc/users.data", getenv("MBSE_ROOT")); - if ((pUsrConfig = fopen(temp,"r+b")) == NULL) { - /* - * This should not happen. - */ - WriteError("$Can't open %s", temp); - printf("Can't open userfile, run \"newuser\" first"); - ExitClient(MBERR_OK); - } + sprintf(temp, "%s/etc/users.data", getenv("MBSE_ROOT")); + if ((pUsrConfig = fopen(temp,"r+b")) == NULL) { + /* + * This should not happen. + */ + WriteError("$Can't open %s", temp); + printf("Can't open userfile, run \"newuser\" first"); + ExitClient(MBERR_OK); + } - fread(&usrconfighdr, sizeof(usrconfighdr), 1, pUsrConfig); - while (fread(&usrconfig, usrconfighdr.recsize, 1, pUsrConfig) == 1) { - if (strcmp(usrconfig.Name, sUnixName) == 0) { - FoundName = TRUE; - break; - } else - grecno++; - } + fread(&usrconfighdr, sizeof(usrconfighdr), 1, pUsrConfig); + while (fread(&usrconfig, usrconfighdr.recsize, 1, pUsrConfig) == 1) { + if (strcmp(usrconfig.Name, sUnixName) == 0) { + FoundName = TRUE; + break; + } else + grecno++; + } if (!FoundName) { printf("Unknown username: %s\n", sUnixName); @@ -261,6 +256,14 @@ void user() else UserCity(mypid, usrconfig.sUserName, (char *)"N/A"); + /* + * Set last file and message area so these numbers are saved when + * the user hangs up or is logged off before het gets to the main + * menu. Later in this function the areas are set permanent. + */ + iAreaNumber = usrconfig.iLastFileArea; + iLastMsgArea = usrconfig.iLastMsgArea; + /* * See if this user is the Sysop. */