home *** CD-ROM | disk | FTP | other *** search
/ Collection of Hack-Phreak Scene Programs / cleanhpvac.zip / cleanhpvac / PWAEQU11.ZIP / EQU.PPS < prev    next >
Text File  |  1995-11-15  |  14KB  |  430 lines

  1. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2. ; Enhanced Quick Uploader v1.1
  3. ; Written by Drew [PWA]
  4. ; Last updated 11-15-95
  5. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  6.  
  7. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  8. ; function & procedure prototypes, err, declarations
  9. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  10. declare procedure Initialize()
  11. declare procedure CheckU()
  12. declare procedure CheckIndicate()
  13. declare function  AskYesNo(string pr_string) boolean
  14. declare procedure PrintSelected(int curcmd, int col1, int col2)
  15. declare function  GenerateDummyFilename() string
  16. declare procedure StuffKeyboard(string filename)
  17. declare procedure IndicateBlindUpload()
  18. declare procedure ShowRules()
  19. declare function  DoPrivateUpload() boolean
  20. declare function  GetFilename() string
  21. declare procedure GetDescription()
  22. declare procedure SendMessage(string filename)
  23. declare procedure CheckAttach()
  24.  
  25.  
  26. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  27. ; some variables just have to be declared globally
  28. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  29. string equ_cfg        ; config file for EQU
  30. string indicate       ; temp 0-byte filename to indicate if this ppe is used
  31. string desclines(5)   ; quick description used when it's a private upload
  32. boolean doprivate     ; flag indicating if upload is private or not
  33. int numspaces         ; number of spaces between commands
  34. string noP, noH       ; unhighlighted & highlighted text for "No"
  35. string yesP, yesH     ; unhighlighted & highlighted text for "Yes"
  36.  
  37.  
  38. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  39. ; main body of program
  40. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  41. begin
  42.     string tmpstr  ; and foo to you too
  43.  
  44.  
  45.     Initialize()
  46.     CheckIndicate()
  47.     CheckAttach()
  48.     ShowRules()
  49.  
  50.     ; ask if the upload is a private upload
  51.     ;
  52.     doprivate = AskYesNo(readline(equ_cfg, 8))
  53.     if (doprivate == TRUE) then
  54.         ; ask for a filename and description
  55.         tmpstr = DoPrivateUpload()
  56.     else
  57.         ; if it's not a private upload, then create a dummy filename
  58.         tmpstr = GenerateDummyFilename()
  59.     endif
  60.  
  61.     IndicateBlindUpload()
  62.     StuffKeyboard(tmpstr)
  63. end
  64.  
  65.  
  66. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  67. ; procedure DoPrivateUpload() 
  68. ;
  69. ; handles if the user wants to send his upload privately to the sysop(s)
  70. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  71. function DoPrivateUpload() string
  72.     string filename
  73.  
  74.     filename = GetFilename()
  75.     newline
  76.     GetDescription()
  77.     newline
  78.     if (AskYesNo(readline(equ_cfg, 9)) == FALSE) then
  79.         ; if we're here, user has selected "No" when asked if the description
  80.         ; they've entered for the private upload is OK or not.  if not, then
  81.         ; delete the indicate file
  82.         ;
  83.         newline
  84.         println readline(equ_cfg, 13)
  85.         startdisp FCL
  86.         if (exist(indicate)) then
  87.             delete indicate
  88.         endif
  89.         kbdstuff chr(13)
  90.         end
  91.     else
  92.         SendMessage(filename)
  93.     endif
  94.  
  95.     DoPrivateUpload = filename
  96. endproc
  97.  
  98.  
  99. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  100. ; procedure SendMessage()
  101. ;
  102. ; actually sends the message
  103. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  104. procedure SendMessage(string filename)
  105.     string msg, subj
  106.     int i
  107.  
  108.     msg = ppepath() + "EQU" + string(pcbnode()) + ".MSG"
  109.     if (exist(msg)) then
  110.         delete msg
  111.     endif
  112.  
  113.     fopen 1, msg, O_WR, S_DN
  114.     fputln 1, "Private upload from " + u_name() + " : " + filename
  115.     fputln 1, ""
  116.     for i = 1 to 5
  117.         if (desclines(i-1) != "") then
  118.             fputln 1, desclines(i-1)
  119.         endif
  120.     next i
  121.     fputln 1, ""
  122.     fputln 1, "@X08Posted via EQU v1.1 by Drew [PWA]@X07"
  123.     fputln 1, ""
  124.     fclose 1
  125.  
  126.     newline
  127.     print readline(equ_cfg, 10)
  128.     subj = readline(equ_cfg, 16)
  129.     message 0, "SYSOP", u_name(), subj, "R", 0, FALSE, FALSE, msg
  130.     println readline(equ_cfg, 11)
  131.     newline
  132.     delete msg
  133. endproc
  134.  
  135.  
  136. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  137. ; procedure GetDescription()
  138. ;
  139. ; Gets the "brief" description that the user is supposed to say.  This
  140. ; description gets sent as a private message to the sysop.
  141. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  142. procedure GetDescription()
  143.     int i
  144.  
  145.     newline
  146.     println readline(equ_cfg, 12)
  147.     newline
  148.     for i = 1 to 5
  149.         print replacestr(readline(equ_cfg, 15), "%FN%", string(i))
  150.         inputstr "_", desclines(i-1), @X07, 70, MASK_ASCII() + MASK_ALNUM(), \
  151.                 AUTO + DEFS + NEWLINE
  152.         if ((i==1) && (desclines(i-1) == "")) then
  153.             ; user has hit RETURN on the first line of the description, 
  154.             ; therefore, aborting the procedure.
  155.             println readline(equ_cfg, 13)
  156.             newline
  157.             startdisp FCL
  158.             kbdstuff chr(13)
  159.             if (exist(indicate)) then
  160.                 delete indicate
  161.             endif
  162.             end
  163.         elseif (desclines(i-1) == "") then
  164.             break
  165.         endif
  166.     next i
  167.  
  168. endproc
  169.  
  170.  
  171. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  172. ; function GetFilename() string
  173. ;
  174. ; asks the user for the filename of the private upload to sysop
  175. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  176. function GetFilename() string
  177.     string tmpstr
  178.  
  179.     newline
  180.     print readline(equ_cfg, 14)
  181.     inputstr "_", tmpstr, @X07, 12, MASK_FILE(), AUTO + DEFS + FIELDLEN + GUIDE
  182.     if (tmpstr == "") then
  183.         ; if we're here, user has hit RETURN w/o entering a filename for the
  184.         ; private upload, so abort the entire procedure and delete the
  185.         ; indicate file
  186.         newline
  187.         println readline(equ_cfg, 13)
  188.         newline
  189.         startdisp FCL
  190.         kbdstuff chr(13)
  191.         if (exist(indicate)) then
  192.             delete indicate
  193.         endif
  194.         end
  195.     else
  196.         GetFilename = tmpstr
  197.     endif
  198. endfunc
  199.  
  200.  
  201. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  202. ; procedure ShowRules()
  203. ;
  204. ; duh
  205. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  206. procedure ShowRules()
  207.     string rules
  208.     int level
  209.  
  210.     if (exist(ppepath() + "EQU.PCB")) then
  211.         dispfile ppepath() + "EQU.PCB", DEFS
  212.     endif
  213.  
  214.     rules = readline(equ_cfg, 1)
  215.     if (exist(rules)) then
  216.         if (u_sec >= s2i(readline(equ_cfg, 2), 10)) then
  217.             dispfile rules, DEFS
  218.         endif
  219.     endif
  220.  
  221.     startdisp FNS
  222.     newline
  223.  
  224. endproc
  225.  
  226.  
  227. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  228. ; procedure IndicateBlindUpload()
  229. ;
  230. ; since we're replacing several prompts instead of the "U" and "UB" commands,
  231. ; we need to make some sort of indication (a "marker") so that the next time
  232. ; this ppe comes up, it knows that it has been run already.  thus, we just
  233. ; create zero-byte file, and end up deleting it when we're done.
  234. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  235. procedure IndicateBlindUpload()
  236.     newline
  237.     fcreate 1, indicate, O_WR, S_DN
  238.     fclose 1
  239. endproc
  240.  
  241.  
  242. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  243. ; procedure StuffKeyboard(string filename)
  244. ;
  245. ; stuffs the keyboard appropriately with a filename and description
  246. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  247. procedure StuffKeyboard(string filename)
  248.     string stuff
  249.  
  250.     if (doprivate == TRUE) then
  251.         stuff = filename + chr(13) + \
  252.                 "/ *** PRIVATE FILE(S) FOR THE SYSOP! ***" + chr(13) + \
  253.                 "/ Blind upload; FILE_ID.DIZ will be used." + chr(13) + \
  254.                 "/ Enhanced Quick Upload v1.1 by Drew [PWA]" + chr(13)
  255.     else
  256.         stuff = filename + chr(13) + \
  257.                 "Blind upload; FILE_ID.DIZ will be used." + chr(13) + \
  258.                 "Enhanced Quick Upload v1.1 by Drew [PWA]" + chr(13)
  259.     endif
  260.  
  261.     kbdstuff stuff + chr(13)
  262. endproc
  263.  
  264.  
  265. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  266. ; function GenerateDummyFilename() string
  267. ;
  268. ; generates a dummy filename.  this particular method is the same method used
  269. ; in the original MA-BAT20 by Mooncrow.
  270. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  271. function GenerateDummyFilename() string
  272.     int i
  273.     string tmpstr
  274.  
  275.     tmpstr = ""
  276.     for i = 1 to 8
  277.         tmpstr = tmpstr + string(random(9))
  278.     next i
  279.     tmpstr = tmpstr + ".ZIP"
  280.  
  281.     GenerateDummyFilename = tmpstr
  282. endfunc
  283.  
  284.  
  285. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  286. ; function AskYesNo(string pr_string) boolean 
  287. ;
  288. ; asks the user "Yes" or "No" in a lightbar fashion.  returns TRUE if yes,
  289. ; FALSE if no.
  290. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  291. function AskYesNo(string pr_string) boolean
  292.     string ascii
  293.     int col1, col2
  294.     int curcmd
  295.     boolean quit
  296.  
  297.     print pr_string
  298.     col1 = getx()
  299.     print noP + space(numspaces)
  300.     col2 = getx()
  301.     print yesP
  302.  
  303.     curcmd = 1
  304.     PrintSelected(curcmd, col1, col2)
  305.  
  306.     quit = FALSE
  307.     while (quit == FALSE) do
  308.         ascii = asc(inkey())
  309.         select case (ascii)
  310.         case 13
  311.             quit = TRUE
  312.         case 76, 68, 44
  313.             ; left & down arrow or comma
  314.             dec curcmd
  315.             if (curcmd < 1) curcmd = 2
  316.             PrintSelected(curcmd, col1, col2)
  317.         case 82, 85, 46
  318.             ; right & up arrow or period
  319.             inc curcmd
  320.             if (curcmd > 2) curcmd = 1
  321.             PrintSelected(curcmd, col1, col2)
  322.         case 89, 121
  323.             ; upper Y and lower y
  324.             curcmd = 2
  325.             PrintSelected(curcmd, col1, col2)
  326.             quit = TRUE
  327.         case 78, 110
  328.             ; upper N and lower n
  329.             curcmd = 1
  330.             PrintSelected(curcmd, col1, col2)
  331.             quit = TRUE
  332.         endselect
  333.     endwhile
  334.  
  335.     newline
  336.     if (curcmd == 1) then
  337.         AskYesNo = FALSE
  338.     else
  339.         AskYesNo = TRUE
  340.     endif
  341. endfunc
  342.  
  343.  
  344. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  345. ; procedure PrintSelected(...)
  346. ;
  347. ; prints the highlighted "Yes" or "No"
  348. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  349. procedure PrintSelected(int curcmd, int col1, int col2)
  350.     if (curcmd == 2) then
  351.         print chr(13)
  352.         forward col1 - 1
  353.         print noP
  354.         print chr(13)
  355.         forward col2 - 1
  356.         print yesH
  357.     elseif (curcmd == 1) then
  358.         print chr(13)
  359.         forward col2 - 1
  360.         print yesP
  361.         print chr(13)
  362.         forward col1 - 1
  363.         print noH
  364.     endif
  365. endproc
  366.  
  367.  
  368. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  369. ; procedure CheckIndicate()
  370. ;
  371. ; check if the indicate file exists or not.  if it is, then that means
  372. ; an invocation to this ppe has been made, so we delete the file and
  373. ; and keyboard stuff a carriage return.  this file is used so that we
  374. ; can figure out when we need to prompt the user.  we only prompt the
  375. ; the user on the first time they hit UPLOAD and the "Enter the filename
  376. ; to upload" prompt comes up.
  377. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  378. procedure CheckIndicate()
  379.     string foo
  380.  
  381.     indicate = ppepath() + "EQUTMP." + string(pcbnode())
  382.     if (exist(indicate)) then
  383.         delete indicate
  384.         kbdstuff chr(13)
  385.         end
  386.     endif
  387. endproc
  388.  
  389.  
  390. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  391. ; procedure CheckAttach()
  392. ;
  393. ; check if we are doing a file attachment or not.  there is kind of a
  394. ; "reverse" logic here, in that if the "ATTACH.###" file exists, that means
  395. ; we ** not ** doing a file attachment.  that file is created by the u.ppe
  396. ; ub.ppe replacement ppe's to indicate we're doing a regular uploading
  397. ; process and not a file attachment (the reason why we need to do this is
  398. ; because the prompt "Enter Filename to Upload" is used in both places).
  399. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  400. procedure CheckAttach()
  401.     string tmpbuf
  402.  
  403.     tmpbuf = ppepath() + "ATTACH." + string(pcbnode())
  404.     if (exist(tmpbuf)) then
  405.         delete tmpbuf
  406.     else
  407.         tmpbuf = ""
  408.         print readline(equ_cfg, 17)
  409.         inputstr "_", tmpbuf, @X07, 12, MASK_FILE(), DEFS + NEWLINE
  410.         kbdstuff tmpbuf + chr(13)
  411.         end
  412.     endif
  413. endproc
  414.  
  415. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  416. ; duh
  417. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  418. procedure Initialize()
  419.     getuser
  420.     equ_cfg = ppepath() + "EQU.CFG"
  421.  
  422.     numspaces = s2i(readline(equ_cfg, 3), 10)
  423.     noP       = readline(equ_cfg, 4)
  424.     noH       = readline(equ_cfg, 5)
  425.     yesP      = readline(equ_cfg, 6)
  426.     yesH      = readline(equ_cfg, 7)
  427.     fclose -1
  428. endproc
  429.  
  430.