unit _uc_tek_updater_func;
interface
uses Classes,Forms,SysUtils,ComCtrls,Dialogs;
Type
TComUPDATER = class
public
class procedure _goUpdaterComTekData(sData:string; vComNODA:TTreeNode);
end;
implementation
uses unit1,_uc_funcs,_uc_i_builder,_uc_refs_vars,_uc_refs_consts,
_uc_tek_builder_func,_uc_ip_codecs,_uc_GuiLanG;
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
class procedure TComUPDATER._goUpdaterComTekData(sData:string; vComNODA:TTreeNode);
var
UPTEK_DATA,sIniLINE :string;
DxxLIST:TStringList;
i,p1,p2:integer;
sIPP,sNAT,sPCD : string;
// if userID in my list not existing in the DATA of the sever TekUP
// then user has not updated at server, so he is offline !
// EXCEPT the data is empty, wich means that the server is down !
procedure _RemoveOfflineUsers;
var
j,k:Integer;
idd:string;
begin
for j:=0 to vComNODA.Count-1 do
begin
if (vComNODA.Item[j]._EXO_NODE_X_LEVEL='Z')and(pos(vComNODA.Item[j]._EXO_NODE_USER_ID,UPTEK_DATA)=0) then
begin
_FXOC_MAIN.TheLOGGER.Log(vComNODA.Item[j].Text+' '+___ccc__0098__OffLineFromCom+vComNODA.Text,6);
idd:=vComNODA.Item[j]._EXO_NODE_USER_ID; // grabb id before deleting
vComNODA.Item[j].Delete;
//--- we deleted from the com above, check if user still existing on others coms or no
// to gray icon if in fav
if (_is_UserID_in_The_NETWORKS_Tree(idd)=nil) then
begin
for k:=0 to _TV_NODE_OF_FAVORITES.Count-1 do
begin
if (copy(_TV_NODE_OF_FAVORITES.Item[k]._EXO_NODE_COM_IDX,1,10)=idd) then
begin
_TV_NODE_OF_FAVORITES.Item[k].ImageIndex :=6;
_TV_NODE_OF_FAVORITES.Item[i]._EXO_NODE_USER_IP :='';
_TV_NODE_OF_FAVORITES.Item[k]._EXO_NODE_COUNTRY :='';
_TV_NODE_OF_FAVORITES.Item[k]._EXO_NODE_MESSAGE :='';
_TV_NODE_OF_FAVORITES.Item[k]._EXO_NODE_UZR_GMT :='';
_TV_NODE_OF_FAVORITES.Item[k]._EXO_NODE_20BOOLS :=''; // add user-boolz
_TV_NODE_OF_FAVORITES.Item[k]._EXO_NODE_X_LEVEL :='L'; // set level as fav-InActive
_TV_NODE_OF_FAVORITES.Item[k].SelectedIndex:=_TV_NODE_OF_FAVORITES.Item[k].ImageIndex; // tp update color
break;
end;
end;
end;
_RemoveOfflineUsers;
Break;
end;
end;
end;
begin
(*
check data
clear offLine
add new if i is lan sh**t
*)
UPTEK_DATA:=sData;
if (UPTEK_DATA='') then begin
//_DoDebugLOG(vComNODA.Text+' : Probably down! DataEmpty!');
exit;
end;
p1:=pos('£F2A',UPTEK_DATA);
p2:=pos('£F2B',UPTEK_DATA);
if (p1>0) and (p2>0) then // top to bottom !
begin
_RemoveOfflineUsers; // Start removing offline users here ONLY ! as data of TekUP is VALID
DxxLIST:=TStringList.Create;
try
sIniLINE:=copy(UPTEK_DATA,p1+4,(p2-p1)-4);
DxxLIST.Text:=StringReplace(sIniLINE,'¤ò¤ò',ret,[rfReplaceAll]);
//TLogger.Log(DxxLIST.Text);
for i:=0 to DxxLIST.Count-1 do
if (DxxLIST[i]<>'') then
begin
// £ID1391046619£NT1£CK1E4429AD51£UX
sIniLINE:=DxxLIST[i];
sIPP:=copy(sIniLINE,pos('£ID',sIniLINE)+3,pos('£NT',sIniLINE)-(pos('£ID',sIniLINE)+3));
sNAT:=copy(sIniLINE,pos('£NT',sIniLINE)+3,pos('£CK',sIniLINE)-(pos('£NT',sIniLINE)+3));
sPCD:=copy(sIniLINE,pos('£CK',sIniLINE)+3,pos('£UX',sIniLINE)-(pos('£CK',sIniLINE)+3));
Case sNAT[1] of
'0' : begin
sIPP:=TIpCodecs.decry(sIPP);
sIPP:=TIpCodecs.int_to_ip(sIPP);
end;
'1' : begin
sIPP:=TIpCodecs.int_to_ip(sIPP); // direct int to ip !! no decry !!!
end;
else begin
_FXOC_MAIN.TheLOGGER.Log('sNAT_error_@Com:'+vComNODA.Text+' : '+sNAT,1);
Continue;
end;
end;
// for kk-lan-user to catch wan-user after him
if is_user_in_this_ComNode(sPCD,vComNODA)=nil then
if (sPCD<>_VV_LOCAL_USER_PC_ID) then // not Self
TStartingComBUILDER._goBuilderComUsers(sIPP,vComNODA); // we let fireWalled access to wan users after him
//begin
//TLogger.Log(vComNODA.Text+'/_e804_new_user_in_:'+sPCD);
//end;
end;
finally DxxLIST.Free; end;
end;
//else _DoDebugLOG(vComNODA.Text+' : TekUP_server_DATA_INVALID!!! :'+ret+UPTEK_DATA);
end;
end.
interface
uses Classes,Forms,SysUtils,ComCtrls,Dialogs;
Type
TComUPDATER = class
public
class procedure _goUpdaterComTekData(sData:string; vComNODA:TTreeNode);
end;
implementation
uses unit1,_uc_funcs,_uc_i_builder,_uc_refs_vars,_uc_refs_consts,
_uc_tek_builder_func,_uc_ip_codecs,_uc_GuiLanG;
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
class procedure TComUPDATER._goUpdaterComTekData(sData:string; vComNODA:TTreeNode);
var
UPTEK_DATA,sIniLINE :string;
DxxLIST:TStringList;
i,p1,p2:integer;
sIPP,sNAT,sPCD : string;
// if userID in my list not existing in the DATA of the sever TekUP
// then user has not updated at server, so he is offline !
// EXCEPT the data is empty, wich means that the server is down !
procedure _RemoveOfflineUsers;
var
j,k:Integer;
idd:string;
begin
for j:=0 to vComNODA.Count-1 do
begin
if (vComNODA.Item[j]._EXO_NODE_X_LEVEL='Z')and(pos(vComNODA.Item[j]._EXO_NODE_USER_ID,UPTEK_DATA)=0) then
begin
_FXOC_MAIN.TheLOGGER.Log(vComNODA.Item[j].Text+' '+___ccc__0098__OffLineFromCom+vComNODA.Text,6);
idd:=vComNODA.Item[j]._EXO_NODE_USER_ID; // grabb id before deleting
vComNODA.Item[j].Delete;
//--- we deleted from the com above, check if user still existing on others coms or no
// to gray icon if in fav
if (_is_UserID_in_The_NETWORKS_Tree(idd)=nil) then
begin
for k:=0 to _TV_NODE_OF_FAVORITES.Count-1 do
begin
if (copy(_TV_NODE_OF_FAVORITES.Item[k]._EXO_NODE_COM_IDX,1,10)=idd) then
begin
_TV_NODE_OF_FAVORITES.Item[k].ImageIndex :=6;
_TV_NODE_OF_FAVORITES.Item[i]._EXO_NODE_USER_IP :='';
_TV_NODE_OF_FAVORITES.Item[k]._EXO_NODE_COUNTRY :='';
_TV_NODE_OF_FAVORITES.Item[k]._EXO_NODE_MESSAGE :='';
_TV_NODE_OF_FAVORITES.Item[k]._EXO_NODE_UZR_GMT :='';
_TV_NODE_OF_FAVORITES.Item[k]._EXO_NODE_20BOOLS :=''; // add user-boolz
_TV_NODE_OF_FAVORITES.Item[k]._EXO_NODE_X_LEVEL :='L'; // set level as fav-InActive
_TV_NODE_OF_FAVORITES.Item[k].SelectedIndex:=_TV_NODE_OF_FAVORITES.Item[k].ImageIndex; // tp update color
break;
end;
end;
end;
_RemoveOfflineUsers;
Break;
end;
end;
end;
begin
(*
check data
clear offLine
add new if i is lan sh**t
*)
UPTEK_DATA:=sData;
if (UPTEK_DATA='') then begin
//_DoDebugLOG(vComNODA.Text+' : Probably down! DataEmpty!');
exit;
end;
p1:=pos('£F2A',UPTEK_DATA);
p2:=pos('£F2B',UPTEK_DATA);
if (p1>0) and (p2>0) then // top to bottom !
begin
_RemoveOfflineUsers; // Start removing offline users here ONLY ! as data of TekUP is VALID
DxxLIST:=TStringList.Create;
try
sIniLINE:=copy(UPTEK_DATA,p1+4,(p2-p1)-4);
DxxLIST.Text:=StringReplace(sIniLINE,'¤ò¤ò',ret,[rfReplaceAll]);
//TLogger.Log(DxxLIST.Text);
for i:=0 to DxxLIST.Count-1 do
if (DxxLIST[i]<>'') then
begin
// £ID1391046619£NT1£CK1E4429AD51£UX
sIniLINE:=DxxLIST[i];
sIPP:=copy(sIniLINE,pos('£ID',sIniLINE)+3,pos('£NT',sIniLINE)-(pos('£ID',sIniLINE)+3));
sNAT:=copy(sIniLINE,pos('£NT',sIniLINE)+3,pos('£CK',sIniLINE)-(pos('£NT',sIniLINE)+3));
sPCD:=copy(sIniLINE,pos('£CK',sIniLINE)+3,pos('£UX',sIniLINE)-(pos('£CK',sIniLINE)+3));
Case sNAT[1] of
'0' : begin
sIPP:=TIpCodecs.decry(sIPP);
sIPP:=TIpCodecs.int_to_ip(sIPP);
end;
'1' : begin
sIPP:=TIpCodecs.int_to_ip(sIPP); // direct int to ip !! no decry !!!
end;
else begin
_FXOC_MAIN.TheLOGGER.Log('sNAT_error_@Com:'+vComNODA.Text+' : '+sNAT,1);
Continue;
end;
end;
// for kk-lan-user to catch wan-user after him
if is_user_in_this_ComNode(sPCD,vComNODA)=nil then
if (sPCD<>_VV_LOCAL_USER_PC_ID) then // not Self
TStartingComBUILDER._goBuilderComUsers(sIPP,vComNODA); // we let fireWalled access to wan users after him
//begin
//TLogger.Log(vComNODA.Text+'/_e804_new_user_in_:'+sPCD);
//end;
end;
finally DxxLIST.Free; end;
end;
//else _DoDebugLOG(vComNODA.Text+' : TekUP_server_DATA_INVALID!!! :'+ret+UPTEK_DATA);
end;
end.