{HttpApp,} URLMon, IdGlobal, IdURI, {Masks,}
Setting, BoardGroup, gzip, Dolib, bmRegExp, AbonUnit,
ExternalBoardManager, ExternalBoardPlugInMain,
- GikoBayesian, GikoMessage;
+ GikoBayesian, GikoMessage, Belib;
type
TVerResourceKey = (
FBayesian : TGikoBayesian; //!< \83x\83C\83W\83A\83\93\83t\83B\83\8b\83^
FVersion : String; //!< \83t\83@\83C\83\8b\83o\81[\83W\83\87\83\93
FGikoMessage: TGikoMessage;
+ FBelib: TBelib;
//! \82 \82é\83Z\83p\83\8c\81[\83^\82Å\8bæ\90Ø\82ç\82ê\82½\95¶\8e\9a\97ñ\82©\82ç\82\8e\94Ô\96Ú\82Ì\95¶\8e\9a\97ñ\82ð\8eæ\82è\8fo\82·
function ChooseString(const Text, Separator: string; Index: integer): string;
//! \88ê\8e\9e\83t\83@\83C\83\8b\82©\82ç\82Ì\95\9c\8b\8c
function DivideSubject(Line: string): TSubjectRec;
property Setting: TSetting read FSetting write FSetting;
property Dolib: TDolib read FDolib write FDolib;
+ property Belib: TBelib read FBelib write FBelib;
function UrlToID(url: string): string;
function UrlToServer(url: string): string;
procedure MenuFont(Font: TFont);
- function RemoveToken(var s:string; const delimiter:string):string;
+// function RemoveToken(var s:string; const delimiter:string):string;
function GetTokenIndex(s: string; delimiter: string; index: Integer): string;
function GetShortName(const LongName: string; ALength: integer): string;
procedure GetSameIDRes(const AID : string; ThreadItem: TThreadItem;var body: TStringList); overload;
procedure GetSameIDRes(AIDNum : Integer; ThreadItem: TThreadItem;var body: TStringList); overload;
function GetResID(AIDNum: Integer; ThreadItem: TThreadItem): String;
+ function ExtructResID(ADateStr: String): String;
//! \92P\8cê\89ð\90Í
procedure SpamCountWord( const text : string; wordCount : TWordCount );
//! \8aw\8fK\83N\83\8a\83A
procedure SpamLearn( wordCount : TWordCount; isSpam : Boolean );
//! \83X\83p\83\80\93x\90\94
function SpamParse( const text : string; wordCount : TWordCount ) : Extended;
- //\88ø\90\94\82ª\81A\93ú\95t\82Å\82à\8e\9e\8d\8f\82Å\82à\82È\82¢\82±\82Æ\82ð\92²\82×\82é
- function NotDateorTimeString(const AStr : string): boolean;
//! \88ø\90\94\82É\91\97\82ç\82ê\82Ä\82«\82½\93ú\95t/ID\95\94\82ÉBE\82Ì\95¶\8e\9a\97ñ\82ª\82 \82Á\82½\82ç\81A\83v\83\8d\83t\83@\83C\83\8b\82Ö\82Ì\83\8a\83\93\83N\82ð\92Ç\89Á
function AddBeProfileLink(AID : string; ANum: Integer): string;
function GetExtpreviewFileName: String;
procedure ShowRefCount(msg: String; unk: IUnknown);
+ //! \96`\8c¯\82Ì\8f\91Cookie\8eæ\93¾
+ function GetBoukenCookie(AURL: String): String;
+ //! \96`\8c¯\82Ì\8f\91Cookie\90Ý\92è
+ procedure SetBoukenCookie(ACookieValue, ADomain: String);
+ //! \96`\8c¯\82Ì\8f\91Cookie\8dí\8f\9c
+ procedure DelBoukenCookie(ADomain: String);
+ //! \96`\8c¯\82Ì\8f\91Domain\88ê\97\97\8eæ\93¾
+ procedure GetBoukenDomain(var ADomain: TStringList);
end;
var
ZERO_DATE: Integer = 25569;
BETA_VERSION_NAME_E = 'beta';
BETA_VERSION_NAME_J = 'ÊÞÀ';
- BETA_VERSION = 58;
+ BETA_VERSION = 62;
BETA_VERSION_BUILD = ''; //!< debug\94Å\82È\82Ç
APP_NAME = 'gikoNavi';
BE_PHP_URL = 'http://be.2ch.net/test/p.php?i=';
Inherited;
FSetting := TSetting.Create;
FDolib := TDolib.Create;
+ FBelib := TBelib.Create;
FAWKStr := TAWKStr.Create(nil);
if DirectoryExists(GetConfigDir) = false then begin
CreateDir(GetConfigDir);
FreeAndNil(FSelectResFilter);
FreeAndNil(FAbon);
FreeAndNil(FAWKStr);
+ FreeAndNil(FBelib);
FreeAndNil(FDolib);
FreeAndNil(FSetting);
inherited;
end;
end;
- ThreadItem.BeginUpdate;
+ //ThreadItem.BeginUpdate;
if (datFileCheck) and (islog) then
FileList.Delete( Index );
Node := FavoriteDM.TreeView.Items.AddChildObject( FavoriteDM.TreeView.Items.Item[0], ThreadItem.Title, FavoThreadItem);
*}
- ThreadItem.EndUpdate;
+ //ThreadItem.EndUpdate;
Board.Add(ThreadItem);
if (ThreadItem.UnRead) and (ThreadItem.IsLogFile) then
Board.IsThreadDatRead := True;
{$IFDEF DEBUG}
rt := GetTickCount - st;
- Writeln('Read Done.' + IntToStr(rt) + ' ms');
+ Writeln('Read Done.' + Board.Title + ':' + IntToStr(rt) + ' ms');
{$ENDIF}
end;
{!
Result.FLastModified := IntToDateTime(StrToIntDef('$' + MojuUtils.RemoveToken(Line, #1), ZERO_DATE));
Result.FKokomade := StrToIntDef('$' + MojuUtils.RemoveToken(Line, #1), -1);
Result.FNewReceive := StrToIntDef('$' + MojuUtils.RemoveToken(Line, #1), 0);
- RemoveToken(Line, #1);//9: ; //\96¢\8eg\97p
+ MojuUtils.RemoveToken(Line, #1);//9: ; //\96¢\8eg\97p
Result.FUnRead := IntToBool(StrToIntDef('$' + MojuUtils.RemoveToken(Line, #1), 0));
Result.FScrollTop := StrToIntDef('$' + MojuUtils.RemoveToken(Line, #1), 0);
Result.FAllResCount := StrToIntDef('$' + MojuUtils.RemoveToken(Line, #1), 0);
Delim := ','
else
Delim := '<>';
- Result.FFileName := RemoveToken(Line, Delim);
- Result.FTitle := Trim(RemoveToken(Line, Delim));
+ Result.FFileName := MojuUtils.RemoveToken(Line, Delim);
+ Result.FTitle := Trim(MojuUtils.RemoveToken(Line, Delim));
ws := Result.FTitle;
if Copy(ws, Length(ws), 1) = ')' then begin
\82Ç\82±\82©\82Ì\83T\83C\83g\82©\82ç\82Ì\83p\83N\83\8a
}
-function TGikoSys.RemoveToken(var s: string;const delimiter: string): string;
+{function TGikoSys.RemoveToken(var s: string;const delimiter: string): string;
var
p: Integer;
begin
Result := Copy(s, 1, p - 1);
Delete(s, 1, Length(Result) + Length(delimiter));
end;
-
+}
{!
\brief n \8cÂ\96Ú\82Ì\83g\81[\83N\83\93\82ð\90Ø\82è\8fo\82µ
begin
Result := '';
for i := 0 to index do
- Result := RemoveToken(s, delimiter);
+ Result := MojuUtils.RemoveToken(s, delimiter);
end;
SI.cbReserved2 := 0;
SI.lpReserved2 := nil;
SI.dwysize := 0;
- Windows.CreateProcess(nil,
+ if Windows.CreateProcess(nil,
PChar(Path),
nil,
nil,
nil,
nil,
SI,
- PI);
+ PI) then
+ begin
+ CloseHandle(PI.hProcess);
+ end;
+
end;
{!
\param BrowserType \83u\83\89\83E\83U\82Ì\83^\83C\83v(IE \82©\82Ç\82¤\82©)
}
procedure TGikoSys.OpenBrowser(URL: string; BrowserType: TGikoBrowserType);
+var
+ i, j : Integer;
+ path, arg : String;
+ params : TStringList;
begin
case BrowserType of
gbtIE:
HlinkNavigateString(nil, PWideChar(WideString(URL)));
gbtUserApp, gbtAuto:
- if (Setting.URLApp) and (FileExists(Setting.URLAppFile)) then
- GikoSys.CreateProcess(Setting.URLAppFile, URL)
- else
+ if (Setting.URLApp) then begin
+ if (FileExists(Setting.URLAppFile)) then begin
+ GikoSys.CreateProcess(Setting.URLAppFile, URL)
+ end else begin
+ // \8bN\93®\83p\83\89\83\81\81[\83^\95t\82«\91Î\8dô
+ path := '';
+ params := TStringList.Create;
+ try
+ params.Delimiter := ' ';
+ params.DelimitedText := Setting.URLAppFile;
+ for i := 0 to params.Count - 1 do begin
+ path := TrimLeft(path + ' ' + params[i]);
+ if (FileExists(path)) then begin
+ arg := '';
+ for j := i + 1 to params.Count - 1 do begin
+ arg := arg + ' ' + params[j];
+ end;
+ break;
+ end;
+ end;
+ if i < params.Count then begin
+ GikoSys.CreateProcess(path, arg + ' ' + URL);
+ end else begin
+ HlinkNavigateString(nil, PWideChar(WideString(URL)));
+ end;
+ finally
+ params.Free;
+ end;
+ end;
+ end else
HlinkNavigateString(nil, PWideChar(WideString(URL)));
end;
end;
\82Ì\8fê\8d\87 stRef = 32, endRes = 50 \82É\82È\82é
}
procedure TGikoSys.GetPopupResNumber(URL : string; var stRes, endRes : Int64);
+const
+ START_NAME : array[0..1] of String = ('st=', 'start=');
+ END_NAME : array[0..1] of String = ('to=', 'end=');
+ RES_NAME : array[0..0] of String = ('res=');
var
buf : String;
convBuf : String;
ps : Int64;
pch : PChar;
+ bufList : TStringList;
+ i, j, idx : Integer;
begin
URL := Trim(LowerCase(URL));
- if (AnsiPos('&st=', URL ) <> 0) and ( AnsiPos( '&to=',URL) <> 0 ) then begin
- stRes := 0;
- endRes := 0;
- try
- buf := Copy( URL, AnsiPos('&st=', URL ) + 4, AnsiPos( '&to=',URL) - AnsiPos('&st=', URL ) - 4 );
- if buf <> '' then
- stRes := StrToInt64( buf );
- if AnsiPos( '&nofirst=',URL) <> 0 then begin
- buf := Copy( URL, AnsiPos('&to=', URL ) + 4, AnsiPos( '&nofirst=',URL) - AnsiPos('&to=', URL ) - 4);
- end else begin
- buf := Copy( URL, AnsiPos('&to=', URL ) + 4, Length( URL ) - AnsiPos('&to=', URL ) - 4 + 1 );
- ps := 0;
- pch := PChar(buf);
- while ( ps < Length(buf) )and ( pch[ps] >= '0' ) and ( pch[ps] <= '9' ) do Inc(ps);
- buf := Copy( buf, 1, ps );
- end;
- try
- if buf <> '' then
- endRes := StrToInt64(buf)
- except
- endRes := 0;
- end;
- except
- stRes := 0;
- end;
- if (stRes <> 0) and (endRes = 0) then
- endRes := stRes + MAX_POPUP_RES
- else if (stRes = 0) and (endRes <> 0) then begin
- stRes := endRes - MAX_POPUP_RES;
- if stRes < 1 then
- stRes := 1;
- end;
- GikoSys.GetBrowsableThreadURL( URL );
- end else if( AnsiPos('&res=', URL ) <> 0 ) then begin
- endRes := 0;
- buf := Copy( URL, AnsiPos('&res=', URL ) + 5, Length( URL ) - AnsiPos('&res=', URL ) - 5 + 1 );
- ps := 0;
- pch := PChar(buf);
- while ( ps < Length(buf) )and ( pch[ps] >= '0' ) and ( pch[ps] <= '9' ) do Inc(ps);
- buf := Copy( buf, 1, ps );
- try
- if buf <> '' then
- stRes := StrToInt(buf)
- else begin
- stRes := 0;
- end;
- except
- stRes := 0;
- end;
- end else if (AnsiPos('&start=', URL ) <> 0) and ( AnsiPos( '&end=',URL) <> 0 ) then begin
- try
- stRes := StrToInt64( Copy( URL, AnsiPos('&start=', URL ) + 7, AnsiPos( '&end=',URL) - AnsiPos('&start=', URL ) - 7 ) );
- if AnsiPos( '&nofirst=',URL) <> 0 then begin
- buf := Copy( URL, AnsiPos('&end=', URL ) + 5, AnsiPos( '&nofirst=',URL) - AnsiPos('&end=', URL ) - 5);
- end else begin
- buf := Copy( URL, AnsiPos('&end=', URL ) + 5, Length( URL ) - AnsiPos('&to=', URL ) - 5 + 1 );
- ps := 0;
- pch := PChar(buf);
- while ( ps < Length(buf) )and ( pch[ps] >= '0' ) and ( pch[ps] <= '9' ) do Inc(ps);
- buf := Copy( buf, 1, ps );
- end;
- try
- if buf <> '' then
- endRes := StrToInt64(buf);
- except
- endRes := 0;
- end;
- except
- stRes := 0;
- end;
- end else if ( AnsiPos('.html',URL) <> Length(URL) -4 ) and ( AnsiPos('.htm',URL) <> Length(URL) -3 ) then begin
+ for i := 0 to Length(START_NAME) -1 do begin
+ idx := AnsiPos(START_NAME[i], URL);
+ if (idx <> 0) then begin
+ break;
+ end;
+ idx := AnsiPos(END_NAME[i], URL);
+ if (idx <> 0) then begin
+ break;
+ end;
+
+ end;
+
+ if (idx <> 0) then begin
+ idx := AnsiPos('?', URL);
+ if (idx = 0) then begin
+ idx := LastDelimiter('/', URL);
+ end;
+ stRes := 0;
+ endRes := 0;
+ bufList := TStringList.Create();
+ try
+ bufList.Delimiter := '&';
+ bufList.DelimitedText := Copy(URL, idx + 1, Length(URL));
+ for i := 0 to bufList.Count - 1 do begin
+ convBuf := '';
+ // \8aJ\8en\83\8c\83X\94Ô\82Ì\8c\9f\8dõ
+ if (stRes = 0) then begin
+ for j := 0 to Length(START_NAME) - 1 do begin
+ idx := AnsiPos(START_NAME[j], bufList[i]);
+ if (idx = 1) then begin
+ convBuf := Copy(bufList[i], idx + Length(START_NAME[j]), Length(bufList[i]));
+ stRes := StrToInt64Def( convBuf, 0 );
+ break;
+ end;
+ end;
+ end;
+ // \8fI\97¹\83\8c\83X\94Ô\82Ì\8c\9f\8dõ
+ if (convBuf = '') and (endRes = 0) then begin
+ for j := 0 to Length(END_NAME) - 1 do begin
+ idx := AnsiPos(END_NAME[j], bufList[i]);
+ if (idx = 1) then begin
+ convBuf := Copy(bufList[i], idx + Length(END_NAME[j]), Length(bufList[i]));
+ endRes := StrToInt64Def( convBuf, 0 );
+ break;
+ end;
+ end;
+ end;
+ // \83\8c\83X\94Ô\82Ì\8c\9f\8dõ
+ if ((stRes = 0) and (endRes = 0) and (convBuf = '')) then begin
+ for j := 0 to Length(RES_NAME) - 1 do begin
+ idx := AnsiPos(RES_NAME[j], bufList[i]);
+ if (idx = 1) then begin
+ convBuf := Copy(bufList[i], idx + Length(RES_NAME[j]), Length(bufList[i]));
+ stRes := StrToInt64Def( convBuf, 0 );
+ endRes := stRes;
+ break;
+ end;
+ end;
+ end;
+ end;
+
+ if (stRes <> 0) and (endRes = 0) then begin
+ endRes := stRes + MAX_POPUP_RES;
+ end else if (stRes = 0) and (endRes <> 0) then begin
+ stRes := endRes - MAX_POPUP_RES;
+ if stRes < 1 then begin
+ stRes := 1;
+ end;
+ end;
+ finally
+ bufList.clear;
+ bufList.free;
+ end;
+ end else if ( AnsiPos('.html',URL) <> Length(URL) -4 ) and ( AnsiPos('.htm',URL) <> Length(URL) -3 ) then begin
buf := Copy(URL, LastDelimiter('/',URL)+1,Length(URL)-LastDelimiter('/',URL)+1);
if Length(buf) > 0 then begin
if AnsiPos('-', buf) = 1 then begin
ps := 0;
pch := PChar(buf);
while ( ps < Length(buf) )and ( pch[ps] >= '0' ) and ( pch[ps] <= '9' ) do Inc(ps);
- try
- convBuf := Copy( buf, 1, ps );
- if convBuf <> '' then
- endRes := StrToInt64(convBuf)
- else
- endRes := 0;
- except
- endRes := 0;
- end;
+ convBuf := Copy( buf, 1, ps );
+ if convBuf <> '' then begin
+ endRes := StrToInt64Def(convBuf, 0);
+ end;
if endRes <> 0 then begin
stRes := endRes - MAX_POPUP_RES;
if stRes < 1 then
ps := 0;
pch := PChar(buf);
while ( ps < Length(buf) )and ( pch[ps] >= '0' ) and ( pch[ps] <= '9' ) do Inc(ps);
- try
- convBuf := Copy( buf, 1, ps );
- if convBuf <> '' then
- endRes := StrToInt64(convBuf)
- else
- endRes := 0;
- except
- endRes := 0;
- end;
+ convBuf := Copy( buf, 1, ps );
+ if convBuf <> '' then begin
+ endRes := StrToInt64Def(convBuf, 0);
+ end;
end else begin
stRes := 0;
end;
end;
end;
end;
- end else begin
- //stRes := 0;
- //endRes := 0;
end;
end;
var
Res: TResRec;
boardPlugIn : TBoardPlugIn;
- stList: TStringList;
- i : Integer;
begin
Result := '';
if (ThreadItem <> nil) and (ThreadItem.IsLogFile)
end else begin
THTMLCreate.DivideStrLine( ReadThreadFile(ThreadItem.GetThreadFileName, AIDNum), @Res);
end;
- Result := Res.FDateTime;
- if AnsiPos('id', AnsiLowerCase(Result)) > 0 then begin
- Result := Copy(Result, AnsiPos('id', AnsiLowerCase(Result)) - 1, 11);
- if AnsiPos(' be:', AnsiLowerCase(Result)) > 0 then begin
- Result := Copy(Result, 1, AnsiPos(' BE:', AnsiLowerCase(Result)) - 1)
- end;
- end else begin
- stlist := TStringList.Create;
- try
- stList.DelimitedText := Result;
- Result := '';
- for i := 0 to stList.Count - 1 do
- if Length(WideString(stList[i])) = 8 then begin
- if NotDateorTimeString(stList[i]) then begin
- Result := stList[i];
- break;
- end;
- end;
- finally
- stList.Free;
- end;
- end;
+ Result := ExtructResID(Res.FDateTime);
end;
end;
-
{!
-\brief \8e\9e\8d\8f\82ð\8e¦\82·\95¶\8e\9a\97ñ\82Å\82Í\96³\82¢\82©\82Ç\82¤\82©
-\param AStr \92²\82×\82é\95¶\8e\9a\97ñ
-\return \8e\9e\8d\8f\82Å\82Í\96³\82¢\82È\82ç True
-\todo \94Û\92è\8c`(Not)\82æ\82è\8dm\92è\8cn(Is)
+\brief \83\8c\83X\82Ì\8e\9e\8d\8f\95\94\82©\82çID\82ð\92\8a\8fo\82·\82é
+\param ADateStr \8e\9e\8d\8f\95\94\82Ì\95¶\8e\9a\97ñ
+\return ID(ID\82Æ\82Ý\82È\82¹\82é\95\94\95ª\82ª\82È\82¢\82Æ\82«\82Í\8bó\95¶\8e\9a\97ñ)
}
-function TGikoSys.NotDateorTimeString(const AStr : string): boolean;
+function TGikoSys.ExtructResID(ADateStr: String): String;
+var
+ stlist : TStringList;
begin
- Result := false;
- try
- StrToDate(AStr);
- except
- try
- StrToTime(AStr);
- Result := false;
- except
- Result := true;
- end;
- end;
-
+ Result := '';
+ if AnsiPos('id', AnsiLowerCase(ADateStr)) > 0 then begin
+ Result := Copy(ADateStr, AnsiPos('id', AnsiLowerCase(ADateStr)), Length(ADateStr));
+ if AnsiPos(' ', Result) > 0 then begin
+ Result := Copy(Result, 1, AnsiPos(' ', Result) - 1);
+ end;
+ Result := ' ' + Result;
+ end else begin
+ stlist := TStringList.Create;
+ try
+ stList.Delimiter := ' ';
+ stList.DelimitedText := ADateStr;
+ // \93ú\95t \8e\9e\8d\8f ID \91¼\81@\82Æ\8cÅ\92è\82Å\8dl\82¦\82é
+ if (stList.Count >= 3) then begin
+ if Length(stList[3 - 1]) >= 7 then begin
+ Result := stList[3 - 1];
+ end;
+ end;
+ finally
+ stList.Free;
+ end;
+ end;
end;
{!
end;
{$ENDIF}
end;
+function TGikoSys.GetBoukenCookie(AURL: String): String;
+var
+ Protocol, Host, Path, Document, Port,Bookmark : String;
+begin
+ Result := '';
+ GikoSys.ParseURI(AURL, Protocol, Host, Path, Document, Port,Bookmark);
+ if ( Length(Host) > 0 ) then begin
+ Result := Setting.GetBoukenCookie(Host);
+ end;
+end;
+procedure TGikoSys.SetBoukenCookie(ACookieValue, ADomain: String);
+begin
+ if ( Length(ADomain) > 0 ) then begin
+ Setting.SetBoukenCookie(ACookieValue, ADomain);
+ end;
+end;
+//! \96`\8c¯\82Ì\8f\91Domain\88ê\97\97\8eæ\93¾
+procedure TGikoSys.GetBoukenDomain(var ADomain: TStringList);
+var
+ i : Integer;
+begin
+ ADomain.Clear;
+ for i := 0 to Setting.BoukenCookieList.Count - 1 do begin
+ ADomain.Add( Setting.BoukenCookieList.Names[i] );
+ end;
+end;
+//! \96`\8c¯\82Ì\8f\91Cookie\8dí\8f\9c
+procedure TGikoSys.DelBoukenCookie(ADomain: String);
+var
+ i : Integer;
+begin
+ for i := 0 to Setting.BoukenCookieList.Count - 1 do begin
+ if ( Setting.BoukenCookieList.Names[i] = ADomain ) then begin
+ Setting.BoukenCookieList.Delete(i);
+ Break;
+ end;
+ end;
+end;
+
initialization
GikoSys := TGikoSys.Create;