home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC/CD Gamer UK 28
/
PCGAMER28.bin
/
wincim
/
scripts.lib
/
CSERVE.SCR
< prev
next >
Wrap
Text File
|
1995-09-13
|
6KB
|
302 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.6"
!-V
DirectConnect = Arg1;
show "Connecting to CompuServe Network";
Tries = 7;
on cancel goto Return_Cancel;
FirstTry = %TRUE;
FailStr = "";
ETX = "^C";
CompuServeHost = "CPS^M";
ifndef %X121Address = "";
ifndef %OKCmd = "";
ifndef %StopAtHost = "";
ifndef %AccountID = "";
ifndef %BreakChar = "#";
ifndef %MicroChallenge = "";
Wait_Time = 80;
Internet = 25;
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,
%mdm_Failure goto CIS_No_Carrier
until Wait_Time;
if %Network <> Internet goto Send_Break;
Wait_Time = 200;
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_ETX:
send ETX;
goto Connect_Wait;
Send_Host_Name:
if Arg2 goto No_Wait;
wait until 10;
No_Wait:
if %StopAtHost = "" goto Send_No_Stop;
if %StopAtHost = "1" goto Return_Success;
send CompuServeHost;
goto Return_Success;
Send_No_Stop:
send CompuServeHost;
goto Connect_Wait;
Send_ID:
define %ErrorCode = 0;
show "Logging onto CompuServe";
if %MicroChallenge = "" goto No_Secure_Login;
send %UserID & %LogonParams & "/INT:60 /secure:1" & %CR;
goto Connect_Wait;
No_Secure_Login:
send %UserID & %LogonParams & "/INT:60" & %CR;
goto Connect_Wait;
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,
"% IPN" goto Process_IPX_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,
%mdm_Failure goto CIS_No_Carrier
until 200;
define %ErrorCode = 22;
goto CIS_Failure;
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,
"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 ETX;
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 = %Success goto Logon_Wait;
! Failure condition.
FailStr = %SecFailTemp;
if Tries = 0 goto Secure_Connect_Failed;
show %SecFailTemp & ", retrying...";
goto Start_Connect;
Secure_Connect_Failed:
goto CIS_Failure;