6 Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
7 Dialogs, StdCtrls, ComCtrls, ExtCtrls, ToolWin, Menus, OleCtrls, Registry,
13 ActiveX, {HTTPApp,} YofUtils, Trip, IniFiles, StrUtils,
14 GikoSystem, GikoUtil, ImgList, Clipbrd, BoardGroup,
15 IdAntiFreezeBase, IdAntiFreeze, IdBaseComponent, IdComponent,
16 IdTCPConnection, IdTCPClient, IdHTTP, ActnList, StdActns, IdIntercept,
17 IdLogBase, IdLogDebug, IdException, DateUtils, MojuUtils, bmRegExp;
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;
91 QuotePasteAction: TAction;
92 QuotePasteMenuItem: TMenuItem;
94 SpaceToNBSPAction: TAction;
95 AmpToCharRefAction: TAction;
96 SpaceTabnbsp1: TMenuItem;
98 BoardInformationTab: TTabSheet;
99 BoardtopTab: TTabSheet;
100 TitlePictureBrowser: TWebBrowser;
102 BoardInformationMemo: TMemo;
103 GetSETTINGTXTAction: TAction;
104 GetheadtxtAction: TAction;
106 SETTINGTXT2: TMenuItem;
108 GetTitlePictureAction: TAction;
111 procedure EditorPageChange(Sender: TObject);
112 procedure FormCreate(Sender: TObject);
113 procedure BrowserStatusTextChange(Sender: TObject;
114 const Text: WideString);
115 procedure FormClose(Sender: TObject; var Action: TCloseAction);
116 procedure FormDestroy(Sender: TObject);
117 procedure SendActionExecute(Sender: TObject);
118 procedure SaveActionExecute(Sender: TObject);
119 procedure AbortActionExecute(Sender: TObject);
120 procedure CloseActionExecute(Sender: TObject);
121 procedure UndoActionExecute(Sender: TObject);
122 procedure CutActionExecute(Sender: TObject);
123 procedure CopyActionExecute(Sender: TObject);
124 procedure PasteActionExecute(Sender: TObject);
125 procedure SendActionUpdate(Sender: TObject);
126 procedure SaveActionUpdate(Sender: TObject);
127 procedure CloseActionUpdate(Sender: TObject);
128 procedure UndoActionUpdate(Sender: TObject);
129 procedure CutActionUpdate(Sender: TObject);
130 procedure CopyActionUpdate(Sender: TObject);
131 procedure PasteActionUpdate(Sender: TObject);
132 procedure TopActionExecute(Sender: TObject);
133 procedure TopActionUpdate(Sender: TObject);
134 procedure SageCheckBoxClick(Sender: TObject);
135 procedure MailComboBoxChange(Sender: TObject);
136 procedure TransActionExecute(Sender: TObject);
137 procedure TransActionUpdate(Sender: TObject);
138 procedure IdLogDebugReceive(ASender: TIdConnectionIntercept;
140 procedure IdLogDebugSend(ASender: TIdConnectionIntercept;
142 procedure SelectAllActionExecute(Sender: TObject);
143 procedure StatusBarResize(Sender: TObject);
144 procedure Timer1Timer(Sender: TObject);
145 procedure FormActivate(Sender: TObject);
146 procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
147 procedure QuotePasteActionExecute(Sender: TObject);
148 procedure SpaceToNBSPActionExecute(Sender: TObject);
149 procedure AmpToCharRefActionExecute(Sender: TObject);
150 procedure BoardTopClick(Sender: TObject);
151 procedure GetSETTINGTXTActionExecute(Sender: TObject);
152 procedure GetheadtxtActionExecute(Sender: TObject);
153 procedure GetTitlePictureActionUpdate(Sender: TObject);
154 procedure GetTitlePictureActionExecute(Sender: TObject);
156 FThreadItem: TThreadItem;
158 FNameComboEdit: THandle;
159 FMailComboEdit: THandle;
162 FStatusCode: Integer;
163 FDebugStrReceive: string;
164 FDebugStrSend: string;
165 FSambaTime: TDateTime;
169 function RepHtml(s: string): string;
170 function Check: Boolean;
171 procedure SetNameList(sName, sMail: string);
172 // procedure Send(SendType: TGikoSendType; SPID: string; PON: string; FirstWriting: Boolean);
173 procedure Send(SPID: string; PON: string; FirstWriting: Boolean);
175 function GetActiveControlHandle: THandle;
176 // function GetSendData: string;
177 // procedure GetSendData(Source: TStringStream);
178 procedure GetSendData(Source: TStringStream);
179 procedure SaveSendFile;
180 procedure SetContent(Content: string);
181 function GetSPID(CookieLine: string): string;
182 function GetPON(CookieLine: string): string;
183 function GetResultType(ResponseText: string): TGikoResultType;
184 procedure ReadSambaTime(const AHost: string);
185 procedure WriteSambaTime(const AHost: string; ATime: TDateTime);
186 function ReadSettingTime(const AHost: string): Integer;
187 function CheckSambaTime(const AHost: string; ATime: TDateTime): Boolean;
188 procedure SetSamba24(AURL: string);
189 ///
\88ø
\97p
\95\84\82Ì
\8eæ
\93¾
190 function GetOEIndentChar : string;
191 ///
\96{
\95¶
\82Ì
\8eæ
\93¾
192 function GetBody : string;
193 //IdHttp
\82Ì
\8f\89\8aú
\89»
194 procedure InitIdHTTP(http: TIdHTTP);
195 procedure ShowBoardInformation(ABoard: TBoard; AMemo: TMemo);
196 function GetTitlePictureURL(body: TStringList; ABoard: TBoard): string;
197 procedure ShowTitlePicture();
199 procedure CreateParams(var Params: TCreateParams); override;
203 procedure SetThreadItem(Item: TThreadItem);
204 procedure SetBoard(Item: TBoard);
205 property BBSID: string read FBBSID write FBBSID;
214 CAPTION_NAME_NEW: string = '
\83M
\83R
\83i
\83r
\83X
\83\8c\97§
\82Ä
\83G
\83f
\83B
\83^';
215 CAPTION_NAME_RES: string = '
\83M
\83R
\83i
\83r
\83\8c\83X
\83G
\83f
\83B
\83^';
217 //
\83G
\83f
\83B
\83b
\83g
\83E
\83B
\83\93\83h
\83E
\82ð
\89E
\89º
\82É
\82¸
\82ç
\82µ
\82Ä
\8aJ
\82
\88Ú
\93®
\97Ê
221 //DAX
\82³
\82ñ±Ø¶ÞÄ!(
\81L
\81¤
\81M)
222 READCGI_ERR = '-ERR';
223 READCGI_INCR = '-INCR';
225 READCGI_PARTIAL = '+PARTIAL';
226 READCGI_ERR_FOUND_KAKO = '-ERR
\89ß
\8b\8e\83\8d\83O
\91q
\8cÉ
\82Å
\94
\8c©';
227 READCGI_ERR_NOT_HTML = '-ERR html
\89»
\91Ò
\82¿';
228 READCGI_ERR_NOT_FOUND = '-ERR
\82»
\82ñ
\82È
\94Âor
\83X
\83\8c\83b
\83h
\82È
\82¢
\82Å
\82·
\81B';
229 READCGI_ERR_ABONE = '-ERR
\82Ç
\82±
\82©
\82Å
\82 \82Ú
\81[
\82ñ
\82ª
\82 \82Á
\82½
\82Ý
\82½
\82¢
\82Å
\82·
\81B';
230 READCGI_ERR_TIMEOUT = '-ERR
\8ew
\92è
\8e\9e\8aÔ
\82ª
\89ß
\82¬
\82Ü
\82µ
\82½
\81B';
231 READCGI_ERR_CANTUSE = '-ERR
\82à
\82¤
\81@
\82Â
\82©
\82¦
\82Ü
\82¹
\82ñ';
232 RES2CH_TRUE = '<!-- 2ch_X:true -->';
233 RES2CH_FALSE = '<!-- 2ch_X:false -->';
234 RES2CH_ERROR = '<!-- 2ch_X:error -->';
235 RES2CH_CHECK = '<!-- 2ch_X:check -->';
236 RES2CH_COOKIE = '<!-- 2ch_X:cookie -->';
239 BBS2CH_NAME: string = '
\82Q
\82¿
\82á
\82ñ
\82Ë
\82é';
240 BBS2CH_LOG_FOLDER: string = '2ch';
241 EXTERNAL_LOG_FOLDER: string = 'exboard';
243 FOLDER_INI_FILENAME: string = 'Folder.ini';
244 FOLDER_INDEX_FILENAME: string = 'Folder.idx';
245 SUBJECT_FILENAME: string = 'subject.txt';
246 PATH_DELIM: string = '\';
251 StartPos, EndPos: Integer;
256 {constructor TEditorForm.Create(AOwner: TComponent; Item: TBoard);
258 inherited Create(AOwner);
261 procedure TEditorForm.CreateParams(var Params: TCreateParams);
264 if FormStyle in [fsNormal, fsStayOnTop] then
265 if BorderStyle in [bsSingle, bsSizeable] then begin
266 Params.ExStyle := Params.ExStyle or WS_EX_APPWINDOW;
267 Params.WndParent := 0;
271 {procedure TEditorForm.CreateParams(var Params: TCreateParams);
273 inherited CreateParams(Params);
274 Params.ExStyle := Params.ExStyle or WS_EX_APPWINDOW;
277 procedure TEditorForm.FormCreate(Sender: TObject);
279 wp: TWindowPlacement;
284 Browser.Navigate('about:blank');
289 //
\83E
\83B
\83\93\83h
\83E
\82Ì
\88Ê
\92u
\90Ý
\92è
290 wp.length := sizeof(wp);
291 wp.rcNormalPosition.Top := GikoSys.Setting.EditWindowTop;
292 wp.rcNormalPosition.Left := GikoSys.Setting.EditWindowLeft;
294 wp.rcNormalPosition.Bottom := GikoSys.Setting.EditWindowTop + GikoSys.Setting.EditWindowHeight;
295 wp.rcNormalPosition.Right := GikoSys.Setting.EditWindowLeft + GikoSys.Setting.EditWindowWidth;
296 wp.showCmd := SW_HIDE;
297 SetWindowPlacement(Handle, @wp);
299 if GikoSys.Setting.EditWindowMax then
300 WindowState := wsMaximized;
302 //
\83E
\83B
\83\93\83h
\83E
\82ª
\89æ
\96Ê
\8aO
\82È
\82ç
\89æ
\96Ê
\93à
\82É
\88Ú
\93®
\82·
\82é
303 if (Left + Width) > Screen.Width then
304 // Left := Screen.Width - Width;
306 if (Top + Height) > Screen.Height then
307 // Top := Screen.Height - Height;
314 //
\8c»
\8dÝ
\82Ì
\83E
\83B
\83\93\83h
\83E
\82Ì
\88Ê
\92u
\82ð
\95Û
\91¶
315 GikoSys.Setting.EditWindowTop := Top + WINDOWMOVE_V; //
\8e\9f\82É
\8aJ
\82
\83E
\83B
\83\93\83h
\83E
\82Í
316 GikoSys.Setting.EditWindowLeft := Left + WINDOWMOVE_H; //
\81@
\81@
\81@
\89E
\8eÎ
\82ß
\89º
\82É
\82¸
\82ç
\82·
317 //
\83E
\83B
\83\93\83h
\83E
\82Ì
\95\9d\82Æ
\8d\82\82³
\82ª
\8f¬
\82³
\82·
\82¬
\82¢
\82ê
\82Î
\8c³
\82É
\96ß
\82·
318 if GikoSys.Setting.EditWindowHeight < 144 then
320 if GikoSys.Setting.EditWindowWidth < 144 then
323 EditorPage.ActivePage := EditorTab;
324 FNameComboEdit := GetWindow(NameComboBox.Handle, GW_CHILD);
325 FMailComboEdit := GetWindow(MailComboBox.Handle, GW_CHILD);
326 NameComboBox.Items.Assign(GikoSys.Setting.NameList);
327 MailComboBox.Items.Assign(GikoSys.Setting.MailList);
332 hUser32 := LoadLibrary('User32.dll');
334 TransAction.Enabled := true
336 TransAction.Enabled := false;
338 TransAction.Enabled := false;
341 FreeLibrary(hUser32);
344 //
\83E
\83B
\83\93\83h
\83E
\82Ì
\83X
\83e
\83C
\8fó
\91Ô
345 if GikoSys.Setting.EditWindowStay then begin //
\83X
\83e
\83C
\8fó
\91Ô
346 SetWindowPos(Handle, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE + SWP_NOSIZE);
347 TopAction.Checked := true;
348 TopToolButton.Down := true;
349 end else begin //
\83X
\83e
\83C
\82µ
\82È
\82¢
350 SetWindowPos(Handle, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE + SWP_NOSIZE);
351 TopAction.Checked := false;
352 TopToolButton.Down := false;
355 //
\83E
\83B
\83\93\83h
\83E
\82Ì
\94¼
\93§
\96¾
\8fó
\91Ô
356 if(GikoSys.Setting.EditWindowTranslucent) and (TransAction.Enabled) then begin //
\94¼
\93§
\96¾
\81i
\83g
\83\89\83\93\83X
\83\8b\81[
\83Z
\83\93\83g
\81j
\8fó
\91Ô
358 TransAction.Checked := true;
359 TransToolButton.Down := true;
360 end else begin //
\95s
\93§
\96¾
362 TransAction.Checked := false;
363 TransToolButton.Down := false;
365 //
\94¼
\93§
\96¾
\8fó
\91Ô
\82Ì
\95Û
\91¶
366 GikoSys.Setting.EditWindowTranslucent := TransAction.Checked;
368 SpaceToNBSPAction.Checked := GikoSys.Setting.SpaceToNBSP;
369 AmpToCharRefAction.Checked := GikoSys.Setting.AmpToCharRef;
371 ini := TIniFile.Create(GikoSys.Setting.GetFileName);
374 BoardtopTab.TabVisible := ini.Readbool('EditorForm', 'BoardTopTab', False);
375 BoardTop.Checked := BoardtopTab.TabVisible;
382 procedure TEditorForm.SetBoard(Item: TBoard);
385 Caption := CAPTION_NAME_NEW + ' - [' + Item.Title + ']';
386 NameComboBox.Text := FBoard.KotehanName;
387 MailComboBox.Text := FBoard.KotehanMail;
388 SageCheckBox.Checked := AnsiPos('sage', MailComboBox.Text) <> 0;
389 TitlePanel.Visible := True;
391 ShowBoardInformation(FBoard, BoardInformationMemo);
395 procedure TEditorForm.SetThreadItem(Item: TThreadItem);
398 Caption := CAPTION_NAME_RES + ' - [' + FThreadItem.Title + ']';
399 NameComboBox.Text := FThreadItem.ParentBoard.KotehanName;
400 MailComboBox.Text := FThreadItem.ParentBoard.KotehanMail;
401 SageCheckBox.Checked := AnsiPos('sage', MailComboBox.Text) <> 0;
402 TitlePanel.Visible := False;
403 SetSamba24(FThreadItem.ParentBoard.URL);
404 ShowBoardInformation(FThreadItem.ParentBoard, BoardInformationMemo);
408 function TEditorForm.GetBody : string;
414 body := BodyEdit.Text;
415 if AmpToCharRefAction.Checked then
416 // &
\82Ì
\92u
\8a·
\82Í
\88ê
\94Ô
\8dÅ
\8f\89\82É
\82â
\82é
\82±
\82Æ
417 body := CustomStringReplace( body, '&', '&' );
418 if SpaceToNBSPAction.Checked then begin
419 body := CustomStringReplace( body, #09, ' ' );
420 body := CustomStringReplace( body, ' ', ' ' );
421 body := CustomStringReplace( body, ' ', ' ' );
422 regexp := TAWKStr.Create( nil );
424 regexp.RegExp := '^ ';
425 regexp.GSub( '\ ', body );
435 procedure TEditorForm.SetFont;
437 BodyEdit.Font.Name := GikoSys.Setting.EditorFontName;
438 BodyEdit.Font.Size := GikoSys.Setting.EditorFontSize;
439 BodyEdit.Font.Color := GikoSys.Setting.EditorFontColor;
440 BodyEdit.Color := GikoSys.Setting.EditorBackColor;
443 procedure TEditorForm.Preview;
456 if FThreadItem = nil then begin
458 Title := RepHtml(TitleEdit.Text);
460 No := IntToStr(FThreadItem.Count + 1);
461 Title := RepHtml(FThreadItem.Title);
466 Namae := RepHtml(NameComboBox.Text);
467 Mail := RepHtml(MailComboBox.Text);
468 Body := RepHtml(body);
469 Body := StringReplace(Body, #13#10, '<br>', [rfReplaceAll]);
470 DateTime := FormatDateTime('yyyy/mm/dd(aaa) hh:nn', now);
472 if Trim(Namae) = '' then
473 Namae := '
\96¼
\96³
\82µ
\82³
\82ñ';
475 s := '<HTML><HEAD>' + #13#10
476 + '<META http-equiv="Content-Type" content="text/html; charset=Shift_JIS">' + #13#10
477 + '<TITLE>' + title + '</TITLE>' + #13#10
478 // + '<STYLE><!--BODY{font-size : 9pt;font-family : "
\82l
\82r
\82o
\83S
\83V
\83b
\83N";}--></STYLE>' + #13#10
480 + '<BODY text="#000000" bgcolor="#EFEFEF" link="#0000FF" alink="#FF0000" vlink="#660099">' + #13#10
481 + '<FONT COLOR="#FF0000">' + title + '</FONT>' + #13#10
483 posTrip := AnsiPos( '#', Namae );
486 tripOrigin := Copy( Namae, posTrip + 1, Length( Namae ) );
488 Copy( Namae, 1, posTrip - 1 ) + '</B>
\81\9f' +
489 get_2ch_trip( PChar( tripOrigin ) ) + '<B>';
492 s := s + '<DT>' + No + '
\81F <FONT color="forestgreen"><B>' + Namae + '</B></FONT>
\81F ' + DateTime+ '<BR><DD>' + Body + '<BR><BR><BR>' + #13#10
494 s := s + '<DT>' + No + '
\81F <A href="mailto:' + Mail + '"><B>' + Namae + '</B></A> [' + Mail + ']
\81F ' + DateTime+ '<BR><DD>' + Body + '<BR><BR><BR>' + #13#10;
495 s := s + '</BODY></HTML>';
499 function TEditorForm.RepHtml(s: string): string;
501 // s := StringReplace(s, '&', '&', [rfReplaceAll]);
502 s := StringReplace(s, '<', '<', [rfReplaceAll]);
503 s := StringReplace(s, '>', '>', [rfReplaceAll]);
504 // s := StringReplace(s, ' ', ' ', [rfReplaceAll]); //
\8ed
\97l
\95Ï
\8dX
\82É
\82æ
\82è
\8eg
\97p
\95s
\89Â
505 s := StringReplace(s, '"', '"', [rfReplaceAll]);
509 procedure TEditorForm.EditorPageChange(Sender: TObject);
511 if EditorPage.ActivePage = PreviewTab then begin
514 Browser.Navigate('about:blank');
518 procedure TEditorForm.BrowserStatusTextChange(Sender: TObject;
519 const Text: WideString);
521 if EditorPage.ActivePage = PreviewTab then begin
522 StatusBar.Panels[0].Text := Text;
524 StatusBar.Panels[0].Text := '';
528 function TEditorForm.Check: Boolean;
535 if FThreadItem = nil then
538 Board := FThreadItem.ParentBoard;
540 if (not GikoSys.Setting.UseMachineTime) and
541 ((Board.LastGetTime = 0) or
542 (Board.LastGetTime = ZERO_DATE)) then begin
543 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
544 + '
\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¢';
545 MsgBox(Handle, Msg, '
\83G
\83\89\81[', MB_OK or MB_ICONSTOP);
547 end else if BodyEdit.Text = '' then begin
548 Msg := '
\96{
\95¶
\82ª
\93ü
\97Í
\82³
\82ê
\82Ä
\82¢
\82Ü
\82¹
\82ñ
\81B';
549 MsgBox(Handle, Msg, '
\83G
\83\89\81[', MB_OK or MB_ICONSTOP);
551 end else if (FBoard <> nil) and (Trim(TitleEdit.Text) = '') then begin
552 Msg := '
\83^
\83C
\83g
\83\8b\82ª
\93ü
\97Í
\82³
\82ê
\82Ä
\82¢
\82Ü
\82¹
\82ñ
\81B';
553 MsgBox(Handle, Msg, '
\83G
\83\89\81[', MB_OK or MB_ICONSTOP);
556 if (not GikoSys.Dolib.Connected) and (AnsiPos('
\81\9c', NameComboBox.Text) <> 0) then begin
557 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
558 + '
\82±
\82Ì
\82Ü
\82Ü
\91\97\90M
\82µ
\82Ä
\82à
\82æ
\82ë
\82µ
\82¢
\82Å
\82·
\82©
\81H';
559 rc := MsgBox(Handle, Msg, '
\8am
\94F', MB_YESNO or MB_ICONQUESTION);
560 Result := (rc = IDYES);
565 procedure TEditorForm.FormClose(Sender: TObject; var Action: TCloseAction);
570 procedure TEditorForm.FormDestroy(Sender: TObject);
572 wp: TWindowPlacement;
574 //
\8dÅ
\91å
\89»
\81E
\83E
\83B
\83\93\83h
\83E
\88Ê
\92u
\95Û
\91¶
575 wp.length := sizeof(wp);
576 GetWindowPlacement(Handle, @wp);
578 GikoSys.Setting.EditWindowTop := wp.rcNormalPosition.Top;
579 GikoSys.Setting.EditWindowLeft := wp.rcNormalPosition.Left;
580 GikoSys.Setting.EditWindowHeight := wp.rcNormalPosition.Bottom - wp.rcNormalPosition.Top;
581 GikoSys.Setting.EditWindowWidth := wp.rcNormalPosition.Right - wp.rcNormalPosition.Left;
582 GikoSys.Setting.EditWindowMax := WindowState = wsMaximized;
583 //GikoSys.Setting.EditWindowStay := FormStyle = fsStayOnTop; //
\83X
\83e
\83C
\8fó
\91Ô
\82Ì
\95Û
\91¶
584 GikoSys.Setting.EditWindowTranslucent := TransAction.Checked; //
\94¼
\93§
\96¾
\8fó
\91Ô
\82Ì
\95Û
\91¶
588 procedure TEditorForm.SetNameList(sName, sMail: string);
590 if Trim(sName) <> '' then begin
591 if GikoSys.Setting.NameList.IndexOf(sName) = -1 then
592 GikoSys.Setting.NameList.Insert(0, sName);
594 if Trim(sMail) <> '' then begin
595 if GikoSys.Setting.MailList.IndexOf(sMail) = -1 then
596 GikoSys.Setting.MailList.Insert(0, sMail);
600 function TEditorForm.GetActiveControlHandle: THandle;
602 if EditorPage.ActivePage = EditorTab then begin
603 if ActiveControl = NameComboBox then
604 Result := FNameComboEdit
605 else if ActiveControl = MailComboBox then
606 Result := FMailComboEdit
607 else if ActiveControl = BodyEdit then
608 Result := BodyEdit.Handle
609 else if ActiveControl = TitleEdit then
610 Result := TitleEdit.Handle
617 procedure TEditorForm.SetContent(Content: string);
621 if Browser.Document <> nil then begin
622 doc := Browser.Document;
625 doc.charset := 'Shift_JIS';
630 procedure TEditorForm.InitIdHTTP(http: TIdHTTP);
633 http.ProxyParams.BasicAuthentication := False;
634 if GikoSys.Setting.WriteProxy then begin
635 http.ProxyParams.ProxyServer := GikoSys.Setting.WriteProxyAddress;
636 http.ProxyParams.ProxyPort := GikoSys.Setting.WriteProxyPort;
637 http.ProxyParams.ProxyUsername := GikoSys.Setting.WriteProxyUserID;
638 http.ProxyParams.ProxyPassword := GikoSys.Setting.WriteProxyPassword;
639 if GikoSys.Setting.ReadProxyUserID <> '' then
640 http.ProxyParams.BasicAuthentication := True;
642 http.ProxyParams.ProxyServer := '';
643 http.ProxyParams.ProxyPort := 80;
644 http.ProxyParams.ProxyUsername := '';
645 http.ProxyParams.ProxyPassword := '';
647 Indy.Request.UserAgent := GikoSys.GetUserAgent;
648 Indy.Request.AcceptEncoding := '';
651 procedure TEditorForm.Send(SPID: string; PON: string; FirstWriting: Boolean);
653 TextStream: TStringStream;
654 Source: TStringStream;
655 ResponseText: string;
658 State: TGikoDownloadState;
659 ResultType: TGikoResultType;
664 //fusianasan
\83g
\83\89\83b
\83v by
\92è
\8aú
\95Ö
666 // SettingTxt: String;
673 Namae := RepHtml(NameComboBox.Text);
674 if FThreadItem = nil then
677 Board := FThreadItem.ParentBoard;
679 { Indy.Request.Clear;
680 Indy.ProxyParams.BasicAuthentication := False;
681 if GikoSys.Setting.WriteProxy then begin
682 Indy.ProxyParams.ProxyServer := GikoSys.Setting.WriteProxyAddress;
683 Indy.ProxyParams.ProxyPort := GikoSys.Setting.WriteProxyPort;
684 Indy.ProxyParams.ProxyUsername := GikoSys.Setting.WriteProxyUserID;
685 Indy.ProxyParams.ProxyPassword := GikoSys.Setting.WriteProxyPassword;
686 if GikoSys.Setting.ReadProxyUserID <> '' then
687 Indy.ProxyParams.BasicAuthentication := True;
689 Indy.ProxyParams.ProxyServer := '';
690 Indy.ProxyParams.ProxyPort := 80;
691 Indy.ProxyParams.ProxyUsername := '';
692 Indy.ProxyParams.ProxyPassword := '';
696 if FThreadItem = nil then begin
697 URL := FBoard.GetSendURL;
698 RefURL := GikoSys.UrlToServer(FBoard.URL) + 'test/bbs.cgi';
700 URL := FThreadItem.GetSendURL;
701 RefURL := FThreadItem.URL;
703 // Indy.Request.UserAgent := GikoSys.GetUserAgent;
704 Indy.Request.Referer := RefURL;
705 // Indy.Request.AcceptEncoding := '';
709 Cookie := Cookie + 'SPID=' + SPID + '; ';
711 Cookie := Cookie + 'PON=' + PON + '; ';
712 Cookie := 'Cookie: ' + Cookie + 'NAME=' + NameComboBox.Text + '; MAIL=' + MailComboBox.Text;
714 sysMenu := GetSystemMenu( Handle, false );
715 EnableMenuItem( sysMenu, SC_CLOSE, MF_GRAYED );
717 EnableMenuItem(SysMenu, SC_CLOSE, MF_BYCOMMAND or MF_ENABLED);
720 Indy.Request.CustomHeaders.Clear;
721 // Indy.Request.CacheControl := 'no-cache';
722 Indy.Request.CustomHeaders.Add('Pragma: no-cache');
723 Indy.Request.AcceptLanguage := 'ja';
724 Indy.Request.Accept := 'image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*';
725 Indy.Request.ContentType := 'application/x-www-form-urlencoded';
726 Indy.Request.CustomHeaders.Add(Cookie);
727 TextStream := TStringStream.Create('');
728 Source := TStringStream.Create('');
731 FDebugStrReceive := '';
734 Indy.Post(URL, Source, TextStream);
735 ResponseText := TextStream.DataString;
737 ResultType := GetResultType(ResponseText);
739 //MsgResult
\8f\89\8aú
\89»
741 //
\83t
\83V
\83A
\83i
\83g
\83\89\83b
\83v
\8cx
\8d\90(LocalMode) by
\92è
\8aú
\95Ö
742 if ((Namae = '
\8eR
\8dè
\8fÂ') or (Namae = 'fusianasan')) and (FirstWriting) then begin
745 '
\83\8a\83\82\81[
\83g
\83z
\83X
\83g
\82ð
\95\
\8e¦
\82·
\82é
\8b@
\94\
\82ª
\8eg
\82í
\82ê
\82Ä
\82¢
\82Ü
\82·' + #13#10 +
746 '
\82à
\82µ
\82à
\8aÔ
\88á
\82Á
\82Ä
\82±
\82Ì
\95û
\96@
\82Å
\83z
\83X
\83g
\82ª
\95\
\8e¦
\82³
\82ê
\82½
\82Æ
\82µ
\82Ä
\82à
\81A
\8e©
\8cÈ
\90Ó
\94C
\82È
\82Ì
\82Å
\8dí
\8f\9c\88Ë
\97\8a\82É
\82Í
\89\9e\82¶
\82Ü
\82¹
\82ñ
\81B' + #13#10#13#10 +
747 '
\90Ó
\94C
\82ð
\95\89\82¤
\82±
\82Æ
\82ð
\8f³
\91ø
\82µ
\82Ä
\8f\91\82«
\8d\9e\82Ý
\82Ü
\82·
\82©
\81H',
749 MB_YESNO or MB_ICONQUESTION);
750 if MsgResult = IDNO then begin
754 EnableMenuItem(SysMenu, SC_CLOSE, MF_BYCOMMAND or MF_ENABLED);
759 if ResultType = grtOK then begin
760 WriteSambaTime(FHost, Now());
761 State := gdsComplete;
762 end else if ResultType = grtCookie then begin
763 //
\83\8b\81[
\83v
\96h
\8e~
764 if not FirstWriting then
765 raise Exception.Create('');
768 '
\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 +
769 '
\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 +
770 '
\91S
\90Ó
\94C
\82ð
\95\89\82¤
\82±
\82Æ
\82ð
\8f³
\91ø
\82µ
\82Ä
\8f\91\82«
\8d\9e\82Ý
\82Ü
\82·
\82©
\81H',
772 MB_YESNO or MB_ICONQUESTION);
773 if MsgResult = IDYES then begin
774 Board.SPID := GetSPID(Indy.Response.RawHeaders.Values['Set-Cookie']);
775 Board.PON := GetPON(Indy.Response.RawHeaders.Values['Set-Cookie']);
776 if (Board.SPID = '') and (Board.PON = '') then
777 raise Exception.Create('');
778 //
\82à
\82¤
\88ê
\89ñ
\82±
\82Ì
\83\81\83\
\83b
\83h
779 Send(Board.SPID, Board.PON, False);
785 EnableMenuItem(SysMenu, SC_CLOSE, MF_BYCOMMAND or MF_ENABLED);
789 end else if ResultType = grtCheck then begin
791 //
\83\8b\81[
\83v
\96h
\8e~
792 if not FirstWriting then
793 raise Exception.Create('');
797 '
\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 +
798 '
\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 +
799 '
\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 +
800 '
\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 +
802 '
\91S
\90Ó
\94C
\82ð
\95\89\82¤
\82±
\82Æ
\82ð
\8f³
\91ø
\82µ
\82Ä
\8f\91\82«
\8d\9e\82Ý
\82Ü
\82·
\82©
\81H',
804 MB_YESNO or MB_ICONQUESTION);
806 if MsgResult = IDYES then begin
807 Board.SPID := GetSPID(Indy.Response.RawHeaders.Values['Set-Cookie']);
808 Board.PON := GetPON(Indy.Response.RawHeaders.Values['Set-Cookie']);
809 if (Board.SPID = '') and (Board.PON = '') then
810 raise Exception.Create('');
811 Send(Board.SPID, Board.PON, False);
814 EnableMenuItem(SysMenu, SC_CLOSE, MF_BYCOMMAND or MF_ENABLED);
822 WriteSambaTime(FHost, Now());
824 raise Exception.Create('');
828 on E: EIdConnectException do begin
830 ResponseText := '<html><body>'
831 + '<div>
\90Ú
\91±
\82ª
\8e¸
\94s
\82µ
\82Ü
\82µ
\82½<br>'
832 + '
\89ñ
\90ü
\82â
\83v
\83\8d\83L
\83V
\82Ì
\8fó
\91Ô
\82ð
\92²
\82×
\82Ä
\82
\82¾
\82³
\82¢<br></div>'
833 + '<br><br><div>' + E.Message + '</div>'
836 on E: Exception do begin
839 FDebugStrReceive := AnsiReplaceText(FDebugStrReceive, '<', '<');
840 FDebugStrReceive := AnsiReplaceText(FDebugStrReceive, '>', '>');
841 FDebugStrSend := AnsiReplaceText(FDebugStrSend, '<', '<');
842 FDebugStrSend := AnsiReplaceText(FDebugStrSend, '>', '>');
844 ResponseText := '<html><body>' + TextStream.DataString;
845 ResponseText := AnsiReplaceText(ResponseText, '</body>', '');
846 ResponseText := AnsiReplaceText(ResponseText, '</html>', '');
847 ResponseText := ResponseText + '<hr><div align="left"><pre>';
848 ResponseText := ResponseText + '<b>
\82±
\82±
\82©
\82ç
\83M
\83R
\83i
\83r
\82Ì
\8fî
\95ñ</b>'#13#10;
849 ResponseText := ResponseText + #13#10'
\81\9c\91\97\90M'#13#10;
850 ResponseText := ResponseText + FDebugStrSend;
851 ResponseText := ResponseText + #13#10'
\81\9c\8eó
\90M'#13#10;
852 ResponseText := ResponseText + FDebugStrReceive;
853 ResponseText := ResponseText + '</pre></div></body></html>';
856 FStatusCode := Indy.ResponseCode;
862 //sysMenu := GetSystemMenu( Handle, true );
863 EnableMenuItem(SysMenu, SC_CLOSE, MF_BYCOMMAND or MF_ENABLED);
867 //
\94ñ
\8cö
\8e®
\83M
\83R
\83i
\83r
\94Â
\82È
\82Ç
\82Ì
\83X
\83N
\83\8a\83v
\83g
\97p
868 //ResponceCode
\82ª302Found
\82Å
\8f\91\82«
\8d\9e\82Ý
\8a®
\97¹
869 if FStatusCode = 302 then begin
870 GikoForm.PlaySound('ResEnd');
872 if FThreadItem = nil then
873 GikoForm.AddMessageList(FBoard.Title + ' [
\90V
\83X
\83\8c\91\97\90M
\8fI
\97¹]', nil, gmiOK)
875 GikoForm.AddMessageList(FThreadItem.Title + ' [
\83\8c\83X
\91\97\90M
\8fI
\97¹]', nil, gmiOK);
879 if State = gdsComplete then begin
880 GikoForm.PlaySound('ResEnd');
882 if FThreadItem = nil then
883 GikoForm.AddMessageList(FBoard.Title + ' [
\90V
\83X
\83\8c\91\97\90M
\8fI
\97¹]', nil, gmiOK)
885 GikoForm.AddMessageList(FThreadItem.Title + ' [
\83\8c\83X
\91\97\90M
\8fI
\97¹]', nil, gmiOK);
887 end else if State = gdsError then begin
888 if FThreadItem = nil then
889 GikoForm.AddMessageList(FBoard.Title + ' [
\90V
\83X
\83\8c\91\97\90M
\8e¸
\94s]', nil, gmiNG)
891 GikoForm.AddMessageList(FThreadItem.Title + ' [
\83\8c\83X
\91\97\90M
\8e¸
\94s]', nil, gmiNG);
892 EditorPage.ActivePage := PreviewTab;
893 SetContent(ResponseText);
894 end else if State = gdsAbort then begin
895 GikoForm.AddMessageList(FThreadItem.Title + ' [
\92\86\92f]', nil, gmiSAD);
899 function TEditorForm.GetResultType(ResponseText: string): TGikoResultType;
901 if AnsiPos('
\8f\91\82«
\82±
\82Ý
\82ª
\8fI
\82í
\82è
\82Ü
\82µ
\82½', ResponseText) <> 0 then
903 else if (AnsiPos('
\83N
\83b
\83L
\81[
\82ª
\82È
\82¢
\82©
\8aú
\8cÀ
\90Ø
\82ê
\82Å
\82·', ResponseText) > 0) or
904 (AnsiPos('<title>
\83N
\83b
\83L
\81[
\8am
\94F
\81I</title>', ResponseText) > 0) or
905 (AnsiPos('<title>
\81¡
\83N
\83b
\83L
\81[
\8am
\94F
\81I
\81¡</title>', ResponseText) > 0) or
906 //(AnsiPos('
\83N
\83b
\83L
\81[
\8am
\94F', ResponseText) > 0) or
907 (AnsiPos(RES2CH_COOKIE, ResponseText) > 0) then
909 else if (AnsiPos('<font size=+2 color=#FF0000>
\8f\91\82«
\8d\9e\82Ý
\83`
\83F
\83b
\83N
\81I </font>', ResponseText) > 0) or
910 (AnsiPos('<title>
\81¡
\8f\91\82«
\8d\9e\82Ý
\8am
\94F
\82µ
\82Ü
\82·
\81¡</title>', ResponseText) > 0) or
911 (AnsiPos('<title>
\93\8a\8de
\8am
\94F</title>', ResponseText) > 0) or
912 (AnsiPos('<b>
\8f\91\82«
\82±
\82Ý
\8am
\94F</b>', ResponseText) > 0) or
913 (AnsiPos('="../test/subbbs.cgi">', ResponseText) > 0) or
914 (AnsiPos(RES2CH_FALSE, ResponseText) > 0) then
921 procedure TEditorForm.GetSendData(Source: TStringStream);
930 if FThreadItem = nil then
933 Board := FThreadItem.ParentBoard;
935 if GikoSys.Setting.UseMachineTime then begin
936 if GikoSys.Setting.TimeAdjust then
937 Adjust := Gikosys.Setting.TimeAdjustSec
939 Adjust := GikoSys.Setting.TimeAdjustSec * -1;
940 SendTime := GikoSys.DateTimeToInt(Now) - (9 * 60 * 60) + Adjust
942 if (Board.LastGetTime = 0) or (Board.LastGetTime = ZERO_DATE) then
943 SendTime := GikoSys.DateTimeToInt(Now)
945 SendTime := GikoSys.DateTimeToInt(Board.LastGetTime);
950 SessionID := GikoSys.Dolib.SessionID;
951 if SessionID <> '' then
952 s := 'sid=' + HttpEncode(SessionID) + '&'
956 + 'FROM=' + HttpEncode(NameComboBox.Text) + '&'
957 + 'mail=' + HttpEncode(MailComboBox.Text) + '&'
958 + 'MESSAGE=' + HttpEncode(body) + '&'
959 + 'bbs=' + Board.BBSID + '&'
960 + 'time=' + IntToStr(SendTime) + '&';
961 if FThreadItem = nil then begin
962 s := s + 'subject=' + HttpEncode(TitleEdit.Text) + '&';
963 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;
965 s := s + 'key=' + ChangeFileExt(FThreadItem.FileName, '') + '&';
966 s := s + 'submit=' + HttpEncode('
\8f\91\82«
\8d\9e\82Þ') + #13#10;
968 Source.WriteString(s);
971 procedure TEditorForm.SaveSendFile;
976 ini := TMemIniFile.Create(GikoSys.GetSentFileName);
978 sDate := IntToStr(GikoSys.DateTimeToInt(Now));
980 ini.WriteString(sDate, 'Name', NameComboBox.Text);
981 ini.WriteString(sDate, 'EMail', MailComboBox.Text);
982 ini.WriteString(sDate, 'Body', HttpEncode(BodyEdit.Text));
983 ini.WriteInteger(sDate, 'Status', FStatusCode);
984 ini.WriteDateTime(sDate, 'Date', Now);
985 if FThreadItem = nil then begin
986 ini.WriteString(sDate, 'Title', TitleEdit.Text);
987 ini.WriteString(sDate, 'BBS', FBoard.BBSID);
988 ini.WriteInteger(sDate, 'NewThread', 1);
990 ini.WriteString(sDate, 'Title', FThreadItem.Title);
991 ini.WriteString(sDate, 'BBS', FThreadItem.ParentBoard.BBSID);
992 ini.WriteString(sDate, 'Key', ChangeFileExt(FThreadItem.FileName, ''));
1001 procedure TEditorForm.SendActionExecute(Sender: TObject);
1005 state : TGikoDownloadState;
1012 SendAction.Enabled := False;
1013 Application.ProcessMessages;
1014 if not Check then Exit;
1016 if FThreadItem = nil then
1019 Board := FThreadItem.ParentBoard;
1021 if FThreadItem = nil then begin
1022 rc := GikoUtil.MsgBox(Handle,
1023 '
\81u' + Board.Title + '
\81v
\94Â
\82É
\90V
\82µ
\82¢
\83X
\83\8c\83b
\83h
\97§
\82Ä
\82Ü
\82·'#13#10#13#10
1024 + '
\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
1025 + '
\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
1026 + '
\81u
\82Í
\82¢
\81v
\82ð
\89\9f\82·
\82Æ
\91\97\90M
\82µ
\82Ü
\82·',
1028 MB_ICONQUESTION or MB_YESNO);
1029 if rc <> ID_YES then
1033 SetNameList(NameComboBox.Text, MailComboBox.Text);
1034 if KotehanCheckBox.Checked then begin
1035 Board.KotehanName := NameComboBox.Text;
1036 Board.KotehanMail := MailComboBox.Text;
1039 if Board.IsBoardPlugInAvailable then begin
1042 if FThreadItem = nil then begin
1043 //
\83X
\83\8c\97§
\82Ä
1044 state := TGikoDownloadState( Board.BoardPlugIn.CreateThread(
1045 DWORD( Board ), TitleEdit.Text, NameComboBox.Text, MailComboBox.Text, body ) );
1047 if state = gdsComplete then begin
1048 GikoForm.PlaySound('ResEnd');
1050 GikoForm.AddMessageList(FBoard.Title + ' [
\90V
\83X
\83\8c\91\97\90M
\8fI
\97¹]', nil, gmiOK);
1053 end else if State = gdsError then begin
1054 GikoForm.AddMessageList(FBoard.Title + ' [
\90V
\83X
\83\8c\91\97\90M
\8e¸
\94s]', nil, gmiNG);
1055 end else if State = gdsAbort then begin
1056 GikoForm.AddMessageList(FThreadItem.Title + ' [
\92\86\92f]', nil, gmiSAD);
1060 state := TGikoDownloadState( FThreadItem.BoardPlugIn.WriteThread(
1061 DWORD( FThreadItem ), NameComboBox.Text, MailComboBox.Text, body ) );
1063 if state = gdsComplete then begin
1064 GikoForm.PlaySound('ResEnd');
1066 GikoForm.AddMessageList(FThreadItem.Title + ' [
\83\8c\83X
\91\97\90M
\8fI
\97¹]', nil, gmiOK);
1069 end else if State = gdsError then begin
1070 GikoForm.AddMessageList(FThreadItem.Title + ' [
\83\8c\83X
\91\97\90M
\8e¸
\94s]', nil, gmiNG);
1071 end else if State = gdsAbort then begin
1072 GikoForm.AddMessageList(FThreadItem.Title + ' [
\92\86\92f]', nil, gmiSAD);
1076 if not Timer1.Enabled then
1077 Send(Board.SPID, Board.PON, True)
1079 if not CheckSambaTime(FHost, Now()) then begin
1080 rc := GikoUtil.MsgBox(Handle,
1081 'Samba24
\82Ì
\8bK
\92è
\92l
\96¢
\96\9e\82Ì
\95b
\90\94\82µ
\82©
\8co
\89ß
\82µ
\82Ä
\82¢
\82Ü
\82¹
\82ñ
\81B'#13#10
1082 + '
\91\97\90M
\82ð
\92\86\8e~
\82µ
\82Ü
\82·
\82©
\81H' + #13#10
1083 + '(
\81u
\82¢
\82¢
\82¦
\81v
\82¾
\82Æ
\91\97\90M
\82µ
\82Ü
\82·)', 'Samba24
\8cx
\8d\90',
1084 MB_YESNO or MB_ICONQUESTION);
1085 if rc = IDYES then begin
1090 Send(Board.SPID, Board.PON, True);
1095 if Timer1.Enabled then
1096 ReadSambaTime(FHost);
1100 procedure TEditorForm.SaveActionExecute(Sender: TObject);
1105 procedure TEditorForm.CloseActionExecute(Sender: TObject);
1110 procedure TEditorForm.UndoActionExecute(Sender: TObject);
1112 SendMessage(GetActiveControlHandle, WM_UNDO, 0, 0);
1115 procedure TEditorForm.CutActionExecute(Sender: TObject);
1117 SendMessage(GetActiveControlHandle, WM_CUT, 0, 0);
1120 procedure TEditorForm.CopyActionExecute(Sender: TObject);
1122 SendMessage(GetActiveControlHandle, WM_COPY, 0, 0);
1125 procedure TEditorForm.PasteActionExecute(Sender: TObject);
1127 SendMessage(GetActiveControlHandle, WM_PASTE, 0, 0);
1130 procedure TEditorForm.SelectAllActionExecute(Sender: TObject);
1132 SendMessage(GetActiveControlHandle, EM_SETSEL, 0, GetWindowTextLength(GetActiveControlHandle));
1135 procedure TEditorForm.TopActionExecute(Sender: TObject); //
\83E
\83B
\83\93\83h
\83E
\8dÅ
\91O
\96Ê(Stay)
\83{
\83^
\83\93\82Ì
\8f\88\97\9d
1137 if not (fsShowing in Self.FormState) then begin
1138 if TopAction.Checked then begin //
\83X
\83e
\83C
\8fó
\91Ô
\82É
\90Ý
\92è
1139 SetWindowPos(Handle, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE + SWP_NOSIZE);
1140 GikoSys.Setting.EditWindowStay := true;
1141 end else begin //
\83X
\83e
\83C
\8fó
\91Ô
\89ð
\8f\9c
1142 SetWindowPos(Handle, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE + SWP_NOSIZE);
1143 GikoSys.Setting.EditWindowStay := false;
1145 //
\83X
\83e
\83C
\8fó
\91Ô
\82Ì
\95Û
\91¶
1146 //GikoSys.Setting.EditWindowStay := FormStyle = fsStayOnTop;
1150 procedure TEditorForm.AbortActionExecute(Sender: TObject);
1155 procedure TEditorForm.SendActionUpdate(Sender: TObject);
1157 SendAction.Enabled := not FWork;
1160 procedure TEditorForm.SaveActionUpdate(Sender: TObject);
1162 SaveAction.Enabled := False;
1165 procedure TEditorForm.CloseActionUpdate(Sender: TObject);
1167 CloseAction.Enabled := not FWork;
1170 procedure TEditorForm.UndoActionUpdate(Sender: TObject);
1172 UndoAction.Enabled := (GetActiveControlHandle <> 0)
1173 and (SendMessage(GetActiveControlHandle, EM_CANUNDO, 0, 0) <> 0)
1177 procedure TEditorForm.CutActionUpdate(Sender: TObject);
1179 Selection: TSelection;
1182 AHandle := GetActiveControlHandle;
1183 SendMessage(AHandle, EM_GETSEL, Longint(@Selection.StartPos), Longint(@Selection.EndPos));
1184 CutAction.Enabled := (AHandle <> 0)
1185 and ((Selection.EndPos - Selection.StartPos) <> 0)
1189 procedure TEditorForm.CopyActionUpdate(Sender: TObject);
1191 Selection: TSelection;
1194 AHandle := GetActiveControlHandle;
1195 SendMessage(AHandle, EM_GETSEL, Longint(@Selection.StartPos), Longint(@Selection.EndPos));
1196 CopyAction.Enabled := (AHandle <> 0)
1197 and ((Selection.EndPos - Selection.StartPos) <> 0)
1201 procedure TEditorForm.PasteActionUpdate(Sender: TObject);
1203 PasteAction.Enabled := (GetActiveControlHandle <> 0)
1204 and (Clipboard.HasFormat(CF_TEXT))
1208 procedure TEditorForm.TopActionUpdate(Sender: TObject);
1210 TopAction.Enabled := not FWork;
1213 procedure TEditorForm.SageCheckBoxClick(Sender: TObject);
1215 if SageCheckBox.Checked then begin
1216 if AnsiPos('sage', MailComboBox.Text) = 0 then
1217 MailComboBox.Text := 'sage' + MailComboBox.Text;
1219 if AnsiPos('sage', MailComboBox.Text) <> 0 then
1220 MailComboBox.Text := StringReplace(MailComboBox.Text, 'sage', '', [rfReplaceAll]);
1224 procedure TEditorForm.MailComboBoxChange(Sender: TObject);
1226 if AnsiPos('sage', MailComboBox.Text) = 0 then
1227 SageCheckBox.Checked := False
1229 SageCheckBox.Checked := True;
1233 function TEditorForm.GetSPID(CookieLine: string): string;
1241 s := Trim(GikoSys.GetTokenIndex(CookieLine, ';', i));
1245 if Pos('SPID=', s) = 1 then begin
1246 Result := Trim(Copy(s, 6, Length(s)));
1254 function TEditorForm.GetPON(CookieLine: string): string;
1262 s := Trim(GikoSys.GetTokenIndex(CookieLine, ';', i));
1266 if Pos('PON=', s) = 1 then begin
1267 Result := Trim(Copy(s, 5, Length(s)));
1275 procedure TEditorForm.IdLogDebugReceive(ASender: TIdConnectionIntercept;
1278 StringStream: TStringStream;
1280 StringStream := TStringStream.Create('');
1282 StringStream.CopyFrom(AStream, AStream.Size);
1283 FDebugStrReceive := FDebugStrReceive + StringStream.DataString;
1289 procedure TEditorForm.IdLogDebugSend(ASender: TIdConnectionIntercept;
1292 StringStream: TStringStream;
1294 StringStream := TStringStream.Create('');
1296 StringStream.CopyFrom(AStream, AStream.Size);
1297 FDebugStrSend := FDebugStrSend + StringStream.DataString;
1303 procedure TEditorForm.TransActionExecute(Sender: TObject);
1305 AlphaBlend := TransAction.Checked;
1306 //
\94¼
\93§
\96¾
\8fó
\91Ô
\82Ì
\95Û
\91¶
1307 GikoSys.Setting.EditWindowTranslucent := TransAction.Checked;
1310 procedure TEditorForm.TransActionUpdate(Sender: TObject);
1312 TransAction.Enabled := not FWork;
1314 //StatusBar
\82ÌPanels[0]
\82Ì
\95\9d\82ð
\89Â
\95Ï
\81B
\8ec
\82è
\82ð
\8cÅ
\92è
\82É
\82·
\82é
1315 procedure TEditorForm.StatusBarResize(Sender: TObject);
1317 StatusBar.Panels[0].Width := StatusBar.Width
1318 - StatusBar.Panels[1].Width - StatusBar.Panels[2].Width;
1322 procedure TEditorForm.Timer1Timer(Sender: TObject);
1324 if FSambaTime = ZERO_DATE then
1325 StatusBar.Panels[1].Text := '
\8f\89\8f\91'
1327 FNow := IncMilliSecond(FNow, 500);
1328 StatusBar.Panels[1].Text := Format('%8.0f
\95b
\8co
\89ß', [SecondSpan(FNow, FSambaTime)]);
1332 //Samba.ini
\82Ì
\8f\91\82«
\8d\9e\82Ý
\8e\9e\8aÔ
\82ð
\93Ç
\82Ý
\8d\9e\82Þ
1333 procedure TEditorForm.ReadSambaTime(const AHost: string);
1338 Timer1.Enabled := false; //
\8co
\89ß
\95b
\90\94\95\
\8e¦Timer
\82ðOff
\82É
\82·
\82é
\81i
\82±
\82ê
\82ªON
\82Ì
\82Æ
\82«Samba24
\91Î
\8dôOn
\81j
1339 FNow := Now(); //
\8c»
\8dÝ
\8e\9e\8aÔ
\82ð
\8eæ
\93¾
\81iTimer
\95\
\8e¦
\97p
\82Å
\81ACheck
\82·
\82é
\82Æ
\82«
\82Í
\8dÄ
\82ÑNow()
\82ð
\8cÄ
\82Ô
\81j
1340 Timer1.Enabled := true; //
\8co
\89ß
\95b
\90\94\95\
\8e¦Timer
\82ðOn
\82É
\82·
\82é
\81i
\82±
\82ê
\82ªON
\82Ì
\82Æ
\82«Samba24
\91Î
\8dôOn
\81j
1341 ini := TMemIniFile.Create(GikoSys.GetSambaFileName);
1343 //
\95¶
\8e\9a\97ñ
\82Å
\93Ç
\82Ý
\8eæ
\82Á
\82Ä
\81A
\95Ï
\8a·
\8aÖ
\90\94\82ÅTDateTime
\82Ö
1344 tmp := ini.ReadString('Send', AHost, DateTimeToStr(ZERO_DATE));
1345 FSambaTime := ConvertDateTimeString(tmp);
1350 //Samba.ini
\82É
\8dÅ
\8fI
\8f\91\82«
\8d\9e\82Ý
\8e\9e\8aÔ
\82ð
\8f\91\82«
\8d\9e\82Þ
1351 procedure TEditorForm.WriteSambaTime(const AHost: string; ATime: TDateTime);
1355 ini := TMemIniFile.Create(GikoSys.GetSambaFileName);
1357 ini.WriteDateTime('Send', AHost, ATime);
1363 //
\8dÅ
\8fI
\8f\91\82«
\8d\9e\82Ý
\8e\9e\8aÔ
\82Æ
\8c»
\8dÝ
\8e\9e\82ð
\94ä
\8ar
\82·
\82é
\81i
\90^
\81F
\8bK
\92è
\92l
\88È
\8fã
\81@
\8bU
\81F
\8bK
\92è
\92l
\96¢
\96\9e\81j
1364 function TEditorForm.CheckSambaTime(const AHost: string; ATime: TDateTime): Boolean;
1367 SettingTime: Integer;
1369 SettingTime := ReadSettingTime(AHost);
1370 ReadSambaTime(AHost);
1371 pastsec := SecondSpan(ATime, FSambaTime);
1372 if pastsec > SettingTime then
1377 //AHost
\81i
\8eI
\96¼
\81j
\82ÌSamba
\82Ì
\8bK
\92è
\92l
\82ð
\93Ç
\82Ý
\8d\9e\82Þ
1378 function TEditorForm.ReadSettingTime(const AHost: string): Integer;
1382 ini := TMemIniFile.Create(GikoSys.GetSambaFileName);
1384 Result := ini.ReadInteger('Setting', AHost, 0);
1385 //
\8bK
\92è
\92l
\82ª
\82O
\82Ì
\82Æ
\82«
\81A
\82à
\82µ
\82
\82Í
\90Ý
\92è
\82³
\82ê
\82Ä
\82¢
\82È
\82¢
\82Æ
\82«
\82Í
\81A
\83t
\83@
\83C
\83\8b\82É
\8f\91\82«
\82½
\82·
\81B
1386 if Result = 0 then begin
1387 ini.WriteInteger('Setting', AHost, 0);
1394 //Form
\82ªActive
\82É
\82È
\82Á
\82½
\82ç
\8dÅ
\8fI
\8f\91\82«
\8d\9e\82Ý
\8e\9e\8aÔ
\82ð
\93Ç
\82Ý
\8d\9e\82Þ
1395 procedure TEditorForm.FormActivate(Sender: TObject);
1397 if ( Timer1.Enabled ) and ( FThreadItem <> nil )then
1398 ReadSambaTime(FHost);
1400 //Samba24
\91Î
\8dô
\82ð
\8eg
\82¤
\82©
\82Ç
\82¤
\82©
\8c\88\82ß
\82é
\8aÖ
\90\94
1401 //ReadSambaTime
\82ð
\8cÄ
\82Ñ
\8fo
\82·
\82ÆTimer
\82ªOn
\82É
\82È
\82é
1402 procedure TEditorForm.SetSamba24(AURL: string);
1404 Protocol, Host, Path, Document, Port, Bookmark : string;
1406 //Samba24
\91Î
\8dô
\82ð
\82µ
\82È
\82¢
\82È
\82ç
\8fI
\97¹
1407 if not GikoSys.Setting.UseSamba then
1409 //Host
\82ÌURL
\82É'.2ch.'
\82©'.bbspink.'
\82ª
\8aÜ
\82Ü
\82ê
\82Ä
\82¢
\82½
\82çSamba24
\91Î
\8dô
\82ð
\82·
\82é
1410 GikoSys.ParseURI( AURL, Protocol,Host, Path, Document, Port, Bookmark );
1411 if GikoSys.Is2chHost(Host) then begin
1412 Host := Copy(Host, 1, AnsiPos('.', Host) - 1);
1413 FHost := Host; //FHost=
\8eI
\96¼
1414 ReadSambaTime(FHost); //
\88È
\91O
\82Ì
\8f\91\82«
\8d\9e\82Ý
\8e\9e\8aÔ
\82ð
\93Ç
\82Ý
\8d\9e\82Þ
1415 //StatusBar
\82É
\82±
\82Ì
\8eI
\82Ì
\8bK
\92è
\92l
\82ð
\95\
\8e¦
\82·
\82é
1416 StatusBar.Panels[2].Text := 'Samba24
\8bK
\92è
\92l' + IntToStr(ReadSettingTime(FHost));
1419 procedure TEditorForm.FormCloseQuery(Sender: TObject;
1420 var CanClose: Boolean);
1422 CanClose := not FWork;
1425 function TEditorForm.GetOEIndentChar : string;
1428 Identities : string;
1431 DEFAULT_CHAR = '> ';
1432 OE_MAIL_PATH = '\Software\Microsoft\Outlook Express\5.0\Mail';
1433 INDENT_CHAR = 'Indent Char';
1436 Result := DEFAULT_CHAR;
1437 regKey := TRegistry.Create;
1440 regKey.RootKey := HKEY_CURRENT_USER;
1441 if not regKey.OpenKey( 'Identities', False ) then
1443 Identities := regKey.ReadString( 'Default User ID' );
1444 if Identities = '' then
1446 if not regKey.OpenKey( Identities + OE_MAIL_PATH, False ) then
1448 IndentChar := regKey.ReadInteger( INDENT_CHAR );
1449 Result := Char( IndentChar ) + ' ';
1458 procedure TEditorForm.QuotePasteActionExecute(Sender: TObject);
1465 quote := GetOEIndentChar;
1466 s := TStringList.Create;
1468 s.Text := Clipboard.AsText;
1470 for i := s.Count - 1 downto 0 do
1471 s[ i ] := quote + s[ i ];
1473 BodyEdit.SelText := s.Text;
1480 procedure TEditorForm.SpaceToNBSPActionExecute(Sender: TObject);
1482 GikoSys.Setting.SpaceToNBSP := SpaceToNBSPAction.Checked;
1483 if EditorPage.ActivePage = PreviewTab then
1487 procedure TEditorForm.AmpToCharRefActionExecute(Sender: TObject);
1489 GikoSys.Setting.AmpToCharRef := AmpToCharRefAction.Checked;
1490 if EditorPage.ActivePage = PreviewTab then
1494 procedure TEditorForm.BoardTopClick(Sender: TObject);
1498 ini := TIniFile.Create(GikoSys.Setting.GetFileName);
1500 BoardtopTab.TabVisible := BoardTop.Checked;
1501 ini.WriteBool('EditorForm', 'BoardTopTab', BoardtopTab.TabVisible);
1508 procedure TEditorForm.GetSETTINGTXTActionExecute(Sender: TObject);
1510 URL, RefURL: string;
1511 settingBody: TStringList;
1515 if FThreadItem = nil then
1518 tmpBoard := FThreadItem.ParentBoard;
1520 if tmpBoard = nil then Exit;
1522 RefURL := tmpBoard.URL;
1523 if RefURL[Length(RefURL)] <> '/' then
1524 URL := RefURL + '/' + 'SETTING.TXT'
1526 URL := RefURL + 'SETTING.TXT';
1528 Indy.Request.LastModified := tmpBoard.SETTINGTXTTime;
1529 Indy.Request.Referer := RefURL;
1530 Screen.Cursor := crHourGlass;
1531 settingBody := TStringList.Create;
1533 StatusBar.Panels[0].Text := 'SETTING.TXT
\83_
\83E
\83\93\83\8d\81[
\83h
\92\86';
1534 settingBody.Text := Indy.Get(URL);
1535 if( Indy.ResponseCode = 200 ) then begin
1536 settingBody.SaveToFile(tmpBoard.GetSETTINGTXTFileName);
1537 tmpBoard.SETTINGTXTTime := Indy.Response.LastModified;
1538 tmpBoard.IsSETTINGTXT := true;
1539 tmpBoard.TitlePictureURL := GetTitlePictureURL(settingBody, tmpBoard);
1540 tmpBoard.Modified := true;
1543 StatusBar.Panels[0].Text := 'SETTING.TXT (' + IntToStr(Indy.ResponseCode) + ')';
1545 Screen.Cursor := crDefault;
1547 ShowBoardInformation(tmpBoard, BoardInformationMemo);
1550 procedure TEditorForm.GetheadtxtActionExecute(Sender: TObject);
1552 URL, RefURL: string;
1553 settingBody: TStringList;
1557 if FThreadItem = nil then
1560 tmpBoard := FThreadItem.ParentBoard;
1562 if tmpBoard = nil then Exit;
1564 RefURL := tmpBoard.URL;
1565 if RefURL[Length(RefURL)] <> '/' then
1566 URL := RefURL + '/' + 'head.txt'
1568 URL := RefURL + 'head.txt';
1570 Indy.Request.LastModified := tmpBoard.HEADTXTTime;
1571 Indy.Request.Referer := RefURL;
1572 Screen.Cursor := crHourGlass;
1573 settingBody := TStringList.Create;
1575 StatusBar.Panels[0].Text := 'head.txt
\83_
\83E
\83\93\83\8d\81[
\83h
\92\86';
1576 settingBody.Text := Indy.Get(URL);
1577 if( Indy.ResponseCode = 200 ) then begin
1578 settingBody.SaveToFile(tmpBoard.GETHEADTXTFileName);
1579 tmpBoard.HEADTXTTime := Indy.Response.LastModified;
1580 tmpBoard.IsHEADTXT := true;
1581 tmpBoard.Modified := true;
1584 StatusBar.Panels[0].Text := 'head.txt (' + IntToStr(Indy.ResponseCode) + ')';
1586 Screen.Cursor := crDefault;
1588 ShowBoardInformation(tmpBoard, BoardInformationMemo);
1591 procedure TEditorForm.ShowBoardInformation(ABoard: TBoard; AMemo: TMemo);
1596 AMemo.Lines.Add('[head.txt]');
1597 if ABoard.IsHEADTXT then begin
1598 if FileExists(ABoard.GETHEADTXTFileName) then begin
1599 AMemo.Lines.Add(DateTimeToStr(ABoard.HEADTXTTime) + '
\8dX
\90V');
1600 body := TStringList.Create;
1602 body.LoadFromFile(ABoard.GETHEADTXTFileName);
1603 CustomStringReplace(body, '<br>', '', true);
1604 AMemo.Lines.AddStrings(body);
1609 ABoard.IsHEADTXT := false;
1610 ABoard.HEADTXTTime := ZERO_DATE;
1611 AMemo.Lines.Add('Local
\82É
\95Û
\91¶
\82³
\82ê
\82½head.txt
\82ª
\8c©
\82Â
\82©
\82è
\82Ü
\82¹
\82ñ');
1612 AMemo.Lines.Add('
\83\81\83j
\83\85\81[
\82æ
\82è
\8dÄ
\8eæ
\93¾
\82µ
\82Ä
\82
\82¾
\82³
\82¢
\81B');
1615 AMemo.Lines.Add('head.txt
\82ð
\8eæ
\93¾
\82µ
\82Ä
\82¢
\82Ü
\82¹
\82ñ
\81B');
1616 AMemo.Lines.Add('
\83\81\83j
\83\85\81[
\82æ
\82è
\8eæ
\93¾
\82µ
\82Ä
\82
\82¾
\82³
\82¢
\81B');
1619 AMemo.Lines.Add(#13#10 + '[SETTING.TXT]');
1620 if ABoard.IsSETTINGTXT then begin
1621 if FileExists(ABoard.GetSETTINGTXTFileName) then begin
1622 AMemo.Lines.Add(DateTimeToStr(ABoard.SETTINGTXTTime) + '
\8dX
\90V');
1623 body := TStringList.Create;
1625 body.LoadFromFile(ABoard.GetSETTINGTXTFileName);
1626 AMemo.Lines.AddStrings(body);
1631 ABoard.IsSETTINGTXT := false;
1632 ABoard.SETTINGTXTTime := ZERO_DATE;
1633 AMemo.Lines.Add('Local
\82É
\95Û
\91¶
\82³
\82ê
\82½SETTING.TXT
\82ª
\8c©
\82Â
\82©
\82è
\82Ü
\82¹
\82ñ');
1634 AMemo.Lines.Add('
\83\81\83j
\83\85\81[
\82æ
\82è
\8dÄ
\8eæ
\93¾
\82µ
\82Ä
\82
\82¾
\82³
\82¢
\81B');
1637 AMemo.Lines.Add('SETTING.TXT
\82ð
\8eæ
\93¾
\82µ
\82Ä
\82¢
\82Ü
\82¹
\82ñ
\81B');
1638 AMemo.Lines.Add('
\83\81\83j
\83\85\81[
\82æ
\82è
\8eæ
\93¾
\82µ
\82Ä
\82
\82¾
\82³
\82¢
\81B');
1641 function TEditorForm.GetTitlePictureURL(body: TStringList; ABoard: TBoard): string;
1642 //BBS_TITLE_PICTURE=
1649 for i := 0 to body.Count - 1 do begin
1650 if (AnsiPos('BBS_TITLE_PICTURE=', body[i]) > 0) or
1651 (AnsiPos('BBS_FIGUREHEAD=', body[i]) > 0) then begin
1653 Delete(tmp, 1, AnsiPos('=', tmp));
1654 if AnsiPos('../', tmp) > 0 then begin
1655 CustomStringReplace(tmp, '../', GikoSys.UrlToServer(ABoard.URL));
1663 procedure TEditorForm.GetTitlePictureActionUpdate(Sender: TObject);
1665 if FThreadItem = nil then
1666 GetTitlePictureAction.Enabled := FBoard.IsSETTINGTXT
1668 GetTitlePictureAction.Enabled := FThreadItem.ParentBoard.IsSETTINGTXT;
1672 procedure TEditorForm.GetTitlePictureActionExecute(Sender: TObject);
1674 memStream: TMemoryStream;
1678 memStream := TMemoryStream.Create;
1680 if FThreadItem = nil then
1683 tmpBoard := FThreadItem.ParentBoard;
1685 Indy.Request.Referer := tmpBoard.URL;
1686 if tmpBoard.TitlePictureURL <> '' then begin
1687 StatusBar.Panels[0].Text := '
\94ÂTOP
\89æ
\91\9c\83_
\83E
\83\93\83\8d\81[
\83h
\92\86';
1688 Screen.Cursor := crHourGlass;
1689 Indy.Get(tmpBoard.TitlePictureURL, memStream);
1690 if Indy.ResponseCode = 200 then begin
1691 memStream.SaveToFile(tmpBoard.GetTitlePictureFileName);
1693 tmpBoard.Modified := true;
1697 Screen.Cursor := crDefault;
1698 StatusBar.Panels[0].Text := '
\94ÂTOP
\89æ
\91\9c (' + IntToStr(Indy.ResponseCode) + ')';
1703 procedure TEditorForm.ShowTitlePicture();
1707 if FThreadItem = nil then
1710 tmpBoard := FThreadItem.ParentBoard;
1712 if FileExists(tmpBoard.GetTitlePictureFileName) then begin
1713 TitlePictureBrowser.Navigate(tmpBoard.GetTitlePictureFileName);
1715 TitlePictureBrowser.Navigate('about:blank');