home *** CD-ROM | disk | FTP | other *** search
/ 3,500 Cliparts Vectoriels 2 / 3500_V2.iso / compu / csi302f / scripts.lib / cserve.scr < prev    next >
Text File  |  1997-01-30  |  9KB  |  385 lines

  1. !
  2. !  Copyright (c) 1996
  3. !  by CompuServe Incorporated, Columbus, Ohio
  4. !
  5. !  The information in this software is subject to change without
  6. !  notice and should not be construed as a commitment by CompuServe.
  7. !
  8. !  CSERVE:
  9. !   Connect to CIS.
  10. !   First argument is %TRUE if direct connect and %FALSE otherwise
  11. !   Success:  returns %Success
  12. !   Failure:  saves error msg in %FailureMsg and returns %Failure
  13. !       or %Fatal (depending on severity).
  14. !
  15. !+V
  16. ! "3.8.3F"
  17. !-V
  18.  
  19. DirectConnect = Arg1;
  20. Internet = 25;
  21. ifndef %HostName = "CPS";
  22. Plus = "+";
  23. ifndef %WaitForPPP = "1";
  24. Wait_Time = 100;
  25. ifndef %Scanned = "";
  26. Msg = "Connexion au rΘseau CompuServe en cours";
  27. if %Network <> Internet goto NotInternet;
  28. Msg = "Ouverture de la session CompuServe .    ";
  29. define %HostName = "CISAGREE";
  30. Wait_Time = 40;
  31.  
  32. NotInternet:
  33. show Msg;
  34. Tries = 7;
  35. NothingSent = 0;
  36. SecureTries = 3;
  37. FirstTry = %TRUE;
  38. FailStr = "";
  39. Sent_Host_Name = %FALSE;
  40. ifndef %X121Address = "";
  41. ifndef %OKCmd = "";
  42. ifndef %StopAtHost = "";
  43. ifndef %AccountID = "";
  44. ifndef %BreakChar = "#";
  45. ifndef %MicroChallenge = "";
  46. ifndef %App = "";
  47. on cancel goto Return_Cancel;
  48.  
  49. Start_Connect:
  50.     if Tries = 0 goto CIS_Error;
  51.     Tries = Tries - 1;
  52.  
  53. Connect_Wait:
  54.     wait
  55.         "UIC:"      goto Send_ETX,
  56.         "Host Name:"    goto Send_Host_Name,
  57.         "User ID:"  goto Send_ID,
  58.         "Password:" goto Send_Password,
  59.         "XPAD:"     goto Send_XPAD,
  60.         "ITI:"      goto Send_XPAD,
  61.         "? LOG"     goto Process_Log_Msg,
  62.         "??LOG"     goto Process_Log_Msg,
  63.         "% IPN"     goto Process_IPX_Msg,
  64.         "? IPX"     goto Process_IPX_Msg,
  65.         "? ICD"     goto Process_Net_Msg,
  66.         "??ICD"     goto Process_Net_Msg,
  67.         "RA:"       goto Handle_Secure_Login,
  68.         "0, OFF):"  goto Send_Baud_Rate,
  69.         %mdm_Failure    goto CIS_No_Carrier
  70.     until Wait_Time;
  71.  
  72.     if %Network <> Internet goto Send_Break;
  73.     Wait_Time = 200;
  74.     if not Sent_Host_Name goto Send_CR;
  75.     if NothingSent goto Send_CR;
  76.     NothingSent = 1;
  77.     goto Start_Connect;
  78.  
  79. Send_Break:
  80.     if not DirectConnect goto Send_CR;
  81.     sendm %BreakChar;
  82.     sendm %BreakChar;
  83.     sendm %BreakChar;
  84.  
  85. Send_CR:
  86.     NothingSent = 0;
  87.     send %CR;
  88.     goto Start_Connect;
  89.  
  90. Send_Baud_Rate:
  91.     send %BaudRate;
  92.     send "^M";
  93.     goto Connect_Wait;
  94.  
  95. Send_ETX:
  96.     send "^C";
  97.     goto Connect_Wait;
  98.  
  99. PPPRecover:
  100.     Sent_Host_Name = %FALSE;
  101.  
  102. Send_Host_Name:
  103.     define %State = 5;
  104.     if Arg2 goto No_Wait;
  105.     wait until 10;
  106. No_Wait:
  107.     if Sent_Host_Name goto Reset_Host_Name;
  108.     Sent_Host_Name = %TRUE;
  109.  
  110.     Wait_Time = 200;
  111.     if %StopAtHost = "1" goto Return_Success;
  112.     send %HostName & "^M";
  113.     if %StopAtHost = "" goto Connect_Wait;
  114.     goto Return_Success;
  115.  
  116. !
  117. ! Only send Host Name response on 1st, 3rd, & 5th attempts
  118. ! to guard against unintended double host name prompts resulting
  119. ! from sending "^M".  On even attempts, eat the Host Name: prompt.
  120. !
  121. Reset_Host_Name:
  122.     Sent_Host_Name = %FALSE;
  123.     Tries = Tries - 1;
  124.     goto Connect_Wait;
  125.  
  126. Send_ID:
  127.     define %State = 6;
  128.     if %StopAtHost = "1" goto GetHost;
  129.     define %ErrorCode = 0;
  130.     if %App = "CID" goto No_Msg1;
  131.     show "Ouverture de la session CompuServe . .  ";
  132. No_Msg1:
  133.     if %MicroChallenge = "" goto No_Secure_Login;
  134.  
  135.     send Plus & %UserID & %LogonParams & "/INT:60 /secure:1^M";
  136.     Plus = "";
  137.     goto Connect_Wait;
  138.  
  139. No_Secure_Login:
  140.     send %UserID & %LogonParams & "/INT:60^M";
  141.     goto Connect_Wait;
  142.  
  143. GetHost:
  144.     send "/HOST^M";
  145.     exit %Success;
  146.  
  147. Send_Password:
  148.     define %State = 7;
  149.     if %MicroChallenge <> "" goto Secure_Failure;
  150.     send %Password & %CR;
  151.     goto Logon_Wait;
  152.  
  153. Secure_Failure:
  154.     define %FailureMsg = "Echec de l'accΦs sΘcurisΘ, abandon de la connexion non sΘcurisΘe";
  155.     define %ErrorCode = 37;
  156.     exit %Fatal;
  157.     
  158. Send_XPAD:
  159.     if %X121Address = "" goto Missing_XPAD;
  160.     send %X121Address & %CR;
  161.     goto Connect_Wait;
  162.  
  163. Missing_XPAD:
  164.     define %FailureMsg = "Adresse X.121 manquante";
  165.     define %ErrorCode = 21;
  166.     exit %Fatal;
  167.     
  168. Logon_Wait:
  169.     wait
  170.         "Account ID:"   goto Send_AccountID,
  171.         "CompuServe"    goto Return_Success,
  172.         "^[[>"      goto Return_Success,
  173.         "^F"        goto Return_Success,
  174.         "? LOG"     goto Process_Log_Msg,
  175.         "??LOG"     goto Process_Log_Msg,
  176.         "? IPX"     goto Process_IPX_Msg,
  177.         " NTW"      goto Logon_Failure,
  178.         "? ICD"     goto Process_Net_Msg,
  179.         "??ICD"     goto Process_Net_Msg,
  180.         "800 Direct Dial access " goto Process_800,
  181.         "OK^M"      goto Send_OK_Cmd,
  182.         "^[I"       goto Send_Response,
  183.         "PPP:"      goto Connect_PPP,
  184.         %mdm_Failure    goto CIS_No_Carrier
  185.     until 300;
  186.  
  187.     define %ErrorCode = 22;
  188.     goto CIS_Failure;
  189.  
  190. Connect_PPP:
  191.     if %App <> "CID" goto Logon_Wait;
  192.     if %WaitForPPP = "0" goto PPPDone;
  193.     PPPTries = 2;
  194.  
  195. RetryPPP:
  196.     if PPPTries = 0 goto Send_ETX;
  197.  
  198.     wait
  199.         "Host Name:"    goto PPPRecover,
  200.         "~"     goto PPPDone,
  201.         %mdm_Failure    goto CIS_No_Carrier
  202.     until 300;
  203.  
  204.     send "^C";
  205.     PPPTries = PPPTries - 1;
  206.     goto RetryPPP;
  207.  
  208. PPPDone:
  209.     define %PPP = "1";
  210.     exit %Success;
  211.         
  212.  
  213. Process_Log_Msg:
  214.     wait
  215.         "INE"   goto Bad_ID,
  216.         "ISX"   goto Bad_ID_Syntax,
  217.         "CAI"   goto Cannot_Auto_Irun,
  218.         "SIL"   goto System_Unavailable,
  219.         "SIU"   goto System_Unavailable,
  220.         "SNA"   goto System_Unavailable,
  221.         "STU"   goto Check_User_ID,
  222.         "INS"   goto Bad_ID_Syntax,
  223.         "UTL"   goto Too_Many_Users
  224.     until 50;
  225.  
  226.     FailStr = "Connexion α l'h⌠te CompuServe impossible";
  227.     goto Scan_Error;
  228.  
  229. Process_IPX_Msg:
  230.     define %ErrorCode = 23;
  231.     FailStr = "InfoPlex n'est pas disponible, essayez plus tard";
  232.     goto Scan_Error;
  233.  
  234. Process_Net_Msg:
  235.     define %GatewayFailure = 1;
  236.     define %ErrorCode = 31;
  237.     FailStr = "Echec de la connexion PPP. Faites une nouvelle tentative";
  238.  
  239. Scan_Error:
  240.     wait
  241.         "^M"    goto Found_Error
  242.     until 15;
  243.  
  244.     goto Return_Fatal_Msg;
  245.  
  246. Found_Error:
  247.     if %Scanned = "" goto Return_Fatal_Msg;
  248.     FailStr = %Scanned;
  249.     goto Return_Fatal_Msg;
  250.  
  251. Send_AccountID:
  252.     send %AccountID & %CR;
  253.     goto Logon_Wait;
  254.  
  255. Too_Many_Users:
  256.     if Tries = 0 goto Users_Failure;
  257.     show "Nombre maximal d'accΦs simultanΘs dΘpassΘ, nouvel essai en cours...";
  258.     goto Start_Connect;
  259.  
  260. Users_Failure:
  261.     define %FailureMsg = "Trop d'utilisateurs en mΩme temps";
  262.     define %ErrorCode = 29;
  263.     exit %Fatal;
  264.  
  265. Cannot_Auto_Irun:
  266.     define %FailureMsg = "Impossible de lancer le serveur 'Auto Irun HMI'";
  267.     exit %Fatal;
  268.  
  269. Bad_ID:
  270.     define %ErrorCode = 24;
  271.     FailStr = "User ID ou mot de passe non valide";
  272.     goto Try_Again;
  273.  
  274. Bad_ID_Syntax:
  275.     define %ErrorCode = 25;
  276.     FailStr = "Syntaxe User ID non valide";
  277. Try_Again:
  278.     if not FirstTry goto CIS_Fatal;
  279.     send "^C";
  280.     FirstTry = %FALSE;
  281.  
  282.     wait
  283.         "User ID"   goto Send_ID,
  284.         %mdm_Failure    goto CIS_No_Carrier
  285.     until 140;
  286.  
  287.     goto CIS_Fatal;
  288.  
  289. System_Unavailable:
  290.     define %ErrorCode = 23;
  291.     FailStr = "Le systΦme n'est pas disponible, essayez plus tard";
  292.     goto Scan_Error;
  293.  
  294. Check_User_ID:
  295.     define %ErrorCode = 26;
  296.     define %FailureMsg = "Le systΦme n'est pas disponible, vΘrifiez le User ID";
  297.     exit %Fatal;
  298.  
  299. Process_800:
  300.     wait
  301.         "is not" goto No_800,
  302.         "rates" goto Access_Rates
  303.     until 25;
  304.     goto Logon_Wait;
  305.  
  306.  
  307. No_800:
  308.     define %FailureMsg = "Le numΘro gratuit 800 n'est pas disponible pour votre compte";
  309.     define %ErrorCode = 4;
  310.     exit %Fatal;
  311.  
  312. Access_Rates:
  313.     show "Le numΘro gratuit 800 est en vigueur";
  314.     goto Logon_Wait;
  315.  
  316. Logon_Failure:
  317.     define %ErrorCode = 27;
  318.     FailStr = "Le correspondant est occupΘ ou non disponible";
  319.     goto Scan_Error;
  320.  
  321. Send_OK_Cmd:
  322.     if %OKCmd = "" goto Logon_Wait;
  323.     send %OKCmd & %CR;
  324.     goto Logon_Wait;
  325.  
  326. Send_Response:
  327.     define %State = 8;
  328.     sendi %ESCIResponse;
  329.     exit %Success;
  330.  
  331. CIS_Error:
  332.     define %ErrorCode = 20;
  333.  
  334. CIS_Failure:
  335.     if %Network <> Internet goto No_Retry;
  336.     define %GatewayFailure = 1;
  337. No_Retry:
  338.     if FailStr <> "" goto Return_Fail_Msg;
  339.     define %FailureMsg = "Connexion α l'h⌠te CompuServe impossible";
  340.     exit %Failure;
  341.  
  342. CIS_No_Carrier:
  343.     define %ErrorCode = 28;
  344.     if FailStr <> "" goto Return_Fail_Msg;
  345.     define %FailureMsg = "Perte de connexion du modem";
  346.     exit %Failure;
  347.  
  348. CIS_Fatal:
  349.     if FailStr <> "" goto Return_Fatal_Msg;
  350.     define %FailureMsg = "Connexion α l'h⌠te CompuServe impossible";
  351.     exit %Fatal;
  352.  
  353. Return_Fail_Msg:
  354.     define %FailureMsg = FailStr;
  355.     exit %Failure;
  356.  
  357. Return_Fatal_Msg:
  358.     define %FailureMsg = FailStr;
  359.     exit %Fatal;
  360.  
  361. Return_Success:
  362.     define %State = 8;
  363.     exit %Success;
  364.  
  365. Return_Cancel:
  366.     exit %Cancel;
  367.  
  368.  
  369. Handle_Secure_Login:
  370.     if %MicroChallenge = "" goto Connect_Wait;
  371.  
  372.     call %Dir & "seclog.scr" () : FailCode;
  373.  
  374.     if FailCode = 0 goto Logon_Wait;
  375.     if FailCode = 1 goto Return_Cancel;
  376.     if FailCode = 3 goto CIS_No_Carrier;
  377.  
  378.     ! Failure condition.
  379.     FailStr = %SecFailTemp;
  380.     SecureTries = SecureTries - 1;
  381.     if SecureTries = 0 goto CIS_Failure;
  382.  
  383.     show %SecFailTemp & ", nouvel essai en cours...";
  384.     goto Start_Connect;
  385.