SHDocVw_TLB,
MSHTML_TLB,
{$IFEND}
- ActiveX, {HTTPApp,} YofUtils, Trip, IniFiles, StrUtils,
+ ActiveX, {HTTPApp,} YofUtils, IniFiles, StrUtils,
GikoSystem, GikoUtil, ImgList, Clipbrd, BoardGroup,
IdAntiFreezeBase, IdAntiFreeze, IdBaseComponent, IdComponent,
IdTCPConnection, IdTCPClient, IdHTTP, ActnList, StdActns, IdIntercept,
- IdLogBase, IdLogDebug, IdException, DateUtils, MojuUtils, bmRegExp;
+ IdLogBase, IdLogDebug, IdException, DateUtils, bmRegExp,
+ Gesture, AppEvnts, SambaTimer;
type
// TSetLayeredWindowAttributes = function(wnd: HWND; crKey: DWORD; bAlpha: BYTE; dwFlag: DWORD): Boolean; stdcall;
N02: TMenuItem;
ToolBarImageList: TImageList;
HotToobarImageList: TImageList;
- BodyEdit: TMemo;
NameBasePanel: TPanel;
NameLabel: TLabel;
MailLabel: TLabel;
SelectAllAction: TAction;
N2: TMenuItem;
SelectAll1: TMenuItem;
- Timer1: TTimer;
QuotePasteAction: TAction;
QuotePasteMenuItem: TMenuItem;
C1: TMenuItem;
HeadTXT1: TMenuItem;
RocalRuleTab: TTabSheet;
WebBrowser1: TWebBrowser;
- CalcCapasityAction: TAction;
+ CalcCapacityAction: TAction;
N4: TMenuItem;
N5: TMenuItem;
- Rule: TMenuItem;
+ LocalRule: TMenuItem;
LocalEdit: TMemo;
+ N6: TMenuItem;
+ LocalRuleBrowse: TMenuItem;
+ ToolButton4: TToolButton;
+ ToolButton6: TToolButton;
+ SaveNameMailAction: TAction;
+ ToolButton7: TToolButton;
+ BeLogInOutEAction: TAction;
+ UpdateSambaAction: TAction;
+ Samba241: TMenuItem;
+ N7: TMenuItem;
+ InputAssistAction: TAction;
+ InputAssistPopupMenu: TPopupMenu;
+ BodyEdit: TMemo;
+ ApplicationEvents1: TApplicationEvents;
+ ToolButton8: TToolButton;
+ ToolButton9: TToolButton;
+ ShowInputAssistForm: TAction;
+ ReleaseCookieAction: TAction;
+ Cookie1: TMenuItem;
+ ContinueModeAction: TAction;
+ ToolButton10: TToolButton;
+ ToolButton11: TToolButton;
+ OpenSendTargetAction: TAction;
+ ReloadTargetAction: TAction;
+ N8: TMenuItem;
+ N9: TMenuItem;
+ N10: TMenuItem;
procedure EditorPageChange(Sender: TObject);
procedure FormCreate(Sender: TObject);
AStream: TStream);
procedure SelectAllActionExecute(Sender: TObject);
procedure StatusBarResize(Sender: TObject);
- procedure Timer1Timer(Sender: TObject);
procedure FormActivate(Sender: TObject);
procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
procedure QuotePasteActionExecute(Sender: TObject);
procedure GetTitlePictureActionUpdate(Sender: TObject);
procedure GetTitlePictureActionExecute(Sender: TObject);
procedure GetHeadTXTActionExecute(Sender: TObject);
- procedure CalcCapasityActionExecute(Sender: TObject);
- procedure RuleClick(Sender: TObject);
+ procedure CalcCapacityActionExecute(Sender: TObject);
+ procedure LocalRuleClick(Sender: TObject);
procedure FormDeactivate(Sender: TObject);
+ procedure LocalRuleBrowseClick(Sender: TObject);
+ procedure SaveNameMailActionExecute(Sender: TObject);
+ procedure BeLogInOutEActionExecute(Sender: TObject);
+ procedure BeLogInOutEActionUpdate(Sender: TObject);
+ procedure UpdateSambaActionUpdate(Sender: TObject);
+ procedure UpdateSambaActionExecute(Sender: TObject);
+ procedure InputAssistActionExecute(Sender: TObject);
+ procedure ApplicationEvents1Message(var Msg: tagMSG;
+ var Handled: Boolean);
+ procedure ShowInputAssistFormExecute(Sender: TObject);
+ procedure ReleaseCookieActionExecute(Sender: TObject);
+ procedure GetSETTINGTXTActionUpdate(Sender: TObject);
+ procedure GetHeadTXTActionUpdate(Sender: TObject);
+ procedure ContinueModeActionExecute(Sender: TObject);
+ procedure ContinueModeActionUpdate(Sender: TObject);
+ procedure OpenSendTargetActionExecute(Sender: TObject);
+ procedure ReloadTargetActionExecute(Sender: TObject);
private
FThreadItem: TThreadItem;
FBoard: TBoard;
FStatusCode: Integer;
FDebugStrReceive: string;
FDebugStrSend: string;
- FSambaTime: TDateTime;
- FHost: string;
FNow: TDateTime;
+ FInputAssistKey: String; ///< \93ü\97Í\83A\83V\83X\83g\82Ì\83L\81[
+ FResistWords: TStringList; ///< \93ü\97Í\83A\83V\83X\83g\82Ì\8e«\8f\91\82©\82ç\82Ì\8c\9f\8dõ\8c\8b\89Ê
+ FSambaTimer: TSambaTimer; ///< Samba\91Î\8dô\82Ì\83^\83C\83}\81[
procedure Preview;
- function RepHtml(s: string): string;
function Check: Boolean;
procedure SetNameList(sName, sMail: string);
-// procedure Send(SendType: TGikoSendType; SPID: string; PON: string; FirstWriting: Boolean);
- procedure Send(SPID: string; PON: string; FirstWriting: Boolean);
-
+ procedure Send(const ACOOKIE: string; const SPID: string; const PON: string; FirstWriting: Boolean);
function GetActiveControlHandle: THandle;
-// function GetSendData: string;
-// procedure GetSendData(Source: TStringStream);
procedure GetSendData(Source: TStringStream);
procedure SaveSendFile;
procedure SetContent(Content: string; ABrowser: TWebBrowser);
- function GetSPID(CookieLine: string): string;
- function GetPON(CookieLine: string): string;
function GetResultType(ResponseText: string): TGikoResultType;
- procedure ReadSambaTime(const AHost: string);
- procedure WriteSambaTime(const AHost: string; ATime: TDateTime);
- function ReadSettingTime(const AHost: string): Integer;
- function CheckSambaTime(const AHost: string; ATime: TDateTime): Boolean;
- procedure SetSamba24(AURL: string);
- /// \88ø\97p\95\84\82Ì\8eæ\93¾
- function GetOEIndentChar : string;
/// \96{\95¶\82Ì\8eæ\93¾
function GetBody : string;
//IdHttp\82Ì\8f\89\8aú\89»
procedure OnGestureMove(Sender: TObject);
//! \83}\83E\83X\83W\83F\83X\83`\83\83\81[\8fI\97¹
procedure OnGestureEnd(Sender: TObject);
- //HEAD.TXT\8e©\93®\95\\8e¦
- procedure ShowBoardHead(ABoard: TBoard; AMemo: TMemo);
+ //HEAD.TXT\8e©\93®\95\\8e¦
+ procedure ShowBoardHead(ABoard: TBoard; AMemo: TMemo);
+ //LocalFusianaTrapAlart
+ function LFusianaGet(const s: String): Boolean;
+ // Cookie\82Ì\8eæ\93¾
+ procedure GetCookie(Rawtext: String; ABoard: TBoard);
+ // hidden\83f\81[\83^\8eæ\93¾
+ procedure GetHiddenParameter(Rawtext: String; ABoard: TBoard);
+ //! \93ü\97Í\83A\83V\83X\83g\82Ì\83|\83b\83v\83A\83b\83v\83\81\83j\83\85\81[\82Ì\83N\83\8a\83b\83N\83C\83x\83\93\83g
+ procedure InputAssistMenuClick(Sender: TObject);
+ //! TMemo\82Ì\83J\81[\83\\83\8b\88Ê\92u\82É\95¶\8e\9a\97ñ\91}\93ü
+ procedure InsertText(Memo: TMemo; Text: String);
+ //! \91\97\90M\92\86\8e~
+ procedure CancelSend(ABoard: TBoard; ASysMenu: HMENU);
+ //! Samba\83^\83C\83}\81[\83C\83x\83\93\83g
+ procedure SambaTimer(Sender: TObject);
+ //! \83E\83B\83\93\83h\83E\82Ì\88Ê\92u\82Æ\83T\83C\83Y\82Ì\90Ý\92è
+ procedure SetWindowRect;
+ //! \8ag\92£\83^\83u\90Ý\92è
+ procedure SetExtraTab;
+ //! \94Â\8eæ\93¾
+ function GetBoard : TBoard;
+ //! URL\82Ì\83f\81[\83^\82ðstream\82É\8eæ\82è\8d\9e\82Þ
+ procedure GetWebData(const URL: string; const RefURL: string;
+ Modified: TDateTime; stream: TStream);
+ //! GikoForm\82É\90V\92\85\83\81\83b\83Z\81[\83W\82ð\92Ç\89Á\82·\82é
+ procedure AddFormMessageNew(icon: TGikoMessageIcon);
+ //! \83\8d\81[\83J\83\8bfusiana\83g\83\89\83b\83v
+ function isLocalFusianaTrap: Boolean;
+ //! \83\8d\81[\83J\83\8bfusiana\83g\83\89\83b\83v
+ function isRemoteFusianaTrap: Boolean;
+ //! Header\95¶\8e\9a\97ñ\8eæ\93¾
+ function getHeaderStr(const ACOOKIE: string; const SPID : string;
+ const PON : string; Board : TBoard) : string;
+ //! fusiana\8cx\8d\90\83_\83C\83A\83\8d\83O
+ function FusianaMsgBox: Integer;
+ //! sent.ini\83t\83@\83C\83\8b\82Ì\90¶\90¬
+ function CreateSentIniFile: TMemIniFile;
protected
procedure CreateParams(var Params: TCreateParams); override;
public
- FBBSID: String;
+ FBBSID: String;
procedure SetFont;
procedure SetThreadItem(Item: TThreadItem);
procedure SetBoard(Item: TBoard);
- property BBSID: string read FBBSID write FBBSID;
-
+ procedure UpdateSambaStatus;
+ property BBSID: string read FBBSID write FBBSID;
end;
implementation
uses
- Giko, ItemDownload, Gesture;
+ Giko, ItemDownload, MojuUtils, IdGlobal, GikoMessage, Imm,
+ InputAssistDataModule, InputAssist, HTMLCreate;
const
CAPTION_NAME_NEW: string = '\83M\83R\83i\83r \83X\83\8c\97§\82Ä\83G\83f\83B\83^';
CAPTION_NAME_RES: string = '\83M\83R\83i\83r \83\8c\83X\83G\83f\83B\83^';
- // \83G\83f\83B\83b\83g\83E\83B\83\93\83h\83E\82ð\89E\89º\82É\82¸\82ç\82µ\82Ä\8aJ\82\88Ú\93®\97Ê
- WINDOWMOVE_H = 30;
- WINDOWMOVE_V = 30;
+ // \83G\83f\83B\83b\83g\83E\83B\83\93\83h\83E\82ð\89E\89º\82É\82¸\82ç\82µ\82Ä\8aJ\82\88Ú\93®\97Ê
+ WINDOWMOVE_H = 30;
+ WINDOWMOVE_V = 30;
//DAX\82³\82ñ±Ø¶ÞÄ!(\81L\81¤\81M)
READCGI_ERR = '-ERR';
RES2CH_CHECK = '<!-- 2ch_X:check -->';
RES2CH_COOKIE = '<!-- 2ch_X:cookie -->';
-
- BBS2CH_NAME: string = '\82Q\82¿\82á\82ñ\82Ë\82é';
- BBS2CH_LOG_FOLDER: string = '2ch';
- EXTERNAL_LOG_FOLDER: string = 'exboard';
-
- FOLDER_INI_FILENAME: string = 'Folder.ini';
- FOLDER_INDEX_FILENAME: string = 'Folder.idx';
- SUBJECT_FILENAME: string = 'subject.txt';
- PATH_DELIM: string = '\';
-
-
type
TSelection = record
StartPos, EndPos: Integer;
end;}
procedure TEditorForm.FormCreate(Sender: TObject);
-var
- wp: TWindowPlacement;
- hUser32 : HINST;
- ini: TIniFile;
begin
FWork := False;
+ FSambaTimer := TSambaTimer.Create(Self);
+ FSambaTimer.Interval := 0;
Browser.Navigate('about:blank');
TitlePictureBrowser.Navigate('about:blank');
+ WebBrowser1.Navigate('about:blank');
FBoard := nil;
FThreadItem := nil;
//\83E\83B\83\93\83h\83E\82Ì\88Ê\92u\90Ý\92è
- wp.length := sizeof(wp);
- wp.rcNormalPosition.Top := GikoSys.Setting.EditWindowTop;
- wp.rcNormalPosition.Left := GikoSys.Setting.EditWindowLeft;
-
- wp.rcNormalPosition.Bottom := GikoSys.Setting.EditWindowTop + GikoSys.Setting.EditWindowHeight;
- wp.rcNormalPosition.Right := GikoSys.Setting.EditWindowLeft + GikoSys.Setting.EditWindowWidth;
- wp.showCmd := SW_HIDE;
- SetWindowPlacement(Handle, @wp);
-
- if GikoSys.Setting.EditWindowMax then
- WindowState := wsMaximized;
-
- //\83E\83B\83\93\83h\83E\82ª\89æ\96Ê\8aO\82È\82ç\89æ\96Ê\93à\82É\88Ú\93®\82·\82é
- if (Left + Width) > Screen.Width then
-// Left := Screen.Width - Width;
- Left := 0;
- if (Top + Height) > Screen.Height then
-// Top := Screen.Height - Height;
- Top := 0;
- if Left < 0 then
- Left := 0;
- if Top < 0 then
- Top := 0;
-
- //\8c»\8dÝ\82Ì\83E\83B\83\93\83h\83E\82Ì\88Ê\92u\82ð\95Û\91¶
- GikoSys.Setting.EditWindowTop := Top + WINDOWMOVE_V; // \8e\9f\82É\8aJ\82\83E\83B\83\93\83h\83E\82Í
- GikoSys.Setting.EditWindowLeft := Left + WINDOWMOVE_H; // \81@\81@\81@\89E\8eÎ\82ß\89º\82É\82¸\82ç\82·
- //\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·
- if GikoSys.Setting.EditWindowHeight < 144 then
- Height := 400;
- if GikoSys.Setting.EditWindowWidth < 144 then
- Width := 640;
+ SetWindowRect;
EditorPage.ActivePage := EditorTab;
FNameComboEdit := GetWindow(NameComboBox.Handle, GW_CHILD);
NameComboBox.Items.Assign(GikoSys.Setting.NameList);
MailComboBox.Items.Assign(GikoSys.Setting.MailList);
SetFont;
- hUser32 := 0;
- try
- try
- hUser32 := LoadLibrary('User32.dll');
- if hUser32 <> 0 then
- TransAction.Enabled := true
- else
- TransAction.Enabled := false;
- except
- TransAction.Enabled := false;
- end;
- finally
- FreeLibrary(hUser32);
- end;
+ // \94¼\93§\96¾\97\98\97p\89Â\94\\90Ý\92è
+ TransAction.Enabled := GikoSys.CanUser32DLL;
// \83E\83B\83\93\83h\83E\82Ì\83X\83e\83C\8fó\91Ô
if GikoSys.Setting.EditWindowStay then begin // \83X\83e\83C\8fó\91Ô
SpaceToNBSPAction.Checked := GikoSys.Setting.SpaceToNBSP;
AmpToCharRefAction.Checked := GikoSys.Setting.AmpToCharRef;
+ // \83\8d\81[\83J\83\8b\83\8b\81[\83\8b\81{\94Â\83g\83b\83v\89æ\91\9c\82Ì\83^\83u\82Ì\90Ý\92è
+ SetExtraTab;
- ini := TIniFile.Create(GikoSys.Setting.GetFileName);
-
- try
- BoardtopTab.TabVisible := ini.Readbool('EditorForm', 'BoardTopTab', False);
- BoardTop.Checked := BoardtopTab.TabVisible;
- RocalRuleTab.TabVisible := ini.Readbool('EditorForm', 'RocalRureTab', False);
- HeadTXT1.Checked := RocalRuleTab.TabVisible;
- finally
- ini.Free;
- end;
-
- // \83}\83E\83X\83W\83F\83X\83`\83\83\81[\82Ì\83C\83\93\83X\83g\81[\83\8b
- if GikoSys.Setting.GestureEnabled then begin
- MouseGesture.UnHook;
- MouseGesture.OnGestureStart := OnGestureStart;
- MouseGesture.OnGestureMove := OnGestureMove;
- MouseGesture.OnGestureEnd := OnGestureEnd;
- MouseGesture.SetHook( Handle );
- end;
-
+ // \83L\81[\90Ý\92è\82Ì\93Ç\82Ý\8d\9e\82Ý
+ GikoSys.LoadKeySetting(ActionList, GikoSys.GetEditorKeyFileName);
+ SaveNameMailAction.Checked := True;
end;
-
procedure TEditorForm.SetBoard(Item: TBoard);
begin
FBoard := Item;
MailComboBox.Text := FBoard.KotehanMail;
SageCheckBox.Checked := AnsiPos('sage', MailComboBox.Text) <> 0;
TitlePanel.Visible := True;
- SetSamba24(FBoard.URL);
+
+ if (FSambaTimer.SetBoard(FBoard) >= 0) then begin
+ UpdateSambaStatus;
+ FNow := Now();
+ FSambaTimer.OnTimer := SambaTimer;
+ end;
+
ShowBoardInformation(FBoard, BoardInformationMemo);
ShowTitlePicture();
end;
MailComboBox.Text := FThreadItem.ParentBoard.KotehanMail;
SageCheckBox.Checked := AnsiPos('sage', MailComboBox.Text) <> 0;
TitlePanel.Visible := False;
- SetSamba24(FThreadItem.ParentBoard.URL);
+
+ if (FSambaTimer.SetBoard(FThreadItem.ParentBoard) >= 0) then begin
+ UpdateSambaStatus;
+ FNow := Now();
+ FSambaTimer.OnTimer := SambaTimer;
+ end;
+
ShowBoardInformation(FThreadItem.ParentBoard, BoardInformationMemo);
ShowTitlePicture();
end;
No: string;
Mail: string;
Namae: string;
- DateTime: string;
Body: string;
s: string;
-
- posTrip : Integer;
- tripOrigin : string;
begin
if FThreadItem = nil then begin
No := '1';
- Title := RepHtml(TitleEdit.Text);
+ Title := THTMLCreate.RepHtml(TitleEdit.Text);
end else begin
No := IntToStr(FThreadItem.Count + 1);
- Title := RepHtml(FThreadItem.Title);
+ Title := THTMLCreate.RepHtml(FThreadItem.Title);
end;
- body := GetBody;
- Namae := RepHtml(NameComboBox.Text);
- Mail := RepHtml(MailComboBox.Text);
- Body := RepHtml(body);
- Body := StringReplace(Body, #13#10, '<br>', [rfReplaceAll]);
- DateTime := FormatDateTime('yyyy/mm/dd(aaa) hh:nn', now);
+ Body := GetBody;
+ Namae := THTMLCreate.RepHtml(NameComboBox.Text);
+ Mail := THTMLCreate.RepHtml(MailComboBox.Text);
+ Body := THTMLCreate.RepHtml(Body);
+ Body := CustomStringReplace(Body, #13#10, '<br>', False);
+
if Trim(Namae) = '' then
Namae := '\96¼\96³\82µ\82³\82ñ';
- s := '<HTML><HEAD>' + #13#10
- + '<META http-equiv="Content-Type" content="text/html; charset=Shift_JIS">' + #13#10
- + '<TITLE>' + title + '</TITLE>' + #13#10
-// + '<STYLE><!--BODY{font-size : 9pt;font-family : "\82l\82r \82o\83S\83V\83b\83N";}--></STYLE>' + #13#10
- + '</HEAD>' + #13#10
- + '<BODY text="#000000" bgcolor="#EFEFEF" link="#0000FF" alink="#FF0000" vlink="#660099">' + #13#10
- + '<FONT COLOR="#FF0000">' + title + '</FONT>' + #13#10
- + '<DL>' + #13#10;
- posTrip := AnsiPos( '#', Namae );
- if posTrip > 0 then
- begin
- tripOrigin := Copy( Namae, posTrip + 1, Length( Namae ) );
- Namae :=
- Copy( Namae, 1, posTrip - 1 ) + '</B> \81\9f' +
- get_2ch_trip( PChar( tripOrigin ) ) + '<B>';
- end;
- if Mail = '' then
- s := s + '<DT>' + No + ' \81F <FONT color="forestgreen"><B>' + Namae + '</B></FONT> \81F ' + DateTime+ '<BR><DD>' + Body + '<BR><BR><BR>' + #13#10
- else
- s := s + '<DT>' + No + ' \81F <A href="mailto:' + Mail + '"><B>' + Namae + '</B></A> [' + Mail + ']\81F ' + DateTime+ '<BR><DD>' + Body + '<BR><BR><BR>' + #13#10;
- s := s + '</BODY></HTML>';
+ s := THTMLCreate.CreatePreviewHTML(Title, No, Mail, Namae, Body);
+
SetContent(s, Browser);
end;
-function TEditorForm.RepHtml(s: string): string;
-begin
-// s := StringReplace(s, '&', '&', [rfReplaceAll]);
- s := StringReplace(s, '<', '<', [rfReplaceAll]);
- s := StringReplace(s, '>', '>', [rfReplaceAll]);
-// s := StringReplace(s, ' ', ' ', [rfReplaceAll]); //\8ed\97l\95Ï\8dX\82É\82æ\82è \8eg\97p\95s\89Â
- s := StringReplace(s, '"', '"', [rfReplaceAll]);
- Result := s;
-end;
-
procedure TEditorForm.EditorPageChange(Sender: TObject);
var
tmpBoard: TBoard;
begin
- if FThreadItem = nil then
- tmpBoard := FBoard
- else
- tmpBoard := FThreadItem.ParentBoard;
+
+ tmpBoard := GetBoard;
if tmpBoard = nil then Exit;
if EditorPage.ActivePage = PreviewTab then begin
Preview;
end else if EditorPage.ActivePage = RocalRuleTab then begin
+ if not FileExists(tmpBoard.GETHEADTXTFileName) then begin
+ LocalEdit.Text := '\83\8d\81[\83J\83\8b\83\8b\81[\83\8b\96¢\8eæ\93¾';
+ Exit;
+ end;
ShowBoardHead(tmpBoard, LocalEdit);
end else begin
Browser.Navigate('about:blank');
end;
function TEditorForm.Check: Boolean;
+const
+ REQUIRED: string = '\82ª\93ü\97Í\82³\82ê\82Ä\82¢\82Ü\82¹\82ñ\81B';
+ ERROR: string = '\83G\83\89\81[';
var
Msg: string;
rc: Integer;
Board: TBoard;
begin
Result := True;
- if FThreadItem = nil then
- Board := FBoard
- else
- Board := FThreadItem.ParentBoard;
+
+ Board := GetBoard;
if (not GikoSys.Setting.UseMachineTime) and
((Board.LastGetTime = 0) or
(Board.LastGetTime = ZERO_DATE)) then begin
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
+ '\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¢';
- MsgBox(Handle, Msg, '\83G\83\89\81[', MB_OK or MB_ICONSTOP);
+ MsgBox(Handle, Msg, ERROR, MB_OK or MB_ICONSTOP);
Result := False;
end else if BodyEdit.Text = '' then begin
- Msg := '\96{\95¶\82ª\93ü\97Í\82³\82ê\82Ä\82¢\82Ü\82¹\82ñ\81B';
- MsgBox(Handle, Msg, '\83G\83\89\81[', MB_OK or MB_ICONSTOP);
+ Msg := '\96{\95¶' + REQUIRED;
+ MsgBox(Handle, Msg, ERROR, MB_OK or MB_ICONSTOP);
Result := False;
end else if (FBoard <> nil) and (Trim(TitleEdit.Text) = '') then begin
- Msg := '\83^\83C\83g\83\8b\82ª\93ü\97Í\82³\82ê\82Ä\82¢\82Ü\82¹\82ñ\81B';
- MsgBox(Handle, Msg, '\83G\83\89\81[', MB_OK or MB_ICONSTOP);
+ Msg := '\83^\83C\83g\83\8b' + REQUIRED;
+ MsgBox(Handle, Msg, ERROR, MB_OK or MB_ICONSTOP);
Result := False;
end else begin
if (not GikoSys.Dolib.Connected) and (AnsiPos('\81\9c', NameComboBox.Text) <> 0) then begin
var
wp: TWindowPlacement;
begin
+ FSambaTimer.Free;
+
//\8dÅ\91å\89»\81E\83E\83B\83\93\83h\83E\88Ê\92u\95Û\91¶
wp.length := sizeof(wp);
GetWindowPlacement(Handle, @wp);
procedure TEditorForm.SetNameList(sName, sMail: string);
begin
- if Trim(sName) <> '' then begin
- if GikoSys.Setting.NameList.IndexOf(sName) = -1 then
- GikoSys.Setting.NameList.Insert(0, sName);
- end;
- if Trim(sMail) <> '' then begin
- if GikoSys.Setting.MailList.IndexOf(sMail) = -1 then
- GikoSys.Setting.MailList.Insert(0, sMail);
+ if SaveNameMailAction.Checked then begin
+ if Trim(sName) <> '' then begin
+ if GikoSys.Setting.NameList.IndexOf(sName) = -1 then
+ GikoSys.Setting.NameList.Insert(0, sName);
+ end;
+ if Trim(sMail) <> '' then begin
+ if GikoSys.Setting.MailList.IndexOf(sMail) = -1 then
+ GikoSys.Setting.MailList.Insert(0, sMail);
+ end;
end;
end;
Result := BoardInformationMemo.Handle
else
Result := 0;
+ end else if Editorpage.ActivePage = RocalRuleTab then begin
+ if ActiveCOntrol = LocalEdit then
+ Result := LocalEdit.Handle
+ else
+ Result := 0;
end else
Result := 0;
end;
procedure TEditorForm.SetContent(Content: string; ABrowser: TWebBrowser);
var
- doc: Variant;
+ doc: OleVariant;
begin
- if ABrowser.Document <> nil then begin
- doc := Idispatch( olevariant(ABrowser.ControlInterface).Document) as IHTMLDocument2;
+ if Assigned(ABrowser.ControlInterface.Document) then begin
+ doc := OleVariant(ABrowser.Document);
doc.Clear;
doc.open;
doc.charset := 'Shift_JIS';
Indy.Request.UserAgent := GikoSys.GetUserAgent;
Indy.Request.AcceptEncoding := '';
end;
+//! \91\97\90M\92\86\8e~\82Ì\82½\82ß\82Ì\83\81\83j\83\85\81[\82Ì\8dÄ\90¶
+procedure TEditorForm.CancelSend(ABoard: TBoard; ASysMenu: HMENU);
+begin
+ ABoard.SPID := '';
+ ABoard.PON := '';
+ FWork := false;
+ EnableMenuItem(ASysMenu, SC_CLOSE, MF_BYCOMMAND or MF_ENABLED);
+ DrawMenuBar(Handle);
+end;
-procedure TEditorForm.Send(SPID: string; PON: string; FirstWriting: Boolean);
+procedure TEditorForm.Send( const ACOOKIE: string; const SPID: string;
+ const PON: string; FirstWriting: Boolean);
var
TextStream: TStringStream;
Source: TStringStream;
ResponseText: string;
URL: string;
- RefURL: string;
State: TGikoDownloadState;
ResultType: TGikoResultType;
MsgResult: Integer;
- Cookie: string;
Board: TBoard;
sysMenu : HMENU;
- //fusianasan\83g\83\89\83b\83v by\92è\8aú\95Ö
- Namae: String;
-// SettingTxt: String;
-// RefeURL: string;
-// RuleURL: String;
-// RuleTxt: String;
-// Name: String;
-// SettingBody: TStringList;
-// tmpBoard: TBoard;
+ {Protocol,Host, Path, Document, Port, Bookmark : String;}
begin
FAbort := False;
State := gdsError;
- Namae := RepHtml(NameComboBox.Text);
- if FThreadItem = nil then
- Board := FBoard
- else
- Board := FThreadItem.ParentBoard;
+ Board := GetBoard;
InitIdHTTP(Indy);
if FThreadItem = nil then begin
URL := FBoard.GetSendURL;
- RefURL := GikoSys.UrlToServer(FBoard.URL) + 'test/bbs.cgi';
+ Indy.Request.Referer := GikoSys.UrlToServer(FBoard.URL) + 'test/bbs.cgi';
end else begin
URL := FThreadItem.GetSendURL;
- RefURL := FThreadItem.URL;
+ Indy.Request.Referer := FThreadItem.URL;
end;
-// Indy.Request.UserAgent := GikoSys.GetUserAgent;
- Indy.Request.Referer := RefURL;
-// Indy.Request.AcceptEncoding := '';
-
- Cookie := '';
- if SPID <> '' then
- Cookie := Cookie + 'SPID=' + SPID + '; ';
- if PON <> '' then
- Cookie := Cookie + 'PON=' + PON + '; ';
- Cookie := 'Cookie: ' + Cookie + 'NAME=' + NameComboBox.Text + '; MAIL=' + MailComboBox.Text;
sysMenu := GetSystemMenu( Handle, false );
EnableMenuItem( sysMenu, SC_CLOSE, MF_GRAYED );
Indy.Request.AcceptLanguage := 'ja';
Indy.Request.Accept := 'image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*';
Indy.Request.ContentType := 'application/x-www-form-urlencoded';
- Indy.Request.CustomHeaders.Add(Cookie);
+ Indy.Request.CustomHeaders.Add(getHeaderStr(ACOOKIE, SPID, PON, Board));
TextStream := TStringStream.Create('');
Source := TStringStream.Create('');
try
try
FDebugStrReceive := '';
FDebugStrSend := '';
+
+ if (FirstWriting) then begin
+ //\83t\83V\83A\83i\83g\83\89\83b\83v\8cx\8d\90(LocalMode) by \92è\8aú\95Ö
+ if (isLocalFusianaTrap) then begin
+ CancelSend( Board, SysMenu );
+ Exit;
+ end;
+ //\83t\83V\83A\83i\83g\83\89\83b\83v\8cx\8d\90(Remote)
+ if (isRemoteFusianaTrap) then begin
+ CancelSend( Board, SysMenu );
+ Exit;
+ end;
+ end;
+
GetSendData(Source);
- Indy.Post(URL, Source, TextStream);
+ IdAntiFreeze.Active := True;
+ try
+ Indy.Post(URL, Source, TextStream);
+ finally
+ IdAntiFreeze.Active := False;
+ end;
ResponseText := TextStream.DataString;
ResultType := GetResultType(ResponseText);
- //MsgResult\8f\89\8aú\89»
- MsgResult := IDNO;
- //\83t\83V\83A\83i\83g\83\89\83b\83v\8cx\8d\90(LocalMode) by \92è\8aú\95Ö
- if ((Namae = '\8eR\8dè\8fÂ') or (Namae = 'fusianasan')) and (FirstWriting) then begin
- MsgResult := MsgBox(
- Handle,
- '\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 +
- '\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 +
- '\90Ó\94C\82ð\95\89\82¤\82±\82Æ\82ð\8f³\91ø\82µ\82Ä\8f\91\82«\8d\9e\82Ý\82Ü\82·\82©\81H',
- '\8fî\95ñ',
- MB_YESNO or MB_ICONQUESTION);
- if MsgResult = IDNO then begin
- Board.SPID := '';
- Board.PON := '';
- FWork := false;
- EnableMenuItem(SysMenu, SC_CLOSE, MF_BYCOMMAND or MF_ENABLED);
- DrawMenuBar(Handle);
- Exit;
- end;
- end;
if ResultType = grtOK then begin
- WriteSambaTime(FHost, Now());
+ if (GikoSys.Setting.UseSamba) and (FSambaTimer.Enabled) then
+ begin
+ FSambaTimer.WriteSambaTime(Now());
+ end;
State := gdsComplete;
end else if ResultType = grtCookie then begin
//\83\8b\81[\83v\96h\8e~
if not FirstWriting then
raise Exception.Create('');
- MsgResult := MsgBox(
- Handle,
- '\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 +
- '\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 +
- '\91S\90Ó\94C\82ð\95\89\82¤\82±\82Æ\82ð\8f³\91ø\82µ\82Ä\8f\91\82«\8d\9e\82Ý\82Ü\82·\82©\81H',
- '\8fî\95ñ',
- MB_YESNO or MB_ICONQUESTION);
+
+ MsgResult := MsgBox( Handle,
+ '\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 +
+ '\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 +
+ '\91S\90Ó\94C\82ð\95\89\82¤\82±\82Æ\82ð\8f³\91ø\82µ\82Ä\8f\91\82«\8d\9e\82Ý\82Ü\82·\82©\81H',
+ '\8fî\95ñ',
+ MB_YESNO or MB_ICONQUESTION);
+
if MsgResult = IDYES then begin
- Board.SPID := GetSPID(Indy.Response.RawHeaders.Values['Set-Cookie']);
- Board.PON := GetPON(Indy.Response.RawHeaders.Values['Set-Cookie']);
- if (Board.SPID = '') and (Board.PON = '') then
+ GetCookie(Indy.Response.RawHeaders.Text, Board);
+ if (Board.Is2ch) then begin
+ GetHiddenParameter(ResponseText, Board);
+ end;
+
+ if (Board.SPID = '') and (Board.PON = '') and (Board.Cookie = '') then
raise Exception.Create('');
+
//\82à\82¤\88ê\89ñ\82±\82Ì\83\81\83\\83b\83h
- Send(Board.SPID, Board.PON, False);
+ Send(Board.Cookie, Board.SPID, Board.PON, False);
Exit;
end else begin
- Board.SPID := '';
- Board.PON := '';
- FWork := false;
- EnableMenuItem(SysMenu, SC_CLOSE, MF_BYCOMMAND or MF_ENABLED);
- DrawMenuBar(Handle);
+ CancelSend( Board, SysMenu );
Exit;
end;
end else if ResultType = grtCheck then begin
- //
//\83\8b\81[\83v\96h\8e~
if not FirstWriting then
raise Exception.Create('');
- MsgResult := MsgBox(
- Handle,
- '\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 +
- '\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 +
- '\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 +
- '\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 +
- #13#10 +
- '\91S\90Ó\94C\82ð\95\89\82¤\82±\82Æ\82ð\8f³\91ø\82µ\82Ä\8f\91\82«\8d\9e\82Ý\82Ü\82·\82©\81H',
- '\8am\94F',
- MB_YESNO or MB_ICONQUESTION);
+ MsgResult := MsgBox( Handle,
+ '\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 +
+ '\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 +
+ '\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 +
+ '\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 +
+ #13#10 +
+ '\91S\90Ó\94C\82ð\95\89\82¤\82±\82Æ\82ð\8f³\91ø\82µ\82Ä\8f\91\82«\8d\9e\82Ý\82Ü\82·\82©\81H',
+ '\8am\94F',
+ MB_YESNO or MB_ICONQUESTION);
if MsgResult = IDYES then begin
- Board.SPID := GetSPID(Indy.Response.RawHeaders.Values['Set-Cookie']);
- Board.PON := GetPON(Indy.Response.RawHeaders.Values['Set-Cookie']);
- if (Board.SPID = '') and (Board.PON = '') then
+ GetCookie(Indy.Response.RawHeaders.Text, Board);
+ if (Board.Is2ch) then begin
+ GetHiddenParameter(ResponseText, Board);
+ end;
+
+ if (Board.SPID = '') and (Board.PON = '') and (Board.Cookie = '') then
raise Exception.Create('');
- Send(Board.SPID, Board.PON, False);
+
+ Send(Board.Cookie, Board.SPID, Board.PON, False);
Exit;
end else begin
- EnableMenuItem(SysMenu, SC_CLOSE, MF_BYCOMMAND or MF_ENABLED);
- DrawMenuBar(Handle);
- Board.SPID := '';
- Board.PON := '';
- FWork := false;
+ CancelSend( Board, SysMenu );
Exit;
- end;
+ end;
end else begin
- WriteSambaTime(FHost, Now());
+ if (GikoSys.Setting.UseSamba) and (FSambaTimer.Enabled) then
+ begin
+ FSambaTimer.WriteSambaTime(Now());
+ end;
+
State := gdsError;
raise Exception.Create('');
end;
-
except
on E: EIdConnectException do begin
State := gdsError;
DrawMenuBar(Handle);
end;
FWork := false;
- //\94ñ\8cö\8e®\83M\83R\83i\83r\94Â\82È\82Ç\82Ì\83X\83N\83\8a\83v\83g\97p
- //ResponceCode\82ª302Found\82Å\8f\91\82«\8d\9e\82Ý\8a®\97¹
- if FStatusCode = 302 then begin
- GikoForm.PlaySound('ResEnd');
- SaveSendFile;
- if FThreadItem = nil then
- GikoForm.AddMessageList(FBoard.Title + ' [\90V\83X\83\8c\91\97\90M\8fI\97¹]', nil, gmiOK)
- else
- GikoForm.AddMessageList(FThreadItem.Title + ' [\83\8c\83X\91\97\90M\8fI\97¹]', nil, gmiOK);
- Close;
- Exit;
+ //\94ñ\8cö\8e®\83M\83R\83i\83r\94Â\82È\82Ç\82Ì2ch\8cÝ\8a·\83X\83N\83\8a\83v\83g\97p
+ //2ch\88È\8aO\82Å\82©\82ÂResponceCode\82ª302Found\82Å\8f\91\82«\8d\9e\82Ý\8a®\97¹
+ //if (not Board.Is2ch) and (FStatusCode = 302) then begin
+ if FStatusCode = 302 then begin
+ GikoForm.PlaySound('ResEnd');
+ SaveSendFile;
+ AddFormMessageNew( gmiOK );
+ if (not ContinueModeAction.Enabled) or (not ContinueModeAction.Checked) then begin
+ Close;
+ Exit;
end;
+ end;
if State = gdsComplete then begin
GikoForm.PlaySound('ResEnd');
SaveSendFile;
- if FThreadItem = nil then
- GikoForm.AddMessageList(FBoard.Title + ' [\90V\83X\83\8c\91\97\90M\8fI\97¹]', nil, gmiOK)
- else
- GikoForm.AddMessageList(FThreadItem.Title + ' [\83\8c\83X\91\97\90M\8fI\97¹]', nil, gmiOK);
- Close;
+ AddFormMessageNew( gmiOK );
+ if (not ContinueModeAction.Enabled) or (not ContinueModeAction.Checked) then begin
+ Close;
+ end;
end else if State = gdsError then begin
- if FThreadItem = nil then
- GikoForm.AddMessageList(FBoard.Title + ' [\90V\83X\83\8c\91\97\90M\8e¸\94s]', nil, gmiNG)
- else
- GikoForm.AddMessageList(FThreadItem.Title + ' [\83\8c\83X\91\97\90M\8e¸\94s]', nil, gmiNG);
+ AddFormMessageNew( gmiOK );
EditorPage.ActivePage := PreviewTab;
SetContent(ResponseText, Browser);
end else if State = gdsAbort then begin
- GikoForm.AddMessageList(FThreadItem.Title + ' [\92\86\92f]', nil, gmiSAD);
+ GikoForm.AddMessageList(FThreadItem.Title + ' ' + GikoSys.GetGikoMessage(gmAbort), nil, gmiSAD);
end;
end;
-
function TEditorForm.GetResultType(ResponseText: string): TGikoResultType;
begin
if AnsiPos('\8f\91\82«\82±\82Ý\82ª\8fI\82í\82è\82Ü\82µ\82½', ResponseText) <> 0 then
(AnsiPos('="../test/subbbs.cgi">', ResponseText) > 0) or
(AnsiPos(RES2CH_FALSE, ResponseText) > 0) then
Result := grtCheck
- else
- Result := grtError;
+ else if (AnsiPos('\81E\93\8a\8de\8eÒ\82Í\81A\8cf\8e¦\94Â\89^\89c\8eÒ\82É\91Î\82µ\82Ä\81A\92\98\8dì\8eÒ\90l\8ai\8c \82ð\88ê\90Ø\8ds\8eg\82µ\82È\82¢\82±\82Æ\82ð\8f³\91ø\82µ\82Ü\82·\81B<br>', ResponseText) > 0) or
+ (AnsiPos('\81i\92\98\8dì\8c \96@\91æ21\8fð\82È\82¢\82µ\91æ28\8fð\82É\8bK\92è\82³\82ê\82é\8c \97\98\82à\8aÜ\82Þ\81j\82»\82Ì\91¼\82Ì\8c \97\98\82É\82Â\82«\81A', ResponseText) > 0) then
+ Result := grtCookie
+ else
+ Result := grtError;
end;
Board: TBoard;
body : string;
begin
- if FThreadItem = nil then
- Board := FBoard
- else
- Board := FThreadItem.ParentBoard;
+ Board := GetBoard;
if GikoSys.Setting.UseMachineTime then begin
if GikoSys.Setting.TimeAdjust then
s := 'sid=' + HttpEncode(SessionID) + '&'
else
s := '';
- s := s + 'subject=&'
- + 'FROM=' + HttpEncode(NameComboBox.Text) + '&'
- + 'mail=' + HttpEncode(MailComboBox.Text) + '&'
- + 'MESSAGE=' + HttpEncode(body) + '&'
- + 'bbs=' + Board.BBSID + '&'
- + 'time=' + IntToStr(SendTime) + '&';
+ s := s + 'subject=&'
+ + 'FROM=' + HttpEncode(NameComboBox.Text) + '&'
+ + 'mail=' + HttpEncode(MailComboBox.Text) + '&'
+ + 'MESSAGE=' + HttpEncode(body) + '&'
+ + 'bbs=' + Board.BBSID + '&'
+ + 'time=' + IntToStr(SendTime) + '&';
+
if FThreadItem = nil then begin
s := s + 'subject=' + HttpEncode(TitleEdit.Text) + '&';
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;
sDate: string;
ini: TMemIniFile;
begin
- ini := TMemIniFile.Create(GikoSys.GetSentFileName);
- try
- sDate := IntToStr(GikoSys.DateTimeToInt(Now));
-
- ini.WriteString(sDate, 'Name', NameComboBox.Text);
- ini.WriteString(sDate, 'EMail', MailComboBox.Text);
- ini.WriteString(sDate, 'Body', HttpEncode(BodyEdit.Text));
- ini.WriteInteger(sDate, 'Status', FStatusCode);
- ini.WriteDateTime(sDate, 'Date', Now);
- if FThreadItem = nil then begin
- ini.WriteString(sDate, 'Title', TitleEdit.Text);
- ini.WriteString(sDate, 'BBS', FBoard.BBSID);
- ini.WriteInteger(sDate, 'NewThread', 1);
- end else begin
- ini.WriteString(sDate, 'Title', FThreadItem.Title);
- ini.WriteString(sDate, 'BBS', FThreadItem.ParentBoard.BBSID);
- ini.WriteString(sDate, 'Key', ChangeFileExt(FThreadItem.FileName, ''));
- end;
-
- ini.UpdateFile;
- finally
- ini.Free;
- end;
+ ini := CreateSentIniFile;
+ if (ini <> nil) then begin
+ try
+ sDate := IntToStr(GikoSys.DateTimeToInt(Now));
+
+ ini.WriteString(sDate, 'Name', NameComboBox.Text);
+ ini.WriteString(sDate, 'EMail', MailComboBox.Text);
+ ini.WriteString(sDate, 'Body', HttpEncode(BodyEdit.Text));
+ ini.WriteInteger(sDate, 'Status', FStatusCode);
+ ini.WriteDateTime(sDate, 'Date', Now);
+ if FThreadItem = nil then begin
+ ini.WriteString(sDate, 'Title', MojuUtils.Sanitize(TitleEdit.Text));
+ //ini.WriteString(sDate, 'BBS', FBoard.BBSID);
+ ini.WriteString(sDate, 'URL', FBoard.URL);
+ ini.WriteInteger(sDate, 'NewThread', 1);
+ end else begin
+ ini.WriteString(sDate, 'Title', FThreadItem.Title);
+ //ini.WriteString(sDate, 'BBS', FThreadItem.ParentBoard.BBSID);
+ ini.WriteString(sDate, 'URL', FThreadItem.URL);
+ ini.WriteString(sDate, 'Key', ChangeFileExt(FThreadItem.FileName, ''));
+ end;
+
+ ini.UpdateFile;
+ finally
+ ini.Free;
+ end;
+ end;
+end;
+function TEditorForm.CreateSentIniFile: TMemIniFile;
+var
+ maxSize, fileSize, i: Integer;
+ newName: String;
+begin
+ Result := nil;
+ // MB -> bytes
+ maxSize := GikoSys.Setting.SentIniFileSize * 1024 * 1024;
+ // \83t\83@\83C\83\8b\83T\83C\83Y\82ª0\82Ì\8fê\8d\87\82Í\81Asent.ini\82É\8f\91\82«\8d\9e\82Ü\82È\82¢\82Ì\82Ånil\82ð\95Ô\82·
+ if (maxSize > 0) then begin
+ fileSize := GikoSys.GetFileSize(GikoSys.Setting.GetSentFileName);
+ // \8dÅ\91å\83T\83C\83Y\82ð\92´\82¦\82Ä\82¢\82½\8fê\8d\87\82Í\83\8a\83l\81[\83\80\82·\82é
+ if (fileSize >= maxSize) then begin
+ i := 0;
+ // \8d¡\82Ì\8e\9e\8d\8f\82ð\83t\83@\83C\83\8b\96¼\82Ì\8cã\82ë\82É\82Â\82¯\82é
+ repeat
+ // 10\89ñ\88È\8fã\8e¸\94s\82µ\82½\82ç\82 \82«\82ç\82ß\82é
+ if (i > 10) then break;
+ DateTimeToString(newName, 'yyhhnnsszzz', Now());
+ Inc(i);
+ until RenameFile(GikoSys.Setting.GetSentFileName,
+ GikoSys.Setting.GetSentFileName + '.' + newName);
+ end;
+ Result := TMemIniFile.Create(GikoSys.Setting.GetSentFileName);
+ end;
end;
-
procedure TEditorForm.SendActionExecute(Sender: TObject);
+const
+ TITLE_SAMBA : string = 'Samba24\8cx\8d\90';
var
Board: TBoard;
rc: Integer;
+ rc2: Integer;
state : TGikoDownloadState;
body : string;
begin
Application.ProcessMessages;
if not Check then Exit;
- if FThreadItem = nil then
- Board := FBoard
- else
- Board := FThreadItem.ParentBoard;
+ Board := GetBoard;
if FThreadItem = nil then begin
rc := GikoUtil.MsgBox(Handle,
end;
SetNameList(NameComboBox.Text, MailComboBox.Text);
- if KotehanCheckBox.Checked then begin
+ if (KotehanCheckBox.Enabled) and (KotehanCheckBox.Checked) then begin
Board.KotehanName := NameComboBox.Text;
Board.KotehanMail := MailComboBox.Text;
end;
if state = gdsComplete then begin
GikoForm.PlaySound('ResEnd');
SaveSendFile;
- GikoForm.AddMessageList(FBoard.Title + ' [\90V\83X\83\8c\91\97\90M\8fI\97¹]', nil, gmiOK);
+ GikoForm.AddMessageList(FBoard.Title + ' ' + GikoSys.GetGikoMessage(gmNewSure), nil, gmiOK);
FWork := False;
Close;
end else if State = gdsError then begin
- GikoForm.AddMessageList(FBoard.Title + ' [\90V\83X\83\8c\91\97\90M\8e¸\94s]', nil, gmiNG);
+ GikoForm.AddMessageList(FBoard.Title + ' ' + GikoSys.GetGikoMessage(gmSureError), nil, gmiNG);
end else if State = gdsAbort then begin
- GikoForm.AddMessageList(FThreadItem.Title + ' [\92\86\92f]', nil, gmiSAD);
+ GikoForm.AddMessageList(FBoard.Title + ' ' + GikoSys.GetGikoMessage(gmAbort), nil, gmiNG);
end;
end else begin
// \83\8c\83X
- state := TGikoDownloadState( FThreadItem.BoardPlugIn.WriteThread(
+ state := TGikoDownloadState( FThreadItem.ParentBoard.BoardPlugIn.WriteThread(
DWORD( FThreadItem ), NameComboBox.Text, MailComboBox.Text, body ) );
if state = gdsComplete then begin
GikoForm.PlaySound('ResEnd');
SaveSendFile;
- GikoForm.AddMessageList(FThreadItem.Title + ' [\83\8c\83X\91\97\90M\8fI\97¹]', nil, gmiOK);
- FWork := False;
+ GikoForm.AddMessageList(FThreadItem.Title + ' ' + GikoSys.GetGikoMessage(gmNewRes), nil, gmiOK);
+ FWork := False;
Close;
end else if State = gdsError then begin
- GikoForm.AddMessageList(FThreadItem.Title + ' [\83\8c\83X\91\97\90M\8e¸\94s]', nil, gmiNG);
+ GikoForm.AddMessageList(FThreadItem.Title + ' ' + GikoSys.GetGikoMessage(gmResError), nil, gmiOK);
end else if State = gdsAbort then begin
- GikoForm.AddMessageList(FThreadItem.Title + ' [\92\86\92f]', nil, gmiSAD);
+ GikoForm.AddMessageList(FThreadItem.Title + ' ' + GikoSys.GetGikoMessage(gmAbort), nil, gmiOK);
end;
end;
end else begin
- if not Timer1.Enabled then
- Send(Board.SPID, Board.PON, True)
- else begin
- if not CheckSambaTime(FHost, Now()) then begin
+ if not FSambaTimer.Enabled then begin
+ if CompareDateTime(Board.Expires ,Now) <= 0 then begin
+ Board.Cookie := '';
+ Board.SPID := '';
+ Board.PON := '';
+ end;
+ Send(Board.Cookie, Board.SPID, Board.PON, True);
+ end else begin
+ if not FSambaTimer.CheckSambaTime(Now()) then begin
rc := GikoUtil.MsgBox(Handle,
'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
+ '\91\97\90M\82ð\92\86\8e~\82µ\82Ü\82·\82©\81H' + #13#10
- + '(\81u\82¢\82¢\82¦\81v\82¾\82Æ\91\97\90M\82µ\82Ü\82·)', 'Samba24\8cx\8d\90',
+ + '(\81u\82¢\82¢\82¦\81v\82¾\82Æ\91\97\90M\82µ\82Ü\82·)', TITLE_SAMBA,
MB_YESNO or MB_ICONQUESTION);
if rc = IDYES then begin
FWork := false;
Exit;
end;
+ if rc = IDNO then begin
+ rc2 := GikoUtil.MsgBox(Handle,
+ '\96{\93\96\82É\91\97\90M\82µ\82Ü\82·\82©\81H',
+ TITLE_SAMBA,
+ MB_YESNO or MB_ICONQUESTION);
+ if rc2 = IDNO then begin
+ FWork := False;
+ Exit;
+ end;
+ end;
+ end;
+ if CompareDateTime(Board.Expires ,Now) <= 0 then begin
+ Board.Cookie := '';
+ Board.SPID := '';
+ Board.PON := '';
end;
- Send(Board.SPID, Board.PON, True);
+ Send(Board.Cookie, Board.SPID, Board.PON, True);
end;
end;
finally
FWork := False;
- if Timer1.Enabled then
- ReadSambaTime(FHost);
+ if FSambaTimer.Enabled then begin
+ FNow := FSambaTimer.Update;
+ end;
end;
end;
SageCheckBox.Checked := True;
end;
-
-function TEditorForm.GetSPID(CookieLine: string): string;
-var
- s: string;
- i: Integer;
-begin
- Result := '';
- i := 0;
- while True do begin
- s := Trim(GikoSys.GetTokenIndex(CookieLine, ';', i));
- if s = '' then
- Break
- else begin
- if Pos('SPID=', s) = 1 then begin
- Result := Trim(Copy(s, 6, Length(s)));
- Break;
- end;
- end;
- inc(i);
- end;
-end;
-
-function TEditorForm.GetPON(CookieLine: string): string;
-var
- s: string;
- i: Integer;
-begin
- Result := '';
- i := 0;
- while True do begin
- s := Trim(GikoSys.GetTokenIndex(CookieLine, ';', i));
- if s = '' then
- Break
- else begin
- if Pos('PON=', s) = 1 then begin
- Result := Trim(Copy(s, 5, Length(s)));
- Break;
- end;
- end;
- inc(i);
- end;
-end;
-
procedure TEditorForm.IdLogDebugReceive(ASender: TIdConnectionIntercept;
AStream: TStream);
var
end;
-procedure TEditorForm.Timer1Timer(Sender: TObject);
-begin
- if FSambaTime = ZERO_DATE then
- StatusBar.Panels[1].Text := '\8f\89\8f\91'
- else begin
- FNow := IncMilliSecond(FNow, 500);
- StatusBar.Panels[1].Text := Format('%8.0f\95b\8co\89ß', [SecondSpan(FNow, FSambaTime)]);
- end;
-
-end;
-//Samba.ini\82Ì\8f\91\82«\8d\9e\82Ý\8e\9e\8aÔ\82ð\93Ç\82Ý\8d\9e\82Þ
-procedure TEditorForm.ReadSambaTime(const AHost: string);
-var
- ini :TMemIniFile;
- tmp: string;
-begin
- 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
- 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
- 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
- ini := TMemIniFile.Create(GikoSys.GetSambaFileName);
- try
- //\95¶\8e\9a\97ñ\82Å\93Ç\82Ý\8eæ\82Á\82Ä\81A\95Ï\8a·\8aÖ\90\94\82ÅTDateTime\82Ö
- tmp := ini.ReadString('Send', AHost, DateTimeToStr(ZERO_DATE));
- FSambaTime := ConvertDateTimeString(tmp);
- finally
- ini.Free;
- end;
-end;
-//Samba.ini\82É\8dÅ\8fI\8f\91\82«\8d\9e\82Ý\8e\9e\8aÔ\82ð\8f\91\82«\8d\9e\82Þ
-procedure TEditorForm.WriteSambaTime(const AHost: string; ATime: TDateTime);
-var
- ini :TMemIniFile;
-begin
- ini := TMemIniFile.Create(GikoSys.GetSambaFileName);
- try
- ini.WriteDateTime('Send', AHost, ATime);
- ini.UpdateFile;
- finally
- ini.Free;
- end;
-end;
-//\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
-function TEditorForm.CheckSambaTime(const AHost: string; ATime: TDateTime): Boolean;
-var
- pastsec: double;
- SettingTime: Integer;
-begin
- SettingTime := ReadSettingTime(AHost);
- ReadSambaTime(AHost);
- pastsec := SecondSpan(ATime, FSambaTime);
- if pastsec > SettingTime then
- Result := true
- else
- Result := false;
-end;
-//AHost\81i\8eI\96¼\81j\82ÌSamba\82Ì\8bK\92è\92l\82ð\93Ç\82Ý\8d\9e\82Þ
-function TEditorForm.ReadSettingTime(const AHost: string): Integer;
-var
- ini :TMemIniFile;
-begin
- ini := TMemIniFile.Create(GikoSys.GetSambaFileName);
- try
- Result := ini.ReadInteger('Setting', AHost, 0);
- //\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
- if Result = 0 then begin
- ini.WriteInteger('Setting', AHost, 0);
- ini.UpdateFile;
- end;
- finally
- ini.Free;
- end;
-end;
//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Þ
procedure TEditorForm.FormActivate(Sender: TObject);
begin
- if ( Timer1.Enabled ) and ( FThreadItem <> nil )then
- ReadSambaTime(FHost);
+ if ( FSambaTimer.Enabled ) and ( FThreadItem <> nil ) then
+ begin
+ FNow := FSambaTimer.Update;
+ end;
if GikoSys.Setting.GestureEnabled then begin
+ GikoSys.Setting.Gestures.ClearGesture;
+ GikoSys.Setting.Gestures.LoadGesture(
+ GikoSys.Setting.GetGestureFileName, ActionList );
MouseGesture.UnHook;
MouseGesture.OnGestureStart := OnGestureStart;
MouseGesture.OnGestureMove := OnGestureMove;
MouseGesture.SetHook( Handle );
end;
end;
-//Samba24\91Î\8dô\82ð\8eg\82¤\82©\82Ç\82¤\82©\8c\88\82ß\82é\8aÖ\90\94
-//ReadSambaTime \82ð\8cÄ\82Ñ\8fo\82·\82ÆTimer\82ªOn\82É\82È\82é
-procedure TEditorForm.SetSamba24(AURL: string);
-var
- Protocol, Host, Path, Document, Port, Bookmark : string;
-begin
- //Samba24\91Î\8dô\82ð\82µ\82È\82¢\82È\82ç\8fI\97¹
- if not GikoSys.Setting.UseSamba then
- Exit;
- //Host\82ÌURL\82É'.2ch.'\82©'.bbspink.'\82ª\8aÜ\82Ü\82ê\82Ä\82¢\82½\82çSamba24\91Î\8dô\82ð\82·\82é
- GikoSys.ParseURI( AURL, Protocol,Host, Path, Document, Port, Bookmark );
- if GikoSys.Is2chHost(Host) then begin
- Host := Copy(Host, 1, AnsiPos('.', Host) - 1);
- FHost := Host; //FHost=\8eI\96¼
- ReadSambaTime(FHost); //\88È\91O\82Ì\8f\91\82«\8d\9e\82Ý\8e\9e\8aÔ\82ð\93Ç\82Ý\8d\9e\82Þ
- //StatusBar\82É\82±\82Ì\8eI\82Ì\8bK\92è\92l\82ð\95\\8e¦\82·\82é
- StatusBar.Panels[2].Text := 'Samba24\8bK\92è\92l' + IntToStr(ReadSettingTime(FHost));
- end;
-end;
procedure TEditorForm.FormCloseQuery(Sender: TObject;
var CanClose: Boolean);
begin
CanClose := not FWork;
end;
-function TEditorForm.GetOEIndentChar : string;
-var
- regKey : TRegistry;
- Identities : string;
- IndentChar : DWORD;
-const
- DEFAULT_CHAR = '> ';
- OE_MAIL_PATH = '\Software\Microsoft\Outlook Express\5.0\Mail';
- INDENT_CHAR = 'Indent Char';
-begin
-
- Result := DEFAULT_CHAR;
- regKey := TRegistry.Create;
- try
- try
- regKey.RootKey := HKEY_CURRENT_USER;
- if not regKey.OpenKey( 'Identities', False ) then
- Exit;
- Identities := regKey.ReadString( 'Default User ID' );
- if Identities = '' then
- Exit;
- if not regKey.OpenKey( Identities + OE_MAIL_PATH, False ) then
- Exit;
- IndentChar := regKey.ReadInteger( INDENT_CHAR );
- Result := Char( IndentChar ) + ' ';
- except
- end;
- finally
- regKey.Free;
- end;
-
-end;
-
procedure TEditorForm.QuotePasteActionExecute(Sender: TObject);
var
s : TStringList;
quote : string;
begin
- quote := GetOEIndentChar;
+ quote := GikoSys.GetOEIndentChar;
s := TStringList.Create;
try
s.Text := Clipboard.AsText;
procedure TEditorForm.BoardTopClick(Sender: TObject);
var
- ini: TIniFile;
+ ini: TMemIniFile;
begin
- ini := TIniFile.Create(GikoSys.Setting.GetFileName);
+ ini := TMemIniFile.Create(GikoSys.Setting.GetFileName);
try
BoardtopTab.TabVisible := BoardTop.Checked;
ini.WriteBool('EditorForm', 'BoardTopTab', BoardtopTab.TabVisible);
+ ini.UpdateFile;
finally
ini.Free;
end;
procedure TEditorForm.GetSETTINGTXTActionExecute(Sender: TObject);
var
+ memStream: TMemoryStream;
URL, RefURL: string;
settingBody: TStringList;
tmpBoard: TBoard;
begin
- InitIdHTTP(Indy);
- if FThreadItem = nil then
- tmpBoard := FBoard
- else
- tmpBoard := FThreadItem.ParentBoard;
-
- if tmpBoard = nil then Exit;
-
- RefURL := tmpBoard.URL;
- if RefURL[Length(RefURL)] <> '/' then
- URL := RefURL + '/' + 'SETTING.TXT'
- else
- URL := RefURL + 'SETTING.TXT';
-
- Indy.Request.LastModified := tmpBoard.SETTINGTXTTime;
- Indy.Request.Referer := RefURL;
- Screen.Cursor := crHourGlass;
- settingBody := TStringList.Create;
- try
- StatusBar.Panels[0].Text := 'SETTING.TXT\83_\83E\83\93\83\8d\81[\83h\92\86';
- try
- settingBody.Text := Indy.Get(URL);
- if( Indy.ResponseCode = 200 ) then begin
- settingBody.SaveToFile(tmpBoard.GetSETTINGTXTFileName);
- tmpBoard.SETTINGTXTTime := Indy.Response.LastModified;
- tmpBoard.IsSETTINGTXT := true;
- tmpBoard.TitlePictureURL := GetTitlePictureURL(settingBody, tmpBoard);
- tmpBoard.Modified := true;
- StatusBar.Panels[0].Text := 'SETTING.TXT\8eæ\93¾\8a®\97¹(' + IntToStr(Indy.ResponseCode) + ')';
- end;
- except
- on E: EIdException do begin
- if( AnsiPos('304', E.Message) > 0 ) then
- StatusBar.Panels[0].Text := 'SETTING.TXT\8dX\90V\96³\82µ(' + IntToStr(Indy.ResponseCode) + ')'
- else
- StatusBar.Panels[0].Text := 'SETTING.TXT\8eæ\93¾\83G\83\89\81[(' + IntToStr(Indy.ResponseCode) + ')';
- end;
- end;
- finally
- settingBody.Free;
- Screen.Cursor := crDefault;
- end;
- ShowBoardInformation(tmpBoard, BoardInformationMemo);
+ if not FWork then begin
+ FWork := True;
+
+ tmpBoard := GetBoard;
+ if tmpBoard <> nil then begin
+
+ RefURL := tmpBoard.URL;
+ if RefURL[Length(RefURL)] <> '/' then
+ URL := RefURL + '/' + 'SETTING.TXT'
+ else
+ URL := RefURL + 'SETTING.TXT';
+ Screen.Cursor := crHourGlass;
+ memStream := TMemoryStream.Create;
+ try
+ try
+ StatusBar.Panels[0].Text := 'SETTING.TXT\83_\83E\83\93\83\8d\81[\83h\92\86';
+ GetWebData(URL, RefURL, tmpBoard.SETTINGTXTTime, memStream);
+ if( Indy.ResponseCode = 200 ) then begin
+ settingBody := TStringList.Create;
+ try
+ memStream.Seek(0, soFromBeginning);
+ settingBody.LoadFromStream(memStream);
+ settingBody.SaveToFile(tmpBoard.GetSETTINGTXTFileName);
+ tmpBoard.SETTINGTXTTime := Indy.Response.LastModified;
+ tmpBoard.IsSETTINGTXT := true;
+ tmpBoard.TitlePictureURL := GetTitlePictureURL(settingBody, tmpBoard);
+ tmpBoard.Modified := true;
+ finally
+ settingBody.Free;
+ end;
+ StatusBar.Panels[0].Text := 'SETTING.TXT\8eæ\93¾\8a®\97¹(' + IntToStr(Indy.ResponseCode) + ')';
+ end;
+ except
+ on E: EIdException do begin
+ if( AnsiPos('304', E.Message) > 0 ) then
+ StatusBar.Panels[0].Text := 'SETTING.TXT\8dX\90V\96³\82µ(' + IntToStr(Indy.ResponseCode) + ')'
+ else
+ StatusBar.Panels[0].Text := 'SETTING.TXT\8eæ\93¾\83G\83\89\81[(' + IntToStr(Indy.ResponseCode) + ')';
+ end;
+ end;
+ finally
+ memStream.Free;
+ Screen.Cursor := crDefault;
+ end;
+ ShowBoardInformation(tmpBoard, BoardInformationMemo);
+ end;
+ FWork := False;
+ end;
end;
procedure TEditorForm.ShowBoardInformation(ABoard: TBoard; AMemo: TMemo);
else
GetTitlePictureAction.Enabled := FThreadItem.ParentBoard.IsSETTINGTXT;
+ if GetTitlePictureAction.Enabled Then begin
+ // \8eÀ\8ds\92\86\82Í\8eÀ\8ds\95s\89Â
+ GetTitlePictureAction.Enabled := not FWork;
+ end;
end;
procedure TEditorForm.GetTitlePictureActionExecute(Sender: TObject);
memStream: TMemoryStream;
tmpBoard: TBoard;
begin
- InitIdHTTP(Indy);
+ if FWork then
+ Exit;
+
+ FWork := True;
memStream := TMemoryStream.Create;
try
- if FThreadItem = nil then
- tmpBoard := FBoard
- else
- tmpBoard := FThreadItem.ParentBoard;
+ tmpBoard := GetBoard;
- Indy.Request.Referer := tmpBoard.URL;
- if tmpBoard.TitlePictureURL <> '' then begin
+ if (tmpBoard <> nil) and (tmpBoard.TitlePictureURL <> '') then begin
StatusBar.Panels[0].Text := '\94Â\83g\83b\83v\89æ\91\9c\83_\83E\83\93\83\8d\81[\83h\92\86';
Screen.Cursor := crHourGlass;
try
- Indy.Get(tmpBoard.TitlePictureURL, memStream);
+ // URL\82ð\8ew\92è\82µ\82Ä\83\81\83\82\83\8a\82É\93Ç\82Ý\8d\9e\82Þ
+ GetWebData(tmpBoard.TitlePictureURL, tmpBoard.URL,
+ ZERO_DATE, memStream);
if Indy.ResponseCode = 200 then begin
memStream.SaveToFile(tmpBoard.GetTitlePictureFileName);
ShowTitlePicture();
tmpBoard.Modified := true;
end;
+ StatusBar.Panels[0].Text := '\94Â\83g\83b\83v\89æ\91\9c (' + IntToStr(Indy.ResponseCode) + ')';
except
end;
end;
finally
- Screen.Cursor := crDefault;
- StatusBar.Panels[0].Text := '\94Â\83g\83b\83v\89æ\91\9c (' + IntToStr(Indy.ResponseCode) + ')';
memStream.Free;
+ FWork := False;
+ Screen.Cursor := crDefault;
end;
+end;
+{
+\brief URL\82Ì\83f\81[\83^\82ðstream\82É\93Ç\82Ý\8d\9e\82Þ
+\param URL \93Ç\82Ý\8d\9e\82Þ\90æ
+\param RefURL referer\82É\90Ý\92è\82·\82é
+\param Modified Modified\82É\90Ý\92è\82·\82é
+\param stream \93Ç\82Ý\8d\9e\82ñ\82¾\83f\81[\83^\82Ì\95Û\91¶\90æ
+}
+procedure TEditorForm.GetWebData(const URL: string; const RefURL: string;
+ Modified: TDateTime; stream: TStream);
+begin
+ InitIdHTTP(Indy);
+ Indy.Request.Referer := RefURL;
+ Indy.Request.LastModified := Modified;
+
+ IdAntiFreeze.Active := True;
+ try
+ Indy.Get(URL, stream);
+ finally
+ IdAntiFreeze.Active := False;
+ end;
end;
procedure TEditorForm.ShowTitlePicture();
tmpBoard: TBoard;
s: String;
begin
- if FThreadItem = nil then
- tmpBoard := FBoard
- else
- tmpBoard := FThreadItem.ParentBoard;
+ tmpBoard := GetBoard;
if FileExists(tmpBoard.GetTitlePictureFileName) then begin
TitlePictureBrowser.Navigate(tmpBoard.GetTitlePictureFileName);
URL, RefURL: string;
settingBody: TStringList;
tmpBoard: TBoard;
+ memStream: TMemoryStream;
begin
- InitIdHTTP(Indy);
- if FThreadItem = nil then
- tmpBoard := FBoard
- else
- tmpBoard := FThreadItem.ParentBoard;
-
- if tmpBoard = nil then Exit;
-
- RefURL := tmpBoard.URL;
- if RefURL[Length(RefURL)] <> '/' then
- URL := RefURL + '/' + 'head.txt'
- else
- URL := RefURL + 'head.txt';
-
- if FileExists(tmpBoard.GETHEADTXTFileName) then
- Indy.Request.LastModified := tmpBoard.HEADTXTTime
- else
- Indy.Request.LastModified := ZERO_DATE;
-
- Indy.Request.Referer := RefURL;
- Screen.Cursor := crHourGlass;
- settingBody := TStringList.Create;
- try
- StatusBar.Panels[0].Text := '\83\8d\81[\83J\83\8b\83\8b\81[\83\8b(head.txt)\83_\83E\83\93\83\8d\81[\83h\92\86';
- try
- settingBody.Text := Indy.Get(URL);
- if( Indy.ResponseCode = 200 ) then begin
- settingBody.Insert(0, '<HTML lang="ja"><HEAD>');
- settingBody.Insert(1, '<META http-equiv="Content-Type" content="text/html; charset=Shift_JIS">');
- settingBody.Insert(2, '<TITLE>' + tmpBoard.Title + '</TITLE>');
- settingBody.Insert(3, '<base href="' + RefURL + '"></HEAD><BODY>');
- settingBody.Add('</BODY></HTML>');
- settingBody.SaveToFile(tmpBoard.GETHEADTXTFileName);
- tmpBoard.HEADTXTTime := Indy.Response.LastModified;
- tmpBoard.IsHEADTXT := true;
- tmpBoard.Modified := true;
- StatusBar.Panels[0].Text := '\83\8d\81[\83J\83\8b\83\8b\81[\83\8b\8eæ\93¾\8a®\97¹(' + IntToStr(Indy.ResponseCode) + ')';
- end;
- except
- on E: EIdException do begin
- if( AnsiPos('304', E.Message) > 0 ) then
- StatusBar.Panels[0].Text := '\83\8d\81[\83J\83\8b\83\8b\81[\83\8b\8dX\90V\96³\82µ(' + IntToStr(Indy.ResponseCode) + ')'
- else
- StatusBar.Panels[0].Text := '\83\8d\81[\83J\83\8b\83\8b\81[\83\8b\8eæ\93¾\83G\83\89\81[(' + IntToStr(Indy.ResponseCode) + ')';
- end;
- end;
- finally
- settingBody.Free;
- Screen.Cursor := crDefault;
- end;
- if tmpBoard.IsHEADTXT then begin
+ if not FWork then begin
+ FWork := True;
+
+ tmpBoard := GetBoard;
+ if (tmpBoard <> nil) then begin
+
+ RefURL := tmpBoard.URL;
+ if RefURL[Length(RefURL)] <> '/' then
+ URL := RefURL + '/' + 'head.txt'
+ else
+ URL := RefURL + 'head.txt';
+
+ Screen.Cursor := crHourGlass;
+ memStream := TMemoryStream.Create;
+ try
+ StatusBar.Panels[0].Text := '\83\8d\81[\83J\83\8b\83\8b\81[\83\8b(head.txt)\83_\83E\83\93\83\8d\81[\83h\92\86';
+ try
+ GetWebData(URL, RefURL, tmpBoard.HEADTXTTime, memStream);
+ if( Indy.ResponseCode = 200 ) then begin
+ settingBody := TStringList.Create;
+ try
+ memStream.Seek(0, soFromBeginning);
+ settingBody.LoadFromStream(memStream);
+ settingBody.Insert(0, '<HTML lang="ja"><HEAD>');
+ settingBody.Insert(1, '<META http-equiv="Content-Type" content="text/html; charset=Shift_JIS">');
+ settingBody.Insert(2, '<TITLE>' + tmpBoard.Title + '</TITLE>');
+ settingBody.Insert(3, '<base href="' + RefURL + '"></HEAD><BODY>');
+ settingBody.Add('</BODY></HTML>');
+ settingBody.SaveToFile(tmpBoard.GETHEADTXTFileName);
+ tmpBoard.HEADTXTTime := Indy.Response.LastModified;
+ tmpBoard.IsHEADTXT := true;
+ tmpBoard.Modified := true;
+ finally
+ settingBody.Free;
+ end;
+ StatusBar.Panels[0].Text := '\83\8d\81[\83J\83\8b\83\8b\81[\83\8b\8eæ\93¾\8a®\97¹(' + IntToStr(Indy.ResponseCode) + ')';
+ end;
+ except
+ on E: EIdException do begin
+ if( AnsiPos('304', E.Message) > 0 ) then
+ StatusBar.Panels[0].Text := '\83\8d\81[\83J\83\8b\83\8b\81[\83\8b\8dX\90V\96³\82µ(' + IntToStr(Indy.ResponseCode) + ')'
+ else
+ StatusBar.Panels[0].Text := '\83\8d\81[\83J\83\8b\83\8b\81[\83\8b\8eæ\93¾\83G\83\89\81[(' + IntToStr(Indy.ResponseCode) + ')';
+ end;
+ end;
+ finally
+ memStream.Free;
+ Screen.Cursor := crDefault;
+ end;
+ if tmpBoard.IsHEADTXT then begin
ShowBoardHead(tmpboard, LocalEdit);
- end;
+ end;
+ end;
+ FWork := False;
+ end;
end;
-procedure TEditorForm.CalcCapasityActionExecute(Sender: TObject);
+procedure TEditorForm.CalcCapacityActionExecute(Sender: TObject);
var
+ Board: TBoard;
body: String;
begin
body := GetBody;
+ //\82Ç\82¤\82à\81A\89ü\8ds\95ª\82¸\82ê\82Ä\82½\82Á\82Û\82¢\82¯\82Ç\81A\96{\93\96\82©\82æ\82\95ª\82©\82ç\82È\82¢\81B
+ Board := GetBoard;
+
+ if Board.BoardPlugIn <> nil then
+ body := CustomStringReplace(body, #13#10, '<br>')
+ else
+ body := CustomStringReplace(body, #13#10, ' <br> ');
StatusBar.Panels[0].Text := '\97e\97Ê:' + IntToStr(Length(body)) + ' byte';
end;
-procedure TEditorForm.RuleClick(Sender: TObject);
+procedure TEditorForm.LocalRuleClick(Sender: TObject);
var
- ini: TIniFile;
+ ini: TMemIniFile;
begin
- ini := TIniFile.Create(GikoSys.Setting.GetFileName);
+ ini := TMemIniFile.Create(GikoSys.Setting.GetFileName);
try
- RocalRuleTab.TabVisible := Rule.Checked;
+ RocalRuleTab.TabVisible := LocalRule.Checked;
ini.WriteBool('EditorForm', 'LocalRuleTab', RocalRuleTab.TabVisible);
+ ini.UpdateFile;
finally
ini.Free;
end;
procedure TEditorForm.FormDeactivate(Sender: TObject);
begin
- if GikoSys.Setting.GestureEnabled then begin
- MouseGesture.UnHook;
- MouseGesture.SetHook( GikoForm.Handle );
- end;
+ if GikoSys.Setting.GestureEnabled then begin
+ GikoSys.Setting.Gestures.ClearGesture;
+ MouseGesture.UnHook;
+ MouseGesture.OnGestureStart := nil;
+ MouseGesture.OnGestureMove := nil;
+ MouseGesture.OnGestureEnd := nil;
+ end;
end;
procedure TEditorForm.OnGestureStart(Sender: TObject);
if Action <> nil then
ActStr := '\81i' + Action.Caption + '\81j';
s := '\83W\83F\83X\83`\83\83\81[: ' + s + ActStr;
- StatusBar.Panels[2].Text := s;
+ StatusBar.Panels[0].Text := s;
end;
procedure TEditorForm.OnGestureEnd(Sender: TObject);
Action: TAction;
begin
s := MouseGesture.GetGestureStr;
+ MouseGesture.Clear;
Action := GikoSys.Setting.Gestures.GetGestureAction(s);
if Action <> nil then
Action.Execute;
- StatusBar.Panels[2].Text := '';
+ StatusBar.Panels[0].Text := '';
end;
procedure TEditorForm.ShowBoardHead(ABoard: TBoard; AMemo: TMemo);
var
- wDoc, WTex, le: OLEVariant;
-begin
- //\8eQ\8dl\8c³
- //http://www.campus.ne.jp/~ishigami/CREATION/TECHNIC/WEBAP-2.htm
- WebBrowser1.Navigate(ABoard.GETHEADTXTFileName,le,le,le,le);
- //\83\8c\83^\83\8a\83\93\83O\82ª\92x\82·\82¬\82ÄTXT\82É\88Ú\82¹\82È\82¢\81B\82Ê\82é\82Ûorz
- //\89º\82Ì\82æ\82¤\82É\82¿\82á\82ñ\82Æ\93Ç\82Ý\8d\9e\82Ý\82ª\8fI\82í\82Á\82Ä\82¢\82é\82©\81A\83`\83F\83b\83N\82·\82ê\82Î\82¢\82¢\82ñ\82¾\82æ\81B
- //\82±\82ê\82Å\82¢\82¯\82Ü\82µ\82½\81B\82 \82è\82ª\82Æ\82¤\82²\82´\82¢\82Ü\82µ\82½\81B
- while (WebBrowser1.ReadyState <> READYSTATE_COMPLETE) and
- (WebBrowser1.ReadyState <> READYSTATE_INTERACTIVE) do begin
- Application.ProcessMessages;
+ range: OleVariant;
+begin
+ //\8eQ\8dl\8c³
+ //http://www.campus.ne.jp/~ishigami/CREATION/TECHNIC/WEBAP-2.htm
+ WebBrowser1.Navigate(ABoard.GETHEADTXTFileName);
+ //\83\8c\83^\83\8a\83\93\83O\82ª\92x\82·\82¬\82ÄTXT\82É\88Ú\82¹\82È\82¢\81B\82Ê\82é\82Ûorz
+ //\89º\82Ì\82æ\82¤\82É\82¿\82á\82ñ\82Æ\93Ç\82Ý\8d\9e\82Ý\82ª\8fI\82í\82Á\82Ä\82¢\82é\82©\81A\83`\83F\83b\83N\82·\82ê\82Î\82¢\82¢\82ñ\82¾\82æ\81B
+ //\82±\82ê\82Å\82¢\82¯\82Ü\82µ\82½\81B\82 \82è\82ª\82Æ\82¤\82²\82´\82¢\82Ü\82µ\82½\81B
+ while (WebBrowser1.ReadyState <> READYSTATE_COMPLETE) and
+ (WebBrowser1.ReadyState <> READYSTATE_INTERACTIVE) do begin
+ Application.ProcessMessages;
+ end;
+
+ try
+ ;
+ range := OleVariant(WebBrowser1.Document).body.createTextRange;
+ LocalEdit.Text := range.text;
+ except
+ end;
+end;
+
+procedure TEditorForm.LocalRuleBrowseClick(Sender: TObject);
+var
+ URL: String;
+ ABoard: TBoard;
+begin
+ ABoard := GetBoard;
+
+ if ABoard = nil
+ then Exit;
+
+ URL := ABoard.GETHEADTXTFileName;
+ GikoSys.OpenBrowser(URL, gbtAuto);
+end;
+
+procedure TEditorForm.SaveNameMailActionExecute(Sender: TObject);
+begin
+ SaveNameMailAction.Checked := not SaveNameMailAction.Checked;
+ KotehanCheckBox.Enabled := SaveNameMailAction.Checked;
+end;
+
+function TEditorForm.LFusianaGet(const s: String): Boolean;
+const
+ FUSIANA = 'fusianasan';
+var
+ i: Integer;
+begin
+ i := AnsiPos(FUSIANA, s);
+ Result := (i > 0);
+end;
+
+procedure TEditorForm.BeLogInOutEActionExecute(Sender: TObject);
+begin
+ GikoSys.Setting.BeLogin := not GikoSys.Setting.BeLogin;
+end;
+
+procedure TEditorForm.BeLogInOutEActionUpdate(Sender: TObject);
+begin
+ if (GikoSys.Setting.BeUserID <> '') and (GikoSys.Setting.BeCode <> '') then begin
+ if (GikoSys.Setting.BeLogin) then BeLogInOutEAction.Checked := true
+ else BeLogInOutEAction.Checked := false;
+ BeLogInOutEAction.Enabled := true
+ end else
+ BeLogInOutEAction.Enabled := false;
+
+end;
+// Cookie\82Ì\8eæ\93¾
+procedure TEditorForm.GetCookie(Rawtext: String; ABoard: TBoard);
+const
+ COOKIE_MARK = 'Set-Cookie:';
+ VAL_SPID = 'SPID=';
+ VAL_PON = 'PON=';
+ EXPIRES_MARK = 'expires=';
+var
+ i, pos: Integer;
+ tmp : string;
+ val : string;
+ curCookies : TStringList;
+ tmpCookieName : string;
+begin
+ // 2008.12.14 \96³\8fð\8c\8f\83N\83\8a\83A\82µ\82Ä\82Í\82¢\82¯\82È\82¢ by \82à\82¶\82ã
+ curCookies := TStringList.Create;
+ curCookies.Delimiter := ';';
+ curCookies.DelimitedText := ABoard.Cookie;
+ ABoard.Cookie := '';
+ try
+ while (AnsiPos(COOKIE_MARK, Rawtext) > 0 ) do begin
+ tmp := Copy(Rawtext, AnsiPos(COOKIE_MARK, Rawtext) + Length(COOKIE_MARK), Length(Rawtext));
+ Delete(Rawtext, 1, AnsiPos('Set-Cookie', Rawtext)+ Length(COOKIE_MARK));
+ //Cookie\82ð\90Ø\82è\8fo\82·
+ val := Trim(GikoSys.GetTokenIndex(tmp, ';', 0));
+ if( AnsiPos(VAL_SPID, val) > 0 ) then begin
+ ABoard.SPID := Copy(val, AnsiPos(VAL_SPID, val) + Length(VAL_SPID), Length(val));
+ end else if( AnsiPos(VAL_PON, val) > 0 ) then begin
+ ABoard.PON := Copy(val, AnsiPos(VAL_PON, val) + Length(VAL_PON), Length(val));
+ end else begin
+ // \8aù\91¶\82ÌCookie\82Ì\8fê\8d\87\82Í\92l\82¾\82¯\95t\82¯\91Ö\82¦\82é
+ pos := AnsiPos('=', val);
+ if pos > 0 then begin
+ tmpCookieName := Copy(val, 0, pos - 1);
+ for i := 0 to curCookies.Count - 1 do begin
+ if (curCookies.IndexOfName(tmpCookieName) >= 0) then begin
+ curCookies.Values[tmpCookieName] := Copy(val, pos + 1, Length(val));
+ tmpCookieName := '';
+ break;
+ end;
+ end;
+ if (tmpCookieName <> '') then begin
+ curCookies.Add(val);
+ end;
+ end;
+ //tmpCookie := tmpCookie + val + '; ';
+ end;
+ //expires\82ð\90Ø\82è\8fo\82·
+ val := Trim(GikoSys.GetTokenIndex(tmp, ';', 1));
+ if( AnsiPos(EXPIRES_MARK, val) > 0) then begin
+ Delete(val, 1, AnsiPos(EXPIRES_MARK, val) + Length(EXPIRES_MARK) - 1);
+ ABoard.Expires := GMTToLocalDateTime(val);
+ end;
+ end;
+ for i := 0 to curCookies.Count - 1 do begin
+ if (curCookies.Strings[i] <> '') then begin
+ ABoard.Cookie := ABoard.Cookie + curCookies.Strings[i] + '; ';
+ end;
+ end;
+
+ finally
+ curCookies.Free;
+ end;
+end;
+//! hidden\83f\81[\83^\8eæ\93¾
+procedure TEditorForm.GetHiddenParameter(Rawtext: String; ABoard: TBoard);
+const
+ INPUT_MARK = '<input type=hidden' ; // \91å\95¶\8e\9a\8f¬\95¶\8e\9a\82Î\82ç\82Î\82ç\82È\82±\82Æ\82É\92\8d\88Ó
+ VALUE_MARK = 'value=' ; // \91å\95¶\8e\9a\8f¬\95¶\8e\9a\82Î\82ç\82Î\82ç\82È\82±\82Æ\82É\92\8d\88Ó
+ NAME_MARK = 'name=' ; // \91å\95¶\8e\9a\8f¬\95¶\8e\9a\82Î\82ç\82Î\82ç\82È\82±\82Æ\82É\92\8d\88Ó
+ IGNORE_NAMES : array[0..6] of String =
+ ('subject', 'from', 'mail', 'message', 'bbs', 'time', 'key');
+var
+ tmp, line, name, value, lname : String;
+ pos, pose, i : Integer;
+begin
+ tmp := AnsiLowerCase(Rawtext);
+ pos := AnsiPos(INPUT_MARK, tmp);
+ while (pos > 0 ) do begin
+ tmp := Copy(Rawtext, pos + Length(INPUT_MARK), Length(tmp));
+ Delete(Rawtext, 1, pos+ Length(INPUT_MARK) - 1);
+ pose := AnsiPos('>', tmp);
+ // name=xxx value=yyy \82ª\90Ø\82è\8fo\82³\82ê\82é
+ line := Copy(tmp, 1, pose - 1);
+ name := '';
+ value := '';
+ pos := AnsiPos(NAME_MARK, tmp);
+ if (pos > 0) then begin
+ name := Copy(Rawtext, pos + Length(NAME_MARK), Length(line));
+ //\94¼\8ap"\82Å\8en\82Ü\82Á\82Ä\82¢\82é\82©
+ if AnsiPos('"', name) = 1 then begin
+ // \94¼\8ap"\82Ü\82Å\82ð\83R\83s\81[
+ Delete(name, 1, 1);
+ pose := AnsiPos('"', name);
+ if (pose > 0) then begin
+ Delete(name, pose, Length(name));
+ end else begin
+ pose := AnsiPos(' ', name);
+ if (pose > 0) then begin
+ Delete(name, pose, Length(name));
+ end;
+ end;
+ end else begin
+ pose := AnsiPos(' ', name);
+ if (pose > 0) then begin
+ Delete(name, pose, Length(name));
+ end;
+ end;
+ end;
+ lname := AnsiLowerCase(name);
+ for i := 0 to Length(IGNORE_NAMES) do begin
+ if lname = IGNORE_NAMES[i] then begin
+ name := '';
+ break;
+ end;
+ end;
+ pos := AnsiPos(VALUE_MARK, tmp);
+ if (name <> '') and (pos > 0) then begin
+ value := Copy(Rawtext, pos + Length(VALUE_MARK), Length(line));
+ //\94¼\8ap"\82Å\8en\82Ü\82Á\82Ä\82¢\82é\82©
+ if AnsiPos('"', value) = 1 then begin
+ // \94¼\8ap"\82Ü\82Å\82ð\83R\83s\81[
+ Delete(value, 1, 1);
+ pose := AnsiPos('"', value);
+ if (pose > 0) then begin
+ Delete(value, pose, Length(value));
+ end else begin
+ pose := AnsiPos(' ', value);
+ if (pose > 0) then begin
+ Delete(value, pose, Length(value));
+ end;
+ end;
+ end else begin
+ pose := AnsiPos(' ', value);
+ if (pose > 0) then begin
+ Delete(value, pose, Length(name));
+ end;
+ end;
+ end;
+ if (name <> '') then begin
+ ABoard.Cookie := ABoard.Cookie + name + '=' + value + '; ';
+
+ end;
+ Delete(tmp, 1, Length(line));
+ Delete(Rawtext, 1, Length(line));
+ pos := AnsiPos(INPUT_MARK, tmp);
+ end;
+end;
+
+//! \83T\83\93\83o\8dX\90V\82Ì\83A\83N\83V\83\87\83\93\82ÌUpdate\83C\83x\83\93\83g\81@\8aÈ\92P\82Ì\82½\82ß\83^\83C\83}\81[\82Æ\93¯\82¶\82É\82µ\82Ä\82¨\82
+procedure TEditorForm.UpdateSambaActionUpdate(Sender: TObject);
+begin
+ UpdateSambaAction.Enabled := FSambaTimer.Enabled;
+end;
+
+//! \83T\83\93\83o\8dX\90V\83A\83N\83V\83\87\83\93
+procedure TEditorForm.UpdateSambaActionExecute(Sender: TObject);
+var
+ input : String;
+ i : Integer;
+begin
+ if InputQuery('Samba24\90Ý\92è\92l\8dX\90V', '\90V\82µ\82¢\90Ý\92è\92l\82ð\93ü\97Í\82µ\82Ä\82\82¾\82³\82¢', input) then begin
+ input := ZenToHan(input);
+ if GikoSys.IsNumeric(input) then begin
+ FSambaTimer.UpdateSambaSetting(StrToInt(input));
+ UpdateSambaStatus;
+ //\91S\82Ä\82Ì\83t\83H\81[\83\80\82©\82ç\81ASamba\83^\83C\83}\81[\82ð\8dX\90V\82·\82é
+ for i := 0 to Screen.FormCount - 1 do begin
+ if Screen.Forms[i] is TEditorForm then begin
+ TEditorForm(Screen.Forms[i]).FSambaTimer.Update;
+ TEditorForm(Screen.Forms[i]).UpdateSambaStatus;
+ end;
+ end;
+ end else begin
+ ShowMessage('\90\94\92l\82ð\93ü\97Í\82µ\82Ä\82\82¾\82³\82¢');
+ UpdateSambaActionExecute(Sender);
+ end;
+ end;
+end;
+
+procedure TEditorForm.UpdateSambaStatus;
+begin
+ if (FSambaTimer.Enabled) then begin
+ StatusBar.Panels[2].Text
+ := 'Samba24\8bK\92è\92l' + IntToStr(FSambaTimer.SambaInterval);
+ end;
+end;
+
+procedure TEditorForm.InputAssistActionExecute(Sender: TObject);
+var
+ count, i : Integer;
+ item : TMenuItem;
+ point: TPoint;
+ Bitmap : TBitmap;
+ TextWidth, ItemWidth, tmpWidth: Integer;
+begin
+ if FInputAssistKey = '' then Exit;
+
+ InputAssistPopupMenu.Items.Clear;
+
+ if (FResistWords = nil) then begin
+ FResistWords := TStringList.Create;
+ end else begin
+ FResistWords.Clear;
+ end;
+
+ if (GetKeyState( VK_SHIFT ) < 0) then begin
+ // \83V\83t\83g\82ª\89\9f\82³\82ê\82Ä\82¢\82ê\82Î\81A\83L\81[\82Å\8en\82Ü\82é\83J\83e\83S\83\8a
+ count :=
+ InputAssistDM.GetStartWithCategoryResistWords(
+ FInputAssistKey, FResistWords);
+ end else begin
+ // \83V\83t\83g\82ª\96³\82¢\82Ì\82Å\81A\83L\81[\82Å\8en\82Ü\82é\83L\81[
+ count :=
+ InputAssistDM.GetStartWithKeyResistWords(
+ FInputAssistKey, FResistWords);
+ end;
+ Bitmap := TBitmap.Create;
+ try
+ Bitmap.Canvas.Font.Assign(BodyEdit.Font);
+ // \83}\81[\83W\83\935px
+ TextWidth := Bitmap.Canvas.TextWidth(FInputAssistKey) + 5;
+ ItemWidth := 0;
+ for i := 0 to count - 1 do begin
+ item := TMenuItem.Create(nil);
+ item.Break := mbNone;
+ item.Caption := FResistWords[i];
+ item.Tag := i;
+ item.OnClick := InputAssistMenuClick;
+ InputAssistPopupMenu.Items.Add(item);
+
+ tmpWidth := Bitmap.Canvas.TextWidth(Item.Caption);
+ if (tmpWidth > ItemWidth) then begin
+ ItemWidth := tmpWidth;
+ end;
+ end;
+ finally
+ Bitmap.Free;
+ end;
+
+ if (count > 0) then begin
+ GetCaretpos(point);
+ point.X := point.X + Self.Left + (Self.Width - BodyEdit.Width) div 2;
+ point.Y := point.Y + Self.Top + (Self.Height - Self.ClientHeight);
+
+ if Screen.DesktopWidth >
+ (point.X + TextWidth + ItemWidth) then begin
+ InputAssistPopupMenu.Popup(
+ point.X + TextWidth,
+ point.Y + EditorPage.Top + EditorPage.TabHeight + BodyEdit.Top);
+ end else begin
+ InputAssistPopupMenu.Popup(
+ point.X - TextWidth - ItemWidth,
+ point.Y + EditorPage.Top + EditorPage.TabHeight + BodyEdit.Top);
+ end;
+ end;
+end;
+
+procedure TEditorForm.InputAssistMenuClick(Sender: TObject);
+var
+ text : String;
+ IMC: HIMC;
+begin
+ if not (Sender is TMenuItem) then Exit;
+
+ if (FResistWords <> nil) then begin
+ try
+ text :=
+ TResistWord(FResistWords.Objects[TMenuItem(Sender).Tag]).GetText;
+ except
+ text := '';
+ end;
+ IMC := ImmGetContext(BodyEdit.Handle); //\83R\83\93\83e\83L\83X\83g\8eæ\93¾
+ try
+ ImmNotifyIME(IMC, NI_COMPOSITIONSTR, CPS_CANCEL, 0);
+ finally
+ ImmReleaseContext(BodyEdit.Handle, IMC); //\83R\83\93\83e\83L\83X\83g\89ð\95ú
+ end;
+
+ FResistWords.Clear;
+ FInputAssistKey := '';
+ end;
+ InsertText(BodyEdit, text);
+end;
+
+//! TMemo\82Ì\83J\81[\83\\83\8b\88Ê\92u\82É\95¶\8e\9a\97ñ\91}\93ü
+procedure TEditorForm.InsertText(Memo: TMemo; Text: String);
+var
+ line, sel, pos: Integer;
+ left, right : String;
+begin
+ Memo.Lines.BeginUpdate;
+ line := SendMessage(Memo.Handle,EM_LINEFROMCHAR,-1,0); //\8ds
+ sel := Memo.SelStart;
+ pos := sel - SendMessage(Memo.Handle, EM_LINEINDEX, -1, 0); //\8c\85
+ if (pos > 0) then begin
+ left := Copy(Memo.Lines[line], 0, pos);
+ end else begin
+ left := '';
+ end;
+ right := Copy(Memo.Lines[line], pos + 1, Length(Memo.Lines[line]));
+ Memo.Lines.Strings[line] := left + Text + right;
+ Memo.Lines.EndUpdate;
+ //\81@\83L\83\83\83\8c\83b\83g\82Ì\88Ê\92u\82ð\8dX\90V\82·\82é
+ Memo.SelStart := sel + Length(text);
+ // \83L\83\83\83\8c\83b\83g\82Ì\88Ê\92u\82Ü\82Å\83X\83N\83\8d\81[\83\8b
+ Memo.Perform(EM_SCROLLCARET, 0, 0);
+
+end;
+
+procedure TEditorForm.ApplicationEvents1Message(var Msg: tagMSG;
+ var Handled: Boolean);
+var
+ wmMsg: TWMKey;
+ IMC: HIMC;
+ Len: integer;
+ Str: string;
+begin
+ if (Self.Active) then begin
+ case Msg.message of
+ //\83L\81[\89\9f\89º\82Ì\82Ý\8eó\82¯\8eæ\82é
+ WM_KEYDOWN:
+ begin
+ // \83^\83u\82ª\81h\95Ò\8fW\81h\82ÅCtrl\83L\81[\82ª\89\9f\82³\82ê\82Ä\82¢\82é\82Ì\82ð\8am\94F\82·\82é
+ if (EditorPage.ActivePageIndex = 0)
+ and (GetKeyState( VK_CONTROL ) < 0) then begin
+ wmMsg.Msg := Msg.message;
+ wmMsg.CharCode := Word(Msg.wParam);
+ wmMsg.KeyData := Msg.lParam;
+ if (wmMsg.CharCode = 229) and (wmMsg.KeyData = 3735553) then begin
+ IMC := ImmGetContext(BodyEdit.Handle); //\83R\83\93\83e\83L\83X\83g\8eæ\93¾
+ Len := ImmGetCompositionString(IMC, GCS_COMPSTR, nil, 0); //\82Ü\82¸\92·\82³\82ð\8eæ\93¾
+ if (Len > 0) then begin
+ SetLength(Str, Len + 1); //Buffer\82Ì\83\81\83\82\83\8a\82ð\90Ý\92è
+ ImmGetCompositionString(IMC, GCS_COMPSTR, PChar(Str), Len + 1); //\82Ü\82¸\92·\82³\82ð\8eæ\93¾
+ SetLength(Str, Len);
+ FInputAssistKey := Str;
+ InputAssistActionExecute(nil);
+ Handled := True;
+ end;
+ ImmReleaseContext(BodyEdit.Handle, IMC); //\83R\83\93\83e\83L\83X\83g\89ð\95ú
+ end;
+ end;
+ end;
+ end;
+
+ end;
+end;
+
+procedure TEditorForm.ShowInputAssistFormExecute(Sender: TObject);
+var
+ form : TInputAssistForm;
+begin
+ form := TInputAssistForm.Create(nil);
+ try
+ if TopAction.Checked then begin // \83X\83e\83C\8fó\91Ô\82É\90Ý\92è
+ SetWindowPos(form.Handle, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE + SWP_NOSIZE);
+ end;
+ form.SetUpFromEditor;
+ if (form.ShowModal = mrOk) then begin
+ InsertText(BodyEdit, form.GetInsertText);
+ end;
+ finally
+ form.Release;
+ end;
+end;
+//! Cookie\8fî\95ñ\8dí\8f\9c
+procedure TEditorForm.ReleaseCookieActionExecute(Sender: TObject);
+var
+ Board : TBoard;
+begin
+ // \83X\83\8c\83b\83h\82ª\96³\82¢\81@\83X\83\8c\97§\82Ä\82Ì\82Æ\82«\82ÍFBoard\82ð\92¼\90Ú\8eg\82¤
+ Board := GetBoard;
+
+ // \83N\83b\83L\81[\82Ì\8fî\95ñ\82ð\8eÌ\82Ä\82é
+ Board.Cookie := '';
+ Board.SPID := '';
+ Board.PON := '';
+ // 0\82É\8aª\82«\96ß\82·
+ Board.Expires := 0;
+end;
+//! \94Â\8fî\95ñ\8eæ\93¾Update\83C\83x\83\93\83g
+procedure TEditorForm.GetSETTINGTXTActionUpdate(Sender: TObject);
+begin
+ // \8eÀ\8ds\92\86\82Í\8eÀ\8ds\95s\89Â
+ GetSETTINGTXTAction.Enabled := not FWork;
+end;
+//! \83\8d\81[\83J\83\8b\83\8b\81[\83\8b\8eæ\93¾Update\83C\83x\83\93\83g
+procedure TEditorForm.GetHeadTXTActionUpdate(Sender: TObject);
+begin
+ // \8eÀ\8ds\92\86\82Í\8eÀ\8ds\95s\89Â
+ GetSETTINGTXTAction.Enabled := not FWork;
+end;
+
+//! Samba\83^\83C\83}\81[\83C\83x\83\93\83g
+procedure TEditorForm.SambaTimer(Sender: TObject);
+begin
+
+ if FSambaTimer.WriteDeta = ZERO_DATE then
+ StatusBar.Panels[1].Text := '\8f\89\8f\91'
+ else begin
+ FNow := IncMilliSecond(FNow, 500);
+ StatusBar.Panels[1].Text :=
+ Format('%8.0f\95b\8co\89ß', [SecondSpan(FNow, FSambaTimer.WriteDeta)]);
+ end;
+end;
+{
+\brief \83E\83B\83\93\83h\83E\82Ì\88Ê\92u\82Æ\83T\83C\83Y\82Ì\90Ý\92è
+}
+procedure TEditorForm.SetWindowRect;
+var
+ wp: TWindowPlacement;
+begin
+ //\83E\83B\83\93\83h\83E\82Ì\88Ê\92u\90Ý\92è
+ wp.length := sizeof(wp);
+ wp.rcNormalPosition.Top := GikoSys.Setting.EditWindowTop;
+ wp.rcNormalPosition.Left := GikoSys.Setting.EditWindowLeft;
+
+ wp.rcNormalPosition.Bottom := GikoSys.Setting.EditWindowTop + GikoSys.Setting.EditWindowHeight;
+ wp.rcNormalPosition.Right := GikoSys.Setting.EditWindowLeft + GikoSys.Setting.EditWindowWidth;
+ wp.showCmd := SW_HIDE;
+ SetWindowPlacement(Handle, @wp);
+
+ if GikoSys.Setting.EditWindowMax then begin
+ WindowState := wsMaximized;
+ end;
+
+ //\83E\83B\83\93\83h\83E\82ª\89æ\96Ê\8aO\82È\82ç\89æ\96Ê\93à\82É\88Ú\93®\82·\82é
+ if (Left + Width) > Screen.Width then begin
+ Left := 0;
+ end;
+ if (Top + Height) > Screen.Height then begin
+ Top := 0;
+ end;
+ if Left < 0 then begin
+ Left := 0;
+ end;
+ if Top < 0 then begin
+ Top := 0;
+ end;
+
+ //\8c»\8dÝ\82Ì\83E\83B\83\93\83h\83E\82Ì\88Ê\92u\82ð\95Û\91¶
+ GikoSys.Setting.EditWindowTop := Top + WINDOWMOVE_V; // \8e\9f\82É\8aJ\82\83E\83B\83\93\83h\83E\82Í
+ GikoSys.Setting.EditWindowLeft := Left + WINDOWMOVE_H; // \81@\81@\81@\89E\8eÎ\82ß\89º\82É\82¸\82ç\82·
+ //\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·
+ if GikoSys.Setting.EditWindowHeight < 144 then begin
+ Height := 400;
+ end;
+ if GikoSys.Setting.EditWindowWidth < 144 then begin
+ Width := 640;
+ end;
+end;
+{
+\brief \8ag\92£\83^\83u\90Ý\92è
+}
+procedure TEditorForm.SetExtraTab;
+const
+ SECTION = 'EditorForm';
+var
+ ini: TMemIniFile;
+begin
+ ini := TMemIniFile.Create(GikoSys.Setting.GetFileName);
+ try
+ BoardtopTab.TabVisible := ini.Readbool(SECTION, 'BoardTopTab', False);
+ BoardTop.Checked := BoardtopTab.TabVisible;
+ RocalRuleTab.TabVisible := ini.ReadBool(SECTION, 'LocalRuleTab', False);
+ LocalRule.Checked := RocalRuleTab.TabVisible;
+ finally
+ ini.Free;
+ end;
+end;
+{
+\brief \94Â\8eæ\93¾
+\return \83\8c\83X\83G\83f\83B\83^\82ª\93\8a\8de\82µ\82æ\82¤\82Æ\82µ\82Ä\82¢\82é\94Â
+}
+function TEditorForm.GetBoard : TBoard;
+begin
+ // \83X\83\8c\83b\83h\83A\83C\83e\83\80\82ªnull\82Ì\8e\9e\82ÍFBoard
+ if FThreadItem = nil then begin
+ Result := FBoard;
+ end else begin
+ Result := FThreadItem.ParentBoard;
+ end;
+end;
+{
+\brief GikoForm\82É\83\81\83b\83Z\81[\83W\82ð\92Ç\89Á\82·\82é
+\param icon \83\81\83b\83Z\81[\83W\82É\82Â\82\83A\83C\83R\83\93
+}
+procedure TEditorForm.AddFormMessageNew(icon: TGikoMessageIcon);
+begin
+ if FThreadItem = nil then begin
+ GikoForm.AddMessageList(FBoard.Title + ' ' + GikoSys.GetGikoMessage(gmNewSure), nil, icon)
+ end else begin
+ GikoForm.AddMessageList(FThreadItem.Title + ' ' + GikoSys.GetGikoMessage(gmNewRes), nil, icon);
+ end;
+
+end;
+{
+\brief \83\8d\81[\83J\83\8bfusiana\83g\83\89\83b\83v
+\return true:\91\97\90M\92\86\8e~ false:\91\97\90M
+}
+function TEditorForm.isLocalFusianaTrap: Boolean;
+var
+ Namae : string;
+begin
+ Result := False;
+ if GikoSys.Setting.LocalTrapAtt then begin
+ Namae := THTMLCreate.RepHtml(NameComboBox.Text);
+ if (LFusianaGet(Namae)) or (Namae = '\8eR\8dè\8fÂ') then begin
+ if FusianaMsgBox = IDNO then begin
+ Result := True;
+ end;
+ end;
+ end;
+end;
+{
+\brief \83\8a\83\82\81[\83gfusiana\83g\83\89\83b\83v
+\return true:\91\97\90M\92\86\8e~ false:\91\97\90M
+}
+function TEditorForm.isRemoteFusianaTrap: Boolean;
+var
+ Namae : string;
+ Board : TBoard;
+ Remote: string;
+ body : TStringList;
+begin
+ Result := False;
+ Namae := THTMLCreate.RepHtml(NameComboBox.Text);
+ if (GikoSys.Setting.RemoteTrapAtt) and (Length(Namae) = 0) then begin
+ Board := GetBoard;
+
+ if Board = nil then Exit;
+
+ if not FileExists(Board.GetSETTINGTXTFileName) then begin
+ //Setting.txt\82ª\82È\82©\82Á\82½\82ç\8eæ\93¾
+ //\8eI\82É\95\89\89×\82ª\82©\82©\82è\82»\82¤...
+ try
+ GetSETTINGTXTAction.Execute;
+ except
+ end;
+ end;
+
+ Remote := '';
+ if FileExists(Board.GetSETTINGTXTFileName) then begin
+ body := TStringList.Create;
+ try
+ body.LoadFromFile(Board.GetSETTINGTXTFileName);
+ Remote := GetFusianaName(body, Board);
+ finally
+ body.Free;
+ end;
+ end;
+
+ if LFusianaGet(Remote) then begin
+ if FusianaMsgBox = IDNO then begin
+ Result := True;
+ end;
+ end;
+ end;
+end;
+{
+\brief Header\95¶\8e\9a\97ñ\8eæ\93¾
+\param ACOOKIE Cookie
+\param SPID SPID
+\param PON PON
+\param Board \94Â
+\return Header\95¶\8e\9a\97ñ
+}
+function TEditorForm.getHeaderStr(const ACOOKIE: string; const SPID : string;
+ const PON : string; Board : TBoard) : string;
+begin
+ Result := ACOOKIE;
+ if SPID <> '' then
+ Result := Result + 'SPID=' + SPID + '; ';
+ if PON <> '' then
+ Result := Result + 'PON=' + PON + '; ';
+
+ //\83z\83X\83g\82ª2ch\82Å\81ABe\82ÉLogin\82µ\82Ä\82¢\82ê\82ÎBE\82Ì\83f\81[\83^\82ð\91\97\82é
+ //GikoSys.ParseURI( URL, Protocol,Host, Path, Document, Port, Bookmark );
+ //if GikoSys.Is2chHost(Host) and GikoSys.Setting.BeLogin then
+ if (Board.Is2ch) then begin
+ // \8cÅ\92è\82Ì\83N\83b\83L\81[\82ª\82 \82ê\82Î\90H\82í\82¹\82é
+ if Length(GikoSys.Setting.FixedCookie) > 0 then begin
+ // \83z\83X\83g\82ª2ch\82Ì\8fê\8d\87\81C\8cÅ\92è\82Ì\83N\83b\83L\81[\82ð\90H\82í\82¹\82é
+ Result := Result + GikoSys.Setting.FixedCookie + '; ';
end;
- wDoc := WebBrowser1.Document;
- wTex := wDoc.body.createTextRange;
- LocalEdit.Text := wTex.text;
+ if (GikoSys.Setting.BeLogin) then begin
+ Result := Result + 'MDMD=' + GikoSys.Setting.BeCode + '; '
+ + 'DMDM=' + GikoSys.Setting.BeUserID + '; ';
+ end;
+ end;
+
+ Result := 'Cookie: ' + Result + 'NAME=' + NameComboBox.Text + '; MAIL=' + MailComboBox.Text;
+
+end;
+{
+\brief fusiana\8cx\8d\90\83_\83C\83A\83\8d\83O
+\return IDYES \8f\91\82«\8d\9e\82Þ IDNO \92\86\8e~
+}
+function TEditorForm.FusianaMsgBox: Integer;
+const
+ MSG_FUSIANA : string = '\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 +
+ '\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'\90Ó\94C\82ð\95\89\82¤\82±\82Æ\82ð\8f³\91ø\82µ\82Ä\8f\91\82«\8d\9e\82Ý\82Ü\82·\82©\81H';
+begin
+ Result := MsgBox(Handle, MSG_FUSIANA, '\8fî\95ñ',
+ MB_YESNO or MB_ICONQUESTION);
+end;
+{
+\brief \98A\93\8a\83\82\81[\83hON/OFF\90Ø\82è\91Ö\82¦
+}
+procedure TEditorForm.ContinueModeActionExecute(Sender: TObject);
+begin
+ ContinueModeAction.Checked := not ContinueModeAction.Checked;
+end;
+{
+\brief \98A\93\8a\83\82\81[\83h\8dX\90V\8f\88\97\9d
+}
+procedure TEditorForm.ContinueModeActionUpdate(Sender: TObject);
+begin
+ // \83X\83\8c\82½\82Ä\82Ì\82Æ\82«\82Í\96³\8cø
+ ContinueModeAction.Enabled := FThreadItem <> nil;
+end;
+{
+\brief \8f\91\82«\8d\9e\82Þ\94Â/\83X\83\8c\83b\83h\82ð\95\\8e¦\82·\82é
+}
+procedure TEditorForm.OpenSendTargetActionExecute(Sender: TObject);
+begin
+ if (FThreadItem <> nil) then begin
+ // \83\81\83C\83\93\82ð\8dX\90V\82µ\82Ä\82µ\82Ü\82¤\82Ì\82Å\89æ\96Ê\82ª\83p\83^\83p\83^\90Ø\82è\91Ö\82í\82é\82Ì\82ð\96h\82®\82½\82ß\82É
+ // \91O\96Ê\82Å\8cÅ\92è\82·\82é
+ if not (fsShowing in Self.FormState) then begin
+ // \83X\83e\83C\8fó\91Ô\82É\90Ý\92è
+ SetWindowPos(Handle, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE + SWP_NOSIZE);
+ end;
+ try
+ // \83X\83\8c\83b\83h
+ GikoForm.InsertBrowserTab(FThreadItem, True);
+ finally
+ if not TopAction.Checked then begin // \83X\83e\83C\8fó\91Ô\89ð\8f\9c
+ SetWindowPos(Handle, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE + SWP_NOSIZE);
+ end;
+ end;
+ Self.SetFocus;
+ end else begin
+ // \94Â
+ GikoForm.SelectTreeNode(
+ GetBoard, True );
+ end;
+end;
+procedure TEditorForm.ReloadTargetActionExecute(Sender: TObject);
+begin
+ if (FThreadItem <> nil) then begin
+ // \83X\83\8c\83b\83h
+ // \83\81\83C\83\93\82ð\8dX\90V\82µ\82Ä\82µ\82Ü\82¤\82Ì\82Å\89æ\96Ê\82ª\83p\83^\83p\83^\90Ø\82è\91Ö\82í\82é\82Ì\82ð\96h\82®\82½\82ß\82É
+ // \91O\96Ê\82Å\8cÅ\92è\82·\82é(\83_\83E\83\93\83\8d\81[\83h\82ª\94\90¶\82·\82é\82Æ\90Ø\82è\91Ö\82í\82Á\82Ä\82µ\82Ü\82¤\82ª\82 \82«\82ç\82ß\82é)
+ if not (fsShowing in Self.FormState) then begin
+ // \83X\83e\83C\8fó\91Ô\82É\90Ý\92è
+ SetWindowPos(Handle, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE + SWP_NOSIZE);
+ end;
+ try
+ GikoForm.DownloadContent(FThreadItem);
+ finally
+ if not TopAction.Checked then begin // \83X\83e\83C\8fó\91Ô\89ð\8f\9c
+ SetWindowPos(Handle, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE + SWP_NOSIZE);
+ end;
+ end;
+ Self.SetFocus;
+ end else begin
+ // \94Â
+ GikoForm.DownloadList(GetBoard);
+ end;
end;
end.