home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Devil's Doorknob BBS Capture (1996-2003)
/
devilsdoorknobbbscapture1996-2003.iso
/
Dloads
/
OTHERUTI
/
WWIV420S.ZIP
/
DEFAULTS.C
< prev
next >
Wrap
C/C++ Source or Header
|
1991-04-06
|
16KB
|
725 lines
/*****************************************************************************
WWIV Version 4
Copyright (C) 1988-1991 by Wayne Bell
Distribution of the source code for WWIV, in any form, modified or unmodified,
without PRIOR, WRITTEN APPROVAL by the author, is expressly prohibited.
Distribution of compiled versions of WWIV is limited to copies compiled BY
THE AUTHOR. Distribution of any copies of WWIV not compiled by the author
is expressly prohibited.
*****************************************************************************/
#include "vars.h"
#pragma hdrstop
void select_editor()
{
char s[81],s1[81],*ss;
int i;
helpl=37;
if (numed==0) {
nl();
pl("No full screen editors available.");
nl();
return;
}
for (i=0; i<5; i++)
odc[i]=0;
pl("0. Normal non-full screen editor");
for (i=0; i<numed; i++) {
npr("%d. %s\r\n",i+1,editors[i].description);
if (((i+1) %10)==0)
odc[(i+1)/10-1]=(i+1)/10;
}
nl();
ansic(2);
npr("Which editor (1-%d, <C/R>=leave as is) ? ",numed);
ss=mmkey(2);
i=atoi(ss);
if ((i>=1) && (i<=numed))
thisuser.defed=i;
else
if (strcmp(ss,"0")==0)
thisuser.defed=0;
}
void print_cur_stat()
{
char s[81],s1[81],s2[81];
userrec ur;
outchr(12);
npr("1. Screen size : %d X %d\r\n",
thisuser.screenchars,
thisuser.screenlines);
npr("2. ANSI : %s\r\n",
(thisuser.sysstatus & sysstatus_ansi)?
((thisuser.sysstatus & sysstatus_color)? "Color":"Monochrome"):
"No ANSI");
npr("3. Pause on screen : %s\r\n",
(thisuser.sysstatus & sysstatus_pause_on_page)?"On":"Off");
outstr("4. Mailbox : ");
if ((thisuser.forwardsys==0) && (thisuser.forwardusr==0))
pl("Normal");
else {
if (thisuser.forwardsys) {
sprintf(s,"Forward to #%u @%u.",thisuser.forwardusr,thisuser.forwardsys);
pl(s);
} else {
read_user(thisuser.forwardusr,&ur);
if (ur.inact & inact_deleted) {
thisuser.forwardusr=0;
pl("Normal");
} else {
sprintf(s,"Forward to %s",nam(&ur,thisuser.forwardusr));
pl(s);
}
}
}
pl("5. Configured Q-scan");
pl("6. Change password");
pl("7. Update macros");
if (okansi()) {
pl("8. Change colors");
npr("9. Full screen editor: %s\r\n",
((thisuser.defed) && (thisuser.defed<=numed))?
editors[thisuser.defed-1].description:"None.");
npr("A. Extended colors : %s\r\n",
(thisuser.sysstatus & sysstatus_funky_colors)?"Yes":"No");
}
npr("B. Optional lines : %d\r\n",thisuser.optional_val);
if (thisuser.wwiv_regnum)
npr("W. WWIV reg num : %ld\r\n",thisuser.wwiv_regnum);
else
pl("W. WWIV reg num : <NONE>");
pl("Q. Quit to main menu");
nl();
nl();
}
char *cn(char c)
{
static char s[20];
if ((checkcomp("Ami")) || (checkcomp("Mac"))) {
sprintf(s,"Color #%d",c);
return(s);
}
switch(c) {
case 0:
return("Black");
case 1:
return("Blue");
case 2:
return("Green");
case 3:
return("Cyan");
case 4:
return("Red");
case 5:
return("Magenta");
case 6:
return("Yellow");
case 7:
return("White");
}
return("");
}
char *describe(char col)
{
static char s[81];
char s1[81];
if (thisuser.sysstatus & sysstatus_color) {
strcpy(s1,cn(col&0x07));
sprintf(s,"%s on %s", s1, cn((col>>4)&0x07));
} else {
if ((col & 0x07) == 0)
strcpy(s,"Inversed");
else
strcpy(s,"Normal");
}
if (col & 0x08) {
if ((checkcomp("Ami")) || (checkcomp("Mac")))
strcat(s,", Bold");
else
strcat(s,", Intense");
}
if (col & 0x80) {
if (checkcomp("Ami"))
strcat(s,", Italicized");
else
if (checkcomp("Mac"))
strcat(s,", Underlined");
else
strcat(s,", Blinking");
}
return(s);
}
void color_list()
{
int i;
nl();
nl();
for (i=0; i<8; i++) {
if (i==0)
setc(0x70);
else
setc(i);
npr("%d. %s",i,cn(i));
setc(0x07);
nl();
}
}
void change_colors()
{
int i,done,i1,i2;
char s[81],ch,nc;
done=0;
helpl=36;
nl();
do {
if ((thisuser.sysstatus & sysstatus_color)==0) {
strcpy(s,"Monochrome base color : ");
if ((thisuser.bwcolors[1] & 0x70) == 0)
strcat(s,cn(thisuser.bwcolors[1] & 0x07));
else
strcat(s,cn((thisuser.bwcolors[1] >> 4) & 0x07));
pl(s);
nl();
}
for (i=0; i<8; i++) {
ansic(i);
itoa(i,s,10);
strcat(s,". ");
switch(i) {
case 0:
strcat(s,"Default ");
break;
case 1:
strcat(s,"Yes/No ");
break;
case 2:
strcat(s,"Prompt ");
break;
case 3:
strcat(s,"Note ");
break;
case 4:
strcat(s,"Input line ");
break;
case 5:
strcat(s,"Yes/No Question ");
break;
case 6:
strcat(s,"Notice! ");
break;
case 7:
strcat(s,"Border ");
break;
}
if (thisuser.sysstatus & sysstatus_color)
strcat(s,describe(thisuser.colors[i]));
else
strcat(s,describe(thisuser.bwcolors[i]));
pl(s);
}
nl();
prt(2,"Change which (0-7, Q=Quit) ? ");
ch=onek("Q01234567");
if (ch=='Q')
done=1;
else {
i1=ch-'0';
if (thisuser.sysstatus & sysstatus_color) {
color_list();
ansic(0);
nl();
prt(2,"Foreground? ");
ch=onek("01234567");
nc=ch-'0';
prt(2,"Background? ");
ch=onek("01234567");
nc=nc | ((ch-'0') << 4);
} else {
nl();
prt(5,"Inversed? ");
if (yn()) {
if ((thisuser.bwcolors[1] & 0x70) == 0)
nc=0 | ((thisuser.bwcolors[1] & 0x07) << 4);
else
nc=(thisuser.bwcolors[1] & 0x70);
} else {
if ((thisuser.bwcolors[1] & 0x70) == 0)
nc=0 | (thisuser.bwcolors[1] & 0x07);
else
nc=((thisuser.bwcolors[1] & 0x70) >> 4);
}
}
if ((checkcomp("Ami")) || (checkcomp("Mac")))
prt(5,"Bold? ");
else
prt(5,"Intensified? ");
if (yn())
nc |= 0x08;
if (checkcomp("Ami"))
prt(5,"Italicized? ");
else
if (checkcomp("Mac"))
prt(5,"Underlined? ");
else
prt(5,"Blinking? ");
if (yn())
nc |= 0x80;
nl();
nl();
setc(nc);
outstr(describe(nc));
ansic(0);
nl();
nl();
prt(5,"Is this OK? ");
if (yn()) {
nl();
pl("Color saved.");
nl();
if (thisuser.sysstatus & sysstatus_color)
thisuser.colors[i1]=nc;
else
thisuser.bwcolors[i1]=nc;
} else {
nl();
pl("Not saved, then.");
nl();
}
}
} while ((!done) && (!hangup));
}
void l_config_qscan()
{
int i,abort;
char s[81];
abort=0;
nl();
pl("Boards to q-scan marked with '*'");
nl();
for (i=0; (i<MAX_SUBS) && (usub[i].subnum!=-1) && (!abort); i++) {
sprintf(s,"%c %s. %s",
#if MAX_SUBS>32
(i>=32)?
(((1L << (usub[i].subnum-32)) & thisuser.qscn2)?'*':' '):
(((1L << (usub[i].subnum)) & thisuser.qscn)?'*':' '),
#else
((1L << (usub[i].subnum)) & thisuser.qscn)?'*':' ',
#endif
usub[i].keys,
subboards[usub[i].subnum].name);
pla(s,&abort);
}
nl();
nl();
}
void config_qscan()
{
char *s;
int i,done;
l_config_qscan();
done=0;
do {
nl();
pl("Enter sub-board identifier, or Q to Quit");
helpl=7;
outstr("Config: ");
s=mmkey(0);
if (s[0])
for (i=0; i<MAX_SUBS; i++)
if (strcmp(usub[i].keys,s)==0) {
#if MAX_SUBS>32
if (i>=32)
thisuser.qscn2 ^=((1L) << (usub[i].subnum-32));
else
thisuser.qscn ^=((1L) << (usub[i].subnum));
#else
thisuser.qscn ^=((1L) << (usub[i].subnum));
#endif
}
if (strcmp(s,"Q")==0)
done=1;
if (strcmp(s,"?")==0)
l_config_qscan();
} while ((!done) && (!hangup));
}
void list_macro(unsigned char *s)
{
int i;
i=0;
outchr('\"');
while ((i<80) && (s[i]!=0)) {
if (s[i]>=32)
outchr(s[i]);
else {
outchr('^');
outchr(s[i]+64);
}
++i;
}
outchr('"');
nl();
}
void make_macros()
{
unsigned char tempmac[81],s[81];
unsigned char ch,ch1;
int i,i1,done,done1;
done=0;
do {
nl();
prt(2,"Macros: L:ist, M:ake, Q:uit : ");
helpl=33;
ch=onek("QLM");
switch(ch) {
case 'Q':
done=1;
break;
case 'L':
nl();
nl();
pl("Ctrl-D macro: ");
list_macro(&(thisuser.macros[0][0]));
nl();
pl("Ctrl-F macro: ");
list_macro(&(thisuser.macros[1][0]));
nl();
pl("Ctrl-A macro: ");
list_macro(&(thisuser.macros[2][0]));
break;
case 'M':
nl();
prt(2,"Which (A,D,F, Q=quit) : ");
ch1=onek("QADF");
if (ch1!='Q') {
switch(ch1) {
case 'A': i1=2; break;
case 'D': i1=0; break;
case 'F': i1=1; break;
}
strcpy(s,&(thisuser.macros[i1][0]));
thisuser.macros[i1][0]=0;
done1=0;
i=0;
nl();
pl("Enter your macro now, hit ctrl-Z when done.");
nl();
okskey=0;
do {
ch1=getkey();
if (ch1==26)
done1=1;
else
if (ch1==8) {
if (i>0) {
i--;
backspace();
if (tempmac[i]<32)
backspace();
}
} else {
if (ch1>=32) {
tempmac[i++]=ch1;
outchr(ch1);
} else {
tempmac[i++]=ch1;
outchr('^');
outchr(ch1+64);
}
}
if (i>=78)
done1=1;
} while ((!done1) && (!hangup));
okskey=1;
tempmac[i]=0;
nl();
pl("You entered:");
nl();
nl();
list_macro(tempmac);
nl();
prt(5,"Is this OK? ");
if (yn()) {
strcpy(&(thisuser.macros[i1][0]),tempmac);
nl();
pl("Macro saved.");
} else {
nl();
strcpy(&(thisuser.macros[i1][0]),s);
pl("Nothing saved.");
}
}
break;
}
} while ((!done) && (!hangup));
}
void input_pw1()
{
char s[81],s1[81];
int ok;
nl();
prt(5,"Change password? ");
if (yn()) {
nl();
pl("You must now enter your current password.");
outstr(": ");
echo=0;
input(s,8);
if (strcmp(s,thisuser.pw)) {
nl();
pl("Incorrect.");
nl();
return;
}
nl();
nl();
pl("Enter your new password, 3 to 8 characters long.");
outstr(": ");
echo=0;
input(s,8);
nl();
nl();
pl("Repeat password for verification.");
outstr(": ");
echo=0;
input(s1,8);
if (strcmp(s,s1)==0) {
strcpy(thisuser.pw,s);
nl();
pl("Password changed.");
nl();
sysoplog("Changed Password.");
} else {
nl();
pl("VERIFY FAILED.");
pl("Password not changed.");
nl();
}
}
}
void modify_mailbox()
{
int i,i1,i2;
unsigned int u;
char s[81];
net_system_list_rec *csne;
nl();
helpl=35;
prt(5,"Do you want to forward your mail? ");
if (!yn()) {
thisuser.forwardsys=0;
thisuser.forwardusr=0;
return;
}
nl();
if (syscfg.systemnumber) {
prt(5,"Forward to another system? ");
if (yn()) {
nl();
prt(2,"Which system (number)? ");
input(s,5);
i2=atoi(s);
if ((csne=next_system(i2))==NULL) {
nl();
pl("Unknown system.");
nl();
return;
}
nl();
npr("System name: %s\r\n",csne -> name);
nl();
if (i2==syscfg.systemnumber) {
nl();
pl("That's this system.");
nl();
return;
}
prt(2,"Which user number on that system? ");
input(s,5);
i=atoi(s);
if ((i>0) && (i<20000)) {
thisuser.forwardsys=i2;
thisuser.forwardusr=i;
nl();
pl("Saved.");
nl();
}
return;
}
}
nl();
prt(2,"Forward to which user? ");
input(s,40);
i=finduser1(s);
if (i==usernum) {
thisuser.forwardsys=0;
thisuser.forwardusr=0;
nl();
pl("Forwarding reset.");
nl();
return;
}
if (i>0) {
thisuser.forwardsys=0;
thisuser.forwardusr=i;
nl();
pl("Saved.");
nl();
}
}
void optional_lines()
{
char s[81];
int i;
pl("You may specify your optional lines value from 0-10,");
pl("0 being all, 10 being none.");
prt(2,"What value? ");
input(s,2);
i=atoi(s);
if ((s[0]) && (i>=0) && (i<11))
thisuser.optional_val = i;
}
void enter_regnum()
{
char s[81];
long l;
pl("You may now enter your WWIV registration number.");
pl("Enter 0 for none.");
nl();
prt(2,"WWIV: ");
input(s,5);
l=atol(s);
if ((s[0]) && (l>=0))
thisuser.wwiv_regnum = l;
}
void defaults()
{
int i,i1,i2,done;
char s[81],s1[81],s2[81],ch;
done=0;
print_cur_stat();
do {
nl();
helpl=4;
if (okansi()) {
prt(2,"Defaults: (1-9,A-B,?,Q) : ");
ch=onek("Q?123456789ABW");
} else {
prt(2,"Defaults: (1-7,B,?,Q) : ");
ch=onek("Q?1234567BW");
}
switch(ch) {
case 'Q':
done=1;
break;
case '?':
print_cur_stat();
break;
case '1':
input_screensize();
break;
case '2':
input_ansistat();
break;
case '3':
if (thisuser.sysstatus & sysstatus_pause_on_page)
thisuser.sysstatus ^= sysstatus_pause_on_page;
nl();
prt(5,"Pause each screenfull? ");
if (yn())
thisuser.sysstatus |= sysstatus_pause_on_page;
break;
case '4':
modify_mailbox();
break;
case '5':
config_qscan();
break;
case '6':
input_pw1();
break;
case '7':
make_macros();
break;
case '8':
change_colors();
break;
case '9':
select_editor();
break;
case 'A':
if (thisuser.sysstatus & sysstatus_funky_colors)
thisuser.sysstatus ^= sysstatus_funky_colors;
nl();
prt(5,"Use extended colors? ");
if (yn())
thisuser.sysstatus |= sysstatus_funky_colors;
break;
case 'B':
optional_lines();
break;
case 'W':
enter_regnum();
break;
}
} while ((!done) && (!hangup));
}