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.
380 lines
11 KiB
Plaintext
380 lines
11 KiB
Plaintext
library InvisCheck;
|
|
|
|
uses
|
|
Classes,
|
|
Windows,
|
|
Messages,
|
|
plugin,
|
|
pluginutil,
|
|
CallExec,
|
|
SysUtils,
|
|
Graphics,
|
|
MMSystem,
|
|
IdMultipartFormData,
|
|
IdExceptionCore,
|
|
idHTTP,
|
|
sform in 'sform.pas' {SetForm};
|
|
|
|
{$I NoRTTI.inc}
|
|
{$R InvisCheck.res}
|
|
{$R 'icons.res' 'Icons\icons.rc'}
|
|
|
|
type
|
|
TPOSTThread = class(TThread)
|
|
protected
|
|
procedure Execute; override;
|
|
end;
|
|
|
|
var
|
|
userPath, andrqPath: AnsiString;
|
|
vApiVersion, currentUIN: Integer;
|
|
|
|
POST: TThread;
|
|
action: boolean;
|
|
|
|
function EngToRus(statuseng: string): string;
|
|
begin
|
|
if statuseng = 'Online' then
|
|
result := 'Â ñåòè';
|
|
if statuseng = 'Occupied' then
|
|
result := 'Çàíÿò';
|
|
if statuseng = 'DND' then
|
|
result := 'Íå áåñïîêîèòü';
|
|
if statuseng = 'N/A' then
|
|
result := 'Íåäîñòóïåí';
|
|
if statuseng = 'Away' then
|
|
result := 'Óø¸ë';
|
|
if statuseng = '' then
|
|
result := 'Ñâîáîäåí';
|
|
if statuseng = 'Offline' then
|
|
result := 'Îòêëþ÷åí';
|
|
if statuseng = 'Unknown' then
|
|
result := 'Íåèçâåñòåí';
|
|
if statuseng = 'Invisible' then
|
|
result := 'Íåâèäèìûé';
|
|
// if statuseng = '' then result:='Îøèáêà! Ïîâòîðèòå çàïðîñ';
|
|
end;
|
|
|
|
procedure OnButtonClickEx(uintocheck: Integer);
|
|
var i: Integer;
|
|
finish, found: boolean;
|
|
|
|
procedure ExceptionProxy(ExcpMsg: string);
|
|
begin
|
|
if (SetForm.AvoidBan.checked = true) and (SetForm.UseProxy.checked = true) and (SetForm.ListBox1.Items.Count >= 2) then
|
|
begin
|
|
if action = true then
|
|
if (GlobalProxy = StartProxy - 1) or ((GlobalProxy = 0) and (StartProxy = 0)) then
|
|
begin
|
|
ifPOST := false;
|
|
MessageBox(0, 'Íå óäàëîñü ïîäêëþ÷èòüñÿ íè ÷åðåç îäèí èç óêàçàííûõ ïðîêñè', namepl, 0);
|
|
POST.Free;
|
|
exit;
|
|
end;
|
|
SetForm.ExecAntiBan;
|
|
action := true;
|
|
OnButtonClickEx(uintocheck);
|
|
end
|
|
else
|
|
begin
|
|
ifPOST := false;
|
|
MessageBox(0, PWideChar('Îøèáêà îñíîâíîãî ïðîêñè:' + #13 + ExcpMsg + #13#13 +
|
|
'Ñïèñîê ïåðåáîðà ïóñò èëè ïåðåáîð ïðîêñè âûêëþ÷åí'), namepl, 0);
|
|
end;
|
|
end;
|
|
|
|
begin
|
|
if uintocheck = -1 then
|
|
uintocheck := RQ_GetChatUIN;
|
|
if uintocheck <= 0 then
|
|
exit;
|
|
try
|
|
if SetForm.TurnedOn.checked = false then
|
|
begin
|
|
SetForm.Show;
|
|
exit;
|
|
end;
|
|
|
|
finish := false;
|
|
if GlobalProxy > SetForm.ListBox1.Items.Count - 1 then
|
|
GlobalProxy := 0;
|
|
if action = false then
|
|
StartProxy := GlobalProxy;
|
|
|
|
if SetForm.UseProxy.checked = true then
|
|
begin
|
|
if SetForm.ListBox1.Items.Count = 0 then
|
|
begin
|
|
ReadTMTnotice := false;
|
|
ifPOST := false;
|
|
MessageBox(0, PWideChar('Âêëþ÷åíî èñïîëüçîâàíèå ïðîêñè, íî ñàì ïðîêñè (èëè èõ ñïèñîê) íå çàäàí'), namepl, 0);
|
|
// POST.Free;
|
|
exit;
|
|
end
|
|
else
|
|
with SetForm do
|
|
if (SetForm.AvoidBan.checked = true) then
|
|
begin
|
|
idH.ProxyParams.ProxyServer := ExtractWord(1, ListBox1.Items[GlobalProxy], delimq);
|
|
idH.ProxyParams.ProxyPort := StrToInt(ExtractWord(2, ListBox1.Items[GlobalProxy], delimq));
|
|
end
|
|
else
|
|
begin
|
|
idH.ProxyParams.ProxyServer := ExtractWord(1, ListBox1.Items[0], delimq);
|
|
idH.ProxyParams.ProxyPort := StrToInt(ExtractWord(2, ListBox1.Items[0], delimq));
|
|
end;
|
|
end;
|
|
|
|
mpf := TIdMultiPartFormDataStream.Create;
|
|
if SetForm.CheckService.ItemIndex = 0 then
|
|
begin
|
|
mpf.AddFormField(SetForm.ikey.text, '1');
|
|
if SetForm.YouAreAdded.checked = true then
|
|
mpf.AddFormField('youwereadded', 'on');
|
|
end;
|
|
mpf.AddFormField('uin', IntToStr(uintocheck));
|
|
|
|
repeat
|
|
ifPOST := true;
|
|
try
|
|
if SetForm.CheckService.ItemIndex = 0 then
|
|
gotcha := idH.POST('http://kanicq.ru/invisible/pda/?method=2', mpf)
|
|
else
|
|
gotcha := idH.POST('http://inviznet.ru/inviz_check.php', mpf);
|
|
except
|
|
mpf.Free;
|
|
MessageBox(0, PWideChar('Âðåìÿ îæèäàíèÿ îòâåòà èñòåêëî.'#13#10'Ìîæíî óâåëè÷èòü òàéìàóò ÷òåíèÿ, åñëè îí ìàë.'), namepl, 0);
|
|
ReadTMTnotice := false;
|
|
ifPOST := false;
|
|
POST.Free;
|
|
exit;
|
|
end;
|
|
|
|
if pos('Your have exceeded', gotcha) > 0 then
|
|
begin
|
|
if (SetForm.AvoidBan.checked = true) and (SetForm.AvoidBan.Enabled = true) then
|
|
begin
|
|
SetForm.ExecAntiBan;
|
|
continue;
|
|
end
|
|
else
|
|
begin
|
|
mpf.Free;
|
|
MessageBox(0, PWideChar('Îòâåò ñ ñàéòà: ' + copy(gotcha, pos('Your have exceeded', gotcha),
|
|
pos(' |
|
ReadTMTnotice := false;
|
|
ifPOST := false;
|
|
POST.Free;
|
|
exit;
|
|
end;
|
|
end;
|
|
|
|
if pos('The service is currently overflooded', gotcha) > 0 then
|
|
begin
|
|
mpf.Free;
|
|
MessageBox(0, PWideChar('Îòâåò ñ ñàéòà: ' + copy(gotcha, pos('The service is currently overflooded', gotcha),
|
|
pos(' |
|
ReadTMTnotice := false;
|
|
ifPOST := false;
|
|
POST.Free;
|
|
exit;
|
|
end;
|
|
|
|
finish := true;
|
|
until finish = true;
|
|
|
|
if SetForm.CheckService.ItemIndex = 0 then
|
|
begin
|
|
gotcha := copy(gotcha, pos('Result:', gotcha), 200);
|
|
num := IntToStr(uintocheck);
|
|
status := EngToRus(copy(gotcha, pos('"> ', gotcha) + 3, pos(' ', gotcha) - 3));
|
|
end
|
|
else if SetForm.CheckService.ItemIndex = 1 then
|
|
begin
|
|
gotcha := copy(gotcha, pos('red !important;"> |
|
// messagebox(0, PWideChar(gotcha), '', 0);
|
|
num := IntToStr(uintocheck);
|
|
status := (copy(gotcha, pos(';"> |
|
// messagebox(0, PWideChar(status), '', 0);
|
|
if pos('íåâèäèìîñò', status) > 0 then
|
|
status := 'Íåâèäèìûé'
|
|
else if pos('Â ñåòè', status) > 0 then
|
|
status := 'Â ñåòè'
|
|
else if pos('Íå â ñåòè', status) > 0 then
|
|
status := 'Îòêëþ÷åí';
|
|
end;
|
|
gdt := FormatDateTime('hh:nn:ss dd.mm.yyyy', now);
|
|
|
|
found := false;
|
|
for i := 2 to glst.Count - 1 do
|
|
if pos(num, glst[i]) = 1 then
|
|
begin
|
|
glst[i] := num + '|' + status + '|' + gdt;
|
|
found := true;
|
|
end;
|
|
|
|
if (StrToInt(num) > 0) and (found = false) then
|
|
glst.Add(num + '|' + status + '|' + gdt);
|
|
glst.SaveToFile(string(RQ_GetUserPath + stname));
|
|
|
|
mpf.Free;
|
|
|
|
ReadTMTnotice := false;
|
|
ifPOST := false;
|
|
POST.Free;
|
|
except
|
|
on E: EIdConnectTimeout do
|
|
ExceptionProxy(E.Message);
|
|
on E: EIdReadTimeout do
|
|
begin
|
|
ReadTMTnotice := true;
|
|
ExceptionProxy(E.Message);
|
|
end;
|
|
|
|
on E: Exception do
|
|
begin
|
|
if (pos('# 10061', E.Message) > 0) or (pos('# 10065', E.Message) > 0) or (pos('# 10054', E.Message) > 0) or
|
|
(pos('timeout', E.Message) > 0) then
|
|
ExceptionProxy(E.Message)
|
|
else
|
|
MessageBox(0, PWideChar(E.Message), namepl, 0);
|
|
end;
|
|
|
|
end;
|
|
end;
|
|
|
|
procedure TPOSTThread.Execute;
|
|
begin
|
|
action := false;
|
|
ReadTMTnotice := false;
|
|
OnButtonClickEx(-1);
|
|
end;
|
|
|
|
procedure OnButtonClick(iButton: Integer);
|
|
// var State: TKeyboardState;
|
|
begin
|
|
case iButton of
|
|
0:
|
|
begin
|
|
// GetKeyboardState(State);
|
|
// if (State[vk_Control] and 128) <> 0 then
|
|
// RQ_SendMsg(765000, 0, AnsiString(IntToStr(RQ_GetChatUIN)))
|
|
// else
|
|
POST := TPOSTThread.Create(false);
|
|
end;
|
|
1:
|
|
SetForm.Show;
|
|
2:
|
|
MessageBox(0, VersionText, namepl, 0);
|
|
end;
|
|
end;
|
|
|
|
function pluginFun(data: pointer): pointer; stdcall;
|
|
begin
|
|
result := NIL;
|
|
if (data = NIL) or (_int_at(data) = 0) then
|
|
exit;
|
|
case _byte_at(data, 4) of
|
|
PM_EVENT:
|
|
case _byte_at(data, 5) of
|
|
// PE_PROPERTIES_CHANGED: smsg(its(_int_at(data,6)){ + ' | ' + _istring_at(data,7)});
|
|
PE_INITIALIZE:
|
|
begin
|
|
RQ__ParseInitString(data, callback, vApiVersion, andrqPath, userPath, currentUIN);
|
|
if RQ_GetRnQVersion < 1074 then
|
|
begin
|
|
MessageBox(0, PChar('Èçâèíèòå, íî ýòîò ïëàãèí íå ìîæåò ðàáîòàòü ñ äàííîé âåðñèåé RnQ.' +
|
|
#13'Ïîæàëóéñòà, îáíîâèòå ïðîãðàììó è ñíèìèòå ãàëêó ñ ïëàãèíà InvisCheck.dll '), PChar(namepl), MB_ICONHAND);
|
|
exit;
|
|
end;
|
|
|
|
idH := TIdHTTP.Create(nil);
|
|
idH.AllowCookies := true;
|
|
idH.HandleRedirects := true;
|
|
idH.MaxAuthRetries := 3;
|
|
idH.ProxyParams.BasicAuthentication := false;
|
|
idH.Request.Accept := 'text/html, */*';
|
|
idH.Request.BasicAuthentication := false;
|
|
|
|
// data := callStr(ansichar(PM_GET) + ansichar(PG_WINDOW) + ansichar(PW_CHAT));
|
|
SetForm := TSetForm.Create(nil);
|
|
idH.ReadTimeout := SetForm.ReadTMT.value;
|
|
glst := TStringList.Create;
|
|
|
|
if fileexists(string(RQ_GetUserPath + stname)) then
|
|
begin
|
|
glst.LoadFromFile(string(RQ_GetUserPath + stname));
|
|
if glst.Count > 0 then
|
|
try
|
|
if pos('|', glst[0]) = 0 then
|
|
glst[0] := glst[0] + '|';
|
|
|
|
if SetForm.ExtractWord(1, glst[0], delims) <> '' then
|
|
SetForm.YouAreAdded.checked := StrToBool(SetForm.ExtractWord(1, glst[0], delims));
|
|
|
|
if SetForm.ExtractWord(2, glst[0], delims) <> '' then
|
|
SetForm.ikey.text := SetForm.ExtractWord(2, glst[0], delims);
|
|
|
|
if SetForm.ExtractWord(3, glst[0], delims) <> '' then
|
|
SetForm.CheckService.ItemIndex := StrToInt(SetForm.ExtractWord(3, glst[0], delims));
|
|
except
|
|
end;
|
|
|
|
if glst.Count > 1 then
|
|
SetForm.TurnedOn.checked := StrToBool(glst[1]);
|
|
end
|
|
else
|
|
begin
|
|
glst.Add('0');
|
|
glst.Add('1');
|
|
end;
|
|
|
|
hico1 := TIcon.Create;
|
|
hico2 := TIcon.Create;
|
|
hico3 := TIcon.Create;
|
|
hico4 := TIcon.Create;
|
|
hico5 := TIcon.Create;
|
|
hico1.Handle := LoadIcon(HInstance, 'ICON_1');
|
|
hico2.Handle := LoadIcon(HInstance, 'ICON_2');
|
|
hico3.Handle := LoadIcon(HInstance, 'ICON_3');
|
|
hico4.Handle := LoadIcon(HInstance, 'ICON_4');
|
|
hico5.Handle := LoadIcon(HInstance, 'ICON_5');
|
|
ba := RQ_CreateChatButton(@OnButtonClick, hico2.Handle, namepl);
|
|
|
|
SetForm.StartTimer;
|
|
|
|
result := str2comm(ansichar(PM_DATA) + _istring(namepl) + _int(APIversion));
|
|
end;
|
|
|
|
PE_PREFERENCES:
|
|
begin
|
|
SetForm.Show;
|
|
end;
|
|
|
|
PE_FINALIZE:
|
|
begin
|
|
idH.Free;
|
|
if MegaTimer <> 0 then
|
|
TimeKillEvent(MegaTimer);
|
|
if ba <> 0 then
|
|
RQ_DeleteChatButton(ba);
|
|
if SetForm <> nil then
|
|
SetForm.Free;
|
|
|
|
glst.Free;
|
|
hico1.Free;
|
|
hico2.Free;
|
|
hico3.Free;
|
|
hico4.Free;
|
|
hico5.Free;
|
|
end;
|
|
|
|
end; // case
|
|
end; // case
|
|
end; // pluginFun
|
|
|
|
exports
|
|
pluginFun;
|
|
|
|
end.
|