You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

3149 lines
95 KiB
Plaintext

4 years ago
{<7B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ
<20> <20>
<20> X - P a c k e t <20>
<20> <20>
<20> <20>
<20> X P I O . P A S <20>
<20> <20>
<20> Verschiedene Routinen zum Ansprechen des TNC <20>
<20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>}
{** MailPolling: MZAR! suchen!}
{**** F<>R Reconnect-Geschichte nach *RECONNECT suchen
F<>r Verschl<68>sseln: *VERSCH}
(* Eine HOSTMODE-Zeile an den TNC senden
Format: SendTNC(KanalNummer,Art(0=Text,1=Kommando),String) *)
(* TNN!!! suchen f<>r TNN-Connect-Erweiterung *)
Procedure SendTNC (* Var Kanal : Byt; ,Art : Byte; Zeile : String) *);
var Laenge : char;
Channel : char;
V24Nr : Byte;
ch : Char;
Begin
if Pseudo then
begin
Channel := chr(Kanal);
Kanal := 0;
end else Channel := K[Kanal]^.TNCKanal;
V24Nr := V24(Kanal);
ClearV24Buffer;
FillChar(K[Kanal]^.Response,SizeOf(K[Kanal]^.Response),0);
if TNC[K[Kanal]^.TncNummer]^.TNC_im_Host then
begin
Laenge := chr(length(Zeile)-1);
Switch_TNC(K[Kanal]^.TncNummer);
IRQsLock;
WriteAux(V24Nr,Channel + chr(Art) + Laenge);
WriteAux(V24Nr,Zeile);
end;
End;
Procedure TNCs_Pollen;
Begin
if not TNC_Halt then
begin
inc(Poll);
if Poll > TNC[PollTNr]^.Kbis then
begin
inc(PollTNr);
if not TNC_used[PollTNr] then PollTNr := 1;
Poll := TNC[PollTNr]^.Kvon;
K[0]^.TncNummer := PollTNr;
Kanal_Pollen(0);
end;
if Poll > 0 then with K[Poll]^ do
begin
if (C_Poll or Test or Ext_Poll or Kanal_benutz or not TNC_ReadOut) or
(not TNC[TncNummer]^.ExtHost and (Pause = PollRate)) then Kanal_Pollen(Poll);
inc(Pause);
if Pause > PollRate then Pause := 0;
end;
end;
End;
Procedure Kanal_Pollen (* Kanal : Byte *);
Var i,i1 : Byte;
VC : Char;
Puffer : Word;
SFrame : Byte;
Begin
with K[Kanal]^ do
Begin
if (Kanal = 0) and TNC[TncNummer]^.ExtHost then
begin
Pseudo := true;
Ausgabe := false;
TxRxTNC(FF,1,'G');
if Idle and (Response > '') then
begin
Idle_TCount := Idle_Tout;
Idle_TMerk := TimerTick;
end;
for i := 1 to Ord(Response[0]) do
begin
VC := Chr(Byte(Ord(Response[i])-1));
for i1 := TNC[TncNummer]^.Kvon to TNC[TncNummer]^.Kbis do
if K[i1]^.TNCKanal = VC then K[i1]^.Ext_Poll := true;
end;
end;
Ext_Poll := false;
Get_Linkstatus(Kanal);
if Kanal = 0 then
begin
Puffer := FreiePuffer(Kanal);
for i1 := TNC[TncNummer]^.Kvon to TNC[TncNummer]^.Kbis do
K[i1]^.BufToLow := Puffer < maxTncBuf;
if (not K[show]^.BufExists or Test) and
(((show = 0) and (Unproto = TncNummer)) or
((show > 0) and (TncNummer = K[show]^.TncNummer))) then
begin
{ if Not OnlHelp then} StatusOut(show,73,1,Attrib[9],SFillStr(6,B1,'('+int_str(Puffer)+')'),2);
end;
end;
if not TNC_ReadOut then
begin
While L_Status[1] + L_Status[2] > 0 do
begin
S_PAC(Kanal,CM,true,'G');
Get_Linkstatus(Kanal);
end;
end else
begin
TncNix := false;
Repeat
S_PAC(Kanal,CM,true,'G');
Until (not MonCode5 and _KeyPressed) or TncNix;
end;
if BufExists and (Kanal > 0) then
begin
if Test then SendTestBuffer(Kanal) else
begin
SFrame := L_Status[3];
While BufExists and not _KeyPressed and
((MaxFrame > SFrame) or
(TNC_Puffer and (FreiePuffer(Kanal) > minTncBuf))) do
begin
SendBuffer(Kanal);
inc(SFrame);
end;
end;
end;
if XBin.TX and not FileSendWait then
begin
SFrame := L_Status[3];
While (not FileSendWait) and (not _KeyPressed) and
(MaxFrame > SFrame) do
begin
xbinSend(Kanal,true);
inc(SFrame);
end;
end;
if (FileSend) and (not FileSendWait) and (not Xbin.an) then
Begin
if not BufExists and TNC_Puffer and (TX_Bin <> 2) then
Repeat
Puffer := FreiePuffer(Kanal);
if (Puffer > minTncBuf) then if FileSend then Send_File(Kanal,true);
Until (Puffer <= minTncBuf) or _KeyPressed or not FileSend
else begin
SFrame := L_Status[3];
While FileSend and not _KeyPressed and
(Upload or (MaxFrame > SFrame) or WishBuf) do
begin
Send_File(Kanal,true);
inc(SFrame);
end;
end;
end;
if not TNC_ReadOut and (Kanal = maxLink) then TNC_ReadOut := true;
end; (* WITH ... *)
End;
Procedure Get_Linkstatus (* Kanal : Byte *);
Var Pstr : String[14];
Attr,
i,i1 : Byte;
Begin
with K[Kanal]^ do
begin
if Kanal = 0 then i1 := 2 else i1 := 6;
Ausgabe := false;
S_PAC(Kanal,CM,true,'L');
for i := 1 to i1 do L_Status[i] := Byte(str_int(ParmStr(i,B1,Response)));
if Kanal > 0 then
begin
Pstr := SFillStr(4,B1,'S'+int_str(L_Status[3])) + { Send_Frames }
SFillStr(3,B1,'A'+int_str(L_Status[4])) + { Schon gesendet Frames }
SFillStr(4,B1,'T'+int_str(L_Status[5])); { Tries }
StatusOut(Kanal,59,1,Attrib[9],PStr,1);
if TxBeepAck and FlagTxBeep and (L_Status[3] = 0) and (L_Status[4] = 0) then
begin
if Klingel then Beep(G^.TxPiepFreq,G^.TxPiepTime);
FlagTxBeep := false;
end;
if TxBeepAck and ((L_Status[3] > 0) or (L_Status[4] > 0)) then FlagTxBeep := true;
{ if (L_STatus[3]>0) or (L_Status[4]>0) or (L_Status[5]>0) then TNC[TNCNummer]^.TXBedarf:=TRUE;}
Attr := Attrib[13];
if L_Status[6] in [1,7..15] then Attr := Attrib[7];
StatusOut(Kanal,61,1,Attr,LinkStatus[L_Status[6]],2);
C_Poll := L_Status[6] > 0;
end;
end;
End;
(* Tastatur solange abfragen, bis kein Zeichen mehr kommt *)
Procedure Check_Keyboard;
var SK : Sondertaste;
VC : char;
i : Byte;
Procedure Tasten;
begin
KeyCheck := true;
_ReadKey(SK,VC);
KeyCheck := false;
if not ScreenSTBY then
begin
polling := false;
PollTime := TimerTick + KeyDelay;
Key_Active(show,SK,VC);
end else
begin
Neu_Bild;
with K[show]^ do
begin
if ((RX_Bin>0) or (SplSave)) and (LstRXInfo<>'') then InfoOut(show,0,1,LstRXInfo);
if (FileSend) and (LstTXInfo<>'') then InfoOut(show,0,1,LstTXInfo);
end;
end;
if ScreenInit > 0 then ScreenTimer := ScreenInit;
end;
Begin
if not ch_aus then
begin
for i := 1 to maxLink do with K[i]^ do
begin
if CSelf = 10 then
begin
AutoZaehl := AutoToAnzJmp;
CSelf := 3;
end;
if CSelf in [3,9] then Autozeile_Holen(i);
end;
if G^.Makro then While G^.Makro do Tasten
else While _KeyPressed do Tasten;
end else
begin
ch_aus := false;
Key_Active(show,SK_out,VC_out);
end;
if not polling then if TimerTick > PollTime then polling := true;
End;
Procedure Rufz_TNC_init (* Kanal : Byte *);
Begin
if Kanal > 0 then with K[Kanal]^ do
begin
if Test or Mo.MonActive or (Kanal = ConvHilfsPort) then
S_PAC(Kanal,CM,true,'I' + B1 + PhantasieCall) else
if not (connected or Kanal_benutz) then
begin
S_PAC(Kanal,CM,true,'I' + B1 + OwnCall);
StatusOut(Kanal,4,1,Attrib[9],EFillStr(9,B1,OwnCall),1);
StatusOut(Kanal,14,1,Attrib[9],ConstStr(B1,29),1);
end;
end;
End;
Procedure MH_Check (* TNC_Nr : Byte; Zeile : Str128 *);
Var i,
AnzDig : Byte;
MailFlag,
FrUI,
FrRej,
DirDig : Boolean;
Rufz : String[9];
LongDig : String[70];
Procedure MH_Update(TNC_Nr : Byte);
var Stelle : Byte;
found : Boolean;
i : Byte;
Begin
if (G^.QRG_Anz > 0) and (AnzDig = 0) then
begin
i := 0;
Repeat
inc(i);
found := (Rufz = G^.QRG[i].Call);
Until found or (i = G^.QRG_Anz);
if found then
begin
with TNC[TNC_Nr]^ do if QRG_Akt <> G^.QRG[i].QRG then
begin
QRG_Akt := G^.QRG[i].QRG;
Status2;
TicStr := ConstStr(B1,TL);
end;
end;
end;
Stelle := 0;
Repeat
inc(Stelle);
found := (RufZ = MH^[Stelle].Call) and (TNC_Nr = MH^[Stelle].TNr);
Until found or (Stelle = maxMH);
if not found then
begin
{ for i := maxMH-1 downto 1 do MH^[i+1] := MH^[i]; }
move(MH^[1],MH^[2],(maxMH-1) * SizeOf(MH_Typ));
Stelle := 1;
FillChar(MH^[Stelle],SizeOf(MH_Typ),0);
end;
with MH^[Stelle] do
begin
Call := RufZ;
Zeit := copy(Datum,4,8) + B1 + copy(Uhrzeit,1,5);
Link := LongDig;
Qrg := TNC[TNC_Nr]^.QRG_Akt;
TNr := TNC_Nr;
if FrRej then inc(Rej);
if FrUI then inc(UIs);
end;
if (TicAnz > 0) and (LongDig = '') then with TNC[TNC_Nr]^ do if Tic then
begin
i := pos(Rufz + B1,TicStr + B1);
if i > 0 then
begin
While TicStr[i] <> B1 do delete(TicStr,i,1);
delete(TicStr,i,1);
end else
begin
i := length(Rufz) + 1;
delete(TicStr,Byte(TL+1-i),i);
end;
TicStr := Rufz + B1 + TicStr;
i := TL;
While (i > 0) and (TicStr[i] <> B1) do
begin
TicStr[i] := B1;
dec(i);
end;
if show = 0 then TickerOut;
end;
End;
Begin
LongDig := '';
AnzDig := 0;
DirDig := false;
Zeile := RestStr(Zeile);
Rufz := CutStr(Zeile);
FrRej := pos(' ctl REJ',Zeile) > 0;
FrUI := pos(' ctl UI',Zeile) > 0;
i := pos(' ctl ',Zeile);
Zeile := copy(Zeile,1,i-1);
i := pos('*',Zeile);
if i > 0 then
begin
DirDig := true;
Zeile := copy(Zeile,1,i-1);
delete(Zeile,1,pos(' via ',Zeile)+4);
While pos(B1,Zeile) > 0 do
begin
LongDig := B1 + CutStr(Zeile) + LongDig;
Zeile := RestStr(Zeile);
inc(AnzDig);
end;
LongDig := CutStr(Zeile) + LongDig;
inc(AnzDig);
end;
MH_Update(TNC_Nr);
if DirDig then
begin
Rufz := CutStr(LongDig);
LongDig := '';
AnzDig := 0;
FrRej := false;
FrUI := false;
MH_Update(TNC_Nr);
end;
End;
Procedure Screen_aus (* Art : Byte *);
Var i : Byte;
Begin
if not ScreenSTBY then
Begin
if (show > 0) and not BackScroll(show) then
Begin
case Art of
1 : dec(ScreenTimer);
2 : ScreenTimer := 0;
end;
if ScreenTimer = 0 then
begin
Teil_Bild_Loesch(1,maxZ,0);
ScreenSTBY := true;
end;
End else if Art = 2 then Alarm;
End;
End;
Function Str_Int(Ein : String) : Longint;
Var Zahl : LongInt;
Fehl : integer;
begin
Val (Ein, Zahl, Fehl);
if Fehl > 0 then Zahl:=0;
Str_Int:=Zahl;
end;
Function QuietPruefen(RS, RM:byte) : Boolean;
var DummyFlag : Boolean;
ZZ : Byte;
begin
DummyFlag:=false;
for ZZ:=1 to 3 do
begin
if (quietZeitG) and (konfig.QuietZt[zz].aktiv) then
with Konfig.QuietZt[Zz] do
begin
if (RS > StdAnf) and (RS < StdEnd) then DummyFlag:=true;
if (RS = STdAnf) and (StdAnf<>StdEnd) then
if RM >= MinAnf then DummyFlag:=True;
if (RS = StdEnd) and (StdAnf<>StdEnd) then
if RM < MinEnd then DummyFlag:=true;
if (StdAnf=StdEnd) and (RS=StdAnf) then
if (RM < MinEnd) and (RM >= MinAnf) then DummyFlag:=true;
end; {with}
end; {for}
QuietPruefen:=DummyFlag;
end;
Procedure Uhr_aus;
Var Zeit : String[8];
j, i : Byte;
HStr : Byte;
QuietM: boolean;
rstd,
min2,
rmin,
sec2 : integer;
rsec : longint;
h1, h2,
mn1,mn2,
s1,s2 : byte;
srec : SearchRec;
Dummy : string;
flag : boolean;
TNCflag : Boolean;
Begin
Zeit := Uhrzeit;
TNCFlag:=false;
{$IFDEF Sound}
if (length(WavStream)>0) then
begin
sprachwav;
end else
if not playing then StopWave_;
{$ENDIF}
{ if TXOffen=0 then TXOffen:=1;
if TXBed=0 then TXBed:=1;}
if copy(Zeit,7,2) <> copy(ZeitMerk,7,2) then
begin
if (not BackupJetzt) and (BackupProc) then
if ((str_int(copy(Zeit,4,2)) Mod Konfig.BackUpTime)=0) then
begin
BackupJetzt:=True;
end;
if (Konfig.BackUpTime>0) and (BackupProc) and (BackupJetzt) and (not BackupBremsen) then
begin {and (not BackupBremsen)}
{ M_aus(Attrib[28],#13+'****Sicherung*** '+copy(zeit,4,2)+':'+int_str(Konfig.BackUpTime)+#13, 2);}
Sicherung_Speichern;
BackupProc:=false;
BackupJetzt:=false;
end;
if (not BackupProc) and (Konfig.BackUpTime>0) and ((str_int(copy(Zeit,4,2)) Mod Konfig.BackUpTime)=Konfig.BackupTime-1)
then BackupProc:=True;
{ _aus(Attrib[20],kanal,ZeitMerk +'<Merk | Zeit>'+Zeit + M1);}
(*
{Beginn: TNC Zeit-Sharing}
inc(TXZeit);
if (TXZeit>TXZMax-1) and (TXZeit<250) then
begin
TXBed:=0;
for i:=TXOffen+1 to MaxTNC do
begin
if (TNC_used[i]) and (TNC[i]^.TXBedarf) and (TXBed=0) then TXBed:=i;
end; {for TXOffen}
if TXBed=0 then
begin
for i:=1 to TXOffen do
begin
if (TNC_used[i]) and (TNC[i]^.TXBedarf) and (TXBed=0) then TXBed:=i;
end;
end;
if TXBed=0 then TXBed:=TXOffen;
if TXBed<>TXOffen then
begin
TNC[TXOffen]^.TXBedarf:=FAlse;
TNC[TXOffen]^.TXGesperrt:=true;
S_Pac(Tnc[TXOffen]^.Kvon, CM, TRUE, 'X0');
TXZeit:=255-TXSicher+1;
end else TXZeit:=1;
end; {if txzeit>6}
if (TXZeit=0) then
begin
TXOffen:=TXBed;
TNC[TXOffen]^.txGesperrt:=false;
TXZeit:=0;
S_Pac(TNC[TXOffen]^.KVon, CM, true, 'X1');
end; {if TXZeit}
{Ende: TNC Zeit-Sharing}
*)
rstd:=Str_Int(Copy(Zeit,1,2));
rmin:=Str_Int(Copy(Zeit,4,2));
if (rstd in [0,1,2]) and (not gotlastdt) and (copy(zeit,7,2)<>'00') then
begin
getdate(Jahr_,Monat_, Tag_, woTag_);
{_aus(Attrib[20],kanal,'Datum2 geholt: '+int_str(Tag_)+'.'+int_str(monat_) + M1);}
gotlastdt:=true;
end;
if rstd>2 then gotlastdt:=false;
if quietZeitG then quiet:=QuietPruefen(Rstd, Rmin);
quietM:=quiet;
if QuietM<>Quiet then
begin
Klingel:=not quiet;
SetzeFlags(show);
end;
RSEC:=0;
h2:=Str_Int(Copy(Zeit,1,2));
h1:=Str_Int(Copy(ZeitMerk,1,2));
mn2:=Str_Int(Copy(Zeit,4,2));
mn1:=Str_Int(Copy(ZeitMerk,4,2));
s2:=Str_Int(Copy(Zeit,7,2));
s1:=Str_Int(Copy(ZeitMerk,7,2));
if h1<=h2 then rstd:=h2-h1;
if h1>h2 then
begin
rstd:=24-h1;
rstd:=rstd+(h2);
end;
rmin:=mn2-mn1;
rsec:=s2-s1;
rsec:=rsec+(rmin*60)+((rstd*60)*60);
if NowFenster and (Box_Time > 0) then
begin
{ BoxZaehl := Pred(BoxZaehl); loesst Integer-Ueberlauf aus, }
{ besser und schneller: //db1ras }
Dec(BoxZaehl);
if BoxZaehl <= 0 then Neu_Bild;
end;
if (not Quiet_Uhr) or (not Quiet) then StatusOut(show,13,4,Attrib[10],Zeit,1);
if quiet and Quiet_Uhr then StatusOut(show, 13, 4, Attrib[10], '*QUIET* ', 1);
Quiet_Uhr:=not Quiet_Uhr;
if (not Scan_) or (not Quiet_Uhr) then StatusOut(show,61,1,Attrib[10],EFillStr(20,B1,Versi),3);
if (Scan_) and (Quiet_Uhr) then StatusOut(show,61,1,Attrib[10],'* * * ! SCAN ! * * *',3);
if ScreenSTBY then ScreenFill;
if HardCur then if not JumpRxScr then
begin
JumpRxZaehl := pred(JumpRxZaehl);
if JumpRxZaehl <= 0 then JumpRxScr := true;
end;
for i := 1 to maxLink do
begin
with K[i]^ do
begin
{NODE-TimeOut}
if (Node) and (NTimeOut>0) then
begin
{NodeTimeOut:=NodeTimeOut-RSec;}
dec(NodeTimeOut);
if NodeTimeOut<1 then
begin
if Connected then begin
s_pac(i,Nu,True,M2+'*TIMEOUT!*'+M1);
S_PAC(i,CM,true,'D');
{*} L_OFF(i);
Rufz_TNC_init(i);
end;
end;
end;
{TERMINAL-TimeOut}
if (not Node) and (Konfig.TTimeOut>0) then
begin
{TermTimeOut:=TermTimeOut-RSec;}
dec(termTimeOut);
if TermTimeOut<1 then
begin
if Connected then begin
s_pac(i,Nu,True,m2+'*TIMEOUT!*'+M1);
S_PAC(i,CM,true,'D');
{*} L_OFF(i);
Rufz_TNC_init(i);
end;
end;
end;
HoldLauf:=HoldLauf-rsec;
if Hold and not (SPlsave or Xbin.TX or XBin.RX or FileSend or Einstiegskanal or AusstiegsKanal)
and (HoldLauf<=0) then
begin
S_PAC(i,NU,true,HoldStr);
if not HardCur then InfoOut(i,0,1,HoldStr);
HoldLauf:=HoldTime * 60;
end;
if CSelf = 4 then
begin
dec(AutoWait);
if AutoWait = 0 then CSelf := 3;
end;
end; {** with k... **}
end;
end;
if copy(Zeit,4,2) <> copy(ZeitMerk,4,2) then
Begin
inc(LaufZeit);
inc(NoActivity);
{$IFNDEF no_Bake} {//db1ras}
for i := 1 to TNC_Anzahl do
begin
with TNC[i]^ do
begin
Dec(MailBakenTimer);
if (MailBake) and (MailBakenTimer=0) then
begin
K[0]^.TncNummer := i;
S_PAC(0,CM,true,'C' + B1 + Konfig.OwnMailPfad);
FindFirst(Konfig.MailVerz + S_ch + MsgExt,Archive,srec);
flag:=false;
if DosError = 0 then
begin
S_PAC(0,NU,false,InfoZeile(392)+B1);
Dummy := '';
end else Flag := true;
While DosError = 0 do
begin
Dummy:=srec.Name;
delete(Dummy,pos('.',Dummy),length(Dummy));
S_PAC(0,NU,false,DUMMY+B1);
Dummy := '';
FindNext(srec);
end;
if not flag then S_PAC(0,NU,true,m1);
S_PAC(0,CM,true,'C' + B1 + BPFad);
MailBakenTimer:=MailBakenZeit;
end;
if Bake then
begin
if (LaufZeit mod BTimer) = 0 then
begin
K[0]^.TncNummer := i;
S_PAC(0,CM,true,'C' + B1 + BPfad);
if BCall<>'' then S_PAC(0,CM,true,'I' + B1 + BCALL);
S_PAC(0,NU,true,BText);
if BCall<>'' then
begin
S_PAC(0,CM,true,'I' + B1 + HostCall);
for j:=1 to maxlink do Rufz_TNC_Init(j);
end;
end;
if show = 0 then Unproto_darstellen;
end;
end;
end;
{$ENDIF}
for i := 1 to maxLink do with K[i]^do
begin
if CSelf = 1 then if AutoTime = copy(Zeit,1,5) then CSelf := 3;
if CSelf = 2 then
begin
inc(AutoZyCount);
if AutoZyCount >= AutoZyConst then CSelf := 3;
end;
if CSelf = 3 then AutoToAnz := AutoToMax;
if (CSelf in [5,6]) and (AutoToCount > 0) then
begin
dec(AutoToCount);
if AutoToCount = 0 then
begin
CSelf := 9;
if AutoToAnz > 0 then
begin
dec(AutoToAnz);
if AutoToAnz = 0 then CSelf := 10;
end;
end;
end;
{if Hold and not (FileSend or Einstiegskanal or AusstiegsKanal)
and ((LaufZeit mod HoldTime) = 0) then}
if Hold and not (FileSend or Einstiegskanal or AusstiegsKanal)
and (HoldLauf<=0) then
begin
S_PAC(i,NU,true,HoldStr);
if not HardCur then InfoOut(i,0,1,HoldStr);
HoldLauf:=HoldTime * 60;
end;
end;
if ScreenInit > 0 then Screen_aus(1);
end;
ZeitMerk := Zeit;
End;
(* TNC-Nachricht abholen und auswerten. Nur nach einem SendTNC ansprechen !!! *)
Procedure GetTNC (* Kanal : Byte *);
var j,i,i1,i2,
iz,ix,
Attr,
TNC_Nr : Byte;
CheckAnwesend1,
Flag : Boolean;
Datei : Text;
hcall,
hcall2 : Str9;
MailZeile,
Bstr : String;
Dummy : String;
IdStr : String[5];
BinFrame2,
BinFrame : Boolean;
Broadc1 : BroadCast;
Broadc2 : BroadCast;
Procedure Port_Ident(Kanal : Byte; var Col : Byte);
var HfPort,i : Byte;
flag : Boolean;
Begin
with K[Kanal]^ do
begin
i := pos(DP,Response);
if i > 0 then
begin
HfPort := str_int(Response[i-1]);
delete(Response,i-1,2);
KillStartBlanks(Response);
i := 1;
flag := false;
Repeat
if (TNC[i]^.DRSI = TNC[K[Kanal]^.TncNummer]^.DRSI) and
(TNC[i]^.HF_Port = HfPort) then flag := true else inc(i);
Until flag or (i > TNC_Anzahl);
if flag then Col := i
else Col := 1;
IdStr := TNC[Col]^.Ident;
if length(IdStr) > 0 then IdStr := EFillStr(5,B1,IdStr)
else IdStr := '';
end else
begin
IdStr := Channel_Id(Kanal);
Col := TncNummer;
end;
end;
End;
Function Rufzeichen(Zeiger : Integer) : Str9;
Var i : Integer;
Bstr : Str9;
Begin
with K[0]^ do
begin
Bstr := '';
for i := Zeiger to Zeiger + 5 do
if Response[i] <> #64 then Bstr := Bstr + Chr(Ord(Response[i]) DIV 2);
if (Ord(Response[Zeiger+6]) DIV 2) <> 48 then
begin
i := (Ord(Response[Zeiger+6]) DIV 2) - 48;
if (i < 0) or (i > 15) then Bstr := Bstr + '-?'
else if (i <> 0) then Bstr := Bstr + '-' + int_str(i);
end;
end;
Rufzeichen := Bstr;
End;
Function Flags : Str8;
Const Flag_str = 'CNMR';
Var Bstr : Str8;
flgs, i : Integer;
Begin
with K[0]^ do
begin
Bstr := '';
flgs := ord(Response[20]) SHR 4;
for i := 1 to 4 do
begin
if flgs mod 2 <> 0 then Bstr := Copy(Flag_str, i, 1) + Bstr
else Bstr := '*' + Bstr;
flgs := flgs SHR 1;
end;
end;
Flags := B1 + Bstr + B1;
End;
{$IFNDEF no_Netrom} {//db1ras}
Procedure SaveBroadCast;
Var BcDatNam : string[12];
BCDat : File of Broadcast;
AnzNds,
IOR : word;
DPs : longint;
donotsave: boolean;
BCFlag : boolean;
begin
AnzNds:=NodesAnzahl(TNC[Broadc1.Port]^.AfuPort);
if TNC[Broadc1.Port]^.AfuPort then BCDatNam:=BCastHAM else BCDatnam:=BCastCB;
assign (BCDat, sys1pfad+BCDatNam);
BCFlag:=true;
donotsave:=false;
if BroadC1.SourceCall='' then BroadC1.SourceCall:=BroadC1.SourceAlias;
if BroadC1.NodeCall='' then BroadC1.NodeCall:=BroadC1.NodeAlias;
{$I-}
reset(BCDat);
ior:=ioresult;
if ior<>0 then REwrite(BCDat);
if ioresult<1 then ior:=ior;
if (ior=0) and (anznds>0) then
begin
DPs:=0;
bcflag:=false;
while ((not EOF(BCDat)) and (not bcFlag)) do
begin
read(BCDat, BroadC2);
if (BroadC1.NodeCall=BroadC2.NodeCall) and
(BroadC1.NodeAlias=BroadC2.NodeAlias) then
begin
if (Broadc2.quality <= Broadc1.quality) then BCFlag:=true
else
begin
bcflag:=true;
doNotSave:=true;
end;
end;
if not BCFlag then inc(DPs);
end; {while}
if BCFlag then seek(BCDat, Dps);
if not BCFlag then
if anznds<Konfig.MaxNodes then BCFlag:=true;
end;
if (BCFlag) and (not DoNotSave) and (BroadC1.NodeCall<>'') and (BroadC1.NodeAlias<>'') then
begin
{ior:=NodesAnzahl(TNC[Broadc1.Port]^.AfuPort);}
write(BCDat, BroadC1);
{ior:=NodesAnzahl(TNC[Broadc1.Port]^.AfuPort);}
ior:=ior;
end;
doNotSave:=false;
ior:=ioresult;
Close(BCDat);
ior:=ioresult;
{ior:=NodesAnzahl(TNC[Broadc1.Port]^.AfuPort)}
{$I+}
end;
{$ENDIF}
Begin
Kanal2:=kanal;
if TNC[K[Kanal]^.TncNummer]^.TNC_im_Host then with K[Kanal]^ do
begin
TNC_Nr := V24(Kanal);
get_Response(Kanal);
CheckAnwesend1:=false;
If not (OverRun or SynchError) then
Case TNC_Code of
0 : Begin (* success, no info *)
Response := '';
Ausgabe := true;
TncNix := true;
End;
1 : Begin (* success with info (null-terminated) *)
if TNC[TncNummer]^.DRSI > 0 then Port_ident(Kanal,ix)
else IdStr := Channel_Id(Kanal);
if Ausgabe then
begin
if TNC_ReadOut then InfoOut(Kanal,0,1,IdStr + Response)
else M_aus(Attrib[28],IdStr + Response +^J, Kanal);
end;
Ausgabe := true;
End;
2 : Begin (* failure with info (null-terminated) *)
if Ausgabe then InfoOut(Kanal,1,1,Channel_Id(Kanal) + Response);
Ausgabe := true;
End;
3 : Begin (* Link Status (null-terminated) *)
if TNC[TncNummer]^.DRSI > 0 then Port_ident(Kanal,ix)
else IdStr := Channel_Id(Kanal);
If pos(LSM[1],Response) > 0 then
Begin (* BUSY fm ... *)
if Fwd then CancelMailPoll(Kanal);
delete(Response,1,12);
Response := BusyStr + Response;
_aus(Attrib[20],Kanal,Response + M1);
Kanal_benutz := false;
if AusstiegsKanal then
begin
S_PAC(GegenKanal,NU,true,M2 + Response + M1);
Send_Prompt(GegenKanal,FF);
RemConInit(Kanal);
end;
Auto_CON := false;
outside:=TRUE;
Rufz_TNC_init(Kanal);
SetzeFlags(Kanal);
End else
If pos(LSM[2],Response) > 0 then
Begin (* CONNECTED to ... *)
SystemErkannt:='';
if not Rekonnekt then
begin
Rekonnekt := false;
Kanal_benutz := true;
L_ON(Kanal,Response,true,false);
Line_ON(Kanal);
end else InfoOut(Kanal,1,1,'Reconnect to ' + Call);
End else
If pos(LSM[3],Response) > 0 then
Begin (* LINK RESET fm ... *)
Response := RestStr(Response);
_aus(Attrib[20],Kanal,Star + Response + M1);
Kanal_benutz := true;
End else
If pos(LSM[4],Response) > 0 then
Begin (* LINK RESET to ... *)
Response := RestStr(Response);
_aus(Attrib[20],Kanal,Star + Response + M1);
Kanal_benutz := true;
End else
If pos(LSM[5],Response) > 0 then
Begin (* DISCONNECTED *)
Rekonnekt := false;
if Conv.Active then ConversQuit(Kanal);
{*} {mu<6D> bleiben!!} L_Off(Kanal);
Rufz_TNC_init(Kanal);
if EinstiegsKanal then
begin
S_PAC(GegenKanal,CM,true,'D');
{*>>} { L_off(GegenKanal);}
end;
if AusstiegsKanal then
begin
if K[GegenKanal]^.RemConReady then
begin
S_PAC(GegenKanal,NU,false,M2 + ReconStr +
K[GegenKanal]^.OwnCall+M2);
Send_Prompt(GegenKanal,FF);
end;
RemConInit(Kanal);
end;
End else
If pos(LSM[6],Response) > 0 then
Begin (* LINK FAILURE with ... *)
if Fwd then CancelMailPoll(Kanal);
if Conv.Active then ConversQuit(Kanal);
if EinstiegsKanal then
begin
S_PAC(GegenKanal,CM,true,'D');
{*>>} {L_Off(GegenKanal);}
end;
if AusstiegsKanal then
begin
if Auto_Con then S_PAC(GegenKanal,NU,false,M2 + FailStr + Ziel_Call + M1) else
begin
if connected
then S_PAC(GegenKanal,NU,false,M1 + ReconStr + K[GegenKanal]^.OwnCall+M1)
else S_PAC(GegenKanal,NU,false,M2 + Star + Response + M1);
end;
Send_Prompt(GegenKanal,FF);
RemConInit(Kanal);
end;
{*} L_Off(Kanal);
Rufz_TNC_init(Kanal);
End else
If pos(LSM[7],Response) > 0 then
Begin (* CONNECT REQUEST fm ... *)
if Klingel then Beep(600,70);
InfoOut(show,1,1,Star + IdStr + Response);
End else
If pos(LSM[8],Response) > 0 then
Begin (* FRAME REJECT fm ... *)
Response := RestStr(Response);
_aus(Attrib[20],Kanal,Star + Response + M1);
End else
If pos(LSM[9],Response) > 0 then
Begin (* FRAME REJECT to ... *)
Response := RestStr(Response);
_aus(Attrib[20],Kanal,Star + Response + M1);
End else
Begin (* Unbekannt *)
_aus(Attrib[20],Kanal,InfoZeile(106) + Response + M1);
End;
End;
4 : Begin (* Monitor header, no info (null-terminated) *)
CheckAnwesend1:=true;
if TNC[TncNummer]^.DRSI > 0 then
begin
Port_Ident(0,ix); {Faktor COLOR-eintr<74>ge/TNC}
ColMon := ColMonBeg + ix * 4 - 3;
MH_Check(ix,Response);
end else
begin
ix := TncNummer;
ColMon := ColMonBeg + ix * 4 - 3;
IdStr := Channel_Id(0);
MH_Check(ix,Response);
end;
TNC_K := (pos(' - ',Response) > 0); (* K auf 2 gesetzt ? *)
if Mon_Anz > 0 then
begin
for i := 1 to maxLink do with K[i]^.Mo do
begin
if MonActive and MonDisAbr then
if (pos(MonStr[1]+B1,K[0]^.Response) > 0) or
(pos(MonStr[2]+B1,K[0]^.Response) > 0) then
begin
if (pos(' ctl DISC',K[0]^.Response) > 0) or
(pos(' ctl DM',K[0]^.Response) > 0) then
begin
_aus(Attrib[20],i,M1 + InfoZeile(437) + B1 +
RestStr(K[0]^.Response) + M1);
Cancel_Call_monitoren(i);
end;
end;
end;
end;
if Drucker then Write_Lpt(0,LptEsc[1]);
Bstr := FormMonFr(ix,IdStr,Response);
if (Time_stamp and not TNC_K) then Bstr := Bstr + B1 + '(' + Uhrzeit + ')';
if not RxLRet then Bstr := ^J + Bstr;
M_aus(Attrib[ColMon],Bstr + ^J, Kanal);
if Drucker then Write_Lpt(0,LptEsc[2]);
(* hcall2:=copy(Bstr,pos('fm ',Bstr)+3,9);
if pos(' ',hcall2)>0 then delete(hcall2,Pos(' ',hcall2),length(hcall2));
j:=0;
if pos('-',hcall2)>0 then
j:=str_int(Copy(Hcall2,Pos('-',Hcall2)+1,Pos('-',Hcall2)+3));
strip(hcall2);
i1:=0;
while length(Hcall2)>0 do
begin
inc(i1);
if not (hcall2[i1] in ['a'..'z', 'A'..'Z', '1'..'9','0']) then hcall2:='';
end;
if hcall2>'' then
for i1:=1 to maxAnwesend do
begin
HCall:=Anwesend[i1]^.Call;
strip(HCall);
if hcall=hcall2 then
for i:=0 to 15 do
begin
if (j = Anwesend[i1]^.SSids[i]) then
begin
Anwesend[i1]^.da:=true;
Anwesend[i1]^.Call:=Hcall;
if i<>0 then Anwesend[i1]^.Call:=Anwesend[i1]^.Call+'-'+int_str(i);
end;
end;
if Anwesend[i1]^.da then Scan_:=true;
end;*)
End;
5 : Begin (* Monitor header with info (null-terminated) *)
CheckAnwesend1:=true;
if TNC[TncNummer]^.DRSI > 0 then
begin
Port_Ident(0,ix);
ColMon := ColMonBeg + ix * 4 - 3;
MH_Check(ix,Response);
end else
begin
ix := TncNummer;
ColMon := ColMonBeg + ix * 4 - 3;
IdStr := Channel_Id(0);
MH_Check(ix,Response);
end;
TNC_K := (pos(' - ',Response) > 0); (* K auf 2 gesetzt ? *)
G^.HeaderStr := Response;
if Drucker then Write_Lpt(0,LptEsc[1]);
Bstr := FormMonFr(ix,IdStr,Response);
NetRom:=false;
if (pos(' pid CF', Bstr) > 0) then
begin
NetRom:=true;
i := pos(' to ', Bstr);
j := i;
i := i - 1;
while (Copy(Bstr, i, 1) <> ' ') and (i > 0) do i := i - 1;
i := i + 1;
G^.NRCall := Copy(Bstr, i, j - i);
end;
MailZeile:=UpcaseStr(Bstr);
delete(mailzeile,1,Pos(' FM ', MailZeile)+3);
MailFrFlag:=false;
for i:=1 to 10 do
begin
if (Pos(UpcaseStr(MailFrame1+Konfig.MailFrame[i]+MailFrame2), MailZeile)>0) or
((Pos(UpcaseStr(MailFrame1+Konfig.MailFrame[i]+' VIA'), MailZeile)>0) and
(Pos(UpcaseStr(MailFrame2), MailZeile)>0)) then
begin
MailFrFlag:=true;
Mail.BoxCall:=copy(Mailzeile,1,Pos(' ',Mailzeile)-1);
for i1:=1 to maxlink do if K[i1]^.owncall=Mail.BoxCall then
begin
Mail.Boxcall:='';
MailFrFlag:=false;
end;
end;
end;
if Time_stamp and not TNC_K then Bstr := Bstr + B1 + '(' + Uhrzeit + ')';
if not RxLRet then Bstr := ^J + Bstr;
M_aus(Attrib[ColMon],Bstr, Kanal);
if Drucker then Write_Lpt(0,LptEsc[2]);
MonCode5 := true;
End;
6 : If MonCode5 then (* Monitor info (Byte count) *)
if Not NetRom then Begin
if MailFrFlag then
begin
MailZeile:=UpcaseStr(Response);
i:=0;
while i<maxlink do
begin
inc(i);
HCall:=UpcaseStr(K[i]^.OwnCall);
if Pos (HCall, MailZeile)>0 then
begin
Mail.ZielCall:= HCall;
Mail.Uhrzeit := Uhrzeit;
Mail.Datum := Datum;
Mail.Port := K[kanal]^.TncNummer;
Mail.Versuche:= 0;
MailSpeichern (Mail);
sound_(2000,5);
MailInBox:=True;
SetzeFlags(show);
end;
end; {while i<maxlink}
end; {MailFrame}
MonCode5 := false;
BinFrame2:=false;
i:=length(response);
Repeat {0..5,15..25,27..31,}
if ord(Response[i]) in BinMenge
then BinFrame2 := true;
dec(i);
Until BinFrame2 or (i < 1);
if (BinFrame2) and (RxComp) then