uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
- Menus, NMHttp, StdCtrls, ComCtrls, Psock, FastSstp, BRegExp, BottleDef,
+ Menus, StdCtrls, ComCtrls, Psock, FastSstp, BRegExp, BottleDef,
IniFiles, ExtCtrls, ShellAPI, StdActns, ActnList, ConstList,
ConstEditor, AppEvnts, TaskTray, ImgList, ToolWin, Buttons, MenuBar,
RichEdit, Clipbrd, ColorCBX, SsParser, MPlayer, SakuraSeeker,
type
TfrmSender = class(TForm)
FastSstp: TFastSstp;
- NMHTTP: TNMHTTP;
MainMenu: TMainMenu;
mnFile: TMenuItem;
mnExit: TMenuItem;
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure actSendExecute(Sender: TObject);
- procedure NMHTTPFailure(Cmd: CmdType);
- procedure NMHTTPSuccess(Cmd: CmdType);
+ procedure HTTPSuccess(Sender: TObject);
+ procedure HTTPFailure(Sender: TObject);
procedure actStartClick(Sender: TObject);
procedure actStopExecute(Sender: TObject);
- procedure NMHTTPInvalidHost(var Handled: Boolean);
procedure FormShow(Sender: TObject);
procedure mnAboutClick(Sender: TObject);
procedure actExitClientExecute(Sender: TObject);
procedure TaskTrayDblClick(Seft: TObject; Button: TMouseButton);
procedure FormActivate(Sender: TObject);
procedure mnTaskNewMessageClick(Sender: TObject);
- procedure NMHTTPDisconnect(Sender: TObject);
procedure ApplicationEventsHint(Sender: TObject);
procedure memScriptKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
FDragTabDest: integer; //\83h\83\8d\83b\83v\82·\82é\88Ê\92u(\82·\82®\89E\82É\82\82é\83^\83u\82Ì\83C\83\93\83f\83b\83N\83X)
//
FCueGhost: TID2Ghost;
+ //
+ FHttp: THTTPDownloadThread; //HTTP\83_\83E\83\93\83\8d\81[\83h\83X\83\8c\83b\83h(\83C\83\93\83X\83^\83\93\83X\82Í1\8cÂ\82Ì\82Ý)
procedure SetStatusText(const Value: String);
procedure SetSleeping(const Value: boolean);
function T2C: TColor;
actVoteMessage.Enabled := false;
actAgreeMessage.Enabled := false;
mnGetNewId.Enabled := false;
- Screen.Cursor := crHourGlass;
+ Screen.Cursor := crAppStart;
end else begin
StatusBar.Panels[PanelConnecting].Text := '';
actStart.Enabled := true;
end;
end;
-procedure TfrmSender.NMHTTPFailure(Cmd: CmdType);
-begin
- Beep;
- ShowHintLabel('SSTP Bottle\83T\81[\83o\82Æ\82Ì\90Ú\91±\82É\8e¸\94s\82µ\82Ü\82µ\82½', WarningColor);
- ShowMessage(NMHTTP.Header);
- Connecting := false;
-end;
-
-procedure TfrmSender.NMHTTPSuccess(Cmd: CmdType);
+procedure TfrmSender.HTTPSuccess(Sender: TObject);
var Str, ResStr, Command: String;
HeadValue: THeadValue;
i: integer;
SetChannel: TStringList;
begin
Connecting := false;
- Str := NMHTTP.Body;
+ Str := (Sender as THttpDownloadThread).RecvString;
HeadValue := nil;
try
try
end;
end;
if SetChannel <> nil then begin
- NMHTTP.Disconnect;
PostSetChannel(SetChannel);
end;
finally
PostSetChannel(nil);
end;
-procedure TfrmSender.NMHTTPInvalidHost(var Handled: Boolean);
-begin
- ShowHintLabel(Pref.CgiName + '\82ª\82Ý\82Â\82©\82è\82Ü\82¹\82ñ', WarningColor);
- Connecting := false;
-end;
-
procedure TfrmSender.FormShow(Sender: TObject);
begin
if FBooted or Application.Terminated then Exit;
StatusBar.Panels[PanelStatus].Text := Value;
end;
-procedure TfrmSender.NMHTTPDisconnect(Sender: TObject);
-begin
- Connecting := false;
-end;
-
procedure TfrmSender.ApplicationEventsHint(Sender: TObject);
begin
if Length(Application.Hint) > 0 then begin
end;
procedure TfrmSender.PostCommand(const Command: array of String);
-var PostStr: String;
+var PostStr: TStringList;
i: integer;
begin
- if NMHTTP.Connected then Exit;
- Connecting := true;
- if Pref.UseHttpProxy then begin
- NMHTTP.Proxy := Pref.ProxyAddress;
- NMHTTP.ProxyPort := Pref.ProxyPort;
- end else begin
- NMHTTP.Proxy := '';
- end;
- for i := Low(Command) to High(Command) do begin
- PostStr := PostStr + Command[i];
- if i <> High(Command) then PostStr := PostStr + #13#10;
+ PostStr := nil;
+ try
+ PostStr := TStringList.Create;
+ for i := Low(Command) to High(Command) do begin
+ PostStr.Add(Command[i]);
+ end;
+ PostCommand(PostStr);
+ finally
+ PostStr.Free;
end;
- NMHTTP.Post(Pref.CgiName, PostStr);
end;
procedure TfrmSender.PostCommand(Command: TStrings);
+var PostStr: String;
begin
Connecting := true;
- if NMHTTP.Connected then Exit;
- if Pref.UseHttpProxy then begin
- NMHTTP.Proxy := Pref.ProxyAddress;
- NMHTTP.ProxyPort := Pref.ProxyPort;
- end else begin
- NMHTTP.Proxy := '';
+ PostStr := Command.Text;
+ PostStr := TIdURI.ParamsEncode(PostStr);
+ try
+ FHttp := THTTPDownloadThread.Create(BottleServer, Pref.CgiName, PostStr);
+ if Pref.UseHttpProxy then begin
+ FHttp.ProxyServer := Pref.ProxyAddress;
+ FHttp.ProxyPort := Pref.ProxyPort;
+ end;
+ FHttp.OnSuccess := HttpSuccess;
+ FHttp.OnConnectionFailed := HttpFailure;
+ FHttp.FreeOnTerminate := true; // \8f\9f\8eè\82É\8e©\95ª\82ÅFree\82µ\82Ä\82\82¾\82³\82¢
+ FHTTP.Resume;
+ except
+ on EHeapException do begin
+ Connecting := false;
+ FHttp.Free;
+ end;
end;
- NMHTTP.Post(Pref.CgiName, Command.Text);
end;
procedure TfrmSender.tabChannelDrawTab(Control: TCustomTabControl;
end;
+procedure TfrmSender.HTTPFailure(Sender: TObject);
+begin
+ SysUtils.Beep;
+ Beep;
+ ShowHintLabel('SSTP Bottle\83T\81[\83o\82Æ\82Ì\90Ú\91±\82É\8e¸\94s\82µ\82Ü\82µ\82½', WarningColor);
+ ShowMessage((Sender as THTTPDownloadThread).LastErrorMessage);
+ Connecting := false;
+end;
+
end.