home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.wwiv.com
/
ftp.wwiv.com.zip
/
ftp.wwiv.com
/
pub
/
BBS
/
J_CONFX.ZIP
/
J_CONF3.PPS
< prev
Wrap
Text File
|
1995-01-06
|
12KB
|
329 lines
; Program name:J_conf.pps Version 1.0
; Written by Tim Fritz 1/6/95
;
; This program replaces the standard PCBoard J command
; (Join a conference) menu. It allows the USER to specify
; if they would like to build a menu "on-the-fly" of those
; conferences they can join, or see a list of all available
; conferences.
;
; A problem with any board is upkeep, i.e. conferences change,
; and new additions are made. Wouldn't it be nice if the system
; just presented the user with the current list...no menu updates,
; it would just use the data in the conference setup files!
;
; That is exactly what this PPE does. It reads the cnames file
; and presents the list of valid conferences to the
; user along with the public/private status of the conference.
; Since it uses the cnames file, you MUST do a normal save when
; adding or blanking out a conference. Remember, cnames only gets
; updated with normal save.
;
; basic form of operation:
; - if the parm "Build Menu" is sent it generates the cmnu file from
; cnames.
; - if a parm is sent and it is NOT "Build Menu", it is re-tokenized
; and passed on to the normal J command
; - if NO parms are sent (ie nothing is tokenized) the program
; requests from the user if they would like a list of ALL
; available conferences or just those they have access to.
; ie:
; List Conferences you can (J)oin or (A)ll
;
; Basic process:
; -if parm sent but NOT "Build Menu" then retokenize, stuff keyboard
; and exit..
; -if parm "Build Menu" sent:
; -get the number of conferences on the board (line 108 of PCBoard.dat)
; -get the location of the cnames file (line 31 of PCBoard.dat)
; -read in the first line of each conference in cnames
; (33*Conference #+1) if it is NOT blank
; -loop thru the file writing out the data to the CMNU file
; -display the conference data for the user, x lines per screen
; (be sure to let the user pick a conference between screens)
; -exit
; -if NO parms, request input from the user:
; -List Conferences you can (J)oin or (A)ll
; -if A, display CMNU (if it does NOT exist, create it)
; -if J, create a list "on-the-fly"
;
; Installation:
; -install by adding to the CMD.LST file using PCBSetup.
; Example:
; Command Security PPE/MNU File -or- Keystroke Replacement
; ------- --------- ------------------------------------------
; J 10 C:\PCB\PPE\J_CONF\J_CONF3.PPE
; JO 10 C:\PCB\PPE\J_CONF\J_CONF3.PPE
; JOI 10 C:\PCB\PPE\J_CONF\J_CONF3.PPE
; JOIN 10 C:\PCB\PPE\J_CONF\J_CONF3.PPE
;
; set the vars up
INTEGER iMaxConf 'Number of conferences on PCBoard
INTEGER iColor 'Color interger for screen display color
INTEGER iUser_rec 'Users record number
INTEGER i 'General use interger counter var
INTEGER k 'General use interger counter var
STRING sCnamesPath 'drive, path, and file from PCBoard.dat for cnames
STRING sCmnuPath 'drive, path, and file for conference menu file
STRING sCurColor 'used for color control of screen output
STRING s1 'General use string var
STRING s2 'General use string var
STRING s3 'General use string var
STRING s4 'General use string var
STRING sResp ' users resp to prompt
STRING saWW(3) 'string array for wworking routine
INTEGER iWW 'integer counter for wworking
INTEGER iWWShow 'integer counter for wworking
INTEGER iWWxCur 'integer counter for wworking x cursor
INTEGER iWWyCur 'integer counter for wworking y cursor
INTEGER iWWxiCur 'integer counter for x cursor prior to calling wworking
INTEGER iWWyiCur 'integer counter for y cursor prior to calling wworking
;Init saWW
saWW(0)="-"
saWW(1)="\"
saWW(2)="|"
saWW(3)="/"
; -if parm sent but NOT "Build Menu" then retokenize, stuff keyboard
; and exit..
IF (TOKCOUNT() > 0) THEN
s1=""
WHILE (TOKCOUNT() > 0) s1=s1+GETTOKEN()+" "
TOKENIZE s1 're-tokenize so we can save it to s1
s1=TOKENSTR() 'save it to s1 for later use
TOKENIZE s1 'do it again so we can look it it
if ("BUILD"=UPPER(GETTOKEN()) & "MENU"=UPPER(GETTOKEN())) THEN
; Build the CMNU and exit
GOSUB BLD_CMNU 'go build the menu file
ELSE
'stuff the keyboard and exit
s1="J;"+s1
KBDSTUFF s1
ENDIF
ELSE
; -NO parms, request input from the user:
; ie List Conferences you can (J)oin or (A)ll
; with default = J
sResp="J"
INPUTSTR "List Conferences you can (J)oin or (A)ll", sResp,@X0E,1,"JA",UPCASE+NEWLINE+GUIDE+FIELDLEN
IF (sResp="A") THEN
sResp=" "
GOSUB CMNU_DISPLAY ' display the CMNU menu file
ELSE 'must be equal to J
sResp=" "
GOSUB ON_THE_FLY 'present the user with a list of accessable conferences
ENDIF
ENDIF
DEFCOLOR
cls
END
*********************************************************************
************************ Sub-Routines *******************************
*********************************************************************
*************************************************************************
:BLD_CMNU 'build the CMNU menu file
; Using the PPL functions PCBDAT() and READLINE()
; we can find out number of conferences and where cnames is located
iMaxConf = READLINE(PCBDAT(),108)
sCnamesPath = READLINE(PCBDAT(),31)
;setup the file (cmnu) in the same path as cnames
sCmnuPath=FILEINF(sCnamesPath,6)+":"+FILEINF(sCnamesPath,7)+"CMNU"
; blow away the old one
FCREATE 1, sCmnuPath, O_RW, S_DN
FOR i = 0 to iMaxConf
s1=READLINE(sCnamesPath,33*i+1) 'conference name
s2=READLINE(sCnamesPath,33*i+20) '0=private, -1=public
IF (s2 ="-1") s2="Public"
IF (s2 = "0") s2="Private"
s3=READLINE(sCnamesPath,33*i+23) 'security level for access
IF (LEN(TRIM(s1," "))>0) THEN
s4=RIGHT(" "+I2S(i,10),3) 'get string of new extension
IF (s2 = "Private") THEN
FPUTLN 1," ",s4," ",MID(s1+space(62),1,62),s2
ELSE
FPUTLN 1," ",s4," ",MID(s1+space(62),1,62),s3
ENDIF
ENDIF
NEXT i
FCLOSE 1
RETURN
*************************************************************************
*************************************************************************
:CMNU_DISPLAY ' display the CMNU menu file
;set the color
GOSUB SET_COLOR
;get the associated file location data
sCnamesPath = READLINE(PCBDAT(),31)
;setup the file (cmnu) in the same path as cnames
sCmnuPath=FILEINF(sCnamesPath,6)+":"+FILEINF(sCnamesPath,7)+"CMNU"
;display the file
IF (!EXIST(sCmnuPath)) GOSUB BLD_CMNU
FOPEN 1, sCmnuPath, O_RD, S_DN
FGET 1,s1
While (!FERR(1) & !ABORT()) DO
COLOR iColor
CLS
PRINTLN " @INCONF@"
PRINTLN " ### Conference Name/Descripton Access"
PRINTLN " --- ------------------------------------------------------------ -------"
FOR i=1 to 12
IF (FERR(1)) BREAK
PRINTLN s1
IF (i=4) PRINTLN
IF (i=8) PRINTLN
IF (i < 12) FGET 1,s1
NEXT i
PRINTLN
IF (i = 13 & !FERR(1)) THEN
INPUTSTR "(@TIMELEFT@ min left), Conference (#) to join or Enter for More",sResp,@X0E,5,"1234567890N",UPCASE+ERASELINE
ELSE
INPUTSTR "(@TIMELEFT@ min left), Conference (#) to join or Enter for none",sResp,@X0E,5,"1234567890N",UPCASE+ERASELINE
ENDIF
; Lets see what they want
IF (LEN(trim(sResp," ")) > 0 ) THEN
IF (sResp="N") BREAK
sResp="J;"+sResp
KBDSTUFF sResp
BREAK
ENDIF
FGET 1,s1
ENDWHILE
RETURN
*************************************************************************
*************************************************************************
:ON_THE_FLY 'presnt the user with a list of accessable conferences
; get the number of conferences and location of cnames
iMaxConf = READLINE(PCBDAT(),108)
sCnamesPath = READLINE(PCBDAT(),31)
;set the color
GOSUB SET_COLOR
; this is what it looks like
; 1 2 3 4 5 6 7 8
;12345678901234567890123456789012345678901234567890123456789012345678901234567890
; ### Conference Name/Description Access"
; --- ------------------------------------------------------------ -------"
GETUSER 'load up the system default vars
iUser_rec=U_RECNUM(U_NAME()) 'get the users record number
k=1 'counter to track display
FOR i = 0 to iMaxConf
IF (k=1) THEN
COLOR iColor
CLS
PRINTLN " @INCONF@"
PRINTLN " ### Conference Name/Descripton Access"
PRINTLN " --- ------------------------------------------------------------ -------"
ENDIF
GOSUB WWORKING
s1=READLINE(sCnamesPath,33*i+1) 'conference name
IF (LEN(TRIM(s1," "))>0) THEN 'if no conf skip it
s2=READLINE(sCnamesPath,33*i+20) '0=private, -1=public
s3=READLINE(sCnamesPath,33*i+23) 'security level for access
;ck if user is qualified for this conference
IF (U_INCONF(iUser_rec,i) | (U_SEC >= S2I(s3,10) & s2="-1")) THEN
; print one to the screen
k=k+1
IF (s2 ="-1") s2="Public"
IF (s2 = "0") s2="Private"
s4=RIGHT(" "+I2S(i,10),3) 'get string of new extension
BACKUP 2
;COLOR iColor
IF (s2 = "Private") THEN
PRINTLN " ",s4," ",MID(s1+space(62),1,62),s2
ELSE
PRINTLN " ",s4," ",MID(s1+space(62),1,62),s3
ENDIF
IF (k=4) PRINTLN
IF (k=8) PRINTLN
ENDIF
ENDIF
; ck if screen is full...if so let them make a choice
IF ((k = 13) | (i = iMaxConf)) THEN
BACKUP 2
;COLOR iColor
IF ((k = 13) & (i <> iMaxConf)) THEN
PRINTLN " "
INPUTSTR "(@TIMELEFT@ min left), Conference (#) to join or Enter for More",sResp,@X0E,5,"1234567890N",UPCASE+ERASELINE
ELSEIF (i = iMaxConf)
PRINTLN " "
INPUTSTR "(@TIMELEFT@ min left), Conference (#) to join or Enter for none",sResp,@X0E,5,"1234567890N",UPCASE+ERASELINE
ENDIF
; Lets see what they want
IF (LEN(trim(sResp," ")) > 0 ) THEN
IF (sResp="N") BREAK
sResp="J;"+sResp
KBDSTUFF sResp
BREAK
ENDIF
k=1
ENDIF
NEXT i
RETURN
*************************************************************************
*************************************************************************
:SET_COLOR 'Set the display color based on the current background
IF (CURCOLOR()<10) THEN
sCurColor="0F"
ELSE
sCurColor=I2S(CURCOLOR(),16)
;set our foreground based on the background color
;for 0 (black) or 1 (blue) use F (bright white)
;for all others use 0 (black)
;if background color is greater then 7 subtract 8 from it first
i=S2I(LEFT(sCurColor,1),16)
IF (7 < i) i=i-8 'no blinking backgrounds !
IF (i = 1) THEN
sCurColor=I2S(i,16)+"F"
ELSE
sCurColor=I2S(i,16)+"8"
ENDIF
ENDIF
iColor=S2I(sCurColor,16)
RETURN
*************************************************************************
*************************************************************************
:WWORKING
; routine to let users know that something is going on
BACKUP 2
COLOR iColor
PRINT saWW(iWW%4), " "
INC iWW
iWWShow=1
INC iWWShow
RETURN
*************************************************************************
; this is what it looks like
; 1 2 3 4 5 6 7 8
;12345678901234567890123456789012345678901234567890123456789012345678901234567890
; ### Conference Name/Description Access"
; --- ------------------------------------------------------------ -------"
;