home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Devil's Doorknob BBS Capture (1996-2003)
/
devilsdoorknobbbscapture1996-2003.iso
/
UTIL
/
WWIVE
/
DEFAULTS.C
< prev
next >
Wrap
Text File
|
1992-02-13
|
16KB
|
736 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("1No 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("11. Screen size : %d X %d\r\n",
thisuser.screenchars,
thisuser.screenlines);
npr("22. ANSI : %s\r\n",
(thisuser.sysstatus & sysstatus_ansi)?
((thisuser.sysstatus & sysstatus_color)? "Color":"Monochrome"):
"No ANSI");
npr("33. Pause on screen : %s\r\n",
(thisuser.sysstatus & sysstatus_pause_on_page)?"On":"Off");
outstr("54. 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("75. Configured Q-scan");
pl("16. Change password");
pl("27. Update macros");
if (okansi()) {
pl("38. Change colors");
npr("59. Full screen editor: %s\r\n",
((thisuser.defed) && (thisuser.defed<=numed))?
editors[thisuser.defed-1].description:"None.");
npr("7A. Extended colors : %s\r\n",
(thisuser.sysstatus & sysstatus_funky_colors)?"Yes":"No");
}
npr("1B. Optional lines : %d\r\n",thisuser.optional_val);
if (thisuser.wwiv_regnum)
npr("2W. WWIV reg num : %ld\r\n",thisuser.wwiv_regnum);
else
pl("2W. WWIV reg num : <NONE>");
npr("3O. Personal Tag : %s\r\n",thisuser.note);
pl("5Q. 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(1,"7[1Change which7]5 [10-7, Q=Quit5]1 ? ");
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("1Color saved.");
nl();
if (thisuser.sysstatus & sysstatus_color)
thisuser.colors[i1]=nc;
else
thisuser.bwcolors[i1]=nc;
} else {
nl();
pl("6Not saved, then.");
nl();
}
}
} while ((!done) && (!hangup));
}
void l_config_qscan()
{
int i,abort;
char s[81];
abort=0;
nl();
pl("1Boards 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("1Enter sub-board identifier, or `Enter' to Quit");
helpl=7;
outstr("5Config: ");
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,"")==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(1,"Macros: 7L1:ist, 7M1:ake, 7Q1:uit 3 : ");
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(7,"[1Which7] (5A1,5D1,5F1, 5Q1=5quit7) 3: ");
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("1Enter 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("3You entered1:");
nl();
nl();
list_macro(tempmac);
nl();
prt(3,"Is this OK1? ");
if (yn()) {
strcpy(&(thisuser.macros[i1][0]),tempmac);
nl();
pl("3Macro saved1.");
} else {
nl();
strcpy(&(thisuser.macros[i1][0]),s);
pl("3Nothing saved1.");
}
}
break;
}
} while ((!done) && (!hangup));
}
void input_pw1()
{
char s[81],s1[81];
int ok;
nl();
prt(3,"Change password1? ");
if (yn()) {
nl();
pl("1You must now enter your current password2.");
outstr(": ");
echo=0;
input(s,8);
if (strcmp(s,thisuser.pw)) {
nl();
pl("6Incorrect.");
nl();
return;
}
nl();
nl();
pl("3Enter your new password1,3 3 to 8 characters long1.");
outstr(": ");
echo=0;
input(s,8);
nl();
nl();
pl("3Repeat password for verification1.");
outstr(": ");
echo=0;
input(s1,8);
if (strcmp(s,s1)==0) {
strcpy(thisuser.pw,s);
nl();
pl("3Password changed1.");
nl();
sysoplog("Changed Password.");
} else {
nl();
pl("6VERIFY FAILED.");
pl("6Password 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 mail1? ");
if (!yn()) {
thisuser.forwardsys=0;
thisuser.forwardusr=0;
return;
}
nl();
if (syscfg.systemnumber) {
prt(5,"Forward to another system1? ");
if (yn()) {
nl();
prt(1,"Which system 5(7number5)1? ");
input(s,5);
i2=atoi(s);
if ((csne=next_system(i2))==NULL) {
nl();
pl("3Unknown system1.");
nl();
return;
}
nl();
npr("3System name1:3 %s\r\n",csne -> name);
nl();
if (i2==syscfg.systemnumber) {
nl();
pl("3That's this system1.");
nl();
return;
}
prt(3,"Which user number on that system1? ");
input(s,5);
i=atoi(s);
if ((i>0) && (i<20000)) {
thisuser.forwardsys=i2;
thisuser.forwardusr=i;
nl();
pl("3Saved1.");
nl();
}
return;
}
}
nl();
prt(3,"Forward to which user1? ");
input(s,40);
i=finduser1(s);
if (i==usernum) {
thisuser.forwardsys=0;
thisuser.forwardusr=0;
nl();
pl("3Forwarding reset1.");
nl();
return;
}
if (i>0) {
thisuser.forwardsys=0;
thisuser.forwardusr=i;
nl();
pl("3Saved1.");
nl();
}
}
void optional_lines()
{
char s[81];
int i;
pl("3You may specify your optional lines value from 0-101,");
pl("30 being all1, 310 being none1.");
prt(3,"What value1? ");
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("3You may now enter your WWIV registration number1.");
pl("3Enter 0 for none1.");
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,"7[1Defaults7]3: 5(11-9,A-B,W,O,?,Q5) 3: ");
ch=onek("Q?123456789ABWO");
} else {
prt(2,"7[1Defaults7]3: 5(11-7,B,W,O,?,Q5) 3: ");
ch=onek("Q?1234567BWO");
}
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(3,"Pause each screenfull1? ");
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(3,"Use extended 1c2o3l5o7r1s2? ");
if (yn())
thisuser.sysstatus |= sysstatus_funky_colors;
break;
case 'B':
optional_lines();
break;
case 'W':
enter_regnum();
break;
case 'O':
nl();
npr("3%s \r\n",thisuser.note);
nl();
pl("1You may now enter your new tag");
prt(2,":");
inputl(thisuser.note,40);
sprintf(s,"2Changed Tag to - 1%s",thisuser.note);
sysoplog(s);
break;
}
} while ((!done) && (!hangup));
}