home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / vxftpsrc.zip / VXFTP.VRX < prev    next >
Text File  |  1995-10-07  |  99KB  |  3,253 lines

  1. /*:VRX         Main
  2. */
  3. /*  Main
  4. */
  5. Main:
  6. /*  Process the arguments.
  7.     Get the parent window.
  8. */
  9.     parse source . calledAs .
  10.     parent = ""
  11.     argCount = arg()
  12.     argOff = 0
  13.     if( calledAs \= "COMMAND" )then do
  14.         if argCount >= 1 then do
  15.             parent = arg(1)
  16.             argCount = argCount - 1
  17.             argOff = 1
  18.         end
  19.     end
  20.     InitArgs.0 = argCount
  21.     if( argCount > 0 )then  do i = 1 to argCount
  22.         InitArgs.i = arg( i + ArgOff )
  23.     end
  24.     drop calledAs argCount argOff 
  25.  
  26. /*  Load the windows
  27. */
  28.     hEventQ = VRInit()
  29.     parse source . . spec
  30.     _VREPrimaryWindowPath = ,
  31.         VRParseFileName( spec, "dpn" ) || ".VRW"
  32.     _VREPrimaryWindow = ,
  33.         VRLoad( parent, _VREPrimaryWindowPath )
  34.     drop parent spec
  35.     if( _VREPrimaryWindow == "" )then do
  36.         call VRMessage "", "Cannot load window:" VRError(), ,
  37.             "Error!"
  38.         _VREReturnValue = 32000
  39.         signal _VRELeaveMain
  40.     end
  41.  
  42. /*  Process events
  43. */
  44.     call Init
  45.     signal on halt
  46.     do while( \ VRGet( _VREPrimaryWindow, "Shutdown" ) )
  47.         _VREEvent = VREvent()
  48.         interpret _VREEvent
  49.     end
  50. _VREHalt:
  51.     _VREReturnValue = Fini()
  52.     call VRDestroy _VREPrimaryWindow
  53. _VRELeaveMain:
  54.     call VRFini
  55. exit _VREReturnValue
  56.  
  57. VRLoadSecondary: procedure
  58.     name = arg( 1 )
  59.  
  60.     window = VRLoad( VRWindow(), VRWindowPath(), name )
  61.     call VRMethod window, "CenterWindow"
  62.     call VRSet window, "Visible", 1
  63.     call VRMethod window, "Activate"
  64. return window
  65.  
  66. /*:VRX         Aliases_Close
  67. */
  68. Aliases_Close:
  69.     window = VRInfo( "Object" )
  70.     call VRDestroy window
  71.     drop window
  72. return
  73. /*:VRX         Aliases_Create
  74. */
  75. Aliases_Create:
  76.     Aliases = VRGetIni( "VxFTP", "Aliases", IniFile, "NoClose" )
  77.  
  78.     if ( Aliases = "" ) then 
  79.         GAliases.0 = 0
  80.     else do
  81.        /* Create the GAliases. stem variable from the "Aliases" 
  82.         * string for holding the Aliases.
  83.         */
  84.         i = 0
  85.         do until Aliases = ""
  86.             i = i + 1
  87.             parse value Aliases with GAliases.i "}{" Aliases
  88.         end
  89.         GAliases.0 = i
  90.  
  91.        /* Build the Alias list in AliasName. for displaying the 
  92.         * Aliases' names in the list box.
  93.         */
  94.         do i = 1 to GAliases.0
  95.             parse value GAliases.i with AliasName.i "|" .
  96.         end
  97.         AliasName.0 = i
  98.  
  99.         rc = VRMethod( "LB_Aliases", "AddStringList", "AliasName."  )
  100.  
  101.         drop Aliases AliasName.
  102.     end
  103.     
  104.     if ( GAliases.0 = 1 ) then
  105.         rc = VRSet( "DT_AliasNumber", "Caption", "1 Alias" )
  106.     else
  107.         rc = VRSet( "DT_AliasNumber", "Caption", GAliases.0 "Aliases" )
  108. return
  109.  
  110. /*:VRX         BasicErrMsg
  111. */
  112. BasicErrMsg:
  113. /* Easy way of showing simple error messages, thanks to VX-REXX's
  114.  * ability to expand the dialog box to fit the message.
  115.  */
  116.     ErrMessage = arg(1)
  117.  
  118.     OK = 1
  119.     Buttons.OK = "OK"
  120.     Cancel = 2
  121.     Buttons.Cancel = "Cancel"
  122.     Buttons.0 = 2
  123.     
  124.     id = VRMessage( VRWindow(), ErrMessage, "Error", ,
  125.                      "Error", "Buttons.", OK, Cancel )
  126.     drop ErrMessage
  127. return
  128.  
  129. /*:VRX         Cache_Close
  130. */
  131. Cache_Close: 
  132.     window = VRInfo( "Window" )
  133.     call VRDestroy window
  134.     drop window
  135.  
  136. return
  137.  
  138. /*:VRX         Cache_Create
  139. */
  140. Cache_Create: 
  141.     value = VRGetIni("VxFTP", "CacheSize", IniFile, "NoClose" )
  142.     rc = VRSet( "SPIN_CacheSize", "Value", value )
  143.     value = VRGetIni("VxFTP", "RefreshInterval", IniFile, "NoClose" )
  144.     rc = VRSet( "SPIN_RefreshInterval", "Value", value )
  145.  
  146.     set = VRGetIni( "VxFTP", "UseCache", IniFile, "NoClose" )
  147.     if (set = 1) then do
  148.         rc = VRSet( "CB_Cache", "Set", 1 )
  149.         rc = VRSet( "SPIN_CacheSize", "Enabled", 1 )
  150.         rc = VRSet( "SPIN_RefreshInterval", "Enabled", 1 )
  151.       end
  152.     else do
  153.         rc = VRSet( "CB_Cache", "Set", 0 )    
  154.         rc = VRSet( "SPIN_CacheSize", "Enabled", 0 )
  155.         rc = VRSet( "SPIN_RefreshInterval", "Enabled", 0 )
  156.     end
  157.  
  158.     drop value
  159.     call Cache_Init
  160. return
  161.  
  162. /*:VRX         Cache_Init
  163. */
  164. Cache_Init: 
  165.     window = VRInfo( "Object" )
  166.     if( \VRIsChildOf( window, "Notebook" ) ) then do
  167.         call VRMethod window, "CenterWindow"
  168.         call VRSet window, "Visible", 1
  169.         call VRMethod window, "Activate"
  170.     end
  171.     drop window
  172. return
  173.  
  174. /*:VRX         CachedDirs_Close
  175. */
  176. CachedDirs_Close: 
  177.     call CachedDirs_Fini
  178. return
  179.  
  180. /*:VRX         CachedDirs_Create
  181. */
  182. CachedDirs_Create: 
  183. /* The Cache table is built by the remote thread (better response
  184.  * to user if local thread doesn't have to manage it).
  185.  */
  186.     rc = VRMethod( "Application", "GetVar", "Table.Dir_Name." )
  187.     rc = VRMethod( "DDCB_CachedDirs", "Reset" )
  188.     rc = VRMethod( "DDCB_CachedDirs", "AddStringList", "Table.Dir_Name."  )
  189. return
  190.  
  191. /*:VRX         CachedDirs_Fini
  192. */
  193. CachedDirs_Fini: 
  194.     window = VRInfo( "Window" )
  195.     call VRDestroy window
  196.     drop window
  197. return
  198. /*:VRX         CB_Cache_Click
  199. */
  200. CB_Cache_Click: 
  201.     set = VRGet( "CB_Cache", "Set" )
  202.     if (set = 1) then do
  203.         rc = VRSetIni( "VxFTP", "UseCache", 1, IniFile, "NoClose" )
  204.         rc = VRSet( "SPIN_CacheSize", "Enabled", 1 )
  205.         rc = VRSet( "SPIN_RefreshInterval", "Enabled", 1 )
  206.       end
  207.     else do
  208.         rc = VRSetIni( "VxFTP", "UseCache", 0, IniFile, "NoClose" )
  209.         rc = VRSet( "SPIN_CacheSize", "Enabled", 0 )
  210.         rc = VRSet( "SPIN_RefreshInterval", "Enabled", 0 )
  211.     end
  212.  
  213.     drop set
  214. return
  215.  
  216. /*:VRX         CB_Hints_Click
  217. */
  218. CB_Hints_Click: 
  219.     set = VRGet( "CB_Hints", "Set" )
  220.     if ( set = 1 ) then do
  221.         rc = VRSetIni( "VxFTP", "Hints", "1", IniFile, "NoClose" )
  222.         rc = VRSet( "MainWindow", "ShowHints", 1 )
  223.       end
  224.     else do
  225.         rc = VRSetIni( "VxFTP", "Hints", "0", IniFile, "NoClose" )
  226.         rc = VRSet( "MainWindow", "ShowHints", 0 )
  227.       end
  228. return
  229.  
  230. /*:VRX         CB_IncludeDate_Click
  231. */
  232. CB_IncludeDate_Click: 
  233.     /* Reset the remote directory cache and reset file list
  234.      */
  235.     if ( ConnectedToHost = 'TRUE' ) then do
  236.         call RefreshRemote
  237.         rc = VRMethod("Application", "PostQueue", RemoteTID, 0, ,
  238.              "call ResetFileList" )
  239.         rc = VRMethod("Application", "PostQueue", RemoteTID, 0, ,
  240.              "call AddFileInfo" )
  241.         rc = VRMethod("Application", "PostQueue", RemoteTID, 0, ,
  242.              "call PostRemoteFiles" )
  243.         rc = VRMethod("Application", "PostQueue", RemoteTID, 0, ,
  244.              "call SetupDirCacheTable" )
  245.     end
  246.  
  247.     set = VRGet( "CB_IncludeDate", "Set" )
  248.  
  249.     RemFileList = VRGetIni( "VxFTP", "RemFileList", IniFile, "NoClose" )
  250.     if ( set = 1 ) then do
  251.         RemFileList = overlay( '1', RemFileList, 3 )
  252.         rc = VRSetIni( "VxFTP", "RemFileList", RemFileList, IniFile, "NoClose" )
  253.      end
  254.     else do
  255.         RemFileList = overlay( '0', RemFileList, 3 )
  256.         rc = VRSetIni( "VxFTP", "RemFileList", RemFileList, IniFile, "NoClose" )
  257.     end
  258.  
  259.     select
  260.         when substr( RemFileList, 2, 2 ) = '00' then
  261.             rc = VRSet( "DT_RemoteFiles", "Caption", "Files" )
  262.         when substr( RemFileList, 2, 2 ) = '10' then
  263.             rc = VRSet( "DT_RemoteFiles", "Caption", "Files | Size" )
  264.         when substr( RemFileList, 2, 2 ) = '01' then
  265.             rc = VRSet( "DT_RemoteFiles", "Caption", "Files | Date" )
  266.         when substr( RemFileList, 2, 2 ) = '11' then
  267.             rc = VRSet( "DT_RemoteFiles", "Caption", "Files | Size | Date" )
  268.     end
  269.  
  270.     call FlushCacheList
  271.  
  272.     drop set
  273. return
  274.  
  275. /*:VRX         CB_IncludeSize_Click
  276. */
  277. CB_IncludeSize_Click: 
  278.     /* Reset the remote directory cache and reset file list
  279.      */
  280.     if ( ConnectedToHost = 'TRUE' ) then do
  281.         call RefreshRemote
  282.         rc = VRMethod("Application", "PostQueue", RemoteTID, 0, ,
  283.              "call ResetFileList" )
  284.         rc = VRMethod("Application", "PostQueue", RemoteTID, 0, ,
  285.              "call AddFileInfo" )
  286.         rc = VRMethod("Application", "PostQueue", RemoteTID, 0, ,
  287.              "call PostRemoteFiles" )
  288.         rc = VRMethod("Application", "PostQueue", RemoteTID, 0, ,
  289.              "call SetupDirCacheTable" )
  290.     end
  291.  
  292.     set = VRGet( "CB_IncludeSize", "Set" )
  293.  
  294.     RemFileList = VRGetIni( "VxFTP", "RemFileList", IniFile, "NoClose" )
  295.     if ( set = 1 ) then do
  296.         RemFileList = overlay( '1', RemFileList, 2 )
  297.         rc = VRSetIni( "VxFTP", "RemFileList", RemFileList, IniFile, "NoClose" )
  298.      end
  299.     else do
  300.         RemFileList = overlay( '0', RemFileList, 2 )
  301.         rc = VRSetIni( "VxFTP", "RemFileList", RemFileList, IniFile, "NoClose" )
  302.     end
  303.  
  304.     select
  305.         when substr( RemFileList, 2, 2 ) = '00' then
  306.             rc = VRSet( "DT_RemoteFiles", "Caption", "Files" )
  307.         when substr( RemFileList, 2, 2 ) = '10' then
  308.             rc = VRSet( "DT_RemoteFiles", "Caption", "Files | Size" )
  309.         when substr( RemFileList, 2, 2 ) = '01' then
  310.             rc = VRSet( "DT_RemoteFiles", "Caption", "Files | Date" )
  311.         when substr( RemFileList, 2, 2 ) = '11' then
  312.             rc = VRSet( "DT_RemoteFiles", "Caption", "Files | Size | Date" )
  313.     end
  314.  
  315.     call FlushCacheList
  316.  
  317.     drop set
  318. return
  319.  
  320. /*:VRX         CB_NoLocalUpdate_Click
  321. */
  322. CB_NoLocalUpdate_Click:
  323.     set = VRGet( "CB_NoLocalUpdate", "Set" )
  324.     if ( set = 1 ) then 
  325.         rc = VRSetIni( "VxFTP", "NoLocalUpdate", "1", IniFile, "NoClose" )
  326.     else 
  327.         rc = VRSetIni( "VxFTP", "NoLocalUpdate", "0", IniFile, "NoClose" )
  328.  
  329. return
  330.  
  331. /*:VRX         CB_NoRemoteUpdate_Click
  332. */
  333. CB_NoRemoteUpdate_Click:
  334.     set = VRGet( "CB_NoRemoteUpdate", "Set" )
  335.     if ( set = 1 ) then
  336.         rc = VRSetIni( "VxFTP", "NoRemoteUpdate", "1", IniFile, "NoClose" )
  337.     else 
  338.         rc = VRSetIni( "VxFTP", "NoRemoteUpdate", "0", IniFile, "NoClose" )
  339.  
  340. return
  341.  
  342. /*:VRX         CB_ProgInd_Click
  343. */
  344. CB_ProgInd_Click: 
  345.     set = VRGet( "CB_ProgInd", "Set" )
  346.     if ( set = 1 ) then
  347.         rc = VRSetIni( "VxFTP", "ProgInd", "1", IniFile, "NoClose" )
  348.     else
  349.         rc = VRSetIni( "VxFTP", "ProgInd", "0", IniFile, "NoClose" )
  350.  
  351.     drop set
  352. return
  353.  
  354. /*:VRX         CB_ReattemptLogin_Click
  355. */
  356. CB_ReattemptLogin_Click: 
  357.     set = VRGet( "CB_ReattemptLogin", "Set" )
  358.     
  359.     if (set = 1) then do
  360.         rc = VRSet( "SPIN_RelogonSecs", "Enabled", 1 )
  361.         rc = VRSetIni( "VxFTP", "UseTimer", 1, IniFile, "NoClose" )
  362.       end
  363.     else do
  364.         rc = VRSet( "SPIN_RelogonSecs", "Enabled", 0 )
  365.         rc = VRSetIni( "VxFTP", "UseTimer", 0, IniFile, "NoClose" )
  366.         rc = VRSet( "TM_Relogin", "Enabled", 0 )
  367.     end
  368.  
  369.     drop set
  370.  
  371. return
  372.  
  373. /*:VRX         CB_Viewer_Click
  374. */
  375. CB_Viewer_Click:
  376.     set = VRGet( "CB_Viewer", "Set" )
  377.     if ( set = 1 ) then 
  378.         rc = VRSetIni( "VxFTP", "EEditor", "1", IniFile, "NoClose" )
  379.     else 
  380.         rc = VRSetIni( "VxFTP", "EEditor", "0", IniFile, "NoClose" )
  381.  
  382. return
  383.  
  384. /*:VRX         CB_ZipConsole_Click
  385. */
  386. CB_ZipConsole_Click: 
  387.     set = VRGet( "CB_ZipConsole", "Set" )
  388.     if ( set = 1 ) then
  389.         rc = VRSetIni( "VxFTP", "ZipConsole", "1", IniFile, "NoClose" )
  390.     else
  391.         rc = VRSetIni( "VxFTP", "ZipConsole", "0", IniFile, "NoClose" )
  392.  
  393. return
  394.  
  395. /*:VRX         Clear_Local
  396. */
  397. Clear_Local:
  398.     /* This function is called when a Directory Change has
  399.        occurred.
  400.      */
  401.     rc = VRMethod( "DDCB_Local_CWD", "Reset" )
  402.     call RefreshLocal
  403. return
  404.  
  405. /*:VRX         Clear_Remote
  406. */
  407. Clear_Remote:
  408.     /* This function is called when a Directory Change has
  409.        occurred on the remote host.
  410.      */
  411.     rc = VRMethod( "DDCB_Remote_CWD", "Reset" )
  412.     call RefreshRemote
  413. return
  414. /*:VRX         DDCB_Local_CWD_Click
  415. */
  416. DDCB_Local_CWD_Click:
  417.     /* Get the new directory and figure out what part of
  418.        the current CWD it is. Then make a string (newPath) 
  419.        that contains the path up to and including newDir.
  420.      */
  421.     selected = VRGet( "DDCB_Local_CWD", "Selected" )
  422.     if (selected = 1) then
  423.         return -1
  424.  
  425.     /* The stem variable localDirs. is not dropped in Set_DDCB_Local_CWD,
  426.      * so we know localDirs.'s values and number of elements.
  427.      */
  428.     if selected = localDirs.0 then
  429.         newPath = "\"
  430.     else do
  431.         newPath = ""
  432.         do i = localDirs.0-1 to selected by -1
  433.             newPath = newPath || "\" || localDirs.i
  434.         end
  435.     end
  436.  
  437.    /* Change to the new local directory   */
  438.     if ( \ VRChDir( newPath ) ) then
  439.         call BasicErrMsg "Cannot change to the directory specified."
  440.  
  441.     call Clear_Local
  442.     call Set_DDCB_Local_CWD
  443.  
  444.     /* Disable the local directory lists while the directory listing
  445.        is being compiled in the LocalDir thread.
  446.      */
  447.     call DisableLocalLists
  448.     call Spawn_LocalDir
  449.     call SetDriveInfoDisplay
  450.  
  451.     drop newPath
  452. return
  453.  
  454. /*:VRX         DDCB_Remote_CWD_Click
  455. */
  456. DDCB_Remote_CWD_Click:
  457.     selected = VRGet( "DDCB_Remote_CWD", "Selected" )
  458.     if (selected = 1) then
  459.         return -1
  460.  
  461.     else do
  462.         rc = VRMethod( "Application", "PostQueue", RemoteTID, 0, ,
  463.             "call Remote_CWD_Click", "selectedDir", selected )
  464.         if (rc = 1) then
  465.             call DisableRemoteLists
  466.  
  467.     end /* end else */
  468.  
  469.     drop newDir
  470. return
  471.  
  472. /*:VRX         DelAliasBtn_Click
  473. */
  474. DelAliasBtn_Click:
  475.     selectedAlias = VRGet( "LB_Aliases", "SelectedString" )
  476.     if ( selectedAlias = "" )
  477.         then return
  478.  
  479.     Found = 'false'
  480.     do i = 1 to GAliases.0
  481.         if ( Found = 'true' ) then do
  482.             j = j + 1
  483.             GAliases.j = GAliases.i
  484.             iterate
  485.         end
  486.  
  487.         parse value GAliases.i with AliasName "|" junk
  488.         if ( AliasName = selectedAlias ) then do
  489.             Found = 'true'
  490.             j = i - 1
  491.         end
  492.     end
  493.  
  494.     if ( Found = 'true' ) then 
  495.         GAliases.0 = j
  496.  
  497.     call UpdateAliases
  498.  
  499.     drop selectedAlias Found junk AliasName
  500. return
  501.  
  502. /*:VRX         Directories_Close
  503. */
  504. Directories_Close:
  505.     window = VRInfo( "Object" )
  506.     call VRDestroy window
  507.     drop window
  508. return
  509. /*:VRX         Directories_Create
  510. */
  511. Directories_Create:
  512.     downloadDirectory = VRGetIni( "VxFTP", "DownloadDir", IniFile, "NoClose" )
  513.     rc = VRSet( "EF_DownDir", "Value", downloadDirectory )
  514.     drop downloadDirectory
  515. return
  516.  
  517. /*:VRX         DisableLocalLists
  518. */
  519. DisableLocalLists:
  520.     /* Disable all local directory/file lists so that user
  521.      * can't mess with 'em.
  522.      */
  523.     call VRSet "DDCB_Local_CWD", "Enabled", 0
  524.     call VRSet "Local_Dir_Combo", "Enabled", 0
  525.     call VRSet "Local_Files_List", "Enabled", 0
  526. return
  527.  
  528. /*:VRX         DisableRemoteLists
  529. */
  530. DisableRemoteLists:
  531.     /* Disable all remote directory/file lists so that
  532.      * user can't mess with 'em.
  533.      */
  534.     rc = VRSet( "DDCB_Remote_CWD", "Enabled", 0 )
  535.     rc = VRSet( "Remote_Dir_Combo", "Enabled", 0 )
  536.     rc = VRSet( "Remote_Files_List", "Enabled", 0 )        
  537. return
  538.  
  539. /*:VRX         EditAliasBtn_Click
  540. */
  541. EditAliasBtn_Click:
  542.     /* Get all the data associated with the Alias that the User selected
  543.      * and pass it to the AliasDE file
  544.      */
  545.     aliasSelected = VRGet( "LB_Aliases", "SelectedString" )
  546.  
  547.     do i = 1 to GAliases.0 
  548.         parse value GAliases.i with AliasName "|" Rest
  549.  
  550.         if (AliasName \= aliasSelected) then 
  551.             iterate
  552.  
  553.         else do
  554.             parse value Rest with AliasHost "|" AliasLogin "|" AliasPasswd "|" AliasCWD "|" AliasHostOS
  555.             values = AliasDE( VRWindow(), 'EDIT', AliasName, AliasHost, AliasLogin, AliasPasswd, AliasCWD, AliasHostOS )
  556.             if ( values \= "" ) then do
  557.                 GAliases.i = values
  558.                 call UpdateAliases
  559.             end /* if */
  560.             leave     /* leave the loop because we're finished */
  561.         end /* else */
  562.     end /* do */
  563.  
  564.     drop values aliasSelected Rest
  565. return
  566.  
  567. /*:VRX         EF_DownDir_Change
  568. */
  569. EF_DownDir_Change:
  570.     /* As user types in the directory, update the setting
  571.      * in the vxftp.ini file
  572.      */
  573.     DownloadDirectory = VRGet( "EF_DownDir", "Value" )
  574.     rc = VRSetIni( "VxFTP", "DownloadDir", DownloadDirectory, IniFile, "NoClose" )
  575.  
  576. return
  577.  
  578. /*:VRX         EF_Email_Change
  579. */
  580. EF_Email_Change:
  581.     /* As user types in his/her Email address, update the setting
  582.      * in the vxftp.ini file
  583.      */
  584.     EmailAddress = VRGet( "EF_Email", "Value" )
  585.     rc = VRSetIni( "VxFTP", "Email", EmailAddress, IniFile, "NoClose" )
  586.  
  587. return
  588.  
  589. /*:VRX         Email_Close
  590. */
  591. Email_Close:
  592.     window = VRInfo( "Object" )
  593.     call VRDestroy window
  594.     drop window
  595. return
  596. /*:VRX         Email_Create
  597. */
  598. Email_Create:
  599.     EmailAddress = VRGetIni( "VxFTP", "Email", IniFile, "NoClose" )
  600.     if ( EmailAddress = "" ) then
  601.         EmailAddress = 'os2-user@vxftp.org'
  602.  
  603.     rc = VRSet( "EF_Email", "Value", EmailAddress )
  604.     drop EmailAddress
  605. return
  606.  
  607. /*:VRX         EnableLocalLists
  608. */
  609. EnableLocalLists:
  610.     rc = VRSet( "DDCB_Local_CWD", "Enabled", 1 )
  611.     rc = VRSet( "Local_Dir_Combo", "Enabled", 1 )
  612.     rc = VRSet( "Local_Files_List", "Enabled", 1 )
  613. return
  614.  
  615. /*:VRX         EnableRemoteLists
  616. */
  617. EnableRemoteLists:
  618.     rc = VRSet( "DDCB_Remote_CWD", "Enabled", 1 )
  619.     rc = VRSet( "Remote_Dir_Combo", "Enabled", 1 )
  620.     rc = VRSet( "Remote_Files_List", "Enabled", 1 )
  621. return
  622.  
  623. /*:VRX         Filelists_Close
  624. */
  625. Filelists_Close: 
  626.     window = VRInfo( "Window" )
  627.     call VRDestroy window
  628.     drop window
  629. return
  630.  
  631. /*:VRX         Filelists_Create
  632. */
  633. Filelists_Create: 
  634.     if ( VRGetIni( "VxFTP", "NoRemoteUpdate", IniFile, "NoClose") = 1 ) then
  635.         rc = VRSet( "CB_NoRemoteUpdate", "Set", 1 )
  636.     else
  637.         rc = VRSet( "CB_NoRemoteUpdate", "Set", 0 )
  638.  
  639.     if ( VRGetIni( "VxFTP", "NoLocalUpdate", IniFile, "NoClose") = 1 ) then
  640.         rc = VRSet( "CB_NoLocalUpdate", "Set", 1 )
  641.     else
  642.         rc = VRSet( "CB_NoLocalUpdate", "Set", 0 )
  643.  
  644.     RemFileList = VRGetIni( "VxFTP", "RemFileList", IniFile, "NoClose")
  645.     if ( left( RemFileList, 1 ) = 'L' ) then do
  646.         rc = VRSet( "RB_Ls", "Set", 1 )
  647.         rc = VRSet( "CB_IncludeSize", "Enabled", 0 )
  648.         rc = VRSet( "CB_IncludeDate", "Enabled", 0 )
  649.       end
  650.     else do
  651.         rc = VRSet( "RB_Dir", "Set", 1 )
  652.         rc = VRSet( "CB_IncludeSize", "Enabled", 1 )
  653.         rc = VRSet( "CB_IncludeDate", "Enabled", 1 )
  654.     end
  655.  
  656.     
  657.     if ( substr( RemFileList, 2, 1 ) = 1 ) then
  658.         rc = VRSet( "CB_IncludeSize", "Set", 1 )
  659.     else
  660.         rc = VRSet( "CB_IncludeSize", "Set", 0 )
  661.  
  662.     if ( substr( RemFileList, 3, 1 ) = 1 ) then
  663.         rc = VRSet( "CB_IncludeDate", "Set", 1 )
  664.     else
  665.         rc = VRSet( "CB_IncludeDate", "Set", 0 )
  666.  
  667.     select
  668.         when right( RemFileList, 1 ) = 'A' then
  669.             rc = VRSet( "RB_SortAscending", "Set", 1 )
  670.         when right( RemFileList, 1 ) = 'N' then
  671.             rc = VRSet( "RB_SortNone", "Set", 1 )
  672.         when right( RemFileList, 1 ) = 'D' then
  673.             rc = VRSet( "RB_SortDescending", "Set", 1 )
  674.         otherwise
  675.             RemFileList = overlay( 'N', RemFileList, 1 )
  676.             rc = VRSet( "VxFTP", "RemFileList", RemFileList, IniFile, "NoClose" )
  677.             rc = VRSet( "RB_SortNone", "Set", 1 )
  678.     end
  679. return
  680.  
  681. /*:VRX         Fini
  682. */
  683. Fini:
  684.     window = VRWindow()
  685.     call VRSet window, "Visible", 0
  686.     drop window
  687. return 0
  688.  
  689. /*:VRX         FlushCacheList
  690. */
  691. FlushCacheList: 
  692.     rc = VRIsValidObject( "DDCB_CachedDirs" )
  693.     if ( rc = 1 ) then do
  694.         rc = VRMethod( "DDCB_CachedDirs", "Reset" )
  695.         rc = VRSet( "DDCB_CachedDirs", "Value", ""  )
  696.     end
  697.  
  698. return
  699.  
  700. /*:VRX         FTPErrMsg
  701. */
  702. FTPErrMsg:
  703.     FTPERRNO = VRInfo( "FTP_Errno" )
  704.  
  705.     select 
  706.         when FTPERRNO = "FTPSERVICE" then
  707.             errMsg = "Unknown FTP Service"
  708.         when FTPERRNO = "FTPHOST" then
  709.             errMsg = "Host" Host "unknown"
  710.         when FTPERRNO = "FTPSOCKET" then
  711.             errMsg = "Cannot obtain a TCP socket"
  712.         when FTPERRNO = "FTPCONNECT" then
  713.             errMsg = "Unable to connect to" Host
  714.         when FTPERRNO = "FTPLOGIN" then
  715.             errMsg = "Login on" Host "failed"
  716.         when FTPERRNO = "FTPABORT" then
  717.             errMsg = "Filed transfer aborted"
  718.         when FTPERRNO = "FTPLOCALFILE" then
  719.             errMsg = "Cannot open local file"
  720.         when FTPERRNO = "FTPDATACONN" then
  721.             errMsg = "Can't initialize data connection"
  722.         when FTPERRNO = "FTPCOMMAND" then
  723.             errMsg = "Command failed"
  724.         otherwise
  725.             errMsg = "Unknown error code" FTPERRNO
  726.     end /* select */
  727.  
  728.     butts.0 = 1
  729.     default = 1
  730.     butts.default = "OK"
  731.     msg.0 = 3
  732.     msg.1 = ""
  733.     msg.2 = errMsg
  734.     msg.3 = ""
  735.     rc = VRMessageStem( VRWindow(), "msg.", "FTP Error", ,
  736.                         "errMsg", "butts.", default)
  737. return
  738.  
  739. /*:VRX         Get_Button_Click
  740. */
  741. Get_Button_Click:
  742.     call MI_GetWithoutRename_Click
  743.  
  744. return
  745. /*:VRX         GetComplete
  746. */
  747. GetComplete:
  748.     call XferComplete "Show"
  749.  
  750.     if ( VRGetIni( "VxFTP", "NoLocalUpdate", IniFile, "NoClose") = 0 ) then do
  751.         call RefreshLocal
  752.         call Spawn_LocalDir
  753.     end
  754. return
  755.  
  756. /*:VRX         GetLoginInfo
  757. */
  758. GetLoginInfo: 
  759.     rc = VRSet( "MainWindow", "StatusText", "" )
  760.     if ( InitArgs.0 = 1 ) then do
  761.         /* If user passed command-line arguments, parse and place them
  762.          *  into the appropriate variables.
  763.          */
  764.         select
  765.             when words( InitArgs.1 ) = 1 then do
  766.                 call BasicErrMsg "Invalid number of arguments:" InitArgs.1
  767.                 signal NoLogon
  768.               end
  769.  
  770.             when words( InitArgs.1 ) = 2 then
  771.                 if translate( left( word( InitArgs.1, 2 ), 4) ) = "ANON" then do
  772.                     Host = word( InitArgs.1, 1 )
  773.                     Anon = "TRUE"
  774.                     Passwd = VRGetIni( "VxFTP", "Email", IniFile, "NoClose" )
  775.                     if ( Passwd = "" ) then
  776.                         Passwd = "os2-user@vxftp.org"
  777.                     rCWD = ""
  778.                     SysType = "auto detect"
  779.                   end
  780.                 else
  781.                     call BasicErrMsg "Need password for login" word( InitArgs.1, 2 )
  782.  
  783.             when  words( InitArgs.1 ) = 3 then 
  784.                 if translate( left( word( InitArgs.1, 2 ), 4) ) = "ANON" then do
  785.                     Host =    word( InitArgs.1, 1 )
  786.                     Anon =    "TRUE"
  787.                     Login =   "Anonymous"
  788.                     Passwd = word( InitArgs.1, 3 )
  789.                     rCWD = ""
  790.                     SysType = "auto detect"
  791.                   end
  792.                 else do
  793.                     Host =    word( InitArgs.1, 1 )
  794.                     Anon =    "FALSE"
  795.                     Login =   word( InitArgs.1, 2)
  796.                     Passwd = word( InitArgs.1, 3 )
  797.                     rCWD = ""
  798.                     SysType = "auto detect"
  799.                   end
  800.                 
  801.             when  words( InitArgs.1 ) = 4 then 
  802.                 if translate( left( word( InitArgs.1, 2 ), 4) ) = "ANON" then do
  803.                     Host =    word( InitArgs.1, 1 )
  804.                     Anon =    "TRUE"
  805.                     Login =   "Anonymous"
  806.                     Passwd = word( InitArgs.1, 3 )
  807.                     rCWD =   word( InitArgs.1, 4 )
  808.                     SysType = "auto detect"
  809.                   end
  810.                 else do
  811.                     Host =    word( InitArgs.1, 1 )
  812.                     Anon =    "FALSE"
  813.                     Login =   word( InitArgs.1, 2 )
  814.                     Passwd = word( InitArgs.1, 3 )
  815.                     rCWD =   word( InitArgs.1, 4 )
  816.                     SysType = "auto detect"
  817.                   end
  818.  
  819.             when words( InitArgs.1 ) > 4 then do
  820.                 call BasicErrMsg "Too many command-line parameters"
  821.                 signal NoLogon
  822.               end
  823.  
  824.             otherwise
  825.                 call BasicErrMsg "Invalid InitArgs.1 value"
  826.                 signal NoLogon
  827.  
  828.         end /* select */
  829.  
  830.         /* Zero-ize the InitArgs so that if user chooses "New Connection" from the
  831.             menu, s/he won't automatically login to the host s/he indicated on the
  832.             command line.
  833.          */
  834.         InitArgs.0 = 0
  835.     end /* if */
  836.     else do
  837.         /* Call the Login() window, passing it this window's ID. 
  838.             Parse out the desired data (Host, Login, and Passwd) in "values".
  839.          */
  840.         values = Login( VRWindow() )
  841.  
  842.         if (values <> "") then
  843.             parse var values Host "|" Login "|" Passwd "|" rCWD "|" Anon "|" SysType
  844.         else do
  845.             call LogoffSuccessful
  846.             signal NoLogon
  847.           end /* else */
  848.     end
  849.  
  850.     rc = VRMethod( "Application", "PostQueue", RemoteTID, 0, "call LogonToHost" ,,
  851.                         "Host", Host, "Login", Login, "Passwd", Passwd,,
  852.                         "rCWD", rCWD, "Anon", Anon, "SysType", SysType )
  853.     if ( rc = 1 ) then do
  854.         call VRSet "MainWindow", "Caption", VxFTPVersion "- Connecting to" Host, ,
  855.             "StatusText", "Connecting to" Host 
  856.         rc = VRSet( "MI_New",  "Enabled", 0 )
  857.         rc = VRSet( "MI_Kill", "Enabled", 1 )
  858.       end
  859.     else
  860.         call BasicErrMsg "Could not communicate login info to Remote thread."
  861.  
  862. NoLogon:
  863.  
  864. return
  865.  
  866. /*:VRX         Halt
  867. */
  868. Halt:
  869.     call VRMethod "Application", "PostQueue", RemoteTID, 0, ,
  870.          "signal _VREHalt"
  871.  
  872.     signal _VREHalt
  873. return
  874.  
  875. /*:VRX         Init
  876. */
  877. Init:
  878.     window = VRWindow()
  879.  
  880.     /* Get the location of the VXFTP.INI file and put it in 
  881.      * a variable accessible by both threads
  882.      */
  883.     IniFile = VRParseFileName("vxftp.ini", "")
  884.     rc = VRMethod( "Application", "PutVar", "IniFile" )
  885.  
  886.     /* Start the thread that'll manage the remote side then
  887.      * setup the local environment
  888.      */
  889.     call SetupRemote
  890.     call InitializeLocalEnv
  891.  
  892.  
  893.     /* Once we've setup the user interface, make the
  894.      * window visible and respond to user commands
  895.      */
  896.     call VRSet window, "Visible", 1
  897.     call VRMethod window, "Activate"
  898.     drop window
  899.  
  900. return
  901.  
  902. /*:VRX         InitializeLocalEnv
  903. */
  904. InitializeLocalEnv:
  905. /* Set up the Local Environment.
  906.  * This REXX code executes surprisingly fast, IMO.
  907.  */
  908.     if RxFuncQuery("SysLoadFuncs") then
  909.         do
  910.         rc = RxFuncAdd("SysLoadFuncs", "RexxUtil", "SysLoadFuncs")
  911.         rc = SysLoadFuncs()
  912.     end
  913.  
  914.     /* Initialize certain variables and conditions
  915.      */
  916.     VxFTPVersion = "VxFTP v1.00"
  917.     rc = VRSet( "MainWindow", "Caption", VxFTPVersion "- Not Connected" )
  918.     rc = VRRedirectStdIO("Off")
  919.     ConnectedToHost = 'FALSE'
  920.     LoginAttemptCount = 0
  921.  
  922.     DownloadDirectory = VRGetIni( "VxFTP", "DownloadDir", IniFile )
  923.     if ( DownloadDirectory <> "" ) then do
  924.         if ( substr( DownloadDirectory, 2, 1 ) = ":" ) then
  925.             rc = VRChDrive( left( DownloadDirectory, 2 ))
  926.         rc = VRChDir( DownloadDirectory )
  927.         if ( rc = 0 ) then
  928.             call BasicErrMsg "Couldn't change to" DownloadDirectory
  929.     end
  930.  
  931.     /* Spawn thread to read in contents of local directory
  932.      */
  933.     call Spawn_LocalDir
  934.     call SetDriveInfoDisplay
  935.     call Set_DDCB_Local_CWD
  936.  
  937.     /* Find out the local drives, and put each one, (format C:)
  938.      * in the stem Drives., which will then be used in each
  939.      * local directory listing.
  940.      */
  941.     usedDrives = SysDriveMap("c:", 'used')
  942.     i = 1
  943.     do while ( wordlength( usedDrives,i ) > 0 )
  944.         LocalDrives.i = "[Drive" word(usedDrives,i) || "]"
  945.         i = i+1;
  946.     end
  947.     LocalDrives.0 = i-1
  948.  
  949.     /* Check whether VXFTP.INI entries are blank. If so, give them
  950.      * default values.
  951.      */
  952.     if ( VRGetIni( "VxFTP", "NoRemoteUpdate", IniFile, "NoClose" ) = "" ) then 
  953.         rc = VRSetIni( "VxFTP", "NoRemoteUpdate", "0", IniFile, "NoClose" )
  954.  
  955.     if ( VRGetIni( "VxFTP", "NoLocalUpdate", IniFile, "NoClose" ) = "" ) then 
  956.         rc = VRSetIni( "VxFTP", "NoLocalUpdate", "0", IniFile, "NoClose" )
  957.  
  958.     if ( VRGetIni( "VxFTP", "EEditor", IniFile, "NoClose" ) = "" ) then
  959.         rc = VRSetIni( "VxFTP", "EEditor", "0", IniFile, "NoClose" )
  960.  
  961.     if ( VRGetIni( "VxFTP", "UnzipPgm", IniFile, "NoClose" ) = "" ) then 
  962.         rc = VRSetIni( "VxFTP", "UnzipPgm", "InfoZip", IniFile, "NoClose" )
  963.  
  964.     if ( VRGetIni( "VxFTP", "ZipConsole", IniFile, "NoClose" ) = "" ) then 
  965.         rc = VRSetIni( "VxFTP", "ZipConsole", "0", IniFile, "NoClose" )
  966.  
  967.     if ( VRGetIni( "VxFTP", "SubDir", IniFile, "NoClose" ) = "" ) then 
  968.         rc = VRSetIni( "VxFTP", "SubDir", "Prompt", IniFile, "NoClose" )
  969.  
  970.     if ( VRGetIni( "VxFTP", "Hints", IniFile, "NoClose" ) = "" ) then
  971.         rc = VRSetIni( "VxFTP", "Hints", "1", IniFile, "NoClose" )
  972.  
  973.     if ( VRGetIni( "VxFTP", "Hints", IniFile, "NoClose" ) = "1" ) then
  974.         rc = VRSet( "MainWindow", "ShowHints", 1 )
  975.     else
  976.         rc = VRSet( "MainWindow", "ShowHints", 0 )
  977.  
  978.     if ( VRGetIni( "VxFTP", "ProgInd", IniFile, "NoClose" ) = "" ) then
  979.         rc = VRSetIni( "VxFTP", "ProgInd", "1", IniFile, "NoClose" )
  980.  
  981.     if ( VRGetIni( "VxFTP", "UseTimer", IniFile, "NoClose" ) = "" ) then
  982.         rc = VRSetIni( "VxFTP", "UseTimer", "0", IniFile, "NoClose" )
  983.  
  984.     ReLoginDelay = VRGetIni( "VxFTP", "ReLoginDelay", IniFile, "NoClose" )
  985.     if ( ReLoginDelay = "" ) then do
  986.         rc = VRSetIni( "VxFTP", "ReLoginDelay", "15", IniFile, "NoClose" )
  987.         rc = VRSet( "TM_Relogin", "Delay", 15000 )
  988.       end
  989.     else 
  990.         rc = VRSet( "TM_Relogin", "Delay", ReLoginDelay * 1000 )
  991.  
  992.  
  993.     if ( VRGetIni( "VxFTP", "UseCache", IniFile, "NoClose" ) = "" ) then do
  994.         rc = VRSetIni( "VxFTP", "UseCache", "1", IniFile, "NoClose" )
  995.         rc = VRSetIni( "VxFTP", "CacheSize", "10", IniFile, "NoClose" )
  996.         rc = VRSetIni( "VxFTP", "RefreshInterval", "30", IniFile, "NoClose" )
  997.     end 
  998.  
  999.     /* "RemFileList" contains the settings for the behavior and style of the
  1000.      * Remote_Files_List box. 
  1001.      *
  1002.      *  Position      Description
  1003.      *  --------      --------------------------------------------
  1004.      *     1          D - use 'DIR' style directory listings
  1005.      *                L - use 'LS' style
  1006.      *     2          0 - do not include file size information
  1007.      *                1 - include file size info
  1008.      *     3          0 - do not include file date information
  1009.      *                1 - include file date info
  1010.      *     4          N - No sorting on list
  1011.      *                A - Ascending sort on list
  1012.      *                D - Descending sort on list
  1013.      */
  1014.     RemFileList = VRGetIni( "VxFTP", "RemFileList", IniFile, "NoClose" )
  1015.     if ( RemFileList = "" ) then 
  1016.         rc = VRSetIni( "VxFTP", "RemFileList", "D00N", IniFile, "NoClose" )
  1017.  
  1018.     if ( left( RemFileList, 1 ) = 'L' ) then
  1019.             rc = VRSet( "DT_RemoteFiles", "Caption", "Files & Dirs" )
  1020.     else
  1021.         select
  1022.             when ( substr( RemFileList, 2, 2 ) = '10' ) then
  1023.                 rc = VRSet( "DT_RemoteFiles", "Caption", "Files | Size" )
  1024.  
  1025.             when ( substr( RemFileList, 2, 2 ) = '01' ) then
  1026.                 rc = VRSet( "DT_RemoteFiles", "Caption", "Files | Date" )
  1027.  
  1028.             when ( substr( RemFileList, 2, 2 ) = '11' ) then
  1029.                 rc = VRSet( "DT_RemoteFiles", "Caption", "Files | Size | Date" )
  1030.             otherwise
  1031.                 nop
  1032.         end 
  1033.  
  1034.     select
  1035.         when ( right( RemFileList, 1 ) = 'A' ) then
  1036.             rc = VRSet( "Remote_Files_List", "Sort", "Ascending" )
  1037.         when ( right( RemFileList, 1 ) = 'D' ) then
  1038.             rc = VRSet( "Remote_Files_List", "Sort", "Descending" )
  1039.         otherwise
  1040.             rc = VRSet( "Remote_Files_List", "Sort", "None" )
  1041.     end
  1042.  
  1043.     select
  1044.         when ( VRGetIni( "VxFTP", "XferType", IniFile, "NoClose" ) = "" ) then do
  1045.             rc = VRSetIni( "VxFTP", "XferType", "Binary", IniFile, "NoClose" )
  1046.             call MI_Binary_Click
  1047.           end
  1048.         when ( VRGetIni( "VxFTP", "XferType", IniFile, "NoClose" ) = "Ascii" ) then 
  1049.             call MI_Ascii_Click
  1050.         otherwise
  1051.             call MI_Binary_Click
  1052.     end
  1053.  
  1054.     WinState = VRGetIni( "VxFTP", "WinState", IniFile, "NoClose" )
  1055.     select
  1056.         when ( WinState = "Normal" ) then do
  1057.             lastWidth = VRGetIni( "VxFTP", "Width", IniFile, "NoClose" )
  1058.             lastHeight = VRGetIni( "VxFTP", "Height", IniFile, "NoClose" )
  1059.             lastTop = VRGetIni( "VxFTP", "Top", IniFile, "NoClose" )
  1060.             lastLeft = VRGetIni( "VxFTP", "Left", IniFile, "NoClose" )
  1061.             call VRSet window, "Width", lastWidth
  1062.             call VRSet window, "Height", lastHeight
  1063.             call VRSet window, "Top", lastTop
  1064.             call VRSet window, "Left", lastLeft
  1065.          end
  1066.  
  1067.         when ( WinState = "Maximized" ) then
  1068.             call VRSet window, "WindowState", "Maximized"
  1069.  
  1070.         otherwise
  1071.             rc = VRSetIni( "VxFTP", "WinState", "Normal", IniFile, "NoClose" )
  1072.             lastwidth = VRGet( window, "InteriorWidth" )
  1073.             lastheight = VRGet( window, "InteriorHeight" )
  1074.  
  1075.     end /* select */
  1076.  
  1077.     /* Extract the Fonts saved from the last session, even though
  1078.      * only the file lists will actually return their font info.
  1079.      * Keep the code in case a future version of VXREXX will correctly
  1080.      * deal with font info.
  1081.      */
  1082.     SavedFonts = VRGetIni( "VxFTP", "ListFonts", IniFile, "NoClose" )
  1083.     parse value SavedFonts with font1 "|" font2 "|" font3 "|" font4 "|" font5 "|" font6
  1084.     rc = VRSet( "Local_Files_List",  "Font", font1 )
  1085.     rc = VRSet( "Local_Dir_Combo",   "Font", font2 )
  1086.     rc = VRSet( "DDCB_Local_CWD",    "Font", font3 )
  1087.     rc = VRSet( "Remote_Files_List", "Font", font4 )
  1088.     rc = VRSet( "Remote_Dir_Combo",  "Font", font5 )
  1089.     rc = VRSet( "DDCB_Remote_CWD",   "Font", font6 )
  1090.     
  1091.     
  1092.     /* The following variables are for determining the position and size
  1093.      * of the various GUI elements on the MainWindow
  1094.      */
  1095.     staticWidth = 1430
  1096.     gutter = 948
  1097.     leftMargin = 241
  1098.     bottomMargin = 211
  1099.     DirListMargin = 842
  1100.     btnMargin = 105
  1101.     GrpBox.outermgn = 120
  1102.     GrpBox.midmgn = 106
  1103.  
  1104.     /* Now that everything has been set, call the Resize function      */
  1105.     call MainWindow_Resize
  1106.  
  1107.     drop i RSortOrder SavedFonts
  1108. return
  1109.  
  1110. /*:VRX         LB_Aliases_DoubleClick
  1111. */
  1112. LB_Aliases_DoubleClick:
  1113.     call EditAliasBtn_Click
  1114. return
  1115.  
  1116. /*:VRX         Local_Dir_Combo_ContextMenu
  1117. */
  1118. Local_Dir_Combo_ContextMenu:
  1119.    rc = VRMethod("MI_PopupLDir", "Popup")
  1120.  
  1121. return
  1122.  
  1123. /*:VRX         Local_Dir_Combo_DoubleClick
  1124. */
  1125. Local_Dir_Combo_DoubleClick:
  1126.     newDir= VRGet( "Local_Dir_Combo", "Value" )
  1127.  
  1128.     if ( newDir = "" ) then
  1129.         signal ENDLocal_Dir_Combo_DClick
  1130.  
  1131.     if ( left(newDir, 6) = "[Drive") then do
  1132.         rc = VRChDrive( substr(newDir, 8,1) ) 
  1133.         call SetDriveInfoDisplay
  1134.     end
  1135.     else do
  1136.         rc = VRChDir( newDir )
  1137.         if (rc = 0) then do
  1138.             call BasicErrMsg "Couldn't change to directory specified"
  1139.             signal ENDLocal_Dir_Combo_DClick
  1140.         end
  1141.     end
  1142.  
  1143.     call Clear_Local
  1144.     call Set_DDCB_Local_CWD    
  1145.  
  1146.     /* Disable the Local Directory fields while you're filling
  1147.        the local directory and file lists.
  1148.      */
  1149.     call DisableLocalLists
  1150.     call Spawn_LocalDir
  1151.  
  1152. ENDLocal_Dir_Combo_DClick:
  1153.     drop newDir
  1154. return
  1155.  
  1156. /*:VRX         Local_Files_List_ContextMenu
  1157. */
  1158. Local_Files_List_ContextMenu:
  1159.     rc = VRMethod("MI_PopupLFiles", "Popup")
  1160. return
  1161.  
  1162. /*:VRX         Local_Files_List_DoubleClick
  1163. */
  1164. Local_Files_List_DoubleClick:
  1165.     call Put_Button_Click
  1166. return
  1167.  
  1168. /*:VRX         LoginAttemptFailed
  1169. */
  1170. LoginAttemptFailed: 
  1171.     call LogoffSuccessful
  1172.  
  1173.     UseTimer = VRGetIni( "VxFTP", "UseTimer", IniFile, "NoClose" )
  1174.     if ( UseTimer = 1 ) then do
  1175.         rc = VRSet( "TM_Relogin", "Enabled", 1 )
  1176.         LoginAttemptCount = LoginAttemptCount + 1
  1177.         TextToSend = 'Login attempt' LoginAttemptCount 'failed'
  1178.         rc = VRSet( "MainWindow", "StatusText", TextToSend )
  1179.     end
  1180.  
  1181. return
  1182.  
  1183. /*:VRX         LogoffSuccessful
  1184. */
  1185. LogoffSuccessful:
  1186.     call Clear_Remote
  1187.     rc = VRSet( "DDCB_Remote_CWD", "Value", "" )
  1188.     call DisableRemoteLists
  1189.  
  1190.     rc = VRSet( "MI_New",              "Enabled", 1 )   
  1191.     rc = VRSet( "MI_Close",            "Enabled", 0 )
  1192.     rc = VRSet( "MI_Kill",             "Enabled", 0 )
  1193.     rc = VRSet( "MI_ASCII",            "Enabled", 0 )
  1194.     rc = VRSet( "MI_Xfer_Type",        "Enabled", 0 )
  1195.     rc = VRSet( "MI_Binary",           "Enabled", 0 )
  1196.     rc = VRSet( "Get_Button",          "Enabled", 0 )
  1197.     rc = VRSet( "Put_Button",          "Enabled", 0 )
  1198.     rc = VRSet( "MI_Remote",           "Enabled", 0 )
  1199.     rc = VRSet( "MI_LPut",             "Enabled", 0 )
  1200.     rc = VRSet( "MI_PopupPut",         "Enabled", 0 )
  1201.  
  1202.     rc = VRSet( "MainWindow", "Caption", VxFTPVersion "- Not Connected" )
  1203.  
  1204.     rc = VRSet( "MI_SysMac",      "Checked", 0 )
  1205.     rc = VRSet( "MI_SysNW",       "Checked", 0 )
  1206.     rc = VRSet( "MI_SysOS2",      "Checked", 0 )
  1207.     rc = VRSet( "MI_SysUNIX",     "Checked", 0 )
  1208.     rc = VRSet( "MI_SysVMS",      "Checked", 0 )
  1209.     rc = VRSet( "MI_SysVM",       "Checked", 0 )
  1210.     rc = VRSet( "MI_SysUnknown",  "Checked", 0 )
  1211.  
  1212.     call FlushCacheList
  1213.     ConnectedToHost = 'FALSE'
  1214.  
  1215.     remote_dir.0 = 0
  1216.     remote_file.0 = 0
  1217.  
  1218. return
  1219.  
  1220. /*:VRX         LogonSuccessful
  1221. */
  1222. LogonSuccessful:
  1223.  
  1224.     rc = VRSet( "MainWindow", "Caption", VxFTPVersion "-" Host )
  1225.     ConnectedToHost = 'TRUE'
  1226.  
  1227.     rc = VRSet( "Get_Button",          "Enabled", 1 )
  1228.     rc = VRSet( "Put_Button",          "Enabled", 1 )
  1229.     rc = VRSet( "MI_New",              "Enabled", 0 )
  1230.     rc = VRSet( "MI_Close",            "Enabled", 1 )
  1231.     rc = VRSet( "MI_Kill",             "Enabled", 1 )
  1232.     rc = VRSet( "MI_ASCII",            "Enabled", 1 )
  1233.     rc = VRSet( "MI_Xfer_Type",        "Enabled", 1 )
  1234.     rc = VRSet( "MI_Binary",           "Enabled", 1 )
  1235.     rc = VRSet( "MI_Remote",           "Enabled", 1 )
  1236.     rc = VRSet( "MI_LPut",             "Enabled", 1 )
  1237.     rc = VRSet( "MI_PopupPut",         "Enabled", 1 )
  1238.  
  1239.     /* Disable ReLogin timer               */
  1240.     rc = VRSet( "TM_Relogin", "Enabled", 0 )
  1241.  
  1242. return
  1243.  
  1244.  
  1245. /*:VRX         MainWindow_Close
  1246. */
  1247. MainWindow_Close:
  1248.     call Quit
  1249. return
  1250.  
  1251. /*:VRX         MainWindow_Resize
  1252. */
  1253. MainWindow_Resize:
  1254.     /* Don't resize if the MainWindow was minimized
  1255.      */
  1256.     WindowState = VRGet( "MainWindow", "WindowState" )
  1257.     if ( WindowState = 'Minimized' ) then 
  1258.        return -1
  1259.  
  1260.     /* Resize and reposition the elements on the MainWindow,
  1261.      * according to the size the user changed it to.
  1262.      */
  1263.     window = VRWindow()
  1264.     width = VRGet( window, "InteriorWidth" )
  1265.     height = VRGet( window, "InteriorHeight" )
  1266.  
  1267.     /* If the height and width are the same as last time this
  1268.      * stupid function was called, then don't resize
  1269.      */
  1270.     if ( lastHeight = height ) & ( lastWidth = width ) then 
  1271.         return -1
  1272.     else do
  1273.         lastHeight = height
  1274.         lastWidth = width
  1275.     end
  1276.  
  1277.     /* If user makes the MainWindow too small, calculate for
  1278.      * a window that's 3750x8000
  1279.      */
  1280.     if (height < 3750) then height = 3750
  1281.     if (width < 8000) then width = 8000
  1282.  
  1283.     /* Do all the size and position calculations
  1284.      */
  1285.     /* These variables are declared in InitializeLocalEnv
  1286.      *          staticWidth = 1430
  1287.      *          gutter = 948
  1288.      *          leftMargin = 241
  1289.      *          bottomMargin = 211
  1290.      *          DirListMargin = 842
  1291.      *          btnMargin = 105
  1292.      *          GrpBox.outermgn = 120
  1293.      *          GrpBox.midmgn = 106
  1294.      */
  1295.     GrpBoxWidth = trunc( ( width - staticWidth ) / 2)
  1296.     GrpBoxHeight = height - bottomMargin
  1297.     GB2_NewLeft = leftMargin + gutter + GrpBoxWidth
  1298.     Btn_NewLeft = leftMargin + GrpBoxWidth + btnMargin
  1299.     DirWidth = VRGet( "Local_Dir_Combo", "Width" )
  1300.     FileWidth = VRGet( "Local_Files_List", "Width" )
  1301.     GrpBox.change = GrpBoxWidth - 346 - DirWidth - FileWidth
  1302.     DirWidth = trunc( DirWidth + (0.25 * GrpBox.change))
  1303.     DirHeight = GrpBoxHeight - 1806
  1304.     FileWidth = trunc( FileWidth + (0.75 * GrpBox.change))
  1305.     LFileLeft = 226 + DirWidth
  1306.     FileHeight = GrpBoxHeight - 602
  1307.     RDirLeft = 226 + FileWidth
  1308.  
  1309.     /* Make everything Invisible        */
  1310.     rc = VRSet( "GB_1", "Visible", 0 )
  1311.     rc = VRSet( "Get_Button", "Visible", 0 )
  1312.     rc = VRSet( "Put_Button", "Visible", 0 )
  1313.     rc = VRSet( "DT_XferType", "Visible", 0 )
  1314.     rc = VRSet( "GB_2", "Visible", 0 )
  1315.  
  1316.     /* Move the Group Boxes                              */
  1317.     rc = VRSet( "GB_2", "Left", GB2_NewLeft )
  1318.     rc = VRSet( "GB_1", "Width", GrpBoxWidth )
  1319.     rc = VRSet( "GB_2", "Width", GrpBoxWidth )
  1320.     rc = VRSet( "GB_1", "Height", GrpBoxHeight )
  1321.     rc = VRSet( "GB_2", "Height", GrpBoxHeight )
  1322.     rc = VRSet( "DT_XferType", "Left", Btn_NewLeft )
  1323.     rc = VRSet( "Get_Button", "Left", Btn_NewLeft )
  1324.     rc = VRSet( "Put_Button", "Left", Btn_NewLeft )
  1325.  
  1326.     /* Move the Local stuff                              */
  1327.     rc = VRSet( "Local_Files_List", "Left", LFileLeft )
  1328.     rc = VRSet( "DT_LocalFiles", "Left", LFileLeft )
  1329.     rc = VRSet( "DDCB_Local_CWD", "Width", DirWidth )
  1330.     rc = VRSet( "Local_Dir_Combo", "Width", DirWidth )
  1331.     rc = VRSet( "Local_Files_List", "Width", FileWidth )
  1332.     rc = VRSet( "Local_Dir_Combo", "Height", DirHeight )
  1333.     rc = VRSet( "Local_Files_List", "Height", FileHeight )
  1334.     rc = VRSet( "DT_LocalDrive", "Top", DirHeight + 1189 )
  1335.     rc = VRSet( "DT_LocalDir", "Width", DirWidth )
  1336.     rc = VRSet( "DT_LocalFiles", "Width", FileWidth )
  1337.  
  1338.     /* Move the remote stuff                           */
  1339.     rc = VRSet( "DDCB_Remote_CWD", "Left", RDirLeft )
  1340.     rc = VRSet( "Remote_Dir_Combo", "Left", RDirLeft )
  1341.     rc = VRSet( "DT_RemoteDir", "Left", RDirLeft )
  1342.     rc = VRSet( "DT_RFileInfo", "Left", RDirLeft )
  1343.     rc = VRSet( "DDCB_Remote_CWD", "Width", DirWidth )
  1344.     rc = VRSet( "Remote_Dir_Combo", "Width", DirWidth )
  1345.     rc = VRSet( "Remote_Dir_Combo", "Height", DirHeight )
  1346.     rc = VRSet( "Remote_Files_List", "Width", FileWidth )
  1347.     rc = VRSet( "Remote_Files_List", "Height", FileHeight )
  1348.     rc = VRSet( "DT_RemoteFiles", "Width", FileWidth )
  1349.     rc = VRSet( "DT_RemoteDir", "Width", DirWidth )
  1350.     rc = VRSet( "DT_RFileInfo", "Top", DirHeight + 949 )
  1351.     rc = VRSet( "DT_RFileInfo", "Width", DirWidth )
  1352.  
  1353.     /* make the Elements visible                    */
  1354.     rc = VRSet( "GB_1", "Visible", 1 )
  1355.     rc = VRSet( "DT_XferType", "Visible", 1 )
  1356.     rc = VRSet( "Get_Button", "Visible", 1 )
  1357.     rc = VRSet( "Put_Button", "Visible", 1 )
  1358.     rc = VRSet( "GB_2", "Visible", 1 )
  1359.  
  1360. return
  1361.  
  1362. /*:VRX         MI_ASCII_Click
  1363. */
  1364. MI_ASCII_Click:
  1365.     rc = VRMethod( "Application", "PostQueue", RemoteTID, 0, "call SetAscii")
  1366.     rc = VRSet( "DT_XferType", "Caption", "ASCII" )
  1367.     rc = VRSet( "MI_Binary", "Checked", 0 )
  1368.     rc = VRSet( "MI_ASCII", "Checked", 1 )
  1369.     rc = VRSetIni( "VxFTP", "XferType", "Ascii", IniFile, "NoClose" )
  1370. return
  1371.  
  1372. /*:VRX         MI_Binary_Click
  1373. */
  1374. MI_Binary_Click:
  1375.     rc = VRMethod( "Application", "PostQueue", RemoteTID, 0, "call SetBinary")
  1376.     rc = VRSet( "DT_XferType", "Caption", "Binary" )
  1377.     rc = VRSet( "MI_Binary", "Checked", 1 )
  1378.     rc = VRSet( "MI_ASCII", "Checked", 0 )
  1379.     rc = VRSetIni( "VxFTP", "XferType", "Binary", IniFile, "NoClose" )
  1380. return
  1381.  
  1382. /*:VRX         MI_Close_Click
  1383. */
  1384. MI_Close_Click:
  1385.     rc = VRMethod( "Application", "PostQueue", RemoteTID, 0, "call FTP_Logoff")
  1386.     if (rc = 0) then
  1387.         call BasicErrMsg "Could not log off. Remote thread is hung."
  1388.  
  1389. return
  1390.  
  1391. /*:VRX         MI_GetWithoutRename_Click
  1392. */
  1393. MI_GetWithoutRename_Click:
  1394.     rc = VRMethod( "Remote_Files_List", "GetSelectedStringList", ,
  1395.          "getFiles." )
  1396.  
  1397.     if (getFiles.0 = 0) then do
  1398.         getFiles.1  = PromptDlg( "Get File", "Enter the remote file name" )
  1399.         if ( getFiles.1 = "" ) then
  1400.             return -1
  1401.         else
  1402.             getFiles.0 = 1
  1403.     end
  1404.  
  1405.     do i = 1 to getFiles.0
  1406.         parse value getFiles.i with getFiles.i "|" .
  1407.         getFiles.i = strip( getFiles.i )
  1408.     end
  1409.  
  1410.     rc = VRMethod( "Application", "PutVar", "getFiles." )
  1411.  
  1412.     /* Get the file size of the file(s) selected and send that to
  1413.      * the remote thread too.
  1414.      */
  1415.     rc = VRMethod( "Application", "GetVar", "remote_size." )
  1416.  
  1417.     do i = 1 to getFiles.0
  1418.         do j = 1 to remote_file.0
  1419.             if ( getFiles.i == word(remote_file.j, 1) ) then do
  1420.                 getFilesSize.i = remote_size.j
  1421.                 leave
  1422.            end
  1423.         end
  1424.     end /* do */
  1425.     getFilesSize.0 = getFiles.0
  1426.     rc = VRMethod( "Application", "PutVar", "getFilesSize." )
  1427.  
  1428.  
  1429.     call XferInProgress                   /* Disable interface objects */
  1430.  
  1431.     rc = VRMethod( "Application", "PostQueue", RemoteTID, 0, ,
  1432.          "call GetFilesNoRename" )
  1433.  
  1434. return
  1435.  
  1436. /*:VRX         MI_GetWithRename_Click
  1437. */
  1438. MI_GetWithRename_Click:
  1439.     rc = VRMethod( "Remote_Files_List", "GetSelectedStringList", ,
  1440.          "getFiles." )
  1441.  
  1442.     if (getFiles.0 = 0) then do
  1443.         getFiles.1  = PromptDlg( "Get File", "Enter the remote file name" )
  1444.         if ( getFiles.1 = "" ) then
  1445.             return -1
  1446.         else
  1447.             getFiles.0 = 1
  1448.     end
  1449.  
  1450.     do i = 1 to getFiles.0
  1451.         parse value getFiles.i with getFiles.i "|" .
  1452.         getFiles.i = strip( getFiles.i )
  1453.     end
  1454.  
  1455.     rc = VRMethod( "Application", "PutVar", "getFiles." )
  1456.  
  1457.     /* Get the file size of the file(s) selected and send that to
  1458.      * the remote thread too.
  1459.      */
  1460.     rc = VRMethod( "Application", "GetVar", "remote_size." )
  1461.  
  1462.     do i = 1 to getFiles.0
  1463.         do j = 1 to remote_file.0
  1464.             if ( getFiles.i == word(remote_file.j, 1) ) then do
  1465.                 getFilesSize.i = remote_size.j
  1466.                 leave
  1467.            end
  1468.         end
  1469.     end /* do */
  1470.     getFilesSize.0 = getFiles.0
  1471.     rc = VRMethod( "Application", "PutVar", "getFilesSize." )
  1472.  
  1473.     call XferInProgress               /* Disable interface objects */
  1474.  
  1475.     rc = VRMethod( "Application", "PostQueue", RemoteTID, 0, ,
  1476.          "call GetFilesRenamed" )    
  1477. return
  1478.  
  1479. /*:VRX         MI_Kill_Click
  1480. */
  1481. MI_Kill_Click: 
  1482.     OK = 1
  1483.     Buttons.OK = "OK"
  1484.     Cancel = 2
  1485.     Buttons.Cancel = "Cancel"
  1486.     Buttons.0 = 2
  1487.     
  1488.     id = VRMessage( VRWindow(), "Kill current connection?",, "Question", ,
  1489.                     "Buttons.", OK, Cancel )
  1490.     if id = 1 then do
  1491.         rc = VRMethod( "Application", "ListThreads", "T_IDs." )
  1492.         do j = T_IDs.0 to 2 by -1
  1493.             rc = VRMethod( "Application", "HaltThread", T_IDs.j )
  1494.         end /* do */
  1495.  
  1496.         call LogoffSuccessful
  1497.         call SetupRemote
  1498.     end
  1499.  
  1500.     drop Buttons. OK Cancel
  1501. return
  1502.  
  1503. /*:VRX         MI_LChDir_Click
  1504. */
  1505. MI_LChDir_Click:
  1506.     if ( VRGet( "Local_Dir_Combo", "SelectedString" ) = "" ) then do
  1507.  
  1508.         value = PromptDlg( "Change Local Directory", "Enter new directory" )
  1509.  
  1510.         if ( value <> "" ) then do
  1511.             if (substr(value, 2, 1) = ":") then do
  1512.                 rc = VRChDrive( left(value, 1) )
  1513.                 length1 = length(value)
  1514.                 value = right(value, length1 - 2)
  1515.             end /* if substr */
  1516.  
  1517.             rc = VRChDir(value)
  1518.             if (rc = 0) then
  1519.                 call BasicErrMsg VRError()
  1520.  
  1521.             else do
  1522.                 call Clear_Local
  1523.                 call Set_DDCB_Local_CWD
  1524.                 /* Disable the local directory lists while the directory listing
  1525.                  * is being compiled.
  1526.                  */
  1527.                 call DisableLocalLists
  1528.                 call Spawn_LocalDir
  1529.             end
  1530.         end
  1531.         drop value length1
  1532.  
  1533.     end /* if */
  1534.     else
  1535.         call Local_Dir_Combo_DoubleClick
  1536.  
  1537. return
  1538.  
  1539. /*:VRX         MI_LCopy_Click
  1540. */
  1541. MI_LCopy_Click:
  1542.     /* Copy local file(s)
  1543.      */
  1544.     rc = VRMethod( "Local_Files_List", "GetSelectedStringList", ,
  1545.          "copyFiles." )
  1546.  
  1547.     if (copyFiles.0 = 0) then do
  1548.         copyFiles.1 = PromptDlg( "Copy File", "Enter name of file to copy" )
  1549.         if ( copyFiles.1 = "" ) then
  1550.             signal ENDMI_LCopy_Click
  1551.         else
  1552.             copyFiles.0 = 1
  1553.     end
  1554.  
  1555.     do i = 1 to copyFiles.0
  1556.         NewFile = PromptDlg("Copy to", "Enter name and/or path to copy to:" )
  1557.  
  1558.         if ( NewFile = "" ) then
  1559.             iterate
  1560.         rc = VRCopyFile( copyFiles.i, NewFile )
  1561.         if ( rc = 0 ) then do
  1562.             call BasicErrMsg  VRError()
  1563.             iterate
  1564.         end /* if */
  1565.     end /* do */
  1566.  
  1567.     call RefreshLocal
  1568.     call Spawn_LocalDir
  1569.  
  1570. ENDMI_LCopy_Click:
  1571.     drop NewFile
  1572. return
  1573.  
  1574. /*:VRX         MI_LDel_Click
  1575. */
  1576. MI_LDel_Click:
  1577.     /* Delete local file(s)
  1578.      */
  1579.     rc = VRMethod( "Local_Files_List", "GetSelectedStringList", ,
  1580.          "deleteFiles." )
  1581.  
  1582.     if (deleteFiles.0 = 0) then do
  1583.         deleteFiles.1 = PromptDlg( "Delete File", "Enter name of file to delete" )
  1584.         if ( deleteFiles.1 = "" ) then
  1585.             return -1
  1586.         else
  1587.             deleteFiles.0 = 1
  1588.     end
  1589.  
  1590.     do i = 1 to deleteFiles.0
  1591.         rc = VRDeleteFile( deleteFiles.i )
  1592.         if ( rc = 0 ) then do
  1593.             call BasicErrMsg  VRError()
  1594.             iterate
  1595.         end /* if */
  1596.     end /* do */
  1597.  
  1598.     call RefreshLocal
  1599.     call Spawn_LocalDir
  1600.     
  1601. return
  1602.  
  1603. /*:VRX         MI_LMkDir_Click
  1604. */
  1605. MI_LMkDir_Click:
  1606.     value = PromptDlg( "Make Local Directory", "Enter directory to create" )
  1607.  
  1608.     if ( value <> "" ) then do
  1609.         rc = VRMkDir( value )
  1610.         if (rc = 0) then
  1611.             call BasicErrMsg VRError()
  1612.  
  1613.         else do
  1614.             call RefreshLocal
  1615.             call Spawn_LocalDir
  1616.         end
  1617.     end /* end if */
  1618.  
  1619.     drop value
  1620. return
  1621.  
  1622. /*:VRX         MI_LPut_Click
  1623. */
  1624. MI_LPut_Click:
  1625.     enabled = VRGet( "Put_Button", "Enabled" )
  1626.     if ( enabled = 1 ) then
  1627.         call Put_Button_Click
  1628. return
  1629.  
  1630. /*:VRX         MI_LRefreshLists_Click
  1631. */
  1632. MI_LRefreshLists_Click: 
  1633.     call Clear_Local
  1634.  
  1635.     /* Disable the Local Directory fields while you're filling
  1636.        the local directory and file lists.
  1637.      */
  1638.     call DisableLocalLists
  1639.     call Spawn_LocalDir
  1640.  
  1641. return
  1642.  
  1643. /*:VRX         MI_LRen_Click
  1644. */
  1645. MI_LRen_Click:
  1646.     /* Rename local file(s)
  1647.      */
  1648.     rc = VRMethod( "Local_Files_List", "GetSelectedStringList", ,
  1649.          "renameFiles." )
  1650.  
  1651.     if (renameFiles.0 = 0) then do
  1652.         renameFiles.1 = PromptDlg( "Rename File", "Enter file to rename" )
  1653.         if ( renameFiles.1 = "" ) then
  1654.             return -1
  1655.         else
  1656.             renameFiles.0 = 1
  1657.     end
  1658.  
  1659.     DoRefresh = 'FALSE'
  1660.     do i = 1 to renameFiles.0
  1661.         RenamedFile = PromptDlg( "Rename Local File", ,
  1662.                                  "Rename" renameFiles.i, ,
  1663.                                  renameFiles.i )
  1664.  
  1665.         if ( RenamedFile = "") then
  1666.             iterate
  1667.         else
  1668.             DoRefresh = 'TRUE'
  1669.  
  1670.         rc = VRRenameFile( renameFiles.i, RenamedFile )
  1671.         if ( rc = 0 ) then do
  1672.             call BasicErrMsg  VRError()
  1673.             iterate
  1674.         end /* if */
  1675.     end /* do */
  1676.  
  1677.     if ( DoRefresh = 'TRUE' ) then do
  1678.         call RefreshLocal
  1679.         call Spawn_LocalDir
  1680.     end
  1681. return
  1682.  
  1683. /*:VRX         MI_LRmDir_Click
  1684. */
  1685. MI_LRmDir_Click:
  1686.     value = VRGet( "Local_Dir_Combo", "Value" )
  1687.  
  1688.     if (value <> "") then do
  1689.         rc = VRRmDir( value )
  1690.         if (rc = 0) then
  1691.             call BasicErrMsg VRError()
  1692.  
  1693.         else do
  1694.             call RefreshLocal
  1695.             call Spawn_LocalDir
  1696.         end
  1697.     end
  1698.     else do
  1699.         value = PromptDlg( "Remove Local Directory", "Enter directory to delete" )
  1700.  
  1701.         if (value <> "") then do
  1702.             rc = VRRmDir( value )
  1703.             if (rc = 0) then
  1704.                 call BasicErrMsg VRError()
  1705.  
  1706.             else do
  1707.                 call RefreshLocal
  1708.                 call Spawn_LocalDir
  1709.             end /* else */
  1710.         end /* if */
  1711.     end /* else */
  1712.  
  1713.     drop value
  1714.  
  1715. return
  1716.  
  1717. /*:VRX         MI_LUnzip_Click
  1718. */
  1719. MI_LUnzip_Click:
  1720. return
  1721.  
  1722. /*:VRX         MI_LView_Click
  1723. */
  1724. MI_LView_Click:
  1725.     /* Download the selected files for viewing.
  1726.      */
  1727.     selected = VRGet( "Local_Files_List", "Selected" )
  1728.     if (selected = 0 ) then do
  1729.         filesToView.1 = PromptDlg( "View File", "Enter name of file to view" )
  1730.         if ( filesToView.1 = "" ) then
  1731.             return -1
  1732.         else
  1733.             filesToView.0 = 1
  1734.     end
  1735.     else
  1736.         rc = VRMethod( "Local_Files_List", "GetSelectedStringList", filesToView. )
  1737.  
  1738.     do i = 1 to filesToView.0
  1739.         /* Check whether or not user wants to use the E system
  1740.          * editor to view files.
  1741.          */
  1742.         if ( VRGetIni( "VxFTP", "EEditor", IniFile, "NoClose" ) = 1 ) then do
  1743.             command = 'start /f e' '"'filesToView.i'"'
  1744.             address cmd command
  1745.         end
  1746.         else
  1747.             call Spawn_ViewTextFile filesToView.i, filesToView.i, "LOCAL"
  1748.     end
  1749.  
  1750.  
  1751. return
  1752.  
  1753. /*:VRX         MI_LWithoutParams_Click
  1754. */
  1755. MI_LWithoutParams_Click:
  1756.     rc = VRMethod( "Local_Files_List", "GetSelectedStringList", ,
  1757.          "selected_files." )
  1758.  
  1759.     if (selected_files.0 = 0) then do
  1760.         selected_files.1 = PromptDlg( "Execute File", "Enter name of file to execute" )
  1761.         if ( selected_files.1 = "" ) then
  1762.             return -1
  1763.         else
  1764.             selected_files.0 = 1
  1765.     end
  1766.  
  1767.     do i = 1 to selected_files.0
  1768.         if ( translate( right( selected_files.i, 4)) = ".EXE") | ,
  1769.            ( translate( right( selected_files.i, 4)) = ".CMD") | ,
  1770.            ( translate( right( selected_files.i, 4)) = ".COM") | ,
  1771.            ( translate( right( selected_files.i, 4)) = ".BAT") then
  1772.  
  1773.             'start /f /pgm' selected_files.i
  1774.         else
  1775.             call BasicErrMsg "The file" selected_files.i "is not executable"
  1776.  
  1777.     end /* do */
  1778.  
  1779. return
  1780.  
  1781. /*:VRX         MI_LWithParams_Click
  1782. */
  1783. MI_LWithParams_Click:
  1784.     rc = VRMethod( "Local_Files_List", "GetSelectedStringList", ,
  1785.          "selected_files." )
  1786.  
  1787.     if (selected_files.0 = 0) then do
  1788.         selected_files.1 = PromptDlg( "Execute with Parameters", "Enter name of file to execute" )
  1789.         if ( selected_files.1 = "" ) then
  1790.             return -1
  1791.         else
  1792.             selected_files.0 = 1
  1793.     end
  1794.  
  1795.     do i = 1 to selected_files.0
  1796.         if ( translate( right( selected_files.i, 4)) = ".EXE") | ,
  1797.            ( translate( right( selected_files.i, 4)) = ".CMD") | ,
  1798.            ( translate( right( selected_files.i, 4)) = ".COM") | ,
  1799.            ( translate( right( selected_files.i, 4)) = ".BAT") then do
  1800.  
  1801.             Buttons.1 = "OK"
  1802.             Buttons.2 = "Cancel"
  1803.             Buttons.0 = 2
  1804.             Param = ""
  1805.             id = VRPrompt( VRWindow(), "Enter your parameters", "Param", ,
  1806.                            "Parameters", "Buttons.", OK, Cancel )
  1807.  
  1808.       if ( id = 1 ) then
  1809.             'start /f /pgm' selected_files.i Param
  1810.         end /* if */
  1811.         else
  1812.             call BasicErrMsg "The file" selected_files.i "is not executable"
  1813.  
  1814.     end /* do */
  1815.  
  1816. return
  1817.  
  1818. /*:VRX         MI_New_Click
  1819. */
  1820. MI_New_Click:
  1821.     rc = VRSet( "TM_Relogin", "Enabled", 0 )
  1822.     LoginAttemptCount = 0
  1823.  
  1824.     call GetLoginInfo
  1825. return
  1826.  
  1827. /*:VRX         MI_Notebook_Click
  1828. */
  1829. MI_Notebook_Click:
  1830.     rc = VRLoadSecondary( "Notebook1" )
  1831.  
  1832. return
  1833.  
  1834. /*:VRX         MI_PopupGetWithoutRename_Click
  1835. */
  1836. MI_PopupGetWithoutRename_Click: 
  1837.     call MI_GetWithoutRename_Click
  1838. return
  1839.  
  1840. /*:VRX         MI_PopupGetWithRename_Click
  1841. */
  1842. MI_PopupGetWithRename_Click: 
  1843.     call MI_GetWithRename_Click
  1844. return
  1845.  
  1846. /*:VRX         MI_PopupLChDir_Click
  1847. */
  1848. MI_PopupLChDir_Click: 
  1849.     call MI_LChDir_Click
  1850. return
  1851.  
  1852. /*:VRX         MI_PopUpLCopy_Click
  1853. */
  1854. MI_PopUpLCopy_Click: 
  1855.     call MI_LCopy_Click
  1856. return
  1857.  
  1858. /*:VRX         MI_PopUpLDelete_Click
  1859. */
  1860. MI_PopUpLDelete_Click: 
  1861.     call MI_LDel_Click
  1862. return
  1863.  
  1864. /*:VRX         MI_PopupLMkDir_Click
  1865. */
  1866. MI_PopupLMkDir_Click: 
  1867.     call MI_LMkDir_Click
  1868. return
  1869.  
  1870. /*:VRX         MI_PopUpLRename_Click
  1871. */
  1872. MI_PopUpLRename_Click: 
  1873.     call MI_LRen_Click
  1874. return
  1875.  
  1876. /*:VRX         MI_PopupLRmDir_Click
  1877. */
  1878. MI_PopupLRmDir_Click: 
  1879.     call MI_LRmDir_Click
  1880. return
  1881.  
  1882. /*:VRX         MI_PopUpLView_Click
  1883. */
  1884. MI_PopUpLView_Click: 
  1885.     call MI_LView_Click
  1886. return
  1887.  
  1888. /*:VRX         MI_PopUpLWithoutParams_Click
  1889. */
  1890. MI_PopUpLWithoutParams_Click: 
  1891.     call MI_LWithoutParams_Click
  1892. return
  1893.  
  1894. /*:VRX         MI_PopUpLWithParams_Click
  1895. */
  1896. MI_PopUpLWithParams_Click: 
  1897.     call MI_LWithParams_Click
  1898. return
  1899.  
  1900. /*:VRX         MI_PopUpPutWithoutRenaming_Click
  1901. */
  1902. MI_PopUpPutWithoutRenaming_Click: 
  1903.     call MI_PutWithoutRename_Click
  1904. return
  1905.  
  1906. /*:VRX         MI_PopUpPutWithRenaming_Click
  1907. */
  1908. MI_PopUpPutWithRenaming_Click: 
  1909.     call MI_PutWithRename_Click
  1910. return
  1911.  
  1912. /*:VRX         MI_PopupRChDir_Click
  1913. */
  1914. MI_PopupRChDir_Click: 
  1915.     call MI_RChDir_Click
  1916. return
  1917.  
  1918. /*:VRX         MI_PopupRDel_Click
  1919. */
  1920. MI_PopupRDel_Click: 
  1921.     call MI_RDel_Click
  1922. return
  1923.  
  1924. /*:VRX         MI_PopupRMkDir_Click
  1925. */
  1926. MI_PopupRMkDir_Click: 
  1927.     call MI_RMkDir_Click
  1928. return
  1929.  
  1930. /*:VRX         MI_PopupRRen_Click
  1931. */
  1932. MI_PopupRRen_Click: 
  1933.     call MI_RRen_Click
  1934. return
  1935.  
  1936. /*:VRX         MI_PopupRRmDir_Click
  1937. */
  1938. MI_PopupRRmDir_Click: 
  1939.     call MI_RRmDir_Click
  1940. return
  1941.  
  1942. /*:VRX         MI_PopupRView_Click
  1943. */
  1944. MI_PopupRView_Click: 
  1945.     call MI_RView_Click
  1946. return
  1947.  
  1948. /*:VRX         MI_PopUpUnzipCurrDir_Click
  1949. */
  1950. MI_PopUpUnzipCurrDir_Click: 
  1951.     call MI_UnzipCurrDir_Click
  1952. return
  1953.  
  1954. /*:VRX         MI_PopUpUnzipNewDir_Click
  1955. */
  1956. MI_PopUpUnzipNewDir_Click: 
  1957.     call MI_UnzipNewDir_Click
  1958. return
  1959.  
  1960. /*:VRX         MI_ProdInfo_Click
  1961. */
  1962. MI_ProdInfo_Click:
  1963.     values = ProductInfo( VRWindow() )    
  1964. return
  1965.  
  1966. /*:VRX         MI_PutWithoutRename_Click
  1967. */
  1968. MI_PutWithoutRename_Click:
  1969.     if ( ConnectedToHost \= 'TRUE' ) then do
  1970.         call BasicErrMsg "Can't Put. Not connected."
  1971.         return -1
  1972.     end
  1973.  
  1974.     rc = VRMethod( "Local_Files_List", "GetSelectedStringList", ,
  1975.          "putFiles." )
  1976.  
  1977.     if (putFiles.0 = 0) then do
  1978.         putFiles.1  = PromptDlg( "Put File", "Enter the local file name" )
  1979.         if ( putFiles.1 = "" ) then
  1980.             return -1
  1981.         else
  1982.             putFiles.0 = 1
  1983.     end
  1984.  
  1985.     rc = VRMethod( "Application", "PutVar", "putFiles." )
  1986.  
  1987.     call XferInProgress                   /* Disable interface objects */
  1988.  
  1989.     rc = VRMethod( "Application", "PostQueue", RemoteTID, 0, ,
  1990.          "call PutFilesNoRename" )
  1991.  
  1992. return
  1993.  
  1994. /*:VRX         MI_PutWithRename_Click
  1995. */
  1996. MI_PutWithRename_Click:
  1997.     rc = VRMethod( "Local_Files_List", "GetSelectedStringList", ,
  1998.          "putFiles." )
  1999.  
  2000.     if (putFiles.0 = 0) then do
  2001.         putFiles.1  = PromptDlg( "Put File", "Enter the local file name" )
  2002.         if ( putFiles.1 = "" ) then
  2003.             return -1
  2004.         else
  2005.             putFiles.0 = 1
  2006.     end
  2007.  
  2008.     if ( ConnectedToHost = 'TRUE' ) then do
  2009.         rc = VRMethod( "Application", "PutVar", "putFiles." )
  2010.  
  2011.         call XferInProgress                   /* Disable interface objects */
  2012.  
  2013.         rc = VRMethod( "Application", "PostQueue", RemoteTID, 0, ,
  2014.              "call PutFilesRenamed" )
  2015.     end
  2016.     else
  2017.         call BasicErrMsg "Can't Put. Not connected."
  2018.  
  2019.   
  2020. return
  2021.  
  2022. /*:VRX         MI_RChDir_Click
  2023. */
  2024. MI_RChDir_Click:
  2025.     if ( VRGet( "Remote_Dir_Combo", "SelectedString" ) = "" ) then do
  2026.         value = PromptDlg( "Change Remote Directory", "Enter new directory" )
  2027.  
  2028.         if ( value <> "" ) then
  2029.             rc = VRMethod( "Application", "PostQueue", RemoteTID, 0, ,
  2030.                  "call FTPChangeDir", "newDir", value )
  2031.         end
  2032.  
  2033.     else
  2034.         call Remote_Dir_Combo_DoubleClick
  2035.     
  2036. return
  2037.  
  2038. /*:VRX         MI_RDel_Click
  2039. */
  2040. MI_RDel_Click:
  2041.     rc = VRMethod( "Remote_Files_List", "GetSelectedStringList", ,
  2042.          "deleteFiles." )
  2043.  
  2044.     if (deleteFiles.0 = 0) then do
  2045.         deleteFiles.1 = PromptDlg( "Delete Remote File", "Enter name of file to delete" )
  2046.         if ( deleteFiles.1 = "" ) then
  2047.             return -1
  2048.         else
  2049.             deleteFiles.0 = 1
  2050.     end
  2051.  
  2052.     call DisableRemoteLists                   /* Disable interface objects */
  2053.  
  2054.     do i = 1 to deleteFiles.0
  2055.         parse value deleteFiles.i with deleteFiles.i "|" .
  2056.         deleteFiles.i = strip( deleteFiles.i )
  2057.     end
  2058.  
  2059.     call VRMethod "Application", "PutVar", "deleteFiles."
  2060.     rc = VRMethod( "Application", "PostQueue", RemoteTID, 0, ,
  2061.          "call FTPDeleteFiles" )
  2062.  
  2063. return
  2064.  
  2065. /*:VRX         MI_RGet_Click
  2066. */
  2067. MI_RGet_Click:
  2068.     call MI_GetWithoutRename_Click
  2069. return
  2070.  
  2071. /*:VRX         MI_RLongList_Click
  2072. */
  2073. MI_RLongList_Click:
  2074.     call Spawn_ViewTextFile "junk", "Long Directory Listing", "VIEWER"
  2075. return
  2076.  
  2077. /*:VRX         MI_RMkDir_Click
  2078. */
  2079. MI_RMkDir_Click:
  2080.     value = PromptDlg( "Make Remote Directory", "Enter directory to create" )
  2081.  
  2082.     if ( value <> "" ) then
  2083.         rc = VRMethod( "Application", "PostQueue", RemoteTID, 0, ,
  2084.              "call FTPMakeDir", "newDir", value )  
  2085. return
  2086.  
  2087. /*:VRX         MI_RQuote_Click
  2088. */
  2089. MI_RQuote_Click: 
  2090.  
  2091.     QuotedMsg = PromptDlg( "Quote", "Enter instruction to send to host" )
  2092.  
  2093.     if ( QuotedMsg <> "" ) then do
  2094.         rc = VRMethod( "Application", "PutVar", "QuotedMsg" )
  2095.         rc = VRMethod( "Application", "PostQueue", RemoteTID, 0, ,
  2096.              "call SendQuotedMsg" )    
  2097.     end
  2098.  
  2099. return
  2100.  
  2101. /*:VRX         MI_RRefreshLists_Click
  2102. */
  2103. MI_RRefreshLists_Click:
  2104.     call RefreshRemote
  2105.     rc = VRMethod( "Application", "PostQueue", RemoteTID, 0, ,
  2106.          "call DownloadNParseList" )
  2107. return
  2108.  
  2109. /*:VRX         MI_RRen_Click
  2110. */
  2111. MI_RRen_Click:
  2112.     /* Rename a remote file
  2113.      */
  2114.     rc = VRMethod( "Remote_Files_List", "GetSelectedStringList", ,
  2115.          "renameFiles." )
  2116.  
  2117.     if (renameFiles.0 = 0) then do
  2118.         renameFiles.1 = PromptDlg( "Rename Remote File", "Enter file to rename" )
  2119.         if ( renameFiles.1 = "" ) then
  2120.             return -1
  2121.         else
  2122.             renameFiles.0 = 1
  2123.     end
  2124.  
  2125.     call DisableRemoteLists                   /* Disable interface objects */
  2126.  
  2127.     do i = 1 to renameFiles.0
  2128.         parse value renameFiles.i with renameFiles.i "|" .
  2129.         renameFiles.i = strip( renameFiles.i )
  2130.     end
  2131.  
  2132.  
  2133.     call VRMethod "Application", "PutVar", "renameFiles."
  2134.     rc = VRMethod( "Application", "PostQueue", RemoteTID, 0, ,
  2135.          "call FTPRenameFiles" )
  2136. return
  2137.  
  2138. /*:VRX         MI_RRmDir_Click
  2139. */
  2140. MI_RRmDir_Click:
  2141.     value = VRGet( "Remote_Dir_Combo", "SelectedString" )
  2142.  
  2143.     if ( value <> "" ) then
  2144.         rc = VRMethod( "Application", "PostQueue", RemoteTID, 0, ,
  2145.              "call FTPRemoveDir", "removeDir", value )
  2146.   
  2147.     else do
  2148.         value = PromptDlg( "Remove Remote Directory", "Enter directory to delete" )
  2149.  
  2150.         if ( value <> "" ) then
  2151.             rc = VRMethod( "Application", "PostQueue", RemoteTID, 0, ,
  2152.                  "call FTPRemoveDir", "removeDir", value )
  2153.  
  2154.         drop value
  2155.     end  /* else */
  2156.  
  2157. return
  2158.  
  2159. /*:VRX         MI_RSite_Click
  2160. */
  2161. MI_RSite_Click: 
  2162.  
  2163.     SiteCmd = PromptDlg( "Site", "Enter command" )
  2164.  
  2165.     if ( SiteCmd <> "" ) then do
  2166.         rc = VRMethod( "Application", "PutVar", "SiteCmd" )
  2167.         rc = VRMethod( "Application", "PostQueue", RemoteTID, 0, ,
  2168.              "call SendSiteCmd" )    
  2169.     end
  2170.  
  2171. return
  2172.  
  2173. /*:VRX         MI_RView_Click
  2174. */
  2175. MI_RView_Click:
  2176.     /* Download the selected files for viewing.
  2177.      */
  2178.     rc = VRMethod( "Remote_Files_List", "GetSelectedStringList", filesToView. )
  2179.     if ( filesToView.0 = 0 ) then do
  2180.         filesToView.1 = PromptDlg( "View File", "Enter name of file to view" )
  2181.         if ( filesToView.1 = "" ) then
  2182.             return -1
  2183.         else
  2184.             filesToView.0 = 1
  2185.     end
  2186.     call VRMethod "Application", "PutVar", "filesToView."
  2187.  
  2188.     do i = 1 to filesToView.0
  2189.         parse value filesToView.i with filesToView.i "|" .
  2190.         filesToView.i = strip( filesToView.i )
  2191.     end
  2192.  
  2193.     rc = VRMethod( "Application", "PutVar", "filesToView." )
  2194.  
  2195.     /* Get the file size of the file(s) selected and send that to
  2196.      * the remote thread too.
  2197.      */
  2198.     rc = VRMethod( "Application", "GetVar", "remote_size." )
  2199.  
  2200.     do i = 1 to filesToView.0
  2201.         do j = 1 to remote_file.0
  2202.             if ( filesToView.i == remote_file.j ) then do
  2203.                 filesToViewSize.i = remote_size.j
  2204.                 leave
  2205.            end
  2206.         end
  2207.     end /* do */
  2208.     filesToViewSize.0 = filesToView.0
  2209.     rc = VRMethod( "Application", "PutVar", "filesToViewSize." )
  2210.  
  2211.     call XferInProgress                   /* Disable interface objects */
  2212.     
  2213.     rc = VRMethod( "Application", "PostQueue", RemoteTID, 0, "call ViewFiles" )
  2214.  
  2215. return
  2216.  
  2217. /*:VRX         MI_SysMac_Click
  2218. */
  2219. MI_SysMac_Click:
  2220.     rc = VRMethod( "Application", "PostQueue", RemoteTID, 0, ,
  2221.          "call SetSysType", "systype", "MAC" )
  2222.     rc = VRSet( "MI_SysMac",  "Checked", 1 )
  2223.     rc = VRSet( "MI_SysNW",   "Checked", 0 )
  2224.     rc = VRSet( "MI_SysOS2",  "Checked", 0 )
  2225.     rc = VRSet( "MI_SysNT",   "Checked", 0 )
  2226.     rc = VRSet( "MI_SysUNIX", "Checked", 0 )
  2227.     rc = VRSet( "MI_SysVMS",  "Checked", 0 )
  2228.     rc = VRSet( "MI_SysVM",   "Checked", 0 )
  2229.     rc = VRSet( "MI_SysUnknown",  "Checked", 0 )
  2230.  
  2231. return
  2232.  
  2233. /*:VRX         MI_SysNT_Click
  2234. */
  2235. MI_SysNT_Click: 
  2236.     rc = VRMethod( "Application", "PostQueue", RemoteTID, 0, ,
  2237.          "call SetSysType", "systype", "NT" )
  2238.     rc = VRSet( "MI_SysMac",      "Checked", 0 )
  2239.     rc = VRSet( "MI_SysNW",       "Checked", 0 )
  2240.     rc = VRSet( "MI_SysOS2",      "Checked", 0 )
  2241.     rc = VRSet( "MI_SysNT",       "Checked", 1 )
  2242.     rc = VRSet( "MI_SysUNIX",     "Checked", 0 )
  2243.     rc = VRSet( "MI_SysVMS",      "Checked", 0 )
  2244.     rc = VRSet( "MI_SysVM",       "Checked", 0 )
  2245.     rc = VRSet( "MI_SysUnknown",  "Checked", 0 )
  2246.  
  2247. return
  2248.  
  2249. /*:VRX         MI_SysNW_Click
  2250. */
  2251. MI_SysNW_Click: 
  2252.     rc = VRMethod( "Application", "PostQueue", RemoteTID, 0, ,
  2253.          "call SetSysType", "systype", "NW" )
  2254.     rc = VRSet( "MI_SysMac",      "Checked", 0 )
  2255.     rc = VRSet( "MI_SysNW",       "Checked", 1 )
  2256.     rc = VRSet( "MI_SysOS2",      "Checked", 0 )
  2257.     rc = VRSet( "MI_SysNT",       "Checked", 0 )
  2258.     rc = VRSet( "MI_SysUNIX",     "Checked", 0 )
  2259.     rc = VRSet( "MI_SysVMS",      "Checked", 0 )
  2260.     rc = VRSet( "MI_SysVM",       "Checked", 0 )
  2261.     rc = VRSet( "MI_SysUnknown",  "Checked", 0 )
  2262.  
  2263. return
  2264.  
  2265. /*:VRX         MI_SysOS2_Click
  2266. */
  2267. MI_SysOS2_Click:
  2268.     rc = VRMethod( "Application", "PostQueue", RemoteTID, 0, ,
  2269.          "call SetSysType", "systype", "PC" )
  2270.     rc = VRSet( "MI_SysMac",      "Checked", 0 )
  2271.     rc = VRSet( "MI_SysNW",       "Checked", 0 )
  2272.     rc = VRSet( "MI_SysOS2",      "Checked", 1 )
  2273.     rc = VRSet( "MI_SysNT",       "Checked", 0 )
  2274.     rc = VRSet( "MI_SysUNIX",     "Checked", 0 )
  2275.     rc = VRSet( "MI_SysVMS",      "Checked", 0 )
  2276.     rc = VRSet( "MI_SysVM",       "Checked", 0 )
  2277.     rc = VRSet( "MI_SysUnknown",  "Checked", 0 )
  2278.  
  2279. return
  2280.  
  2281. /*:VRX         MI_SysUNIX_Click
  2282. */
  2283. MI_SysUNIX_Click:
  2284.     rc = VRMethod( "Application", "PostQueue", RemoteTID, 0, ,
  2285.          "call SetSysType", "systype", "UNIX" )
  2286.     rc = VRSet( "MI_SysMac",      "Checked", 0 )
  2287.     rc = VRSet( "MI_SysNW",       "Checked", 0 )
  2288.     rc = VRSet( "MI_SysOS2",      "Checked", 0 )
  2289.     rc = VRSet( "MI_SysNT",       "Checked", 0 )
  2290.     rc = VRSet( "MI_SysUNIX",     "Checked", 1 )
  2291.     rc = VRSet( "MI_SysVMS",      "Checked", 0 )
  2292.     rc = VRSet( "MI_SysVM",       "Checked", 0 )
  2293.     rc = VRSet( "MI_SysUnknown",  "Checked", 0 )
  2294. return
  2295.  
  2296. /*:VRX         MI_SysUnknown_Click
  2297. */
  2298. MI_SysUnknown_Click:
  2299.     rc = VRMethod( "Application", "PostQueue", RemoteTID, 0, ,
  2300.          "call SetSysType", "systype", "UNIX" )
  2301.     rc = VRSet( "MI_SysMac",      "Checked", 0 )
  2302.     rc = VRSet( "MI_SysNW",       "Checked", 0 )
  2303.     rc = VRSet( "MI_SysOS2",      "Checked", 0 )
  2304.     rc = VRSet( "MI_SysNT",       "Checked", 0 )
  2305.     rc = VRSet( "MI_SysUNIX",     "Checked", 0 )
  2306.     rc = VRSet( "MI_SysVMS",      "Checked", 0 )
  2307.     rc = VRSet( "MI_SysVM",       "Checked", 0 )
  2308.     rc = VRSet( "MI_SysUnknown",  "Checked", 1 )
  2309. return
  2310.  
  2311. /*:VRX         MI_SysVM_Click
  2312. */
  2313. MI_SysVM_Click:
  2314.     rc = VRMethod( "Application", "PostQueue", RemoteTID, 0, ,
  2315.          "call SetSysType", "systype", "VM" )
  2316.     rc = VRSet( "MI_SysMac",      "Checked", 0 )
  2317.     rc = VRSet( "MI_SysNW",       "Checked", 0 )
  2318.     rc = VRSet( "MI_SysOS2",      "Checked", 0 )
  2319.     rc = VRSet( "MI_SysNT",       "Checked", 0 )
  2320.     rc = VRSet( "MI_SysUNIX",     "Checked", 0 )
  2321.     rc = VRSet( "MI_SysVMS",      "Checked", 0 )
  2322.     rc = VRSet( "MI_SysVM",       "Checked", 1 )
  2323.     rc = VRSet( "MI_SysUnknown",  "Checked", 0 )
  2324. return
  2325.  
  2326. /*:VRX         MI_SysVMS_Click
  2327. */
  2328. MI_SysVMS_Click:
  2329.     rc = VRMethod( "Application", "PostQueue", RemoteTID, 0, ,
  2330.          "call SetSysType", "systype", "VMS" )
  2331.     rc = VRSet( "MI_SysMac",      "Checked", 0 )
  2332.     rc = VRSet( "MI_SysNW",       "Checked", 0 )
  2333.     rc = VRSet( "MI_SysOS2",      "Checked", 0 )
  2334.     rc = VRSet( "MI_SysNT",       "Checked", 0 )
  2335.     rc = VRSet( "MI_SysUNIX",     "Checked", 0 )
  2336.     rc = VRSet( "MI_SysVMS",      "Checked", 1 )
  2337.     rc = VRSet( "MI_SysVM",       "Checked", 0 )
  2338.     rc = VRSet( "MI_SysUnknown",  "Checked", 0 )
  2339. return
  2340.  
  2341. /*:VRX         MI_UnzipCurrDir_Click
  2342. */
  2343. MI_UnzipCurrDir_Click:
  2344.     rc = VRMethod( "Local_Files_List", "GetSelectedStringList", ,
  2345.          "unzipFiles." )
  2346.  
  2347.     if (unzipFiles.0 = 0) then do
  2348.         unzipFiles.1 = PromptDlg( "Unzip File", "Enter name of file to unzip" )
  2349.         if ( unzipFiles.1 = "" ) then
  2350.             return -1
  2351.         else
  2352.             unzipFiles.0 = 1
  2353.     end
  2354.  
  2355.     if ( VRGetIni( "VxFTP", "ZipConsole", IniFile, "NoClose" ) = "1" ) then do
  2356.         rc = VRRedirectStdIO("On")
  2357.         Console = "ON"
  2358.     end
  2359.     do i = 1 to unzipFiles.0
  2360.         rc = VRSet( "MainWindow", "StatusText", "Unzipping" unzipFiles.i )
  2361.         if ( VRGetIni( "VxFTP", "UnzipPgm", IniFile, "NoClose" ) = 'InfoZip' ) then
  2362.             "unzip -oq" unzipFiles.i
  2363.         else if ( VRGetIni( "VxFTP", "UnzipPgm", IniFile, "NoClose" ) = 'PKUnzip' ) then
  2364.                 "pkunzip -o" unzipFiles.i
  2365.             else
  2366.                 call BasicErrMsg "Can't unzip. Check Notebook settings."
  2367.     end /* do */
  2368.  
  2369.     if ( Console = "ON" ) then do
  2370.         Console = "OFF"
  2371.         CCTID = VRMethod( "Application", "StartThread", "CConsole")
  2372.         if CCTID = 0 then
  2373.             call BasicErrMsg "Couldn't start Console thread."
  2374.     end
  2375.  
  2376.     rc = VRSet( "MainWindow", "StatusText", "" )
  2377.  
  2378.     call RefreshLocal
  2379.     call Spawn_LocalDir
  2380.  
  2381. return
  2382.  
  2383. /*:VRX         MI_UnzipNewDir_Click
  2384. */
  2385. MI_UnzipNewDir_Click:
  2386.     rc = VRMethod( "Local_Files_List", "GetSelectedStringList", ,
  2387.          "unzipFiles." )
  2388.  
  2389.     if (unzipFiles.0 = 0) then do
  2390.         unzipFiles.1 = PromptDlg( "Unzip File", "Enter name of file to unzip" )
  2391.         if ( unzipFiles.1 = "" ) then
  2392.             signal ENDMI_UnzipNewDir_Click
  2393.         else
  2394.             unzipFiles.0 = 1
  2395.     end
  2396.  
  2397.     if ( VRGetIni( "VxFTP", "ZipConsole", IniFile, "NoClose" ) = "1" ) then do
  2398.         rc = VRRedirectStdIO("On")
  2399.         Console = "ON"
  2400.     end
  2401.     do i = 1 to unzipFiles.0
  2402.         if ( VRGetIni("VxFTP", "SubDir", IniFile, "NoClose" ) = 'Prompt' ) then do
  2403.             UnzipDir = PromptDlg( "Unzip File", "Enter name of subdirectory for" unzipFiles.i)
  2404.             if ( UnzipDir = "" ) then
  2405.                 iterate
  2406.         end
  2407.         else
  2408.             UnzipDir = left( unzipFiles.i, length( unzipFiles.i) -4 )
  2409.  
  2410.  
  2411.         rc = VRMkDir( UnzipDir )
  2412.         if ( rc = 0 ) then do
  2413.             call BasicErrMsg "Couldn't make" UnzipDir
  2414.             iterate
  2415.         end
  2416.         rc = VRCopyFile( unzipFiles.i, UnzipDir )
  2417.         rc = VRChDir( UnzipDir )
  2418.         if ( rc = 0 ) then do
  2419.             call BasicErrMsg "Couldn't change to" UnzipDir
  2420.             iterate
  2421.         end
  2422.  
  2423.         rc = VRSet( "MainWindow", "StatusText", "Unzipping" unzipFiles.i )
  2424.         if ( VRGetIni( "VxFTP", "UnzipPgm", IniFile, "NoClose" ) = 'InfoZip' ) then
  2425.             "unzip -oq" unzipFiles.i
  2426.         else if ( VRGetIni( "VxFTP", "UnzipPgm", IniFile, "NoClose" ) = 'PKUnzip' ) then
  2427.                 "pkunzip -o" unzipFiles.i
  2428.             else
  2429.                 call BasicErrMsg "Can't Unzip. Use Notebook Settings."
  2430.  
  2431.         rc = VRDeleteFile( unzipFiles.i )
  2432.         rc = VRChDir( ".." )
  2433.     end /* do */
  2434.     if ( Console = "ON" ) then do
  2435.         Console = "OFF"
  2436.         CCTID = VRMethod( "Application", "StartThread", "CConsole")
  2437.         if CCTID = 0 then
  2438.             call BasicErrMsg "Couldn't start Console thread."
  2439.     end
  2440.  
  2441.     call RefreshLocal
  2442.     call Spawn_LocalDir
  2443.  
  2444. ENDMI_UnzipNewDir_Click:
  2445.     rc = VRSet( "MainWindow", "StatusText", " " )
  2446.     drop UnzipDir unzipFiles.
  2447. return
  2448.  
  2449. /*:VRX         MI_ViewCachedDirs_Click
  2450. */
  2451. MI_ViewCachedDirs_Click: 
  2452.     rc = VRLoadSecondary( "CachedDirs" )
  2453.  
  2454. return
  2455.  
  2456. /*:VRX         MI_VxFTPHelp_Click
  2457. */
  2458. MI_VxFTPHelp_Click: 
  2459.     OK = 1
  2460.     Buttons.OK = "OK"
  2461.     Cancel = 2
  2462.     Buttons.Cancel = "Cancel"
  2463.     Buttons.0 = 2
  2464.     
  2465.     id = VRMessage( VRWindow(), "Press OK to launch Web Explorer", ,
  2466.                     "VxFTP Help", "Info", "Buttons.", OK, Cancel )
  2467.  
  2468.     if id = 1 then
  2469.         address cmd "start explore -q http://sheriff.law.utexas.edu"
  2470.  
  2471. return
  2472.  
  2473. /*:VRX         NB_Settings1_PageSelected
  2474. */
  2475. NB_Settings1_PageSelected: 
  2476.  
  2477. return
  2478.  
  2479. /*:VRX         NewAliasBtn_Click
  2480. */
  2481. NewAliasBtn_Click:
  2482.     values = AliasDE( VRWindow(), 'NEW' )
  2483.  
  2484.     if ( values <> "" ) then do
  2485.         i = GAliases.0 + 1
  2486.         GAliases.i = values
  2487.         Galiases.0 = i
  2488.  
  2489.         call UpdateAliases
  2490.     end /* if */
  2491. return
  2492.  
  2493. /*:VRX         Notebook1_Close
  2494. */
  2495. Notebook1_Close:
  2496.     window = VRInfo( "Object" )
  2497.     call VRDestroy window
  2498.     drop window
  2499. return
  2500. /*:VRX         Options_Close
  2501. */
  2502. Options_Close:
  2503.     window = VRInfo( "Object" )
  2504.     call VRDestroy window
  2505.     drop window
  2506. return
  2507. /*:VRX         Options_Create
  2508. */
  2509. Options_Create:
  2510.     if ( VRGetIni( "VxFTP", "EEditor", IniFile, "NoClose") = 1 ) then 
  2511.         rc = VRSet( "CB_Viewer", "Set", 1 )
  2512.     else
  2513.         rc = VRSet( "CB_Viewer", "Set", 0 )
  2514.  
  2515.     if ( VRGetIni( "VxFTP", "Hints", IniFile, "NoClose") = 1 ) then 
  2516.         rc = VRSet( "CB_Hints", "Set", 1 )
  2517.     else
  2518.         rc = VRSet( "CB_Hints", "Set", 0 )
  2519.  
  2520.     if ( VRGetIni( "VxFTP", "ProgInd", IniFile, "NoClose") = 1 ) then 
  2521.         rc = VRSet( "CB_ProgInd", "Set", 1 )
  2522.     else
  2523.         rc = VRSet( "CB_ProgInd", "Set", 0 )
  2524. return
  2525.  
  2526. /*:VRX         PB_CacheChange_Click
  2527. */
  2528. PB_CacheChange_Click: 
  2529.     newPath = VRGet( "DDCB_CachedDirs", "Value" )
  2530.  
  2531.     if ( newPath <> "" ) then do
  2532.         rc = VRMethod( "Application", "PostQueue", RemoteTID, 0, ,
  2533.              "call PB_CacheChange_Click", "newPath", newPath )
  2534.         if (rc = 1) then
  2535.               call DisableRemoteLists
  2536.     end
  2537.  
  2538. return
  2539.  
  2540. /*:VRX         PB_CacheClose_Click
  2541. */
  2542. PB_CacheClose_Click: 
  2543.     parent = VRGet( "PB_CacheClose", "Parent" )
  2544.     call VRDestroy parent
  2545.     drop parent
  2546.  
  2547. return
  2548.  
  2549. /*:VRX         PromptDlg
  2550. */
  2551. PromptDlg: procedure
  2552.     Title = arg(1)
  2553.     Text  = arg(2)
  2554.  
  2555.     if ( arg() = 3 ) then
  2556.         value = arg(3)
  2557.  
  2558.     Buttons.1 = "OK"
  2559.     Buttons.2 = "Cancel"
  2560.     Buttons.0 = 2
  2561.     
  2562.     id = VRPrompt( VRWindow(), Text, "value", Title, "Buttons.", OK, Cancel )
  2563.  
  2564.     if ( ( id = 0 ) | ( id = 2 ) ) then
  2565.         return ""
  2566.  
  2567. return value
  2568.  
  2569. /*:VRX         Put_Button_Click
  2570. */
  2571. Put_Button_Click:
  2572.     call MI_PutWithoutRename_Click
  2573.  
  2574. return
  2575.  
  2576. /*:VRX         PutComplete
  2577. */
  2578. PutComplete:
  2579.     call XferComplete "Show"
  2580.  
  2581.     if ( VRGetIni( "VxFTP", "NoRemoteUpdate", IniFile, "NoClose") = 0 ) then
  2582.         call RefreshRemote
  2583.  
  2584. return
  2585.  
  2586. /*:VRX         Quit
  2587. */
  2588. Quit:
  2589.     rc = VRSet( "MainWindow", "StatusText", "Shutting Down" )
  2590.     rc = VRMethod( "Application", "PostQueue", RemoteTID, 0, "call Quit")
  2591.  
  2592.     windowstate = VRGet( "MainWindow", "WindowState" )
  2593.     if ( windowstate = "Maximized" ) then     
  2594.         rc = VRSetIni( "VxFTP", "WinState", "Maximized", IniFile, "NoClose" )
  2595.     else do
  2596.         rc = VRSetIni( "VxFTP", "WinState", "Normal", IniFile, "NoClose" )
  2597.         lastWidth = VRGet( "MainWindow", "Width" )
  2598.         lastHeight = VRGet( "MainWindow", "Height" )
  2599.         lastTop = VRGet( "MainWindow", "Top" )
  2600.         lastLeft = VRGet( "MainWindow", "Left" )
  2601.         rc = VRSetIni( "VxFTP", "Width", lastWidth, IniFile, "NoClose" )
  2602.         rc = VRSetIni( "VxFTP", "Height", lastHeight, IniFile, "NoClose" )
  2603.         rc = VRSetIni( "VxFTP", "Top", lastTop, IniFile, "NoClose" )
  2604.         rc = VRSetIni( "VxFTP", "Left", lastLeft, IniFile, "NoClose" )
  2605.     end /* else */
  2606.  
  2607.     /* Save the fonts the user might have changed.
  2608.      */
  2609.     font1 = VRGet( "Local_Files_List", "Font" )
  2610.     font2 = VRGet( "Local_Dir_Combo", "Font" )
  2611.     font3 = VRGet( "DDCB_Local_CWD", "Font" )
  2612.     font4 = VRGet( "Remote_Files_List", "Font" )
  2613.     font5 = VRGet( "Remote_Dir_Combo", "Font" )
  2614.     font6 = VRGet( "DDCB_Remote_CWD", "Font" )
  2615.     Fonts = font1"|"font2"|"font3"|"font4"|"font5"|"font6
  2616.     rc = VRSetIni( "VxFTP", "ListFonts", Fonts, IniFile )
  2617.  
  2618.     /* VxREXX is faster than you'd expect. Give the remote thread a little
  2619.      * time to Logoff if it is indeed alive.
  2620.      */
  2621.     if ( ConnectedToHost = 'TRUE' ) then
  2622.         call SysSleep 1
  2623.  
  2624.     /* Prepare to shut down the application. Find out the number of threads
  2625.      * still active. If it's greater than 1, kill the outstanding threads 
  2626.      * one by one. We try this process three times until either they all die 
  2627.      * or we've done it three time. How obvious.
  2628.      */
  2629.     do i = 1 to 3
  2630.         rc = VRMethod( "Application", "ListThreads", "T_IDs.")
  2631.         if ( T_IDs.0 > 1 ) then 
  2632.             do j = T_IDs.0 to 2 by -1
  2633.                 rc = VRSet( "MainWindow", "StatusText", "Killing Thread" j ) 
  2634.                 rc = VRMethod( "Application", "HaltThread", T_IDs.j )
  2635.                 call SysSleep 1
  2636.             end
  2637.         else
  2638.             leave
  2639.     end /* do */
  2640.  
  2641.     window = VRWindow()
  2642.     call VRSet window, "Shutdown", 1
  2643.     drop window
  2644. return
  2645.  
  2646. /*:VRX         RB_Dir_Click
  2647. */
  2648. RB_Dir_Click: 
  2649.     /* Reset the remote directory cache and re-download file list
  2650.      */
  2651.     if ( ConnectedToHost = 'TRUE' ) then do
  2652.         rc = VRMethod("Application", "PostQueue", RemoteTID, 0, ,
  2653.              "call SetupDirCacheTable" )
  2654.         call MI_RRefreshLists_Click
  2655.     end
  2656.  
  2657.     RemFileList = VRGetIni( "VxFTP", "RemFileList", IniFile, "NoClose" )
  2658.     RemFileList = overlay( 'D', RemFileList, 1 )
  2659.     rc = VRSetIni("VxFTP", "RemFileList", RemFileList, IniFile, "NoClose" )
  2660.     rc = VRSet( "CB_IncludeSize", "Enabled", 1 )
  2661.     rc = VRSet( "CB_IncludeDate", "Enabled", 1 )
  2662.  
  2663.     select
  2664.         when substr( RemFileList, 2, 2 ) = '00' then
  2665.             rc = VRSet( "DT_RemoteFiles", "Caption", "Files" )
  2666.         when substr( RemFileList, 2, 2 ) = '10' then
  2667.             rc = VRSet( "DT_RemoteFiles", "Caption", "Files | Size" )
  2668.         when substr( RemFileList, 2, 2 ) = '01' then
  2669.             rc = VRSet( "DT_RemoteFiles", "Caption", "Files | Date" )
  2670.         when substr( RemFileList, 2, 2 ) = '11' then
  2671.             rc = VRSet( "DT_RemoteFiles", "Caption", "Files | Size | Date" )
  2672.     end
  2673.  
  2674.     call FlushCacheList
  2675. return
  2676.  
  2677. /*:VRX         RB_Extract_Click
  2678. */
  2679. RB_Extract_Click:
  2680.     rc = VRSetIni( "VxFTP", "SubDir", "Extract", IniFile, "NoClose" )
  2681.     
  2682. return
  2683.  
  2684. /*:VRX         RB_InfoZip_Click
  2685. */
  2686. RB_InfoZip_Click:
  2687.     rc = VRSetIni( "VxFTP", "UnzipPgm", "InfoZip", IniFile, "NoClose" )
  2688.  
  2689. return
  2690.  
  2691. /*:VRX         RB_Ls_Click
  2692. */
  2693. RB_Ls_Click: 
  2694.     /* Reset the remote directory cache and re-download file list
  2695.      */
  2696.     if ( ConnectedToHost = 'TRUE' ) then do
  2697.         rc = VRMethod("Application", "PostQueue", RemoteTID, 0, ,
  2698.              "call SetupDirCacheTable" )
  2699.         call MI_RRefreshLists_Click
  2700.     end
  2701.  
  2702.     RemFileList = VRGetIni( "VxFTP", "RemFileList", IniFile, "NoClose" )
  2703.     RemFileList = overlay( 'L', RemFileList, 1 )
  2704.     rc = VRSetIni("VxFTP", "RemFileList", RemFileList, IniFile, "NoClose" )
  2705.     rc = VRSet( "CB_IncludeSize", "Enabled", 0 )
  2706.     rc = VRSet( "CB_IncludeDate", "Enabled", 0 )
  2707.     rc = VRSet( "DT_RemoteFiles", "Caption", "Files & Dirs" )
  2708.  
  2709.     call FlushCacheList
  2710. return
  2711.  
  2712. /*:VRX         RB_PKUnzip_Click
  2713. */
  2714. RB_PKUnzip_Click:
  2715.     rc = VRSetIni( "VxFTP", "UnzipPgm", "PKUnzip", IniFile, "NoClose" )
  2716. return
  2717. /*:VRX         RB_Prompt_Click
  2718. */
  2719. RB_Prompt_Click:
  2720.     rc = VRSetIni( "VxFTP", "SubDir", "Prompt", IniFile, "NoClose" )
  2721. return
  2722.  
  2723. /*:VRX         RB_SortAscending_Click
  2724. */
  2725. RB_SortAscending_Click: 
  2726.     RemFileList = VRGetIni( "VxFTP", "RemFileList", IniFile, "NoClose" )
  2727.     RemFileList = overlay( 'A', RemFileList, 4 )
  2728.     rc = VRSetIni("VxFTP", "RemFileList", RemFileList, IniFile, "NoClose" )
  2729.  
  2730.     rc = VRSet( "Remote_Files_List", "Sort", "Ascending" ) 
  2731.     call RefreshRemote
  2732.     call SetRemoteDir
  2733. return
  2734.  
  2735. /*:VRX         RB_SortDescending_Click
  2736. */
  2737. RB_SortDescending_Click: 
  2738.     RemFileList = VRGetIni( "VxFTP", "RemFileList", IniFile, "NoClose" )
  2739.     RemFileList = overlay( 'D', RemFileList, 4 )
  2740.     rc = VRSetIni("VxFTP", "RemFileList", RemFileList, IniFile, "NoClose" )
  2741.  
  2742.     rc = VRSet( "Remote_Files_List", "Sort", "Descending" )
  2743.     call RefreshRemote
  2744.     call SetRemoteDir
  2745.  
  2746. return
  2747.  
  2748. /*:VRX         RB_SortNone_Click
  2749. */
  2750. RB_SortNone_Click: 
  2751.     RemFileList = VRGetIni( "VxFTP", "RemFileList", IniFile, "NoClose" )
  2752.     RemFileList = overlay( 'N', RemFileList, 4 )
  2753.     rc = VRSetIni("VxFTP", "RemFileList", RemFileList, IniFile, "NoClose" )
  2754.  
  2755.     rc = VRSet( "Remote_Files_List", "Sort", "None" )
  2756.     call RefreshRemote
  2757.     call SetRemoteDir
  2758.  
  2759. return
  2760.  
  2761. /*:VRX         Re_Logon_Close
  2762. */
  2763. Re_Logon_Close: 
  2764.     call Re_Logon_Fini
  2765. return
  2766.  
  2767. /*:VRX         Re_Logon_Create
  2768. */
  2769. Re_Logon_Create: 
  2770.     if ( VRGetIni( "VxFTP", "UseTimer", IniFile, "NoClose") = 1 ) then do
  2771.         rc = VRSet( "CB_ReattemptLogin", "Set", 1 )
  2772.         rc = VRSet( "GB_Relogon", "Enabled", 1 )
  2773.       end
  2774.     else do
  2775.         rc = VRSet( "CB_ReattemptLogin", "Set", 0 )
  2776.         rc = VRSet( "GB_Relogon", "Enabled", 1 )
  2777.     end
  2778.  
  2779.     ReLoginDelay = VRGetIni( "VxFTP", "ReLoginDelay", IniFile, "NoClose")
  2780.     rc = VRSet( "SPIN_RelogonSecs", "Value", ReLoginDelay )    
  2781.  
  2782.     call Re_Logon_Init
  2783.  
  2784. return
  2785.  
  2786. /*:VRX         Re_Logon_Fini
  2787. */
  2788. Re_Logon_Fini: 
  2789.     window = VRInfo( "Window" )
  2790.     call VRDestroy window
  2791.     drop window
  2792. return
  2793. /*:VRX         Re_Logon_Init
  2794. */
  2795. Re_Logon_Init: 
  2796.     window = VRInfo( "Object" )
  2797.     if( \VRIsChildOf( window, "Notebook" ) ) then do
  2798.         call VRMethod window, "CenterWindow"
  2799.         call VRSet window, "Visible", 1
  2800.         call VRMethod window, "Activate"
  2801.     end
  2802.     drop window
  2803. return
  2804.  
  2805. /*:VRX         RefreshCachedDirs
  2806. */
  2807. RefreshCachedDirs: 
  2808.     rc = VRIsValidObject( "DDCB_CachedDirs" )
  2809.     if ( rc = 1 ) then do
  2810.         rc = VRMethod( "Application", "GetVar", "Table.Dir_Name." )
  2811.         rc = VRMethod( "DDCB_CachedDirs", "Reset" )
  2812.         rc = VRMethod( "DDCB_CachedDirs", "AddStringList", "Table.Dir_Name."  )
  2813.     end
  2814.  
  2815. return
  2816.  
  2817. /*:VRX         RefreshLocal
  2818. */
  2819. RefreshLocal:
  2820.     /* To refreshen the directory and file lists once
  2821.        their contents have changed.
  2822.      */
  2823.     rc = VRMethod( "Local_Dir_Combo", "Reset" )
  2824.     rc = VRSet( "Local_Dir_Combo", "Value", "" )
  2825.     rc = VRMethod( "Local_Files_List", "Reset" )
  2826.  
  2827. return
  2828.  
  2829. /*:VRX         RefreshRemote
  2830. */
  2831. RefreshRemote:
  2832.     /* To refreshen the directory & file lists once a change
  2833.        has occurred.
  2834.      */
  2835.     rc = VRSet( "DT_RFileInfo", "Caption", "" )
  2836.     rc = VRMethod( "Remote_Dir_Combo", "Reset" )
  2837.     rc = VRSet( "Remote_Dir_Combo", "Value", "" )
  2838.     rc = VRMethod( "Remote_Files_List", "Reset" )
  2839. return
  2840.  
  2841. /*:VRX         Remote_Dir_Combo_ContextMenu
  2842. */
  2843. Remote_Dir_Combo_ContextMenu:
  2844.  
  2845.     rc = VRMethod("MI_PopupRDir", "Popup")
  2846. return
  2847.  
  2848. /*:VRX         Remote_Dir_Combo_DoubleClick
  2849. */
  2850. Remote_Dir_Combo_DoubleClick:
  2851.  
  2852.     newDir = VRGet( "Remote_Dir_Combo", "Value" )
  2853.     rc = VRMethod("Application", "PostQueue", RemoteTID, 0, ,
  2854.          "call Remote_Dir_Combo_DoubleClick", "Dir_From_GUI", newDir)
  2855.     if (rc = 1) then
  2856.             call DisableRemoteLists
  2857.  
  2858.     drop newDir
  2859. return
  2860.  
  2861. /*:VRX         Remote_Files_List_Click
  2862. */
  2863. Remote_Files_List_Click:
  2864.     RemFileList = VRGetIni( "VxFTP", "RemFileList", IniFile, "NoClose" )
  2865.     if ( left( RemFileList, 1 ) = 'L' ) then do
  2866.         rc = VRSet( "DT_RFileInfo", "Caption", "Use 'dir' option in Notebook for file info" )
  2867.         return
  2868.     end
  2869.  
  2870.     rc = VRMethod( "Remote_Files_List", "GetSelectedStringList", "infoFiles." )
  2871.     rc = VRMethod( "Application", "GetVar", "remote_size." )
  2872.     CR_LF = "0a"x
  2873.  
  2874.     if ( infoFiles.0 > 1 ) then do
  2875.     /*  If the user selected more than one item, add up the file sizes (in
  2876.         remote_size.) and show the TotalKB in DT_RFileInfo
  2877.      */ 
  2878.         TotalKB = 0
  2879.         do i = 1 to infoFiles.0
  2880.             do j = 1 to remote_file.0
  2881.                 if ( infoFiles.i == remote_file.j ) then do
  2882.                     TotalKB = TotalKB + remote_size.j
  2883.                     leave
  2884.                end
  2885.             end
  2886.         end /* do */
  2887.  
  2888.         if TotalKB > 1000 then
  2889.             rc = VRSet( "DT_RFileInfo", "Caption", ,
  2890.                         "Files Selected:" CR_LF || trunc(TotalKB / 1000, 1) "KB" )
  2891.         else
  2892.             rc = VRSet( "DT_RFileInfo", "Caption", ,
  2893.                         "Files Selected:" CR_LF || TotalKB "bytes" )
  2894.     end
  2895.  
  2896.     else do
  2897.     /* If the user only selected one item, show the file's size and date/time stamp
  2898.        in DT_RFileInfo
  2899.      */
  2900.         rc = VRMethod( "Application", "GetVar", "remote_date." )
  2901.         rc = VRMethod( "Application", "GetVar", "remote_time." )
  2902.  
  2903.         if ( right( RemFileList, 1 ) = 'N' ) then
  2904.             j = VRGet( "Remote_Files_List", "Selected" )
  2905.  
  2906.         else   
  2907.             do j = 1 to remote_file.0
  2908.                if ( infoFiles.1 == remote_file.j ) then
  2909.                    leave          
  2910.             end /* do */
  2911.  
  2912.         rc = VRSet( "DT_RFileInfo", "Caption", "Size:" remote_size.j CR_LF"Date:" remote_date.j remote_time.j )
  2913.     end /* else */
  2914.  
  2915. return
  2916.  
  2917. /*:VRX         Remote_Files_List_ContextMenu
  2918. */
  2919. Remote_Files_List_ContextMenu:
  2920.     rc = VRMethod("MI_PopupRFiles", "Popup")
  2921.     
  2922. return
  2923.  
  2924. /*:VRX         Remote_Files_List_DoubleClick
  2925. */
  2926. Remote_Files_List_DoubleClick:
  2927.     call Get_Button_Click
  2928. return
  2929. /*:VRX         Set_DDCB_Local_CWD
  2930. */
  2931. Set_DDCB_Local_CWD:
  2932.     /* Replace blanks in directory names (HPFS) with an asterick,
  2933.        which is illegal in HPFS. (We'll soon re-replace the astericks
  2934.        which the space once we've assigned the file to the directory
  2935.        stem variable.) Remove the backslashes in the path, replacing
  2936.        them with blanks so the REXX word functions will work.
  2937.      */
  2938.     directories = translate( VRCurrDir(), '*', ' ')
  2939.     directories = translate(directories, ' ', '\')
  2940.     directories = "\ " || directories
  2941.     numDirs = words(directories)
  2942.     localDirs.0 = numDirs 
  2943.  
  2944.     /* Add the "word"s within "directories" to localDirs. stem,
  2945.        replacing any astericks with the blank spaces that were
  2946.        originally there.
  2947.      */
  2948.     do i = 1 to numDirs
  2949.         localDirs.i = word(directories, numDirs-(i-1))
  2950.         localDirs.i = translate(localDirs.i, ' ', '*')
  2951.     end
  2952.     
  2953.     rc = VRSet("DDCB_Local_CWD", "Value", localDirs.1)
  2954.     rc = VRMethod( "DDCB_Local_CWD", "Clear" )
  2955.     rc = VRMethod( "DDCB_Local_CWD", "AddStringList", "localDirs."  )
  2956.     
  2957.     drop directories numDirs
  2958. return
  2959. /*:VRX         Set_DDCB_Remote_CWD
  2960. */
  2961. Set_DDCB_Remote_CWD:
  2962.     call VRMethod "Application", "GetVar", "RemoteCWDDirs."
  2963.     rc = VRSet("DDCB_Remote_CWD", "Value", RemoteCWDDirs.1)
  2964.     rc = VRMethod( "DDCB_Remote_CWD", "Clear" )
  2965.     rc = VRMethod( "DDCB_Remote_CWD", "AddStringList", "RemoteCWDDirs."  )
  2966.         
  2967.     drop RemoteCWDDirs.
  2968. return
  2969. /*:VRX         SetDriveInfoDisplay
  2970. */
  2971. SetDriveInfoDisplay: 
  2972.     DriveInfo = "Drive" VRCurrDrive() "     " VRDiskInfo( F ) % 1000 "KB Free"
  2973.     rc = VRSet( "DT_LocalDrive", "Caption", DriveInfo )
  2974.  
  2975. return
  2976.  
  2977. /*:VRX         SetLocalDir
  2978. */
  2979. SetLocalDir:
  2980.     /* Fill the user interface items with the local directory
  2981.      * information gathered and parsed in separate thread.
  2982.      */
  2983.     call VRMethod "Application", "GetVar", "dirList."
  2984.     call VRMethod "Application", "GetVar", "fileList."
  2985.  
  2986.     rc = VRSet( "Local_Dir_Combo", "Value", "" )
  2987.     rc = VRMethod( "Local_Dir_Combo", "AddStringList", "dirList."  )
  2988.     rc = VRMethod( "Local_Dir_Combo", "AddStringList", "LocalDrives."  )
  2989.     rc = VRMethod( "Local_Files_List", "AddStringList", "fileList." )
  2990.  
  2991.     call SetDriveInfoDisplay
  2992.     call EnableLocalLists
  2993.  
  2994.     drop dirList. fileList.
  2995. return
  2996.  
  2997. /*:VRX         SetRemoteDir
  2998. */
  2999. SetRemoteDir:
  3000.     /* Fill the user interface items with the remote directory
  3001.      * information gathered and parsed in remote thread.
  3002.      */
  3003.     call VRMethod "Application", "GetVar", "remote_file."
  3004.     call VRMethod "Application", "GetVar", "remote_dir."
  3005.  
  3006.     rc = VRSet( "Remote_Dir_Combo", "Value", "" )
  3007.     rc = VRMethod( "Remote_Dir_Combo", "AddStringList", "remote_dir."  )
  3008.     rc = VRMethod( "Remote_Files_List", "AddStringList", "remote_file." )
  3009.     rc = VRSet( "DT_RFileInfo", "Caption", "" )
  3010.  
  3011.     call EnableRemoteLists
  3012.  
  3013. return
  3014.  
  3015. /*:VRX         SetupRemote
  3016. */
  3017. SetupRemote:
  3018.     /* Spawn Remote thread
  3019.      */
  3020.     RemoteTID = VRMethod( "Application", "StartThread", "Remote")
  3021.     if RemoteTID = 0 then do
  3022.         call BasicErrMsg "Couldn't start Remote Process thread."
  3023.         call Quit
  3024.     end
  3025.  
  3026. return
  3027.  
  3028. /*:VRX         Spawn_LocalDir
  3029. */
  3030. Spawn_LocalDir:
  3031.     LocalDirTID = VRMethod("Application", "StartThread", "LocalDir")
  3032.     if LocalDirTID = 0 then
  3033.         call BasicErrMsg "Couldn't start Local Directory List thread."
  3034. return
  3035.  
  3036. /*:VRX         Spawn_ViewTextFile
  3037. */
  3038. Spawn_ViewTextFile: procedure
  3039.     LocalFile      = arg(1)   /* Name of file locally              */
  3040.     FiletoDownload = arg(2)   /* Name to stick in the Title Frame  */
  3041.     Locale         = arg(3)   /* Will contain "VIEWER" when called from MI_RLongList */
  3042.  
  3043.     TextFileTID = VRMethod("Application", "StartThread", "TextFile", LocalFile"||"FiletoDownload"||"Locale )
  3044.     if TextFileTID = 0 then
  3045.         call BasicErrMsg "Couldn't start View Text File thread."
  3046.  
  3047. return
  3048.  
  3049. /*:VRX         SPIN_CacheSize_Change
  3050. */
  3051. SPIN_CacheSize_Change: 
  3052.     value = VRGet( "SPIN_CacheSize", "Value" )
  3053.     rc = VRSetIni( "VxFTP", "CacheSize", value, IniFile, "NoClose" )
  3054. return
  3055.  
  3056. /*:VRX         SPIN_RefreshInterval_Change
  3057. */
  3058. SPIN_RefreshInterval_Change: 
  3059.     value = VRGet( "SPIN_RefreshInterval", "Value" )
  3060.     rc = VRSetIni( "VxFTP", "RefreshInterval", value, IniFile, "NoClose" )
  3061. return
  3062.  
  3063. /*:VRX         SPIN_RelogonSecs_Change
  3064. */
  3065. SPIN_RelogonSecs_Change: 
  3066.     ReLoginDelay = VRGet( "SPIN_RelogonSecs", "Value" )
  3067.     rc = VRSetIni( "VxFTP", "ReLoginDelay", ReLoginDelay, IniFile, "NoClose" )
  3068.  
  3069.     ReLoginDelay = ReLoginDelay * 1000
  3070.     rc = VRSet( "TM_Relogin", "Delay", ReLoginDelay )
  3071.  
  3072. return
  3073.  
  3074. /*:VRX         TM_Relogin_Trigger
  3075. */
  3076. TM_Relogin_Trigger: 
  3077.     /* Re-attempt to log into host
  3078.      */
  3079.     rc = VRMethod( "Application", "PostQueue", RemoteTID, 0, "call LogonToHost" ,,
  3080.                    "Host", Host, "Login", Login, "Passwd", Passwd,,
  3081.                    "rCWD", rCWD, "Anon", Anon, "SysType", SysType )
  3082.  
  3083.     rc = VRSet( "MainWindow", "StatusText", "Re-attempting to logon to" Host )
  3084.     
  3085. return
  3086.  
  3087. /*:VRX         Unzip_Close
  3088. */
  3089. Unzip_Close:
  3090.     window = VRInfo( "Object" )
  3091.     call VRDestroy window
  3092.     drop window
  3093. return
  3094. /*:VRX         Unzip_Create
  3095. */
  3096. Unzip_Create:
  3097.  
  3098.     if ( VRGetIni( "VxFTP", "UnzipPgm", IniFile, "NoClose" ) = 'PKUnzip' ) then do
  3099.         rc = VRSet( "RB_InfoZip", "Set", 0 )
  3100.         rc = VRSet( "RB_PKUnzip", "Set", 1 )
  3101.       end
  3102.     else do
  3103.         rc = VRSet( "RB_InfoZip", "Set", 1 )
  3104.         rc = VRSet( "RB_PKUnzip", "Set", 0 )
  3105.     end
  3106.  
  3107.     if ( VRGetIni( "VxFTP", "SubDir", IniFile, "NoClose" ) = 'Extract' ) then do
  3108.         rc = VRSet( "RB_Extract", "Set", 1 )
  3109.         rc = VRSet( "RB_Prompt",  "Set", 0 )
  3110.       end
  3111.     else do
  3112.         rc = VRSet( "RB_Extract", "Set", 0 )
  3113.         rc = VRSet( "RB_Prompt",  "Set", 1 )
  3114.     end
  3115.  
  3116.     if ( VRGetIni( "VxFTP", "ZipConsole", IniFile, "NoClose" ) = '1' ) then
  3117.         rc = VRSet( "CB_ZipConsole", "Set", 1 )
  3118.     else
  3119.         rc = VRSet( "CB_ZipConsole", "Set", 0 )
  3120.  
  3121. return
  3122.  
  3123. /*:VRX         UpdateAliases
  3124. */
  3125. UpdateAliases:
  3126.     rc = VRSet( "NewAliasBtn", "Enabled", 0 )
  3127.     rc = VRSet( "EditAliasBtn", "Enabled", 0 )
  3128.     rc = VRSet( "DelAliasBtn", "Enabled", 0 )
  3129.     
  3130.     /* Extract the Aliases from the GAlias stem and update
  3131.      * the Aliases in the IniFile.
  3132.      * Also, extract out the Aliases' names into AliasName.i
  3133.      * and redisplay the names in the list box
  3134.      */
  3135.     NewAliases = ""
  3136.     do i = 1 to GAliases.0
  3137.         NewAliases = NewAliases || GAliases.i || "}{"
  3138.         parse value GAliases.i with AliasName.i "|" rest
  3139.     end
  3140.     AliasName.0 = i - 1
  3141.  
  3142.     rc = VRSetIni( "VxFTP", "Aliases", NewAliases, IniFile, "NoClose" )
  3143.  
  3144.     rc = VRMethod( "LB_Aliases", "Reset" )    
  3145.     rc = VRMethod( "LB_Aliases", "AddStringList", "AliasName."  )
  3146.  
  3147.     if ( GAliases.0 = 1 ) then
  3148.         rc = VRSet( "DT_AliasNumber", "Caption", "1 Alias" )
  3149.     else
  3150.         rc = VRSet( "DT_AliasNumber", "Caption", GAliases.0 "Aliases" )
  3151.  
  3152.     rc = VRSet( "NewAliasBtn",  "Enabled", 1 )
  3153.     rc = VRSet( "EditAliasBtn", "Enabled", 1 )
  3154.     rc = VRSet( "DelAliasBtn",  "Enabled", 1 )
  3155.  
  3156.     drop NewAliases AliasName. rest
  3157. return
  3158.  
  3159. /*:VRX         XferComplete
  3160. */
  3161. XferComplete:
  3162.     parse arg ShowStatus
  3163.     if ( ShowStatus = "Show" ) then
  3164.         rc = VRSet( "MainWindow", "StatusText", "File Transfer(s) Complete" )
  3165.  
  3166.     rc = VRSet( "MI_Kill",             "Enabled", 1 )
  3167.     rc = VRSet( "MI_ASCII",            "Enabled", 1 )
  3168.     rc = VRSet( "MI_Binary",           "Enabled", 1 )
  3169.     rc = VRSet( "MI_Close",            "Enabled", 1 )
  3170.     rc = VRSet( "MI_LChDir",           "Enabled", 1 )
  3171.     rc = VRSet( "MI_LMkDir",           "Enabled", 1 )
  3172.     rc = VRSet( "MI_LRmDir",           "Enabled", 1 )
  3173.     rc = VRSet( "MI_RChDir",           "Enabled", 1 )
  3174.     rc = VRSet( "MI_RMkDir",           "Enabled", 1 )
  3175.     rc = VRSet( "MI_RRmDir",           "Enabled", 1 )
  3176.     rc = VRSet( "MI_RRefreshLists",    "Enabled", 1 )
  3177.     rc = VRSet( "MI_LPut",             "Enabled", 1 )
  3178.     rc = VRSet( "MI_RGet",             "Enabled", 1 )
  3179.     rc = VRSet( "MI_RView",            "Enabled", 1 )
  3180.     rc = VRSet( "MI_RDel",             "Enabled", 1 )
  3181.     rc = VRSet( "MI_RRen",             "Enabled", 1 )
  3182.     rc = VRSet( "MI_ViewCachedDirs",   "Enabled", 1 )
  3183.     rc = VRSet( "MI_RQuote",           "Enabled", 1 )
  3184.     rc = VRSet( "MI_RSite",            "Enabled", 1 )
  3185.     rc = VRSet( "MI_PopupPut",         "Enabled", 1 )
  3186.     rc = VRSet( "Get_Button",          "Enabled", 1 )
  3187.     rc = VRSet( "Put_Button",          "Enabled", 1 )
  3188.  
  3189.     call EnableLocalLists            /* Re-enable lists    */
  3190.     call EnableRemoteLists
  3191.  
  3192.     /* If VxFTP is minimized, get the Handle of the window that
  3193.      * currently has the focus ("GetFocusWindow"), put up a dialog
  3194.      * box to indicate "File Transfer(s) complete", then give
  3195.      * focus back to the window that had it ("SetFocus").
  3196.      */
  3197.     windowstate = VRGet( "MainWindow", "WindowState" )
  3198.     if ( windowstate = "Minimized" ) then do
  3199.         WHandle = VRMethod( "Screen", "GetFocusWindow" )
  3200.         OK = 1
  3201.         Buttons.OK = "OK"
  3202.         Buttons.0 = 1
  3203.         id = VRMessage( VRWindow(), "File Transfer(s) complete", "VxFTP", ,
  3204.                         "Info", "Buttons.", OK )
  3205.         rc = VRMethod( WHandle, "SetFocus" )
  3206.     end /* if */
  3207.  
  3208.     if ( VRGetIni( "VxFTP", "Hints", IniFile, "NoClose" ) = "1" ) then
  3209.         rc = VRSet( "MainWindow", "ShowHints", 1 )
  3210.     else
  3211.         rc = VRSet( "MainWindow", "StatusText", "" )
  3212.  
  3213. return
  3214.  
  3215. /*:VRX         XferInProgress
  3216. */
  3217. XferInProgress:
  3218.     /* Disable most of the user interface            */
  3219.     call VRSet "DDCB_Local_CWD", "Enabled", 0
  3220.     call VRSet "Local_Dir_Combo", "Enabled", 0
  3221.  
  3222.     call DisableRemoteLists
  3223.     rc = VRSet( "MainWindow", "ShowHints", 0 ) 
  3224.     
  3225.     rc = VRSet( "MI_New",              "Enabled", 0 )   
  3226.     rc = VRSet( "MI_Kill",             "Enabled", 1 )
  3227.     rc = VRSet( "MI_ASCII",            "Enabled", 0 )
  3228.     rc = VRSet( "MI_Binary",           "Enabled", 0 )
  3229.     rc = VRSet( "MI_Close",            "Enabled", 0 )
  3230.     rc = VRSet( "MI_LChDir",           "Enabled", 0 )
  3231.     rc = VRSet( "MI_LMkDir",           "Enabled", 0 )
  3232.     rc = VRSet( "MI_LRmDir",           "Enabled", 0 )
  3233.     rc = VRSet( "MI_RChDir",           "Enabled", 0 )
  3234.     rc = VRSet( "MI_RMkDir",           "Enabled", 0 )
  3235.     rc = VRSet( "MI_RRmDir",           "Enabled", 0 )
  3236.     rc = VRSet( "MI_RRefreshLists",    "Enabled", 0 )
  3237.     rc = VRSet( "MI_LPut",             "Enabled", 0 )
  3238.     rc = VRSet( "MI_RGet",             "Enabled", 0 )
  3239.     rc = VRSet( "MI_RView",            "Enabled", 0 )
  3240.     rc = VRSet( "MI_RDel",             "Enabled", 0 )
  3241.     rc = VRSet( "MI_RRen",             "Enabled", 0 )
  3242.     rc = VRSet( "MI_ViewCachedDirs",   "Enabled", 0 )
  3243.     rc = VRSet( "MI_RQuote",           "Enabled", 0 )
  3244.     rc = VRSet( "MI_RSite",            "Enabled", 0 )
  3245.     rc = VRSet( "MI_PopupPut",         "Enabled", 0 )
  3246.     rc = VRSet( "Get_Button",          "Enabled", 0 )
  3247.     rc = VRSet( "Put_Button",          "Enabled", 0 )
  3248.  
  3249.     rc = VRSet( "MainWindow", "StatusText", "File Transfer(s) in progress" ) 
  3250. return
  3251.  
  3252.  
  3253.