home *** CD-ROM | disk | FTP | other *** search
/ Jason Aller Floppy Collection / 189.img / TCS120S.ZIP / NEWNET.PAS < prev    next >
Pascal/Delphi Source File  |  1987-06-23  |  7KB  |  252 lines

  1. Overlay Procedure Net_Send_Overlay;
  2. var Finished,z:boolean;
  3.     Outs:array [1..30] of boolean;
  4.  
  5.   procedure Send(xx:anystr);
  6.   var cnt:integer;
  7.   begin
  8.     for cnt:=1 to length(xx) do begin
  9.       sendchar (xx[cnt]);
  10.       write (usr,xx[cnt]);
  11.     end;
  12.   end;
  13.  
  14.   Function There_Is_Any_Mail:boolean;
  15.   var out:anystr;
  16.       ct:integer;
  17.       a:boolean;
  18.   begin
  19.     gotoxy(11,9);
  20.     There_Is_Any_Mail:=false;
  21.     for ct:=1 to 30 do Outs[Ct]:=false;
  22.     ct:=0;
  23.     a:=false;
  24.     while (Ct<=30) do begin
  25.       cT:=ct+1;
  26.       out:=uploaddir+strr(ct)+'.Out';
  27.       if exist(out) then begin
  28.         There_Is_Any_Mail:=true;
  29.         a:=true;
  30.         Outs[ct]:=true;
  31.         write (usr,strr(ct)+' ');
  32.       end;
  33.     end;
  34.   end;
  35.  
  36.   Procedure Send_The_Mail;
  37.   var going:anystr;
  38.       ct:integer;
  39.       Dest:Anystr;
  40.       joe:text;
  41.  
  42.     Procedure ReadRec(Num:Integer);
  43.     var t:text;
  44.     begin
  45.       assign (t,uploaddir+strr(num)+'.out');
  46.       reset (t);
  47.       readln(t,Dest);
  48.       close(t);
  49.       gotoxy(14,13);
  50.       write(usr,Dest,'      ');
  51.     end;
  52.  
  53.     Function Call (var number:anystr):boolean;
  54.     var jo:integer;
  55.         ss,rest:anystr;
  56.         loc,cmp:mstr;
  57.         abt:Char;
  58.     begin
  59.       Setparam(1,1200,False);
  60.       gotoxy(9,14);
  61.       loc:=copy(Returning,1,3);
  62.       cmp:=copy(Dest,1,3);
  63.       rest:=copy(Dest,4,255);
  64.       if loc=cmp then writeln(usr,'Dialing Local: ',rest,'                    ')
  65.         else Writeln (usr,'Dialing: ',number,'                 ');
  66.       online:=false;
  67.       ss:=number;
  68.       if ss='' then exit;
  69.       if keypressed then begin
  70.         read (kbd,Abt);
  71.         gotoxy(9,14);
  72.         write(usr,'Aborted..                         ');
  73.       end;
  74.       doanswer;
  75.       delay (200);
  76.       gotoxy(1,22);
  77.       send(^M);
  78.       delay(50);
  79.       send(^M);
  80.       send ('      '^M);
  81.       delay(500);
  82.       if loc=cmp then send('ATDT'+rest+#13) else send ('ATDT'+extender+ss+#13);
  83.       jo:=25000;
  84.       Finished:=False;
  85.       repeat
  86.         jo:=jo-1;
  87.         if keypressed then Finished:=true;
  88.         gotoxy(70,13);
  89.         if (jo div 1000)<10 then write('0');
  90.         write(jo div 1000);
  91.         if carrier then Finished:=true;
  92.       until Finished or (jo<1);
  93.       gotoxy(1,22);
  94.       send (^M);
  95.       call:=carrier;
  96.     end;
  97.  
  98.     Procedure Once_Got_Carrier;
  99.     begin
  100.       gotoxy(9,14);
  101.       writeln (usr,'Carrier detected..                        ');
  102.       online:=true;
  103.       gotoxy (1,22);
  104.       delay (999);
  105.       send (^M^M^M'        ');
  106.       writeln(usr,^j);
  107.       delay (3000);
  108.       send (^H^H^H^H^H^H^H^H);
  109.       Delay (200);
  110.       send ('PNET-FILE'+#13);
  111.       writeln(usr,^j);
  112.       delay (500);
  113.       if carrier then send ('***************');
  114.     end;
  115.  
  116.     procedure Check_All_Mail(Start:Integer);  { Almost Artificial Intelligence!! Yeah!! }
  117.     var Position,Cnt:Integer;
  118.         Out:text;
  119.         Tmp:Anystr;
  120.  
  121.       Procedure Send_The_File (xx:lstr);
  122.       var comp:boolean;
  123.           sent:text;
  124.       begin
  125.         ymodem:=false;
  126.         Wxmodem:=false;
  127.         kermit:=false;
  128.         zmodem:=false;
  129.         delay (3000);
  130.         clearitall;
  131.         repeat until (numchars>0) or hungupon or keypressed;
  132.         if numchars>0 then begin
  133.           comp:=protocolxfer(true,true,uploaddir+xx);
  134.           assign (Sent,uploaddir+xx);
  135.           if comp then erase (Sent);
  136.           gotoxy(9,14);
  137.           IF comp then Writeln (USR,'EmuMail Transfer Successful..                  ')
  138.             else Writeln (USR,'EmuMail Transfer Failed..                            ');
  139.           delay(1000);
  140.           clearitall;
  141.         end;
  142.       end;
  143.  
  144.     begin
  145.       gotoxy(21,10);
  146.       For Cnt:=1 to 30 do begin
  147.         if Outs[Cnt] then begin
  148.           assign(Joe,uploaddir+strr(cnt)+'.out');
  149.           reset(joe);
  150.           readln(Joe,Tmp);
  151.           close(Joe);
  152.           if tmp=dest then write(usr,cnt:1,' ');
  153.         end;
  154.       end;
  155.       position:=24;
  156.       for Cnt:=1 to 30 do begin
  157.         if Outs[Cnt] then begin
  158.           assign(Joe,uploaddir+strr(cnt)+'.out');
  159.           reset(joe);
  160.           readln(Joe,Tmp);
  161.           close(Joe);
  162.           if Tmp=Dest then begin
  163.             gotoxy(position,11);
  164.             write(usr,cnt:1,' ');
  165.             Send_The_File (strr(cnt)+'.out');
  166.             position:=position+2;
  167.             if cnt>9 then position:=position+1;
  168.             Outs[Cnt]:=false;
  169.           end;
  170.         end;
  171.       end;
  172.     end;
  173.  
  174.   begin
  175.     ct:=0;
  176.     while (Ct<=30) do begin
  177.       cT:=ct+1;
  178.       if Outs[Ct] then begin
  179.         ReadRec(Ct);
  180.         if Call(Dest) then begin
  181.           Once_Got_Carrier;
  182.           gotoxy(18,10);
  183.           write(usr,'                              ');
  184.           gotoxy(24,11);
  185.           write(usr,'                              ');
  186.           Check_All_Mail(Ct);
  187.         end;
  188.         disconnect;
  189.         gotoxy(9,14);
  190.         writeln(usr,'Disconnecting..                          ');
  191.         online:=false;
  192.         gotoxy(1,22);
  193.         delay (500);
  194.         send (^M'  '^M);
  195.       end;
  196.     end;
  197.   end;
  198.  
  199. begin
  200.   modeminlock:=false;
  201.   modemoutlock:=false;
  202.   local:=false;
  203.   window (1,1,80,25);
  204.   clrscr;
  205.   gotoxy (1,9);
  206.   writeln(usr,'Outgoing:');
  207.   gotoxy (1,10);
  208.   writeln(usr,'Outgoing to Dest: ');
  209.   gotoxy (1,11);
  210.   writeln(usr,'Outgoing Already Sent: ');
  211.   gotoxy (1,13);
  212.   writeln(usr,'Destination: ');
  213.   gotoxy (63,13);
  214.   writeln(usr,'Time: [  ]');
  215.   gotoxy (1,14);
  216.   writeln(usr,'Status: ');
  217.   gotoxy (30,17);
  218.   writeln (USR,'EmuMail 1.02 (tm).');
  219.   gotoxy (1,18);
  220.   writeln (usr,'_______________________________________________________________________________');
  221.   gotoxy (5,20);
  222.   writeln(usr,'Modem Commands: ');
  223.   z:=There_Is_Any_Mail;
  224.   if Z then begin
  225.     gotoxy(1,22);
  226.     send ('     '^M);
  227.     delay (500);
  228.     send (^M'AT S0=0'^M);
  229.     gotoxy(9,14);
  230.     writeln(usr,'Turning Off Auto-Answer..                        ');
  231.     delay(1000);
  232.     Send_The_Mail;
  233.     if carrier then disconnect;
  234.     gotoxy(9,14);
  235.     Writeln (usr,'NetMail send complete.. Returning to BBS..        ');
  236.     gotoxy(1,22);
  237.     send (^M^M^M'   ');
  238.     delay (200);
  239.     send (^M'AT S0=1'^M);
  240.     gotoxy(9,14);
  241.     writeln(usr,'Turning On Auto-Answer..                          ');
  242.     delay(1000);
  243.     Async_Close;
  244.     Halt(0);
  245.   end else begin
  246.     gotoxy(9,14);
  247.     writeln(usr,'No NetMail.. Returning to BBS..');
  248.     Async_Close;
  249.     Halt(0);
  250.   end;
  251. end;
  252.