6 Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
7 Dialogs, StdCtrls, ComCtrls, ExtCtrls, ToolWin, Menus, OleCtrls,
13 ActiveX, {HTTPApp,} YofUtils, IniFiles, StrUtils,
14 GikoSystem, GikoUtil, ImgList, Clipbrd, BoardGroup,
15 IdAntiFreezeBase, IdAntiFreeze, IdBaseComponent, IdComponent,
16 IdTCPConnection, IdTCPClient, IdHTTP, ActnList, StdActns, IdIntercept,
17 IdLogBase, IdLogDebug, IdException;
20 // TSetLayeredWindowAttributes = function(wnd: HWND; crKey: DWORD; bAlpha: BYTE; dwFlag: DWORD): Boolean; stdcall;
21 //
\8f\91\82«
\8d\9e\82Ý
\96ß
\82è
\92l
\83^
\83C
\83v
22 TGikoResultType = (grtOK, grtCookie, grtCheck, grtError);
24 TEditorForm = class(TForm)
27 PostMessage: TMenuItem;
28 SaveMessage: TMenuItem;
31 StatusBar: TStatusBar;
32 EditorPage: TPageControl;
34 PreviewTab: TTabSheet;
42 ToolBarImageList: TImageList;
43 HotToobarImageList: TImageList;
45 NameBasePanel: TPanel;
48 NameComboBox: TComboBox;
49 MailComboBox: TComboBox;
51 SendToolButton: TToolButton;
52 OutBoxToolButton: TToolButton;
53 ToolButton5: TToolButton;
54 UndoToolButton: TToolButton;
55 CutToolButton: TToolButton;
56 CopyToolButton: TToolButton;
57 PasteToolButton: TToolButton;
58 ToolButton3: TToolButton;
59 TransToolButton: TToolButton;
60 TopToolButton: TToolButton;
62 IdAntiFreeze: TIdAntiFreeze;
63 ToolButton1: TToolButton;
64 ToolButton2: TToolButton;
65 ActionList: TActionList;
79 SageCheckBox: TCheckBox;
80 IdLogDebug: TIdLogDebug;
83 KotehanCheckBox: TCheckBox;
87 SelectAllAction: TAction;
89 SelectAll1: TMenuItem;
90 procedure EditorPageChange(Sender: TObject);
91 procedure FormCreate(Sender: TObject);
92 procedure BrowserStatusTextChange(Sender: TObject;
93 const Text: WideString);
94 procedure FormClose(Sender: TObject; var Action: TCloseAction);
95 procedure FormDestroy(Sender: TObject);
96 procedure SendActionExecute(Sender: TObject);
97 procedure SaveActionExecute(Sender: TObject);
98 procedure AbortActionExecute(Sender: TObject);
99 procedure CloseActionExecute(Sender: TObject);
100 procedure UndoActionExecute(Sender: TObject);
101 procedure CutActionExecute(Sender: TObject);
102 procedure CopyActionExecute(Sender: TObject);
103 procedure PasteActionExecute(Sender: TObject);
104 procedure SendActionUpdate(Sender: TObject);
105 procedure SaveActionUpdate(Sender: TObject);
106 procedure CloseActionUpdate(Sender: TObject);
107 procedure UndoActionUpdate(Sender: TObject);
108 procedure CutActionUpdate(Sender: TObject);
109 procedure CopyActionUpdate(Sender: TObject);
110 procedure PasteActionUpdate(Sender: TObject);
111 procedure TopActionExecute(Sender: TObject);
112 procedure TopActionUpdate(Sender: TObject);
113 procedure SageCheckBoxClick(Sender: TObject);
114 procedure MailComboBoxChange(Sender: TObject);
115 procedure TransActionExecute(Sender: TObject);
116 procedure TransActionUpdate(Sender: TObject);
117 procedure IdLogDebugReceive(ASender: TIdConnectionIntercept;
119 procedure IdLogDebugSend(ASender: TIdConnectionIntercept;
121 procedure SelectAllActionExecute(Sender: TObject);
123 FThreadItem: TThreadItem;
125 FNameComboEdit: THandle;
126 FMailComboEdit: THandle;
129 FStatusCode: Integer;
130 FDebugStrReceive: string;
131 FDebugStrSend: string;
134 function RepHtml(s: string): string;
135 function Check: Boolean;
136 procedure SetNameList(sName, sMail: string);
137 // procedure Send(SendType: TGikoSendType; SPID: string; PON: string; FirstWriting: Boolean);
138 procedure Send(SPID: string; PON: string; FirstWriting: Boolean);
140 function GetActiveControlHandle: THandle;
141 // function GetSendData: string;
142 // procedure GetSendData(Source: TStringStream);
143 procedure GetSendData(Source: TStringStream);
144 procedure SaveSendFile;
145 procedure SetContent(Content: string);
146 function GetSPID(CookieLine: string): string;
147 function GetPON(CookieLine: string): string;
148 function GetResultType(ResponseText: string): TGikoResultType;
150 procedure CreateParams(var Params: TCreateParams); override;
153 procedure SetThreadItem(Item: TThreadItem);
154 procedure SetBoard(Item: TBoard);
162 CAPTION_NAME_NEW: string = '
\83M
\83R
\83i
\83r
\83X
\83\8c\97§
\82Ä
\83G
\83f
\83B
\83^';
163 CAPTION_NAME_RES: string = '
\83M
\83R
\83i
\83r
\83\8c\83X
\83G
\83f
\83B
\83^';
165 //DAX
\82³
\82ñ±Ø¶ÞÄ!(
\81L
\81¤
\81M)
166 READCGI_ERR = '-ERR';
167 READCGI_INCR = '-INCR';
169 READCGI_PARTIAL = '+PARTIAL';
170 READCGI_ERR_FOUND_KAKO = '-ERR
\89ß
\8b\8e\83\8d\83O
\91q
\8cÉ
\82Å
\94
\8c©';
171 READCGI_ERR_NOT_HTML = '-ERR html
\89»
\91Ò
\82¿';
172 READCGI_ERR_NOT_FOUND = '-ERR
\82»
\82ñ
\82È
\94Âor
\83X
\83\8c\83b
\83h
\82È
\82¢
\82Å
\82·
\81B';
173 READCGI_ERR_ABONE = '-ERR
\82Ç
\82±
\82©
\82Å
\82 \82Ú
\81[
\82ñ
\82ª
\82 \82Á
\82½
\82Ý
\82½
\82¢
\82Å
\82·
\81B';
174 READCGI_ERR_TIMEOUT = '-ERR
\8ew
\92è
\8e\9e\8aÔ
\82ª
\89ß
\82¬
\82Ü
\82µ
\82½
\81B';
175 READCGI_ERR_CANTUSE = '-ERR
\82à
\82¤
\81@
\82Â
\82©
\82¦
\82Ü
\82¹
\82ñ';
176 RES2CH_TRUE = '<!-- 2ch_X:true -->';
177 RES2CH_FALSE = '<!-- 2ch_X:false -->';
178 RES2CH_ERROR = '<!-- 2ch_X:error -->';
179 RES2CH_CHECK = '<!-- 2ch_X:check -->';
180 RES2CH_COOKIE = '<!-- 2ch_X:cookie -->';
184 StartPos, EndPos: Integer;
189 {constructor TEditorForm.Create(AOwner: TComponent; Item: TBoard);
191 inherited Create(AOwner);
194 procedure TEditorForm.CreateParams(var Params: TCreateParams);
197 if FormStyle in [fsNormal, fsStayOnTop] then
198 if BorderStyle in [bsSingle, bsSizeable] then begin
199 Params.ExStyle := Params.ExStyle or WS_EX_APPWINDOW;
200 Params.WndParent := 0;
204 {procedure TEditorForm.CreateParams(var Params: TCreateParams);
206 inherited CreateParams(Params);
207 Params.ExStyle := Params.ExStyle or WS_EX_APPWINDOW;
210 procedure TEditorForm.FormCreate(Sender: TObject);
214 wp: TWindowPlacement;
217 Browser.Navigate('about:blank');
222 //
\83E
\83B
\83\93\83h
\83E
\82Ì
\88Ê
\92u
\90Ý
\92è
223 { i := GikoSys.Setting.EditWindowLeft +
224 GikoSys.Setting.EditWindowTop +
225 GikoSys.Setting.EditWindowWidth +
226 GikoSys.Setting.EditWindowHeight;
228 SetBounds(GikoSys.Setting.EditWindowLeft, GikoSys.Setting.EditWindowTop,
229 GikoSys.Setting.EditWindowWidth, GikoSys.Setting.EditWindowHeight);
230 if GikoSys.Setting.EditWindowMax then
231 WindowState := wsMaximized;
233 //
\83E
\83B
\83\93\83h
\83E
\82Ì
\88Ê
\92u
\90Ý
\92è
234 wp.length := sizeof(wp);
235 wp.rcNormalPosition.Top := GikoSys.Setting.EditWindowTop;
236 wp.rcNormalPosition.Left := GikoSys.Setting.EditWindowLeft;
237 wp.rcNormalPosition.Bottom := GikoSys.Setting.EditWindowTop + GikoSys.Setting.EditWindowHeight;
238 wp.rcNormalPosition.Right := GikoSys.Setting.EditWindowLeft + GikoSys.Setting.EditWindowWidth;
239 wp.showCmd := SW_HIDE;
240 SetWindowPlacement(Handle, @wp);
242 if GikoSys.Setting.EditWindowMax then
243 WindowState := wsMaximized;
245 //
\83E
\83B
\83\93\83h
\83E
\82ª
\89æ
\96Ê
\8aO
\82È
\82ç
\89æ
\96Ê
\93à
\82É
\88Ú
\93®
\82·
\82é
246 if (Left + Width) > Screen.Width then
247 Left := Screen.Width - Width;
248 if (Top + Height) > Screen.Height then
249 Top := Screen.Height - Height;
255 //
\95\9d\82Æ
\8d\82\82³
\82ª0
\82È
\82ç
\91å
\82«
\82
\82·
\82é
256 if GikoSys.Setting.EditWindowHeight < 0 then
258 if GikoSys.Setting.EditWindowWidth < 0 then
261 EditorPage.ActivePage := EditorTab;
262 FNameComboEdit := GetWindow(NameComboBox.Handle, GW_CHILD);
263 FMailComboEdit := GetWindow(MailComboBox.Handle, GW_CHILD);
264 NameComboBox.Items.Assign(GikoSys.Setting.NameList);
265 MailComboBox.Items.Assign(GikoSys.Setting.MailList);
267 u32 := GetModuleHandle('User32.dll') <> 0;
268 TransAction.Enabled := u32;
271 procedure TEditorForm.SetBoard(Item: TBoard);
274 Caption := CAPTION_NAME_NEW + ' - [' + Item.Title + ']';
275 NameComboBox.Text := FBoard.KotehanName;
276 MailComboBox.Text := FBoard.KotehanMail;
277 SageCheckBox.Checked := AnsiPos('sage', MailComboBox.Text) <> 0;
278 TitlePanel.Visible := True;
281 procedure TEditorForm.SetThreadItem(Item: TThreadItem);
284 Caption := CAPTION_NAME_RES + ' - [' + FThreadItem.Title + ']';
285 NameComboBox.Text := FThreadItem.ParentBoard.KotehanName;
286 MailComboBox.Text := FThreadItem.ParentBoard.KotehanMail;
287 SageCheckBox.Checked := AnsiPos('sage', MailComboBox.Text) <> 0;
288 TitlePanel.Visible := False;
291 procedure TEditorForm.SetFont;
293 BodyEdit.Font.Name := GikoSys.Setting.EditorFontName;
294 BodyEdit.Font.Size := GikoSys.Setting.EditorFontSize;
295 BodyEdit.Font.Color := GikoSys.Setting.EditorFontColor;
296 BodyEdit.Color := GikoSys.Setting.EditorBackColor;
299 procedure TEditorForm.Preview;
310 temp1, temp2 : string;
312 if FThreadItem = nil then begin
314 Title := RepHtml(TitleEdit.Text);
316 No := IntToStr(FThreadItem.Count + 1);
317 Title := RepHtml(FThreadItem.Title);
320 Namae := RepHtml(NameComboBox.Text);
321 Mail := RepHtml(MailComboBox.Text);
322 Body := RepHtml(BodyEdit.Text);
323 Body := StringReplace(Body, #13#10, '<br>', [rfReplaceAll]);
324 DateTime := FormatDateTime('yyyy/mm/dd(aaa) hh:nn', now);
326 if Trim(Namae) = '' then
327 Namae := '
\96¼
\96³
\82µ
\82³
\82ñ';
329 s := '<HTML><HEAD>' + #13#10
330 + '<META http-equiv="Content-Type" content="text/html; charset=Shift_JIS">' + #13#10
331 + '<TITLE>' + title + '</TITLE>' + #13#10
332 // + '<STYLE><!--BODY{font-size : 9pt;font-family : "
\82l
\82r
\82o
\83S
\83V
\83b
\83N";}--></STYLE>' + #13#10
334 + '<BODY text="#000000" bgcolor="#EFEFEF" link="#0000FF" alink="#FF0000" vlink="#660099">' + #13#10
335 + '<FONT COLOR="#FF0000">' + title + '</FONT>' + #13#10
337 posTrip := Pos( '#', Namae );
340 //Namae := LeftStr( Namae, posTrip - 1 ) + '
\81\9f' + get_2ch_trip( PChar( Copy( Namae, posTrip + 1, Length( Namae ) ) ) );
341 temp1 := Copy( Namae, 1, posTrip - 1 ) + '
\81\9f';
342 temp2 := Copy( Namae, posTrip + 1, Length( Namae ) );
343 temp2 := get_2ch_trip( PChar( temp2 ) );
344 Namae := temp1 + temp2;
347 s := s + '<DT>' + No + '
\96¼
\91O
\81F <FONT color="forestgreen"><B>' + Namae + '</B></FONT>
\93\8a\8de
\93ú
\81F ' + DateTime+ '<BR><DD>' + Body + '<BR><BR><BR>' + #13#10
349 s := s + '<DT>' + No + '
\96¼
\91O
\81F <A href="mailto:' + Mail + '"><B>' + Namae + '</B></A>
\93\8a\8de
\93ú
\81F ' + DateTime+ '<BR><DD>' + Body + '<BR><BR><BR>' + #13#10;
350 s := s + '</BODY></HTML>';
354 function TEditorForm.RepHtml(s: string): string;
356 // s := StringReplace(s, '&', '&', [rfReplaceAll]);
357 s := StringReplace(s, '<', '<', [rfReplaceAll]);
358 s := StringReplace(s, '>', '>', [rfReplaceAll]);
359 // s := StringReplace(s, ' ', ' ', [rfReplaceAll]); //
\8ed
\97l
\95Ï
\8dX
\82É
\82æ
\82è
\8eg
\97p
\95s
\89Â
360 s := StringReplace(s, '"', '"', [rfReplaceAll]);
364 procedure TEditorForm.EditorPageChange(Sender: TObject);
366 if EditorPage.ActivePage = PreviewTab then begin
369 Browser.Navigate('about:blank');
373 procedure TEditorForm.BrowserStatusTextChange(Sender: TObject;
374 const Text: WideString);
376 if EditorPage.ActivePage = PreviewTab then begin
377 StatusBar.Panels[0].Text := Text;
379 StatusBar.Panels[0].Text := '';
383 function TEditorForm.Check: Boolean;
390 if FThreadItem = nil then
393 Board := FThreadItem.ParentBoard;
395 if (not GikoSys.Setting.UseMachineTime) and
396 ((Board.LastGetTime = 0) or
397 (Board.LastGetTime = ZERO_DATE)) then begin
398 Msg := '
\83T
\81[
\83o
\82Ì
\8e\9e\8d\8f\82ª
\95ª
\82©
\82ç
\82È
\82¢
\82½
\82ß
\81A
\91\97\90M
\8fo
\97\88\82Ü
\82¹
\82ñ'#13#10
399 + '
\83X
\83\8c\83b
\83h
\82ð
\8dX
\90V
\81i
\8eæ
\93¾
\81j
\8cã
\81A15
\95b
\91Ò
\82Á
\82Ä
\82©
\82ç
\91\97\90M
\82µ
\82Ä
\82
\82¾
\82³
\82¢';
400 MsgBox(Handle, Msg, '
\83G
\83\89\81[', MB_OK or MB_ICONSTOP);
402 end else if BodyEdit.Text = '' then begin
403 Msg := '
\96{
\95¶
\82ª
\93ü
\97Í
\82³
\82ê
\82Ä
\82¢
\82Ü
\82¹
\82ñ
\81B';
404 MsgBox(Handle, Msg, '
\83G
\83\89\81[', MB_OK or MB_ICONSTOP);
406 end else if (FBoard <> nil) and (Trim(TitleEdit.Text) = '') then begin
407 Msg := '
\83^
\83C
\83g
\83\8b\82ª
\93ü
\97Í
\82³
\82ê
\82Ä
\82¢
\82Ü
\82¹
\82ñ
\81B';
408 MsgBox(Handle, Msg, '
\83G
\83\89\81[', MB_OK or MB_ICONSTOP);
411 if (not GikoSys.Dolib.Connected) and (AnsiPos('
\81\9c', NameComboBox.Text) <> 0) then begin
412 Msg := '
\83\8d\83O
\83C
\83\93\82µ
\82Ä
\82¢
\82È
\82¢
\82Ì
\82Å
\81\9c\82Ì
\8b@
\94\
\82Í
\97\98\97p
\8fo
\97\88\82Ü
\82¹
\82ñ
\81B'#13#10
413 + '
\82±
\82Ì
\82Ü
\82Ü
\91\97\90M
\82µ
\82Ä
\82à
\82æ
\82ë
\82µ
\82¢
\82Å
\82·
\82©
\81H';
414 rc := MsgBox(Handle, Msg, '
\8am
\94F', MB_YESNO or MB_ICONQUESTION);
415 Result := (rc = IDYES);
420 procedure TEditorForm.FormClose(Sender: TObject; var Action: TCloseAction);
425 procedure TEditorForm.FormDestroy(Sender: TObject);
427 wp: TWindowPlacement;
429 //
\8dÅ
\91å
\89»
\81E
\83E
\83B
\83\93\83h
\83E
\88Ê
\92u
\95Û
\91¶
430 wp.length := sizeof(wp);
431 GetWindowPlacement(Handle, @wp);
433 GikoSys.Setting.EditWindowTop := wp.rcNormalPosition.Top;
434 GikoSys.Setting.EditWindowLeft := wp.rcNormalPosition.Left;
435 GikoSys.Setting.EditWindowHeight := wp.rcNormalPosition.Bottom - wp.rcNormalPosition.Top;
436 GikoSys.Setting.EditWindowWidth := wp.rcNormalPosition.Right - wp.rcNormalPosition.Left;
437 GikoSys.Setting.EditWindowMax := WindowState = wsMaximized;
440 procedure TEditorForm.SetNameList(sName, sMail: string);
442 if Trim(sName) <> '' then begin
443 if GikoSys.Setting.NameList.IndexOf(sName) = -1 then
444 GikoSys.Setting.NameList.Insert(0, sName);
446 if Trim(sMail) <> '' then begin
447 if GikoSys.Setting.MailList.IndexOf(sMail) = -1 then
448 GikoSys.Setting.MailList.Insert(0, sMail);
452 function TEditorForm.GetActiveControlHandle: THandle;
454 if EditorPage.ActivePage = EditorTab then begin
455 if ActiveControl = NameComboBox then
456 Result := FNameComboEdit
457 else if ActiveControl = MailComboBox then
458 Result := FMailComboEdit
459 else if ActiveControl = BodyEdit then
460 Result := BodyEdit.Handle
461 else if ActiveControl = TitleEdit then
462 Result := TitleEdit.Handle
469 procedure TEditorForm.SetContent(Content: string);
473 doc := Browser.Document;
476 doc.charset := 'Shift_JIS';
481 procedure TEditorForm.Send(SPID: string; PON: string; FirstWriting: Boolean);
483 TextStream: TStringStream;
484 Source: TStringStream;
485 ResponseText: string;
488 State: TGikoDownloadState;
489 ResultType: TGikoResultType;
496 if FThreadItem = nil then
499 Board := FThreadItem.ParentBoard;
502 Indy.ProxyParams.BasicAuthentication := False;
503 if GikoSys.Setting.WriteProxy then begin
504 Indy.ProxyParams.ProxyServer := GikoSys.Setting.WriteProxyAddress;
505 Indy.ProxyParams.ProxyPort := GikoSys.Setting.WriteProxyPort;
506 Indy.ProxyParams.ProxyUsername := GikoSys.Setting.WriteProxyUserID;
507 Indy.ProxyParams.ProxyPassword := GikoSys.Setting.WriteProxyPassword;
508 if GikoSys.Setting.ReadProxyUserID <> '' then
509 Indy.ProxyParams.BasicAuthentication := True;
511 Indy.ProxyParams.ProxyServer := '';
512 Indy.ProxyParams.ProxyPort := 80;
513 Indy.ProxyParams.ProxyUsername := '';
514 Indy.ProxyParams.ProxyPassword := '';
516 if FThreadItem = nil then begin
517 URL := FBoard.GetSendURL;
518 RefURL := GikoSys.UrlToServer(FBoard.URL) + 'test/bbs.cgi';
520 URL := FThreadItem.GetSendURL;
521 RefURL := GikoSys.UrlToServer(FThreadItem.ParentBoard.URL)
523 + FThreadItem.ParentBoard.BBSID
524 + '/' + ChangeFileExt(FThreadItem.FileName, '')
527 Indy.Request.UserAgent := GikoSys.GetUserAgent;
528 Indy.Request.Referer := RefURL;
529 Indy.Request.AcceptEncoding := '';
533 Cookie := Cookie + 'SPID=' + SPID + '; ';
535 Cookie := Cookie + 'PON=' + PON + '; ';
536 Cookie := 'Cookie: ' + Cookie + 'NAME=' + NameComboBox.Text + '; MAIL=' + MailComboBox.Text;
538 Indy.Request.CustomHeaders.Clear;
539 // Indy.Request.CacheControl := 'no-cache';
540 Indy.Request.CustomHeaders.Add('Pragma: no-cache');
541 Indy.Request.AcceptLanguage := 'ja';
542 Indy.Request.Accept := 'image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*';
543 Indy.Request.ContentType := 'application/x-www-form-urlencoded';
544 Indy.Request.CustomHeaders.Add(Cookie);
545 TextStream := TStringStream.Create('');
546 Source := TStringStream.Create('');
549 FDebugStrReceive := '';
552 Indy.Post(URL, Source, TextStream);
553 ResponseText := TextStream.DataString;
555 ResultType := GetResultType(ResponseText);
557 if ResultType = grtOK then
559 else if ResultType = grtCookie then begin
560 //
\83\8b\81[
\83v
\96h
\8e~
561 if not FirstWriting then
562 raise Exception.Create('');
565 '
\81E
\93\8a\8de
\82³
\82ê
\82½
\93à
\97e
\82Í
\83R
\83s
\81[
\81A
\95Û
\91¶
\81A
\88ø
\97p
\81A
\93]
\8dÚ
\93\99\82³
\82ê
\82é
\8fê
\8d\87\82ª
\82 \82è
\82Ü
\82·
\81B' + #13#10 +
566 '
\81E
\93\8a\8de
\82É
\8aÖ
\82µ
\82Ä
\94
\90¶
\82·
\82é
\90Ó
\94C
\82Í
\91S
\82Ä
\93\8a\8de
\8eÒ
\82É
\8bA
\82µ
\82Ü
\82·
\81B' + #13#10#13#10 +
567 '
\91S
\90Ó
\94C
\82ð
\95\89\82¤
\82±
\82Æ
\82ð
\8f³
\91ø
\82µ
\82Ä
\8f\91\82«
\8d\9e\82Ý
\82Ü
\82·
\82©
\81H',
569 MB_YESNO or MB_ICONQUESTION);
570 if MsgResult = IDYES then begin
571 Board.SPID := GetSPID(Indy.Response.RawHeaders.Values['Set-Cookie']);
572 Board.PON := GetPON(Indy.Response.RawHeaders.Values['Set-Cookie']);
573 if (Board.SPID = '') and (Board.PON = '') then
574 raise Exception.Create('');
575 //
\82à
\82¤
\88ê
\89ñ
\82±
\82Ì
\83\81\83\
\83b
\83h
576 Send(Board.SPID, Board.PON, False);
583 end else if ResultType = grtCheck then begin
585 //
\83\8b\81[
\83v
\96h
\8e~
586 if not FirstWriting then
587 raise Exception.Create('');
591 '
\8f\91\82«
\8d\9e\82Ý
\82É
\8aÖ
\82µ
\82Ä
\82Í
\97l
\81X
\82È
\83\8d\83O
\8fî
\95ñ
\82ª
\8bL
\98^
\82³
\82ê
\82Ä
\82¢
\82Ü
\82·
\81B' + #13#10 +
592 '
\93\8a\8de
\82É
\8aÖ
\82µ
\82Ä
\94
\90¶
\82·
\82é
\90Ó
\94C
\82Í
\91S
\82Ä
\93\8a\8de
\8eÒ
\82É
\8bA
\82µ
\82Ü
\82·
\81B' + #13#10 +
593 '
\8cö
\8f\98\97Ç
\91
\82É
\94½
\82µ
\82½
\82è
\81A
\91¼
\90l
\82É
\96À
\98f
\82ð
\82©
\82¯
\82é
\8f\91\82«
\8d\9e\82Ý
\82Í
\8dT
\82¦
\82Ä
\89º
\82³
\82¢
\81B' + #13#10 +
594 '
\93\8a\8de
\82³
\82ê
\82½
\93à
\97e
\82Í
\83R
\83s
\81[
\81E
\95Û
\91¶
\81E
\88ø
\97p
\81E
\93]
\8dÚ
\93\99\82³
\82ê
\82é
\8fê
\8d\87\82ª
\82 \82è
\82Ü
\82·
\81B' + #13#10 +
596 '
\91S
\90Ó
\94C
\82ð
\95\89\82¤
\82±
\82Æ
\82ð
\8f³
\91ø
\82µ
\82Ä
\8f\91\82«
\8d\9e\82Ý
\82Ü
\82·
\82©
\81H',
598 MB_YESNO or MB_ICONQUESTION);
600 if MsgResult = IDYES then begin
601 Board.SPID := GetSPID(Indy.Response.RawHeaders.Values['Set-Cookie']);
602 Board.PON := GetPON(Indy.Response.RawHeaders.Values['Set-Cookie']);
603 if (Board.SPID = '') and (Board.PON = '') then
604 raise Exception.Create('');
605 Send(Board.SPID, Board.PON, False);
614 raise Exception.Create('');
617 on E: EIdConnectException do begin
619 ResponseText := '<html><body>'
620 + '<div>
\90Ú
\91±
\82ª
\8e¸
\94s
\82µ
\82Ü
\82µ
\82½<br>'
621 + '
\89ñ
\90ü
\82â
\83v
\83\8d\83L
\83V
\82Ì
\8fó
\91Ô
\82ð
\92²
\82×
\82Ä
\82
\82¾
\82³
\82¢<br></div>'
622 + '<br><br><div>' + E.Message + '</div>'
625 on E: Exception do begin
628 FDebugStrReceive := AnsiReplaceText(FDebugStrReceive, '<', '<');
629 FDebugStrReceive := AnsiReplaceText(FDebugStrReceive, '>', '>');
630 FDebugStrSend := AnsiReplaceText(FDebugStrSend, '<', '<');
631 FDebugStrSend := AnsiReplaceText(FDebugStrSend, '>', '>');
633 ResponseText := '<html><body>' + TextStream.DataString;
634 ResponseText := AnsiReplaceText(ResponseText, '</body>', '');
635 ResponseText := AnsiReplaceText(ResponseText, '</html>', '');
636 ResponseText := ResponseText + '<hr><div align="left"><pre>';
637 ResponseText := ResponseText + '<b>
\82±
\82±
\82©
\82ç
\83M
\83R
\83i
\83r
\82Ì
\8fî
\95ñ</b>'#13#10;
638 ResponseText := ResponseText + #13#10'
\81\9c\91\97\90M'#13#10;
639 ResponseText := ResponseText + FDebugStrSend;
640 ResponseText := ResponseText + #13#10'
\81\9c\8eó
\90M'#13#10;
641 ResponseText := ResponseText + FDebugStrReceive;
642 ResponseText := ResponseText + '</pre></div></body></html>';
645 FStatusCode := Indy.ResponseCode;
653 if State = gdsComplete then begin
654 GikoForm.PlaySound('ResEnd');
656 if FThreadItem = nil then
657 GikoForm.AddMessageList(FBoard.Title + ' [
\90V
\83X
\83\8c\91\97\90M
\8fI
\97¹]', nil, gmiOK)
659 GikoForm.AddMessageList(FThreadItem.Title + ' [
\83\8c\83X
\91\97\90M
\8fI
\97¹]', nil, gmiOK);
661 end else if State = gdsError then begin
662 if FThreadItem = nil then
663 GikoForm.AddMessageList(FBoard.Title + ' [
\90V
\83X
\83\8c\91\97\90M
\8e¸
\94s]', nil, gmiNG)
665 GikoForm.AddMessageList(FThreadItem.Title + ' [
\83\8c\83X
\91\97\90M
\8e¸
\94s]', nil, gmiNG);
666 EditorPage.ActivePage := PreviewTab;
667 SetContent(ResponseText);
668 end else if State = gdsAbort then begin
669 GikoForm.AddMessageList(FThreadItem.Title + ' [
\92\86\92f]', nil, gmiSAD);
673 function TEditorForm.GetResultType(ResponseText: string): TGikoResultType;
675 if AnsiPos('
\8f\91\82«
\82±
\82Ý
\82ª
\8fI
\82í
\82è
\82Ü
\82µ
\82½', ResponseText) <> 0 then
677 else if (AnsiPos('
\83N
\83b
\83L
\81[
\82ª
\82È
\82¢
\82©
\8aú
\8cÀ
\90Ø
\82ê
\82Å
\82·', ResponseText) > 0) or
678 (AnsiPos('<title>
\83N
\83b
\83L
\81[
\8am
\94F
\81I</title>', ResponseText) > 0) or
679 (AnsiPos('<title>
\81¡
\83N
\83b
\83L
\81[
\8am
\94F
\81I
\81¡</title>', ResponseText) > 0) or
680 //(AnsiPos('
\83N
\83b
\83L
\81[
\8am
\94F', ResponseText) > 0) or
681 (AnsiPos(RES2CH_COOKIE, ResponseText) > 0) then
683 else if (AnsiPos('<font size=+2 color=#FF0000>
\8f\91\82«
\8d\9e\82Ý
\83`
\83F
\83b
\83N
\81I </font>', ResponseText) > 0) or
684 (AnsiPos('<title>
\81¡
\8f\91\82«
\8d\9e\82Ý
\8am
\94F
\82µ
\82Ü
\82·
\81¡</title>', ResponseText) > 0) or
685 (AnsiPos('<title>
\93\8a\8de
\8am
\94F</title>', ResponseText) > 0) or
686 (AnsiPos('<b>
\8f\91\82«
\82±
\82Ý
\8am
\94F</b>', ResponseText) > 0) or
687 (AnsiPos('="../test/subbbs.cgi">', ResponseText) > 0) or
688 (AnsiPos(RES2CH_FALSE, ResponseText) > 0) then
695 procedure TEditorForm.GetSendData(Source: TStringStream);
703 if FThreadItem = nil then
706 Board := FThreadItem.ParentBoard;
708 if GikoSys.Setting.UseMachineTime then begin
709 if GikoSys.Setting.TimeAdjust then
710 Adjust := Gikosys.Setting.TimeAdjustSec
712 Adjust := GikoSys.Setting.TimeAdjustSec * -1;
713 SendTime := GikoSys.DateTimeToInt(Now) - (9 * 60 * 60) + Adjust
715 if (Board.LastGetTime = 0) or (Board.LastGetTime = ZERO_DATE) then
716 SendTime := GikoSys.DateTimeToInt(Now)
718 SendTime := GikoSys.DateTimeToInt(Board.LastGetTime);
720 SessionID := GikoSys.Dolib.SessionID;
721 if SessionID <> '' then
722 s := 'sid=' + HttpEncode(SessionID) + '&'
726 + 'FROM=' + HttpEncode(NameComboBox.Text) + '&'
727 + 'mail=' + HttpEncode(MailComboBox.Text) + '&'
728 + 'MESSAGE=' + HttpEncode(BodyEdit.Text) + '&'
729 + 'bbs=' + Board.BBSID + '&'
730 + 'time=' + IntToStr(SendTime) + '&';
731 if FThreadItem = nil then begin
732 s := s + 'subject=' + HttpEncode(TitleEdit.Text) + '&';
733 s := s + 'submit=' + HttpEncode('
\91S
\90Ó
\94C
\82ð
\95\89\82¤
\82±
\82Æ
\82ð
\8f³
\91ø
\82µ
\82Ä
\8f\91\82«
\8d\9e\82Þ') + #13#10;
735 s := s + 'key=' + ChangeFileExt(FThreadItem.FileName, '') + '&';
736 s := s + 'submit=' + HttpEncode('
\8f\91\82«
\8d\9e\82Þ') + #13#10;
738 Source.WriteString(s);
741 procedure TEditorForm.SaveSendFile;
746 ini := TMemIniFile.Create(GikoSys.GetSentFileName);
748 sDate := IntToStr(GikoSys.DateTimeToInt(Now));
750 ini.WriteString(sDate, 'Name', NameComboBox.Text);
751 ini.WriteString(sDate, 'EMail', MailComboBox.Text);
752 ini.WriteString(sDate, 'Body', HttpEncode(BodyEdit.Text));
753 ini.WriteInteger(sDate, 'Status', FStatusCode);
754 ini.WriteDateTime(sDate, 'Date', Now);
755 if FThreadItem = nil then begin
756 ini.WriteString(sDate, 'Title', TitleEdit.Text);
757 ini.WriteString(sDate, 'BBS', FBoard.BBSID);
758 ini.WriteInteger(sDate, 'NewThread', 1);
760 ini.WriteString(sDate, 'Title', FThreadItem.Title);
761 ini.WriteString(sDate, 'BBS', FThreadItem.ParentBoard.BBSID);
762 ini.WriteString(sDate, 'Key', ChangeFileExt(FThreadItem.FileName, ''));
771 procedure TEditorForm.SendActionExecute(Sender: TObject);
780 SendAction.Enabled := False;
781 Application.ProcessMessages;
782 if not Check then Exit;
784 if FThreadItem = nil then
787 Board := FThreadItem.ParentBoard;
789 if FThreadItem = nil then begin
790 rc := GikoUtil.MsgBox(Handle,
791 '
\81u' + Board.Title + '
\81v
\94Â
\82É
\90V
\82µ
\82¢
\83X
\83\8c\83b
\83h
\97§
\82Ä
\82Ü
\82·'#13#10#13#10
792 + '
\81E
\94Â
\82Ì
\83\8b\81[
\83\8b\82ð
\8eç
\82Á
\82½
\8f\91\82«
\8d\9e\82Ý
\82Å
\82 \82é
\82±
\82Æ
\82ð
\8am
\94F
\82µ
\82Ü
\82µ
\82½
\82©
\81H'#13#10
793 + '
\81E
\91¼
\82É
\93¯
\82¶
\82æ
\82¤
\82È
\83X
\83\8c\83b
\83h
\82ª
\96³
\82©
\82Á
\82½
\82±
\82Æ
\82ð
\8am
\94F
\82µ
\82Ü
\82µ
\82½
\82©
\81H'#13#10#13#10
794 + '
\81u
\82Í
\82¢
\81v
\82ð
\89\9f\82·
\82Æ
\91\97\90M
\82µ
\82Ü
\82·',
796 MB_ICONQUESTION or MB_YESNO);
801 SetNameList(NameComboBox.Text, MailComboBox.Text);
802 if KotehanCheckBox.Checked then begin
803 Board.KotehanName := NameComboBox.Text;
804 Board.KotehanMail := MailComboBox.Text;
806 Send(Board.SPID, Board.PON, True);
812 procedure TEditorForm.SaveActionExecute(Sender: TObject);
817 procedure TEditorForm.CloseActionExecute(Sender: TObject);
822 procedure TEditorForm.UndoActionExecute(Sender: TObject);
824 SendMessage(GetActiveControlHandle, WM_UNDO, 0, 0);
827 procedure TEditorForm.CutActionExecute(Sender: TObject);
829 SendMessage(GetActiveControlHandle, WM_CUT, 0, 0);
832 procedure TEditorForm.CopyActionExecute(Sender: TObject);
834 SendMessage(GetActiveControlHandle, WM_COPY, 0, 0);
837 procedure TEditorForm.PasteActionExecute(Sender: TObject);
839 SendMessage(GetActiveControlHandle, WM_PASTE, 0, 0);
842 procedure TEditorForm.SelectAllActionExecute(Sender: TObject);
844 SendMessage(GetActiveControlHandle, EM_SETSEL, 0, GetWindowTextLength(GetActiveControlHandle));
847 procedure TEditorForm.TopActionExecute(Sender: TObject);
849 if TopAction.Checked then
850 FormStyle := fsStayOnTop
852 FormStyle := fsNormal;
855 procedure TEditorForm.AbortActionExecute(Sender: TObject);
860 procedure TEditorForm.SendActionUpdate(Sender: TObject);
862 SendAction.Enabled := not FWork;
865 procedure TEditorForm.SaveActionUpdate(Sender: TObject);
867 SaveAction.Enabled := False;
870 procedure TEditorForm.CloseActionUpdate(Sender: TObject);
872 SendAction.Enabled := not FWork;
875 procedure TEditorForm.UndoActionUpdate(Sender: TObject);
877 UndoAction.Enabled := (GetActiveControlHandle <> 0)
878 and (SendMessage(GetActiveControlHandle, EM_CANUNDO, 0, 0) <> 0)
882 procedure TEditorForm.CutActionUpdate(Sender: TObject);
884 Selection: TSelection;
887 AHandle := GetActiveControlHandle;
888 SendMessage(AHandle, EM_GETSEL, Longint(@Selection.StartPos), Longint(@Selection.EndPos));
889 CutAction.Enabled := (AHandle <> 0)
890 and ((Selection.EndPos - Selection.StartPos) <> 0)
894 procedure TEditorForm.CopyActionUpdate(Sender: TObject);
896 Selection: TSelection;
899 AHandle := GetActiveControlHandle;
900 SendMessage(AHandle, EM_GETSEL, Longint(@Selection.StartPos), Longint(@Selection.EndPos));
901 CopyAction.Enabled := (AHandle <> 0)
902 and ((Selection.EndPos - Selection.StartPos) <> 0)
906 procedure TEditorForm.PasteActionUpdate(Sender: TObject);
908 PasteAction.Enabled := (GetActiveControlHandle <> 0)
909 and (Clipboard.HasFormat(CF_TEXT))
913 procedure TEditorForm.TopActionUpdate(Sender: TObject);
915 TopAction.Enabled := not FWork;
918 procedure TEditorForm.SageCheckBoxClick(Sender: TObject);
920 if SageCheckBox.Checked then begin
921 if AnsiPos('sage', MailComboBox.Text) = 0 then
922 MailComboBox.Text := 'sage' + MailComboBox.Text;
924 if AnsiPos('sage', MailComboBox.Text) <> 0 then
925 MailComboBox.Text := StringReplace(MailComboBox.Text, 'sage', '', [rfReplaceAll]);
929 procedure TEditorForm.MailComboBoxChange(Sender: TObject);
931 if AnsiPos('sage', MailComboBox.Text) = 0 then
932 SageCheckBox.Checked := False
934 SageCheckBox.Checked := True;
938 function TEditorForm.GetSPID(CookieLine: string): string;
946 s := Trim(GikoSys.GetTokenIndex(CookieLine, ';', i));
950 if Pos('SPID=', s) = 1 then begin
951 Result := Trim(Copy(s, 6, Length(s)));
959 function TEditorForm.GetPON(CookieLine: string): string;
967 s := Trim(GikoSys.GetTokenIndex(CookieLine, ';', i));
971 if Pos('PON=', s) = 1 then begin
972 Result := Trim(Copy(s, 5, Length(s)));
980 procedure TEditorForm.IdLogDebugReceive(ASender: TIdConnectionIntercept;
983 StringStream: TStringStream;
985 StringStream := TStringStream.Create('');
987 StringStream.CopyFrom(AStream, AStream.Size);
988 FDebugStrReceive := FDebugStrReceive + StringStream.DataString;
994 procedure TEditorForm.IdLogDebugSend(ASender: TIdConnectionIntercept;
997 StringStream: TStringStream;
999 StringStream := TStringStream.Create('');
1001 StringStream.CopyFrom(AStream, AStream.Size);
1002 FDebugStrSend := FDebugStrSend + StringStream.DataString;
1008 procedure TEditorForm.TransActionExecute(Sender: TObject);
1010 AlphaBlend := TransAction.Checked;
1013 procedure TEditorForm.TransActionUpdate(Sender: TObject);
1015 TransAction.Enabled := not FWork;