home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fonts Pro 2002
/
kf_2002.bin
/
compsrv
/
scripts.lib
/
CSERVE.SCR
< prev
next >
Wrap
Text File
|
1995-12-05
|
8KB
|
344 lines
!
! Copyright (c) 1995
! by CompuServe Incorporated, Columbus, Ohio
!
! The information in this software is subject to change without
! notice and should not be construed as a commitment by CompuServe.
!
! CSERVE:
! Connect to CIS.
! First argument is %TRUE if direct connect and %FALSE otherwise
! Success: returns %Success
! Failure: saves error msg in %FailureMsg and returns %Failure
! or %Fatal (depending on severity).
!
!+V
! "3.8.1"
!-V
DirectConnect = Arg1;
Internet = 25;
ifndef %HostName = "CPS";
Plus = "+";
Wait_Time = 80;
ifndef %Scanned = "";
Msg = "Connecting to CompuServe Network";
if %Network <> Internet goto NotInternet;
Msg = "Logging onto CompuServe . ";
define %HostName = "CISAGREE";
Wait_Time = 30;
NotInternet:
show Msg;
Tries = 7;
SecureTries = 3;
FirstTry = %TRUE;
FailStr = "";
Sent_Host_Name = %FALSE;
ifndef %X121Address = "";
ifndef %OKCmd = "";
ifndef %StopAtHost = "";
ifndef %AccountID = "";
ifndef %BreakChar = "#";
ifndef %MicroChallenge = "";
ifndef %App = "";
on cancel goto Return_Cancel;
Start_Connect:
if Tries = 0 goto CIS_Error;
Tries = Tries - 1;
Connect_Wait:
wait
"UIC:" goto Send_ETX,
"Host Name:" goto Send_Host_Name,
"User ID:" goto Send_ID,
"Password:" goto Send_Password,
"XPAD:" goto Send_XPAD,
"ITI:" goto Send_XPAD,
"? LOG" goto Process_Log_Msg,
"??LOG" goto Process_Log_Msg,
"% IPN" goto Process_IPX_Msg,
"? IPX" goto Process_IPX_Msg,
"? ICD" goto Process_Net_Msg,
"??ICD" goto Process_Net_Msg,
"RA:" goto Handle_Secure_Login,
"0, OFF):" goto Send_Baud_Rate,
%mdm_Failure goto CIS_No_Carrier
until Wait_Time;
if %Network <> Internet goto Send_Break;
Wait_Time = 200;
if not Sent_Host_Name goto Send_CR;
goto Start_Connect;
Send_Break:
if not DirectConnect goto Send_CR;
sendm %BreakChar;
sendm %BreakChar;
sendm %BreakChar;
Send_CR:
send %CR;
goto Start_Connect;
Send_Baud_Rate:
send %BaudRate;
send "^M";
goto Connect_Wait;
Send_ETX:
send "^C";
goto Connect_Wait;
Send_Host_Name:
if Arg2 goto No_Wait;
wait until 10;
No_Wait:
if Sent_Host_Name goto Reset_Host_Name;
Sent_Host_Name = %TRUE;
Wait_Time = 200;
if %StopAtHost = "1" goto Return_Success;
send %HostName & "^M";
if %StopAtHost = "" goto Connect_Wait;
goto Return_Success;
!
! Only send Host Name response on 1st, 3rd, & 5th attempts
! to guard against unintended double host name prompts resulting
! from sending "^M". On even attempts, eat the Host Name: prompt.
!
Reset_Host_Name:
Sent_Host_Name = %FALSE;
Tries = Tries - 1;
goto Connect_Wait;
Send_ID:
if %StopAtHost = "1" goto GetHost;
define %ErrorCode = 0;
if %App = "CID" goto No_Msg1;
show "Logging onto CompuServe . . ";
No_Msg1:
if %MicroChallenge = "" goto No_Secure_Login;
send Plus & %UserID & %LogonParams & "/INT:60 /secure:1^M";
Plus = "";
goto Connect_Wait;
No_Secure_Login:
send %UserID & %LogonParams & "/INT:60^M";
goto Connect_Wait;
GetHost:
send "/HOST^M";
exit %Success;
Send_Password:
send %Password & %CR;
goto Logon_Wait;
Send_XPAD:
if %X121Address = "" goto Missing_XPAD;
send %X121Address & %CR;
goto Connect_Wait;
Missing_XPAD:
define %FailureMsg = "Missing X.121 address";
define %ErrorCode = 21;
exit %Fatal;
Logon_Wait:
wait
"Account ID:" goto Send_AccountID,
"CompuServe" goto Return_Success,
"^[[>" goto Return_Success,
"^F" goto Return_Success,
"? LOG" goto Process_Log_Msg,
"??LOG" goto Process_Log_Msg,
"? IPX" goto Process_IPX_Msg,
" NTW" goto Logon_Failure,
"? ICD" goto Process_Net_Msg,
"??ICD" goto Process_Net_Msg,
"800 Direct Dial access " goto Process_800,
"OK^M" goto Send_OK_Cmd,
"^[I" goto Send_Response,
"PPP:" goto Connect_PPP,
%mdm_Failure goto CIS_No_Carrier
until 200;
define %ErrorCode = 22;
goto CIS_Failure;
Connect_PPP:
if %App <> "CID" goto Logon_Wait;
define %PPP = "1";
exit %Success;
Process_Log_Msg:
wait
"INE" goto Bad_ID,
"ISX" goto Bad_ID_Syntax,
"CAI" goto Cannot_Auto_Irun,
"SIL" goto System_Unavailable,
"SIU" goto System_Unavailable,
"SNA" goto System_Unavailable,
"STU" goto Check_User_ID,
"INS" goto Bad_ID_Syntax,
"UTL" goto Too_Many_Users
until 50;
goto Try_Again;
Process_IPX_Msg:
define %ErrorCode = 23;
define %FailureMsg = "InfoPlex is unavailable, try again later";
exit %Fatal;
Process_Net_Msg:
define %ErrorCode = 31;
FailStr = "PPP connection failure, please try again";
wait
"^M" goto Found_Error
until 10;
goto Return_Fail_Msg;
Found_Error:
if %Scanned = "" goto Return_Fail_Msg;
FailStr = %Scanned;
goto Return_Fail_Msg;
Send_AccountID:
send %AccountID & %CR;
goto Logon_Wait;
Too_Many_Users:
if Tries = 0 goto Users_Failure;
show "Simultaneous users exceeded, retrying...";
goto Start_Connect;
Users_Failure:
define %FailureMsg = "Simultaneous users exceeded";
define %ErrorCode = 29;
exit %Fatal;
Cannot_Auto_Irun:
define %FailureMsg = "Cannot Auto Irun HMI server";
exit %Fatal;
Bad_ID:
define %ErrorCode = 24;
FailStr = "Incorrect User ID or password";
goto Try_Again;
Bad_ID_Syntax:
define %ErrorCode = 25;
FailStr = "Incorrect User ID syntax";
goto Try_Again;
System_Unavailable:
define %ErrorCode = 23;
define %FailureMsg = "The system is unavailable, try again later";
exit %Fatal;
Check_User_ID:
define %ErrorCode = 26;
define %FailureMsg = "The system is unavailable, check User ID";
exit %Fatal;
Process_800:
wait
"is not" goto No_800,
"rates" goto Access_Rates
until 20;
goto Logon_Wait;
No_800:
define %FailureMsg = "800 Direct Dial access is not available on your account";
define %ErrorCode = 4;
exit %Fatal;
Access_Rates:
show "800 Direct Dial access rates now in effect";
goto Logon_Wait;
Try_Again:
if not FirstTry goto CIS_Fatal;
send "^C";
FirstTry = %FALSE;
wait
"User ID" goto Send_ID,
%mdm_Failure goto CIS_No_Carrier
until 140;
goto CIS_Fatal;
Logon_Failure:
define %ErrorCode = 27;
define %FailureMsg = "Remote is busy or unavailable";
exit %Fatal;
Send_OK_Cmd:
if %OKCmd = "" goto Logon_Wait;
send %OKCmd & %CR;
goto Logon_Wait;
Send_Response:
sendi %ESCIResponse;
exit %Success;
CIS_Error:
define %ErrorCode = 20;
CIS_Failure:
if FailStr <> "" goto Return_Fail_Msg;
define %FailureMsg = "Unable to connect to CompuServe host";
exit %Failure;
CIS_No_Carrier:
define %ErrorCode = 28;
if FailStr <> "" goto Return_Fail_Msg;
define %FailureMsg = "Modem connection lost";
exit %Failure;
CIS_Fatal:
if FailStr <> "" goto Return_Fatal_Msg;
define %FailureMsg = "Unable to connect to CompuServe host";
exit %Fatal;
Return_Fail_Msg:
define %FailureMsg = FailStr;
exit %Failure;
Return_Fatal_Msg:
define %FailureMsg = FailStr;
exit %Fatal;
Return_Success:
exit %Success;
Return_Cancel:
exit %Cancel;
Handle_Secure_Login:
if %MicroChallenge = "" goto Connect_Wait;
call %Dir & "seclog.scr" () : FailCode;
if FailCode = 0 goto Logon_Wait;
if FailCode = 1 goto Return_Cancel;
if FailCode = 3 goto CIS_No_Carrier;
! Failure condition.
FailStr = %SecFailTemp;
SecureTries = SecureTries - 1;
if SecureTries = 0 goto CIS_Failure;
show %SecFailTemp & ", retrying...";
goto Start_Connect;