diff --git a/ChangeLog b/ChangeLog index a0ab1eb5..24f7e4ce 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,10 +3,21 @@ $Id$ v0.83.0 06-Nov-2005 + mbsebbs: + Removed antique line editor. + mbtask: Fixed accepting connections with the chatserver when no password is given. + mbsetup: + In users edit screen, removed append record option. + Blocked changing the users unixname. + Removed antique line editor is edit users. + + lang: + Changed language prompts 373 and 438. + v0.82.0 06-Oct-2005 - 06-Nov-2005 diff --git a/html/images/users.png b/html/images/users.png index 3e32f097..50bfd0fb 100644 Binary files a/html/images/users.png and b/html/images/users.png differ diff --git a/html/images/users2.png b/html/images/users2.png index bddcafb4..130c85d2 100644 Binary files a/html/images/users2.png and b/html/images/users2.png differ diff --git a/html/setup/users.html b/html/setup/users.html index 73e82db2..01de638a 100644 --- a/html/setup/users.html +++ b/html/setup/users.html @@ -14,7 +14,7 @@
-
Last update 24-Feb-2004
+
Last update 08-Nov-2005

MBSE BBS Setup - BBS Users.

Introduction.

@@ -36,7 +36,7 @@ Fields that can be changed by the users themselves are in the second screen. Security The security level of the user. Expirydate The expiry date of the user DD-MM-YYYY. Expiry Sec The security level the user gets after expiry. -Unix uid The unix username of the user. +Unix uid Displays the unix name of the user. 1st login Displays the date of the first login. Last login Displays the date of the last login. Pwdchange Displays the date of the last password change. diff --git a/lang/Language.xref b/lang/Language.xref index 1de10e39..ba3bdd95 100644 --- a/lang/Language.xref +++ b/lang/Language.xref @@ -371,7 +371,7 @@ 370 change.c |New Files check is now ON 371 change.c |New Files check is now OFF 372 change.c |Now using the -373 change.c 123|Select: 1) Line editor, 2) Fullscreen editor, 3) External editor +373 change.c 12|Select: 1) Fullscreen editor, 2) External editor 374 offline.c |No messages found to download! 375 funcs4.c |Press (Enter) to continue: 376 lineedit.c |Center @@ -436,7 +436,7 @@ 435 user.c |Your password is expired, new password : 436 funcs.c |Press ENTER to continue 437 mail.c |Posting not allowed, this area is Read Only! -438 change.c 12|Select: 1) Line editer, 2) Fullscreen editer +438 change.c 1|Select: 1) Fullscreen editer 439 offline.c |Offline Reader Upload 440 offline.c |Invalid packet received 441 offline.c |Unknown compression type diff --git a/lang/chinese.txt b/lang/chinese.txt index 9b0ed226..abb0eace 100644 --- a/lang/chinese.txt +++ b/lang/chinese.txt @@ -371,7 +371,7 @@ YN|Are you Sure? [Y/n]: |New Files check is now ON |New Files check is now OFF |Now using the -123|Select: 1) Line editor, 2) Fullscreen editor, 3) External editor +12|Select: 1) Fullscreen editor, 2) External editor |No messages found to download! |Press (Enter) to continue: |Center @@ -436,7 +436,7 @@ YN|Do you want to download these messages [Y/n]? |Your password is expired, new password : |Press ENTER to continue |Posting not allowed, this area is Read Only! -12|Select: 1) Line editor, 2) Fullscreen editor +1|Select: 1) Fullscreen editor |Offline Reader Upload |Invalid packet received |Unknown compression type diff --git a/lang/dutch.txt b/lang/dutch.txt index 61cfabe3..b7a220d4 100644 --- a/lang/dutch.txt +++ b/lang/dutch.txt @@ -371,7 +371,7 @@ JN|Zeker weten? [J/n]: |Tonen nieuwe Bestanden is nu AAN |Tonen nieuwe Bestanden is nu UIT |U gebruikt nu de -123|Kies: 1) Regel editer, 2) Volle scherm editer, 3) Externe editer +12|Kies: 1) Volle scherm editer, 2) Externe editer |Geen berichten gevonden voor download! |Geef (Enter) voor doorgaan: |Centreer @@ -436,7 +436,7 @@ JN|Wilt U deze berichten downloaden [J/n]? |Uw wachtwoord is verlopen, geef nieuw wachtwoord: |Toets ENTER voor doorgaan |Plaatsen berichten niet toegestaan, dit gebied is alleen lezen! -12|Kies: 1) Regel editer, 2) Volle scherm editer +1|Kies: 1) Volle scherm editer |Offline Reader Upload |Ongeldig pakket ontvangen |Onbekende compressie methode diff --git a/lang/english.txt b/lang/english.txt index 2a1ddbf0..c77850f2 100644 --- a/lang/english.txt +++ b/lang/english.txt @@ -371,7 +371,7 @@ YN|Are you Sure? [Y/n]: |New Files check is now ON |New Files check is now OFF |Now using the -123|Select: 1) Line editor, 2) Fullscreen editor, 3) External editor +12|Select: 1) Fullscreen editor, 2) External editor |No messages found to download! |Press (Enter) to continue: |Center @@ -436,7 +436,7 @@ YN|Do you want to download these messages [Y/n]? |Your password is expired, new password : |Press ENTER to continue |Posting not allowed, this area is Read Only! -12|Select: 1) Line editor, 2) Fullscreen editor +1|Select: 1) Fullscreen editor |Offline Reader Upload |Invalid packet received |Unknown compression type diff --git a/lang/french.txt b/lang/french.txt index e006e0ea..04b6c04b 100644 --- a/lang/french.txt +++ b/lang/french.txt @@ -371,7 +371,7 @@ YN|Are you Sure? [Y/n]: |New Files check is now ON |New Files check is now OFF |Now using the -123|Select: 1) Line editor, 2) Fullscreen editor, 3) External editor +12|Select: 1) Fullscreen editor, 2) External editor |No messages found to download! |Press (Enter) to continue: |Center @@ -436,7 +436,7 @@ YN|Do you want to download these messages [Y/n]? |Your password is expired, new password : |Press ENTER to continue |Posting not allowed, this area is Read Only! -12|Select: 1) Line editor, 2) Fullscreen editor +1|Select: 1) Fullscreen editor |Offline Reader Upload |Invalid packet received |Unknown compression type diff --git a/lang/galego.txt b/lang/galego.txt index e6764b44..24271250 100644 --- a/lang/galego.txt +++ b/lang/galego.txt @@ -371,7 +371,7 @@ SN| |Comprobar ficheiros novos ACTIVADO |Comprobar ficheios novos DESACTIVADO |Est s usando o editor -123|Escolle: 1) Editor de li¤as, 2) E. pantalla completa, 3) Editor externo +12|Escolle: 1) E. pantalla completa, 2) Editor externo |¡Non hai mensaxes! |Pulsa (Enter) para seguir: |Centrar @@ -436,7 +436,7 @@ SN| |A tua password caducou, nova password : |Pulsa ENTER para seguir |Non podes escribir, ­esta  rea es S¢ Lectura! -12|Escolle: 1) Editor de li¤as, 2) Editor de pantalla completa +1|Escolle: 1) Editor de pantalla completa |Upload de correo Off-Line |O paquete recibido non ‚ v lido |Comprimido con un compresor desco¤ecido diff --git a/lang/german.txt b/lang/german.txt index 441ea4ce..a3616118 100644 --- a/lang/german.txt +++ b/lang/german.txt @@ -371,7 +371,7 @@ JN|Sind Sie sicher? [J/n]: |Check auf neue Dateien ist jetzt AN |Check auf neue Dateien ist jetzt AUS |Sie verwenden jetzt den -123|Auswahl: 1) Zeilen-Editor, 2) Vollbild-Editor, 3) Externer Editor +12|Auswahl: 1) Vollbild-Editor, 2) Externer Editor |Es liegen keine Mitteilungen zum Herunterladen vor! |Weiter mit ... |Zentrieren @@ -436,7 +436,7 @@ JN|Moechten Sie diese Mitteilungen herunterladen [J/n]? |Ihr Passwort ist abgelaufen, neues Passwort: |Druecken Sie um fortzufahren |Kein Senden moeglich, diese Area ist "Nur lesen"! -12|Auswahl: 1) Zeilen-Editor, 2) Vollbild-Editor +1|Auswahl: 1) Vollbild-Editor |"Offline Reader" Paket heraufladen |Kein oder fehlerhaftes Paket erhalten |Unbekannter Datenkompressionstyp diff --git a/lang/germandu.txt b/lang/germandu.txt index b02ab2e2..d6dc2943 100644 --- a/lang/germandu.txt +++ b/lang/germandu.txt @@ -371,7 +371,7 @@ JN|Bist Du sicher? [a/ein]: |Check auf neue Dateien ist jetzt AN |Check auf neue Dateien ist jetzt AUS |Du verwendest jetzt den -123|Auswahl: <1> Zeilen-Editor, <2> Vollbild-Editor, <3> Externer Editor +12|Auswahl: <1> Vollbild-Editor, <3> Externer Editor |Es liegen keine Mitteilungen zum Herunterladen vor! |Weiter mit ... |Zentrieren @@ -436,7 +436,7 @@ JN|Moechtest Du diese Mitteilungen herunterladen [a/ein]? |Dein Passwort ist abgelaufen, neues Passwort: |Drueck um fortzufahren |Kein Senden moeglich, diese Area ist "Nur lesen"! -12|Auswahl: <1> Zeilen-Editor, <2> Vollbild-Editor +1|Auswahl: <1> Vollbild-Editor |"Offline Reader" Paket heraufladen |Kein oder fehlerhaftes Paket erhalten |Unbekannter Datenkompressionstyp diff --git a/lang/spanish.txt b/lang/spanish.txt index e9cdb22e..54804686 100644 --- a/lang/spanish.txt +++ b/lang/spanish.txt @@ -371,7 +371,7 @@ SN| |Comprobar ficheros nuevos ACTIVADO |Comprobar ficheros nuevos DESACTIVADO |Est s usando el editor -123|Elige: 1) Editor de l¡neas, 2) E. Pantalla completa, 3) Editor externo +12|Elige: 1) E. Pantalla completa, 2) Editor externo |¡No hay mensajes! |Pulsa (Enter) para seguir: |Centrar @@ -436,7 +436,7 @@ SN| |Tu password ha caducado, nuevo password : |Pulsa ENTER para seguir |No puedes escribir, ­esta  rea es de Solo Lectura! -12|Elige: 1) Editor de l¡neas, 2) Editor de pantalla completa +1|Elige: 1) Editor de pantalla completa |Upload de correo Off-Line |El paquete recibido no es v lido |Comprimido con un compresor desconocido diff --git a/lib/users.h b/lib/users.h index 8e3e7148..b9373014 100644 --- a/lib/users.h +++ b/lib/users.h @@ -36,7 +36,7 @@ #define Max_passlen 14 /* Define maximum passwd length */ -typedef enum {LINEEDIT, FSEDIT, EXTEDIT} MSGEDITOR; +typedef enum {X_LINEEDIT, FSEDIT, EXTEDIT} MSGEDITOR; /************************************************************************ diff --git a/mbsebbs/Makefile b/mbsebbs/Makefile index b17a4f04..57ea3444 100644 --- a/mbsebbs/Makefile +++ b/mbsebbs/Makefile @@ -6,7 +6,7 @@ include ../Makefile.global SRCS = signature.c filesub.c language.c \ msgutil.c oneline.c morefile.c \ - email.c fsedit.c lineedit.c page.c \ + email.c fsedit.c page.c \ bye.c funcs.c mail.c term.c ttyio.c openport.c \ newuser.c pinfo.c timecheck.c change.c transfer.c \ exitinfo.c mbsebbs.c menu.c pop3.c lastcallers.c \ @@ -15,7 +15,7 @@ SRCS = signature.c filesub.c language.c \ door.c dispfile.c userlist.c timestats.c logentry.c \ ymsend.c ymrecv.c zmmisc.c zmsend.c zmrecv.c HDRS = signature.h filesub.h language.h mbsebbs.h misc.h offline.h \ - timeout.h email.h fsedit.h lineedit.h \ + timeout.h email.h fsedit.h \ msgutil.h oneline.h user.h bye.h morefile.h \ funcs.h mail.h page.h term.h ttyio.h openport.h \ change.h exitinfo.h newuser.h \ @@ -26,14 +26,14 @@ HDRS = signature.h filesub.h language.h mbsebbs.h misc.h offline.h \ MBSEBBS_OBJS = signature.o chat.o file.o funcs.o mail.o menu.o \ misc.o pinfo.o oneline.o page.o fsedit.o transfer.o \ bye.o change.o mbsebbs.o timeout.o user.o timecheck.o \ - exitinfo.o filesub.o lineedit.o offline.o language.o msgutil.o \ + exitinfo.o filesub.o offline.o language.o msgutil.o \ pop3.o email.o input.o whoson.o door.o dispfile.o userlist.o timestats.o \ logentry.o morefile.o lastcallers.o term.o ttyio.o openport.o \ ymsend.o ymrecv.o zmmisc.o zmsend.o zmrecv.o MBSEBBS_LIBS = ../lib/libmbse.a ../lib/libmsgbase.a ../lib/libdbase.a ../lib/libmbinet.a ../lib/libnodelist.a MBNEWUSR_OBJS = mbnewusr.o newuser.o language.o timeout.o dispfile.o oneline.o ttyio.o \ timecheck.o input.o exitinfo.o funcs.o misc.o change.o door.o term.o openport.o \ - filesub.o mail.o email.o msgutil.o pop3.o lineedit.o fsedit.o whoson.o + filesub.o mail.o email.o msgutil.o pop3.o fsedit.o whoson.o MBNEWUSR_LIBS = ../lib/libmbse.a ../lib/libmsgbase.a ../lib/libdbase.a ../lib/libmbinet.a ../lib/libnodelist.a OTHER = Makefile TARGET = mbsebbs mbnewusr @@ -99,11 +99,10 @@ oneline.o: ../config.h ../lib/mbselib.h ../lib/mbse.h ../lib/users.h oneline.h f morefile.o: ../config.h ../lib/mbselib.h ../lib/mbse.h ../lib/users.h input.h language.h morefile.h timeout.h term.h ttyio.h email.o: ../config.h ../lib/mbselib.h ../lib/mbse.h ../lib/users.h ../lib/msgtext.h ../lib/msg.h ../lib/mbinet.h exitinfo.h language.h mail.h timeout.h msgutil.h input.h email.h whoson.h term.h ttyio.h fsedit.o: ../config.h ../lib/mbselib.h ../lib/mbse.h ../lib/users.h mail.h input.h language.h timeout.h pinfo.h fsedit.h term.h ttyio.h -lineedit.o: ../config.h ../lib/mbselib.h ../lib/mbse.h ../lib/users.h mail.h input.h language.h timeout.h lineedit.h term.h ttyio.h page.o: ../config.h ../lib/mbselib.h ../lib/mbse.h ../lib/users.h dispfile.h input.h chat.h page.h timeout.h mail.h language.h term.h ttyio.h bye.o: ../config.h ../lib/mbselib.h ../lib/mbse.h ../lib/users.h ../lib/nodelist.h dispfile.h misc.h language.h bye.h term.h openport.h ttyio.h funcs.o: ../config.h ../lib/mbselib.h ../lib/mbse.h ../lib/users.h ../lib/msgtext.h ../lib/msg.h funcs.h term.h ttyio.h -mail.o: ../config.h ../lib/mbselib.h ../lib/mbse.h ../lib/users.h ../lib/nodelist.h ../lib/msgtext.h ../lib/msg.h mail.h funcs.h input.h language.h misc.h timeout.h oneline.h exitinfo.h lineedit.h fsedit.h filesub.h msgutil.h pop3.h email.h door.h whoson.h term.h ttyio.h openport.h +mail.o: ../config.h ../lib/mbselib.h ../lib/mbse.h ../lib/users.h ../lib/nodelist.h ../lib/msgtext.h ../lib/msg.h mail.h funcs.h input.h language.h misc.h timeout.h oneline.h exitinfo.h fsedit.h filesub.h msgutil.h pop3.h email.h door.h whoson.h term.h ttyio.h openport.h term.o: ../config.h ../lib/mbselib.h ../lib/users.h term.h ttyio.h ttyio.o: ../config.h ../lib/mbselib.h ttyio.h openport.o: ../config.h ../lib/mbselib.h ttyio.h openport.h zmmisc.h diff --git a/mbsebbs/change.c b/mbsebbs/change.c index 07ce86c6..4a1d4f24 100644 --- a/mbsebbs/change.c +++ b/mbsebbs/change.c @@ -410,21 +410,18 @@ void Chg_FsMsged() Enter(1); if (strlen(CFG.externaleditor)) - /* Select: 1) Line editor, 2) Fullscreen editor, 3) External editor */ + /* Select: 1) Fullscreen editor, 2) External editor */ pout(WHITE, BLACK, (char *)Language(373)); else - /* Select: 1) Line editor, 2) Fullscreen editor */ + /* Select: 1) Fullscreen editor */ pout(WHITE, BLACK, (char *)Language(438)); alarm_on(); z = toupper(Readkey()); if (z == Keystroke(373, 0)) { - exitinfo.MsgEditor = LINEEDIT; - Syslog('+', "User selected line editor"); - } else if (z == Keystroke(373, 1)) { exitinfo.MsgEditor = FSEDIT; Syslog('+', "User selected fullscreen editor"); - } else if ((z == Keystroke(373, 2) && strlen(CFG.externaleditor))) { + } else if ((z == Keystroke(373, 1) && strlen(CFG.externaleditor))) { exitinfo.MsgEditor = EXTEDIT; Syslog('+', "User selected external editor"); } diff --git a/mbsebbs/dispfile.c b/mbsebbs/dispfile.c index fe3efbaf..9c80e700 100644 --- a/mbsebbs/dispfile.c +++ b/mbsebbs/dispfile.c @@ -528,13 +528,13 @@ void ControlCodeU(int ch) case '3': switch(exitinfo.MsgEditor) { - case LINEEDIT: snprintf(temp, 81, "%s", Language(387)); - break; - case FSEDIT: snprintf(temp, 81, "%s", Language(388)); - break; - case EXTEDIT: snprintf(temp, 81, "%s", Language(389)); - break; - default: snprintf(temp, 81, "?"); + case X_LINEEDIT: snprintf(temp, 81, "%s", Language(388)); + break; + case FSEDIT: snprintf(temp, 81, "%s", Language(388)); + break; + case EXTEDIT: snprintf(temp, 81, "%s", Language(389)); + break; + default: snprintf(temp, 81, "?"); } break; diff --git a/mbsebbs/lineedit.c b/mbsebbs/lineedit.c deleted file mode 100644 index 6220354d..00000000 --- a/mbsebbs/lineedit.c +++ /dev/null @@ -1,576 +0,0 @@ -/***************************************************************************** - * - * $Id$ - * Purpose ...............: Message line editor. - * - ***************************************************************************** - * Copyright (C) 1997-2005 - * - * Michiel Broek FIDO: 2:280/2802 - * Beekmansbos 10 - * 1971 BV IJmuiden - * the Netherlands - * - * This file is part of MBSE BBS. - * - * This BBS is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2, or (at your option) any - * later version. - * - * MBSE BBS is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with MBSE BBS; see the file COPYING. If not, write to the Free - * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - *****************************************************************************/ - -#include "../config.h" -#include "../lib/mbselib.h" -#include "../lib/mbse.h" -#include "../lib/users.h" -#include "mail.h" -#include "input.h" -#include "language.h" -#include "timeout.h" -#include "lineedit.h" -#include "term.h" -#include "ttyio.h" - - -extern int Line; -extern char *Message[]; - - -/* - * Internal prototypes - */ -void Line_Edit_Append(void); /* Append lines */ -void Line_Edit_Delete(void); /* Delete lines */ -void Line_Edit_Edit(void); /* Edit lines */ -void Line_Edit_Insert(void); /* Insert lines */ -void Line_Edit_Replace(void); /* Replace lines */ -void Line_Edit_Text(void); /* Edit (replace) text in line */ -void Line_Edit_Center(void); /* Center a line */ - - - - -void Line_Edit_Append() -{ - char msg[41]; - - if ((Line - 1) == TEXTBUFSIZE) { - Enter(1); - /* Maximum message length exceeded */ - pout(CYAN, BLACK, (char *) Language(166)); - Enter(1); - return; - } - - while (TRUE) { - snprintf(msg, 41, "%-2d : ", Line); - pout(LIGHTGREEN, BLACK, msg); - colour(CFG.MsgInputColourF, CFG.MsgInputColourB); - alarm_on(); - GetstrP(Message[Line], 72, 0); - - if ((strcmp(Message[Line], "")) == 0) - return; - - Line++; - if ((Line - 1) == TEXTBUFSIZE) { - Enter(1); - /* Maximum message length exceeded */ - pout(LIGHTRED, BLACK, (char *) Language(166)); - Enter(1); - return; - } - } -} - - - -void Line_Edit_Delete() -{ - int i, start, end = 0, total, Loop; - char temp[81]; - - while (TRUE) { - Enter(2); - /* Delete starting at line */ - snprintf(temp, 81, "%s#(1 - %d): ", (char *) Language(176), (Line - 1) ); - pout(LIGHTGREEN, BLACK, temp); - colour(CFG.InputColourF, CFG.InputColourB); - GetstrC(temp, 80); - if ((strcmp(temp, "")) == 0) { - /* Aborted. */ - pout(WHITE, BLACK, (char *) Language(177)); - Enter(1); - return; - } - - start = atoi(temp); - if (start > (Line - 1)) { - Enter(1); - /* Please enter a number in the range of */ - snprintf(temp, 81, "%s(1 - %d)", (char *) Language(178), (Line - 1) ); - pout(LIGHTGREEN, BLACK, temp); - } else - break; - } - - while (TRUE) { - /* Delete ending at line */ - snprintf(temp, 81, "%s# (1 - %d): ", (char *) Language(179), (Line - 1) ); - pout(LIGHTGREEN, BLACK, temp); - colour(CFG.InputColourF, CFG.InputColourB); - GetstrC(temp, 80); - if ((strcmp(temp, "")) == 0) { - /* Aborted. */ - pout(WHITE, BLACK, (char *) Language(176)); - Enter(1); - return; - } - - end = atoi(temp); - - if(end > (Line - 1)) { - Enter(1); - /* Please enter a number in the range of */ - snprintf(temp, 81, "%s(1 - %d)", (char *) Language(179), (Line - 1) ); - pout(LIGHTGREEN, BLACK, temp); - Enter(2); - } else - break; - } - - /* Get total by minusing the end line from the start line */ - /* and + 1 will give you total lines between start and end */ - total = (end - start) + 1; - - /* Define loop by minusing total lines from end which will */ - /* do a loop for only the amount of lines left after the */ - /* end line */ - Loop = Line - end++; - - /* Minus the total amount of deleted lines from the current */ - /* amount of lines to keep track of how many lines you are */ - /* working with */ - Line -= total; - - /* Do loop to copy the current message over the deleted lines */ - - for (i = 0; i < Loop; i++) - strcpy(*(Message + start++), *(Message + end++)); -} - - - -void Line_Edit_Edit() -{ - int j, edit; - char temp[81]; - - while (TRUE) { - while (TRUE) { - Enter(1); - /* Enter line # to edit */ - snprintf(temp, 81, "%s(1 - %d): ", (char *) Language(181), (Line - 1) ); - pout(LIGHTGREEN, BLACK, temp); - colour(CFG.InputColourF, CFG.InputColourB); - GetstrC(temp, 80); - if ((strcmp(temp, "")) == 0) - return; - - edit = atoi(temp); - - if (edit > Line) { - Enter(1); - /* Please enter a number in the range of */ - snprintf(temp, 81, "%s(1 - %d) ", (char *) Language(178), (Line - 1) ); - pout(LIGHTGREEN, BLACK, temp); - } else - break; - } - - Enter(1); - snprintf(temp, 81, "%d : ", edit); - pout(LIGHTGREEN, BLACK, temp); - colour(CFG.MsgInputColourF, CFG.MsgInputColourB); - PUTSTR(Message[edit]); - j = strlen(Message[edit]); - colour(CFG.MsgInputColourF, CFG.MsgInputColourB); - alarm_on(); - GetstrP(Message[edit], 80, j); - } -} - - - -void Line_Edit_Insert() -{ - int i, j, start, end = 0, total; - char temp[81]; - - if ((Line - 1) == TEXTBUFSIZE) { - Enter(1); - /* Maximum message length exceeded */ - pout(CYAN, BLACK, (char *) Language(166)); - Enter(1); - return; - } - - while (TRUE) { - Enter(2); - /* Enter line # to insert text before */ - snprintf(temp, 81, "%s(1 - %d): ", (char *) Language(183), (Line - 1)); - pout(LIGHTGREEN, BLACK, temp); - colour(CFG.InputColourF, CFG.InputColourB); - GetstrC(temp, 80); - if ((strcmp(temp, "")) == 0) { - /* Aborted. */ - pout(WHITE, BLACK, (char *) Language(177)); - return; - } - - start = atoi(temp); - - if (start > (Line - 1)) { - Enter(1); - /* Please enter a number in the range of */ - snprintf(temp, 81, "%s(1 - %d)", (char *) Language(178), (Line - 1)); - pout(LIGHTGREEN, BLACK, temp); - } else - break; - } - - Enter(1); - j = start; - snprintf(temp, 81, "%-2d : ", start); - pout(LIGHTGREEN, BLACK, temp); - colour(CFG.MsgInputColourF, CFG.MsgInputColourB); - GetstrC(temp, 80); - - if ((strcmp(temp, "")) == 0) - return; - - total = Line - start; - end = Line; - Line++; - start = Line; - - for (i = 0; i < total + 1; i++) { - strcpy(Message[start], Message[end]); - start--; - end--; - } - - strcpy(Message[j], temp); -} - - - -void Line_Edit_Replace() -{ - int edit; - char temp[81]; - - while (TRUE) { - while (TRUE) { - Enter(2); - /* Enter line # to replace */ - snprintf(temp, 81, "%s(1 - %d): ", (char *) Language(185), (Line - 1) ); - pout(LIGHTGREEN, BLACK, temp); - colour(CFG.InputColourF, CFG.InputColourB); - GetstrC(temp, 80); - if ((strcmp(temp, "")) == 0) - return; - - edit = atoi(temp); - - if (edit > Line) { - Enter(1); - /* Please enter a number in the range of */ - snprintf(temp, 81, "%s(1 - %d) ", (char *) Language(178), (Line - 1)); - pout(LIGHTGREEN, BLACK, temp); - } else - break; - } - - Enter(1); - /* Line reads: */ - pout(WHITE, BLACK, (char *) Language(186)); - Enter(1); - - snprintf(temp, 81, "%d : ", edit); - pout(LIGHTGREEN, BLACK, temp); - colour(CFG.MsgInputColourF, CFG.MsgInputColourB); - PUTSTR(Message[edit]); - Enter(2); - - snprintf(temp, 81, "%d : ", edit); - pout(LIGHTGREEN, BLACK, temp); - colour(CFG.MsgInputColourF, CFG.MsgInputColourB); - GetstrC(temp, 80); - if ((strcmp(temp, "")) == 0) { - Enter(1); - /* Unchanged. */ - pout(WHITE, BLACK, (char *) Language(187)); - Enter(1); - } else - strcpy(Message[edit], temp); - - Enter(1); - /* Line now reads: */ - pout(WHITE, BLACK, (char *) Language(188)); - Enter(1); - - snprintf(temp, 81, "%d : ", edit); - pout(LIGHTGREEN, BLACK, temp); - - colour(CFG.MsgInputColourF, CFG.MsgInputColourB); - PUTSTR(Message[edit]); - } -} - - - -void Line_Edit_Text() -{ - int edit; - char temp[81], temp1[81]; - - while (TRUE) { - while (TRUE) { - Enter(2); - /* Enter line # to edit */ - snprintf(temp, 81, "%s(1 - %d): ", (char *) Language(194), (Line - 1)); - pout(LIGHTGREEN, BLACK, temp); - colour(CFG.InputColourF, CFG.InputColourB); - GetstrC(temp, 80); - if ((strcmp(temp, "")) == 0) - return; - - edit = atoi(temp); - - if (edit > Line) { - Enter(1); - /* Please enter a number in the range of */ - snprintf(temp, 81, "%s(1 - %d) ", (char *) Language(178), (Line - 1) ); - pout(LIGHTGREEN, BLACK, temp); - } else - break; - } - - Enter(1); - /* Line reads: */ - pout(WHITE, BLACK, (char *) Language(186)); - Enter(1); - snprintf(temp, 81, "%d : ", edit); - pout(LIGHTGREEN, BLACK, temp); - colour(CFG.MsgInputColourF, CFG.MsgInputColourB); - PUTSTR(Message[edit]); - Enter(2); - - /* Text to replace: */ - pout(LIGHTGREEN, BLACK, (char *) Language(195)); - colour(CFG.InputColourF, CFG.InputColourB); - GetstrC(temp, 80); - /* Replacement text: */ - pout(LIGHTGREEN, BLACK, (char *) Language(196)); - colour(CFG.InputColourF, CFG.InputColourB); - GetstrC(temp1, 80); - - strreplace(Message[edit], temp, temp1); - - Enter(1); - /* Line now reads: */ - pout(WHITE, BLACK, (char *) Language(197)); - Enter(1); - snprintf(temp, 81, "%d : ", edit); - pout(LIGHTGREEN, BLACK, temp); - colour(CFG.MsgInputColourF, CFG.MsgInputColourB); - PUTSTR(Message[edit]); - } -} - - - -void Line_Edit_Center() -{ - int i, j, z, center, maxlen = 78; - char *CEnter, temp[81]; - - Enter(2); - /* Enter line # to center */ - snprintf(temp, 81, "%s(1 - %d): ", (char *) Language(203), (Line - 1)); - pout(WHITE, BLACK, temp); - GetstrC(temp, 80); - if ((strcmp(temp, "")) == 0) - return; - - CEnter = calloc(81, sizeof(char)); - center = atoi(temp); - j = strlen(Message[center]); - if (j >= maxlen) { - Enter(1); - /* Line is maximum length and cannot be centered */ - pout(LIGHTGREEN, BLACK, (char *) Language(204)); - Enter(1); - } else { - z = 35 - (j / 2); - - for (i = 0; i < z; i++) - strcat(CEnter," "); - strcat(CEnter, Message[center]); - strcpy(Message[center], CEnter); - } - - Enter(1); - colour(CFG.MsgInputColourF, CFG.MsgInputColourB); - PUTSTR(Message[center]); - Enter(1); - free(CEnter); -} - - - -int Line_Edit() -{ - int i, j; - char msg[81]; - - clear(); - colour(LIGHTRED, BLACK); - /* Begin your message now, Blank line to end */ - Center((char *) Language(164)); - /* Maximum of TEXTBUFSIZE lines, 73 chars per line */ - Center((char *) Language(165)); - colour(YELLOW, BLACK); - PUTSTR((char *)" ("); - for (i = 0; i < 74; i++) - PUTSTR((char *)"-"); - PUTSTR((char *)")"); - Enter(1); - - Line_Edit_Append(); - - while (TRUE) { - Enter(1); - /* Functions available: (Current Message: */ /* Lines) */ - snprintf(msg, 81, "%s%d %s", (char *) Language(167), (Line - 1), (char *) Language(168)); - pout(YELLOW, BLACK, msg); - Enter(2); - - /* L - List message S - Save message C - Continue message */ - pout(LIGHTCYAN, BLACK, (char *) Language(169)); - Enter(1); - - /* Q - Quit message D - Delete line I - Insert line */ - pout(LIGHTCYAN, BLACK, (char *) Language(170)); - Enter(1); - - /* T - Text edit E - Edit line R - Replace line */ - pout(LIGHTCYAN, BLACK, (char *) Language(171)); - Enter(1); - - /* Z - Center line */ - pout(LIGHTCYAN, BLACK, (char *) Language(172)); - Enter(2); - - snprintf(msg, 81, "%s [", (char *) Language(173)); - pout(WHITE, BLACK, msg); - for (i = 0; i < 10; i++) - PUTCHAR(Keystroke(172, i)); - PUTSTR((char *)"]: "); - - alarm_on(); - j = toupper(Readkey()); - - if (j == Keystroke(172, 2)) { - /* Continue */ - pout(WHITE, BLACK, (char *) Language(174)); - Enter(1); - Line_Edit_Append(); - } else if (j == Keystroke(172, 4)) { - /* Delete */ - pout(WHITE, BLACK, (char *) Language(175)); - Enter(1); - Line_Edit_Delete(); - } else if (j == Keystroke(172, 7)) { - /* Edit */ - pout(WHITE, BLACK, (char *) Language(180)); - Enter(1); - Line_Edit_Edit(); - } else if (j == Keystroke(172, 5)) { - /* Insert */ - pout(WHITE, BLACK, (char *) Language(182)); - Enter(1); - Line_Edit_Insert(); - } else if (j == Keystroke(172, 0)) { - pout(WHITE, BLACK, (char *) Language(184)); - Enter(2); - - for (i = 1; i < Line; i++) { - snprintf(msg, 81, "%d: ", i); - pout(LIGHTGREEN, BLACK, msg); - colour(CFG.MsgInputColourF, CFG.MsgInputColourB); - PUTSTR(Message[i]); - Enter(1); - } - } else if (j == Keystroke(172, 8)) { - /* Replace */ - pout(WHITE, BLACK, (char *) Language(362)); - Enter(1); - Line_Edit_Replace(); - } else if (j == Keystroke(172, 3)) { - /* Quit */ - pout(WHITE, BLACK, (char *) Language(189)); - Enter(2); - - /* Are you sure [y/N] */ - PUTSTR((char *) Language(190)); - alarm_on(); - - if (toupper(Readkey()) == Keystroke(190, 0)) { - /* Yes */ - pout(CFG.HiliteF, CFG.HiliteB, (char *) Language(356)); - Enter(1); - /* Message aborted. */ - pout(WHITE, BLACK, (char *) Language(191)); - Enter(2); - - sleep(1); - return FALSE; - } - - /* No */ - pout(CFG.HiliteF, CFG.HiliteB, (char *) Language(192)); - Enter(1); - } else if (j == Keystroke(172, 6)) { - /* Text Edit */ - pout(WHITE, BLACK, (char *) Language(193)); - Line_Edit_Text(); - } else if (j == Keystroke(172, 1)) { - /* Save */ - pout(WHITE, BLACK, (char *) Language(198)); - Enter(1); - - if (Line > 1) - return TRUE; - - return FALSE; - } else if (j == Keystroke(172, 9)) { - /* Center */ - pout(WHITE, BLACK, (char *) Language(376)); - Enter(1); - Line_Edit_Center(); - } - } -} - - diff --git a/mbsebbs/lineedit.h b/mbsebbs/lineedit.h deleted file mode 100644 index 71894eca..00000000 --- a/mbsebbs/lineedit.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef _LINEEDIT_H -#define _LINEEDIT_H - -int Line_Edit(void); /* The message line editor */ - -#endif - diff --git a/mbsebbs/mail.c b/mbsebbs/mail.c index 5fb19a1f..4dcdd1de 100644 --- a/mbsebbs/mail.c +++ b/mbsebbs/mail.c @@ -50,7 +50,6 @@ #include "timeout.h" #include "oneline.h" #include "exitinfo.h" -#include "lineedit.h" #include "fsedit.h" #include "filesub.h" #include "msgutil.h" @@ -376,9 +375,9 @@ void SysopComment(char *Cmt) int Edit_Msg() { switch (exitinfo.MsgEditor) { - case LINEEDIT: return Line_Edit(); - case FSEDIT: return Fs_Edit(); - case EXTEDIT: return Ext_Edit(); + case X_LINEEDIT: return Fs_Edit(); + case FSEDIT: return Fs_Edit(); + case EXTEDIT: return Ext_Edit(); } return 0; } diff --git a/mbsetup/ledit.c b/mbsetup/ledit.c index e3f3965c..4a2b6334 100644 --- a/mbsetup/ledit.c +++ b/mbsetup/ledit.c @@ -1813,10 +1813,10 @@ int edit_newsmode(int y, int x, int val) char *getmsgeditor(int val) { switch (val) { - case LINEEDIT: return (char *)"Line"; - case FSEDIT: return (char *)"FS. "; - case EXTEDIT: return (char *)"Ext."; - default: return NULL; + case X_LINEEDIT: return (char *)"FS. "; + case FSEDIT: return (char *)"FS. "; + case EXTEDIT: return (char *)"Ext."; + default: return NULL; } } @@ -1841,10 +1841,14 @@ int edit_msgeditor(int y, int x, int val) ch = readkey(y, x, YELLOW, BLUE); if (ch == ' ') { - if (val < EXTEDIT) - val++; - else - val = LINEEDIT; + if (strlen(CFG.externaleditor)) { + if (val < EXTEDIT) + val++; + else + val = FSEDIT; + } else { + val = FSEDIT; + } } } while ((ch != KEY_ENTER) && (ch != '\012')); diff --git a/mbsetup/m_users.c b/mbsetup/m_users.c index f853ea89..c0da0b3f 100644 --- a/mbsetup/m_users.c +++ b/mbsetup/m_users.c @@ -90,57 +90,60 @@ int CountUsers(void) int OpenUsers(void); int OpenUsers(void) { - FILE *fin, *fout; - char fnin[PATH_MAX], fnout[PATH_MAX]; - int oldsize; + FILE *fin, *fout; + char fnin[PATH_MAX], fnout[PATH_MAX]; + int oldsize; - snprintf(fnin, PATH_MAX, "%s/etc/users.data", getenv("MBSE_ROOT")); - snprintf(fnout, PATH_MAX, "%s/etc/users.temp", getenv("MBSE_ROOT")); - if ((fin = fopen(fnin, "r")) != NULL) { - if ((fout = fopen(fnout, "w")) != NULL) { - fread(&usrconfighdr, sizeof(usrconfighdr), 1, fin); - /* - * In case we are automatic upgrading the data format - * we save the old format. If it is changed, the - * database must always be updated. - */ - oldsize = usrconfighdr.recsize; - if (oldsize != sizeof(usrconfig)) { - UsrUpdated = 1; - Syslog('+', "Upgraded %s, format changed", fnin); - } else - UsrUpdated = 0; - usrconfighdr.hdrsize = sizeof(usrconfighdr); - usrconfighdr.recsize = sizeof(usrconfig); - fwrite(&usrconfighdr, sizeof(usrconfighdr), 1, fout); + snprintf(fnin, PATH_MAX, "%s/etc/users.data", getenv("MBSE_ROOT")); + snprintf(fnout, PATH_MAX, "%s/etc/users.temp", getenv("MBSE_ROOT")); + if ((fin = fopen(fnin, "r")) != NULL) { + if ((fout = fopen(fnout, "w")) != NULL) { + fread(&usrconfighdr, sizeof(usrconfighdr), 1, fin); + /* + * In case we are automatic upgrading the data format + * we save the old format. If it is changed, the + * database must always be updated. + */ + oldsize = usrconfighdr.recsize; + if (oldsize != sizeof(usrconfig)) { + UsrUpdated = 1; + Syslog('+', "Upgraded %s, format changed", fnin); + } else + UsrUpdated = 0; + usrconfighdr.hdrsize = sizeof(usrconfighdr); + usrconfighdr.recsize = sizeof(usrconfig); + fwrite(&usrconfighdr, sizeof(usrconfighdr), 1, fout); - /* - * The datarecord is filled with zero's before each - * read, so if the format changed, the new fields - * will be empty. - */ - memset(&usrconfig, 0, sizeof(usrconfig)); - while (fread(&usrconfig, oldsize, 1, fin) == 1) { - /* - * In version 0.33.20 the message editor has 3 choices, - * adjust settings. - */ - if (usrconfig.xFsMsged && (usrconfig.MsgEditor == LINEEDIT)) { - usrconfig.MsgEditor = FSEDIT; - UsrUpdated = 1; - Syslog('+', "Adjusted editor setting for user %s", usrconfig.sUserName); - } - fwrite(&usrconfig, sizeof(usrconfig), 1, fout); - memset(&usrconfig, 0, sizeof(usrconfig)); - } + /* + * The datarecord is filled with zero's before each + * read, so if the format changed, the new fields + * will be empty. + */ + memset(&usrconfig, 0, sizeof(usrconfig)); + while (fread(&usrconfig, oldsize, 1, fin) == 1) { + /* + * Since 0.83.0 there is no more line editor. + */ + if ((usrconfig.MsgEditor == X_LINEEDIT) || + ((usrconfig.MsgEditor == EXTEDIT) && (strlen(CFG.externaleditor) == 0))) { + if (strlen(CFG.externaleditor)) + usrconfig.MsgEditor = EXTEDIT; + else + usrconfig.MsgEditor = FSEDIT; + UsrUpdated = 1; + Syslog('+', "Adjusted editor setting for user %s", usrconfig.sUserName); + } + fwrite(&usrconfig, sizeof(usrconfig), 1, fout); + memset(&usrconfig, 0, sizeof(usrconfig)); + } - fclose(fin); - fclose(fout); - return 0; - } else - return -1; - } - return -1; + fclose(fin); + fclose(fout); + return 0; + } else + return -1; + } + return -1; } @@ -171,26 +174,6 @@ void CloseUsers(int force) -int AppendUsers(void) -{ - FILE *fil; - char ffile[PATH_MAX]; - - snprintf(ffile, PATH_MAX, "%s/etc/users.temp", getenv("MBSE_ROOT")); - if ((fil = fopen(ffile, "a")) != NULL) { - memset(&usrconfig, 0, sizeof(usrconfig)); - usrconfig.MailScan = TRUE; - usrconfig.ieFILE = TRUE; - fwrite(&usrconfig, sizeof(usrconfig), 1, fil); - fclose(fil); - UsrUpdated = 1; - return 0; - } else - return -1; -} - - - void Screen1(void) { clr_index(); @@ -201,28 +184,28 @@ void Screen1(void) mbse_mvprintw( 7, 2, "2. Security"); mbse_mvprintw( 8, 2, "3. Expirydate"); mbse_mvprintw( 9, 2, "4. Expiry Sec"); - mbse_mvprintw(10, 2, "5. Unix name"); + mbse_mvprintw(10, 2, " Unix name"); mbse_mvprintw(11, 2, " 1st login"); mbse_mvprintw(12, 2, " Last login"); mbse_mvprintw(13, 2, " Pwdchange"); - mbse_mvprintw(14, 2, "6. Credit"); - mbse_mvprintw(15, 2, "7. Hidden"); - mbse_mvprintw(16, 2, "8. Deleted"); - mbse_mvprintw(17, 2, "9. No Kill"); - mbse_mvprintw(18, 2, "10. Comment"); + mbse_mvprintw(14, 2, "5. Credit"); + mbse_mvprintw(15, 2, "6. Hidden"); + mbse_mvprintw(16, 2, "7. Deleted"); + mbse_mvprintw(17, 2, "8. No Kill"); + mbse_mvprintw(18, 2, "9. Comment"); - mbse_mvprintw( 6,54, "11. Locked"); - mbse_mvprintw( 7,54, "12. Guest"); - mbse_mvprintw( 8,54, "13. Ext Info"); - mbse_mvprintw( 9,54, "14. Email"); + mbse_mvprintw( 6,54, "10. Locked"); + mbse_mvprintw( 7,54, "11. Guest"); + mbse_mvprintw( 8,54, "12. Ext Info"); + mbse_mvprintw( 9,54, "13. Email"); mbse_mvprintw(10,54, " Calls"); mbse_mvprintw(11,54, " Downlds"); mbse_mvprintw(12,54, " Down Kb"); mbse_mvprintw(13,54, " Uploads"); mbse_mvprintw(14,54, " Upload Kb"); mbse_mvprintw(15,54, " Posted"); - mbse_mvprintw(16,54, "15. Time left"); - mbse_mvprintw(17,54, "16. Screen 2"); + mbse_mvprintw(16,54, "14. Time left"); + mbse_mvprintw(17,54, "15. Screen 2"); } @@ -238,8 +221,9 @@ void Fields1(void) show_int( 7,17, usrconfig.Security.level); show_str( 8,17,10, usrconfig.sExpiryDate); show_int( 9,17, usrconfig.ExpirySec.level); + set_color(LIGHTGRAY, BLACK); show_str(10,17, 8, usrconfig.Name); - + now = usrconfig.tFirstLoginDate; ld = localtime(&now); snprintf(Date, 30, "%02d-%02d-%04d %02d:%02d:%02d", ld->tm_mday, @@ -256,6 +240,7 @@ void Fields1(void) ld->tm_mon+1, ld->tm_year + 1900, ld->tm_hour, ld->tm_min, ld->tm_sec); show_str(13,17,19, Date); + set_color(WHITE, BLACK); show_int( 14,17, usrconfig.Credit); show_bool(15,17, usrconfig.Hidden); show_bool(16,17, usrconfig.Deleted); @@ -266,12 +251,14 @@ void Fields1(void) show_bool( 7,68, usrconfig.Guest); show_bool( 8,68, usrconfig.OL_ExtInfo); show_bool( 9,68, usrconfig.Email); + set_color(LIGHTGRAY, BLACK); show_int( 10,68, usrconfig.iTotalCalls); show_int( 11,68, usrconfig.Downloads); show_int( 12,68, usrconfig.DownloadK); show_int( 13,68, usrconfig.Uploads); show_int( 14,68, usrconfig.UploadK); show_int( 15,68, usrconfig.iPosted); + set_color(WHITE, BLACK); show_int( 16,68, usrconfig.iTimeLeft); } @@ -502,13 +489,19 @@ int EditUsrRec(int Area) fread(&usrconfig, sizeof(usrconfig), 1, fil); fclose(fil); + + if (strlen(usrconfig.sUserName) == 0) { + errmsg((char *)"You cannot edit an empty record"); + return -1; + } + crc = 0xffffffff; crc = upd_crc32((char *)&usrconfig, crc, sizeof(usrconfig)); Screen1(); for (;;) { Fields1(); - j = select_menu(16); + j = select_menu(15); switch(j) { case 0: crc1 = 0xffffffff; crc1 = upd_crc32((char *)&usrconfig, crc1, sizeof(usrconfig)); @@ -541,22 +534,21 @@ int EditUsrRec(int Area) break; case 3 :E_STR( 8,17,10,usrconfig.sExpiryDate, "The ^Expiry Date^ in DD-MM-YYYY format, 00-00-0000 is no expire") case 4 :E_INT( 9,17, usrconfig.ExpirySec.level,"The ^Expiry Level^ for this user") - case 5 :E_STR( 10,17,8, usrconfig.Name, "The ^Unix username^ for this user") - case 6 :E_INT( 14,17, usrconfig.Credit, "Users ^Credit^") - case 7 :E_BOOL(15,17, usrconfig.Hidden, "Is user ^hidden^ on the BBS") - case 8 :E_BOOL(16,17, usrconfig.Deleted, "Is user marked for ^deletion^") - case 9 :E_BOOL(17,17, usrconfig.NeverDelete, "^Never delete^ this user") - case 10:E_STR( 18,17,62,usrconfig.sComment, "A ^Comment^ for this user") + case 5 :E_INT( 14,17, usrconfig.Credit, "Users ^Credit^") + case 6 :E_BOOL(15,17, usrconfig.Hidden, "Is user ^hidden^ on the BBS") + case 7 :E_BOOL(16,17, usrconfig.Deleted, "Is user marked for ^deletion^") + case 8 :E_BOOL(17,17, usrconfig.NeverDelete, "^Never delete^ this user") + case 9 :E_STR( 18,17,62,usrconfig.sComment, "A ^Comment^ for this user") - case 11:E_BOOL( 6,68, usrconfig.LockedOut, "User is ^Locked Out^ of this BBS") - case 12:E_BOOL( 7,68, usrconfig.Guest, "This is a ^Guest^ account") - case 13:E_BOOL( 8,68, usrconfig.OL_ExtInfo, "Add ^Extended Message Info^ in OLR download") - case 14:E_BOOL( 9,68, usrconfig.Email, "User has a ^private email^ mailbox") - case 15:if (yes_no((char *)"Reset time left for today") == 1) { + case 10:E_BOOL( 6,68, usrconfig.LockedOut, "User is ^Locked Out^ of this BBS") + case 11:E_BOOL( 7,68, usrconfig.Guest, "This is a ^Guest^ account") + case 12:E_BOOL( 8,68, usrconfig.OL_ExtInfo, "Add ^Extended Message Info^ in OLR download") + case 13:E_BOOL( 9,68, usrconfig.Email, "User has a ^private email^ mailbox") + case 14:if (yes_no((char *)"Reset time left for today") == 1) { Reset_Time(); } break; - case 16:EditUsrRec2(); + case 15:EditUsrRec2(); clr_index(); Screen1(); Fields1(); @@ -570,99 +562,90 @@ int EditUsrRec(int Area) void EditUsers(void) { - int records, i, o, x, y; - char pick[12]; - FILE *fil; - char temp[PATH_MAX]; - int offset; + int records, i, o, x, y; + char pick[12]; + FILE *fil; + char temp[PATH_MAX]; + int offset; + clr_index(); + working(1, 0, 0); + IsDoing("Browsing Menu"); + if (config_read() == -1) { + working(2, 0, 0); + return; + } + + records = CountUsers(); + if (records == -1) { + working(2, 0, 0); + return; + } + + if (OpenUsers() == -1) { + working(2, 0, 0); + return; + } + o = 0; + if (! check_free()) + return; + + for (;;) { clr_index(); - working(1, 0, 0); - IsDoing("Browsing Menu"); - if (config_read() == -1) { - working(2, 0, 0); - return; - } - - records = CountUsers(); - if (records == -1) { - working(2, 0, 0); - return; - } - - if (OpenUsers() == -1) { - working(2, 0, 0); - return; - } - o = 0; - if (! check_free()) - return; - - for (;;) { - clr_index(); - set_color(WHITE, BLACK); - mbse_mvprintw( 5, 3, "15. USERS EDITOR"); + set_color(WHITE, BLACK); + mbse_mvprintw( 5, 3, "15. USERS EDITOR"); + set_color(CYAN, BLACK); + if (records != 0) { + snprintf(temp, PATH_MAX, "%s/etc/users.temp", getenv("MBSE_ROOT")); + working(1, 0, 0); + if ((fil = fopen(temp, "r")) != NULL) { + fread(&usrconfighdr, sizeof(usrconfighdr), 1, fil); + x = 2; + y = 7; set_color(CYAN, BLACK); - if (records != 0) { - snprintf(temp, PATH_MAX, "%s/etc/users.temp", getenv("MBSE_ROOT")); - working(1, 0, 0); - if ((fil = fopen(temp, "r")) != NULL) { - fread(&usrconfighdr, sizeof(usrconfighdr), 1, fil); - x = 2; - y = 7; - set_color(CYAN, BLACK); - for (i = 1; i <= 20; i++) { - if (i == 11) { - x = 42; - y = 7; - } - if ((o + i) <= records) { - offset = sizeof(usrconfighdr) + (((i + o) - 1) * usrconfighdr.recsize); - fseek(fil, offset, 0); - fread(&usrconfig, usrconfighdr.recsize, 1, fil); - if (!usrconfig.Deleted) - set_color(CYAN, BLACK); - else - set_color(LIGHTBLUE, BLACK); - snprintf(temp, 81, "%3d. %-32s", o + i, usrconfig.sUserName); - temp[37] = 0; - mbse_mvprintw(y, x, temp); - y++; - } - } - fclose(fil); - } - } - strcpy(pick, select_record(records, 20)); - - if (strncmp(pick, "-", 1) == 0) { - CloseUsers(FALSE); - open_bbs(); - return; - } - - if (strncmp(pick, "A", 1) == 0) { - working(1, 0, 0); - if (AppendUsers() == 0) { - records++; - working(1, 0, 0); - } else - working(2, 0, 0); - } - - if (strncmp(pick, "N", 1) == 0) - if ((o + 20) < records) - o = o + 20; - - if (strncmp(pick, "P", 1) == 0) - if ((o - 20) >= 0) - o = o - 20; - - if ((atoi(pick) >= 1) && (atoi(pick) <= records)) { - EditUsrRec(atoi(pick)); - o = ((atoi(pick) - 1) / 20) * 20; + for (i = 1; i <= 20; i++) { + if (i == 11) { + x = 42; + y = 7; + } + if ((o + i) <= records) { + offset = sizeof(usrconfighdr) + (((i + o) - 1) * usrconfighdr.recsize); + fseek(fil, offset, 0); + fread(&usrconfig, usrconfighdr.recsize, 1, fil); + if ((!usrconfig.Deleted) && strlen(usrconfig.sUserName)) + set_color(CYAN, BLACK); + else + set_color(LIGHTBLUE, BLACK); + snprintf(temp, 81, "%3d. %-32s", o + i, usrconfig.sUserName); + temp[37] = 0; + mbse_mvprintw(y, x, temp); + y++; + } } + fclose(fil); + } } + strcpy(pick, select_pick(records, 20)); + + if (strncmp(pick, "-", 1) == 0) { + CloseUsers(FALSE); + open_bbs(); + return; + } + + if (strncmp(pick, "N", 1) == 0) + if ((o + 20) < records) + o = o + 20; + + if (strncmp(pick, "P", 1) == 0) + if ((o - 20) >= 0) + o = o - 20; + + if ((atoi(pick) >= 1) && (atoi(pick) <= records)) { + EditUsrRec(atoi(pick)); + o = ((atoi(pick) - 1) / 20) * 20; + } + } }