function Find(key: string): TCategory;
function FindBBSID(const BBSID: string): TBoard;
function FindBoardFromTitle(const Title: string): TBoard;
+ function FindBoardFromTitleAndCategory(const CategoryTitle: string; const BoardTitle: string): TBoard;
function FindBoardFromURL(const inURL: string): TBoard;
function FindThreadFromURL(const inURL : string ) : TThreadItem;
function FindThreadItem(const BBSID, FileName: string): TThreadItem;
public
constructor Create(const inPlugIn : TBoardPlugIn; const inBoard : TBoard; inURL : string ); overload;
constructor Create(const inPlugIn : TBoardPlugIn; const inBoard : TBoard;
- inURL : string; inExist: Boolean; const inFilename: string ); overload;
+ const inURL : string; inExist: Boolean; const inFilename: string ); overload;
destructor Destroy; override;
function GetDatgzURL: string;
// function GetOldDatgzURL: string;
function GetOfflawCgiURL(const SessionID: string): string;
+//////////////// 2013/10/13 ShiroKuma\91Î\89\9e zako Start ///////////////////////////
+ function GetOfflaw2SoURL: string;
+//////////////// 2013/10/13 ShiroKuma\91Î\89\9e zako End /////////////////////////////
+ function GetRokkaURL(const SessionID: string): string; // Rokka\91Î\89\9e
+ function GetExternalBoardKakoDatURL: string; // \8aO\95\94\94Â\89ß\8b\8e\83\8d\83OURL\8eæ\93¾
function GetSendURL: string;
procedure DeleteLogFile;
function GetThreadFileName: string;
property BoardPlugIn : TBoardPlugIn read FBoardPlugIn write FBoardPlugIn;
end;
+ // \93Á\8eê\97p\93r\97pTBoard
+ TSpecialBoard = class(TBoard)
+ public
+ function Add(item: TThreadItem): integer; overload;
+ procedure Clear; overload;
+ end;
+
+ // \83X\83\8c\83b\83h\96¼NG\83\8f\81[\83h\83\8a\83X\83g
+ TThreadNgList = class(TStringList)
+ private
+ FFilePath: String;
+ public
+ constructor Create;
+ procedure Load;
+ procedure Save;
+ function IsNG(const Title: String): Boolean;
+ end;
function BBSsFindBoardFromBBSID( inBBSID : string ) : TBoard;
function BBSsFindBoardFromURL( inURL : string ) : TBoard;
function BBSsFindThreadFromURL(const inURL : string ) : TThreadItem;
function ConvertDateTimeString( inDateTimeString : string) : TDateTime;
+ procedure DestorySpecialBBS( inBBS : TBBS );
+
var
BBSs : array of TBBS;
BoardGroups : array of TBoardGroup;
+ SpecialBBS : TBBS;
+ SpecialBoard: TSpecialBoard;
+ ThreadNgList: TThreadNgList;
implementation
SETTINGTXT_FILENAME: string = 'SETTING.TXT';
HEADTXT_FILENAME: string = 'head.html';
//DEFAULT_LIST_COUNT: Integer = 100;
+ THREAD_NG_FILE: String = 'ThreadNg.txt';
+
//! \83\8d\83O\82ð\8e\9d\82Á\82Ä\82¢\82é\82È\82ç\90^\82ð\95Ô\82·
function CountLog(Item: TThreadItem): Boolean;
end;
end;
+{!
+\brief \93Á\8eê\97p\93rBBS\8dí\8f\9c
+\param bbs \8dí\8f\9c\82·\82é\93Á\8eê\97p\93rBBS
+}
+procedure DestorySpecialBBS( inBBS : TBBS );
+var
+ sCategory : TCategory;
+ sBoard : TSpecialBoard;
+begin
+ if inBBS <> nil then begin
+ sCategory := inBBS.Items[0];
+ if sCategory <> nil then begin
+ sBoard := TSpecialBoard(sCategory.Items[0]);
+ if sBoard <> nil then begin
+ sBoard.Modified := False;
+ sBoard.Clear;
+ FreeAndNil(sBoard);
+ end;
+ end;
+ FreeAndNil(inBBS);
+ end;
+end;
(*************************************************************************
*\8b@\94\\96¼\81FTBBS\83R\83\93\83X\83g\83\89\83N\83^
end;
//*************************************************************************
+// \83J\83e\83S\83\8a\96¼\82Æ\94Â\96¼\82Ì\88ê\92v\82·\82é\94Â\82ð\92T\82·
+//*************************************************************************)
+function TBBS.FindBoardFromTitleAndCategory(const CategoryTitle: string; const BoardTitle: string): TBoard;
+var
+ i: Integer;
+begin
+ if not IsBoardFileRead then
+ GikoSys.ReadBoardFile( Self );
+ for i := Count - 1 downto 0 do begin
+ if AnsiCompareStr(Items[ i ].Title, CategoryTitle) = 0 then begin
+ Result := Items[ i ].FindBoardFromTitle(BoardTitle);
+ if Result <> nil then
+ Exit;
+ end;
+ end;
+ Result := nil;
+end;
+
+//*************************************************************************
// URL \82ð\8eó\82¯\95t\82¯\82é\94Â\82ð\92T\82·
//*************************************************************************)
function TBBS.FindBoardFromURL(const inURL: string): TBoard;
constructor TThreadItem.Create(
const inPlugIn : TBoardPlugIn;
const inBoard : TBoard;
- inURL : string;
+ const inURL : string;
inExist: Boolean;
const inFilename: string
);
// dat \82Ì\95Û\91¶\83p\83X\82ð\90Ý\92è
FileName := inFilename;
IsLogFile := inExist;
- URL := GikoSys.Get2chBrowsableThreadURL( inURL );
+ URL := inURL;
end else begin
// \83v\83\89\83O\83C\83\93\82É TThreadItem \82ª\8dì\90¬\82³\82ê\82½\82±\82Æ\82ð\93`\82¦\82é
inPlugIn.CreateThreadItem( DWORD( Self ) );
end;
end;
+function TThreadItem.GetOfflaw2SoURL: string;
+begin
+ Result := GikoSys.UrlToServer(ParentBoard.URL)
+ + 'test/offlaw2.so?shiro=kuma&bbs=' + ParentBoard.BBSID
+ + '&key=' + ChangeFileExt(FileName, '');
+end;
+
+function TThreadItem.GetRokkaURL(const SessionID: string): string;
+var
+ Domain: string;
+ Host: string;
+ Idx: Integer;
+ HostPos: Integer;
+begin
+ if FDownloadHost = '' then begin
+ Idx := AnsiPos('.2ch.net/', ParentBoard.URL);
+ if (Idx > 0) then begin
+ Domain := '2ch.net';
+ end else begin
+ Idx := AnsiPos('.bbspink.com/', ParentBoard.URL);
+ if (Idx > 0) then
+ Domain := 'bbspink.com';
+ end;
+ if (Idx > 0) then begin
+ HostPos := AnsiPos('://', ParentBoard.URL) + 3;
+ Host := Copy(ParentBoard.URL, HostPos, Idx - HostPos);
+ end;
+ end else begin
+ Idx := AnsiPos('.2ch.net', FDownloadHost);
+ if (Idx > 0) then begin
+ Domain := '2ch.net';
+ end else begin
+ Idx := AnsiPos('.bbspink.com', FDownloadHost);
+ if (Idx > 0) then
+ Domain := 'bbspink.com';
+ end;
+ if (Idx > 0) then begin
+ Host := Copy(FDownloadHost, 1, Idx - 1);
+ end;
+ end;
+
+ if ((Domain = '') or (Host = '')) then
+ Result := ''
+ else
+ Result := 'http://rokka.' + Domain + '/' + Host + '/'
+ + ParentBoard.BBSID + '/' + ChangeFileExt(FileName, '')
+ + '/?sid=' + SessionID;
+end;
+
+// \8aO\95\94\94Â\89ß\8b\8e\83\8d\83OURL\8eæ\93¾
+function TThreadItem.GetExternalBoardKakoDatURL: string;
+var
+ DatNo: string;
+begin
+ DatNo := ChangeFileExt(FileName, '');
+ //http://xxx.vip2ch.com/xxx/kako/1234/12345/1234567890.dat
+ Result := Format('%s%s/%.4s/%.5s/%s.dat', [ParentBoard.URL, 'kako', DatNo, DatNo, DatNo]);
+end;
+// \8aO\95\94\94Â\89ß\8b\8e\83\8d\83OURL\8eæ\93¾
+
function TThreadItem.GetSendURL: string;
begin
Result := GikoSys.UrlToServer(ParentBoard.URL)
end;
function TThreadItem.GetCreateDate: TDateTime;
-var
- unixtime: Int64;
- tmp: string;
begin
// \83t\83@\83C\83\8b\96¼\82©\82ç\83X\83\8c\8dì\90¬\93ú\8e\9e\82ð\8b\81\82ß\82é
try
Result := ZERO_DATE
else begin
// \83\8d\83O\83t\83@\83C\83\8b\82Ì\8ag\92£\8eq\82ð\82Í\82¸\82µ\82½\82à\82Ì\82ª\83X\83\8c\8dì\90¬\93ú\8e\9e
- tmp := ChangeFileExt(FFileName, '');
- if AnsiPos('_', tmp) <> 0 then
- if AnsiPos('_', tmp) > 9 then
- tmp := Copy(tmp, 1, AnsiPos('_', tmp)-1)
- else
- Delete(tmp, AnsiPos('_', tmp), 1);
-
- if ( Length(tmp) = 9) and ( tmp[1] = '0' ) then
- Insert('1', tmp, 1);
-
- unixtime := StrToInt64Def(tmp, ZERO_DATE);
- Result := UnixToDateTime(unixtime) + OffsetFromUTC;
+ Result := GikoSys.GetCreateDateFromName(FFileName);
if GikoSys.Setting.FutureThread then begin
if CompareDateTime(Result, Now) = 1 then
Result := ZERO_DATE;
end;
+function TSpecialBoard.Add(item: TThreadItem): integer;
+begin
+ Result := inherited AddObject(Item.URL, Item);
+end;
+
+procedure TSpecialBoard.Clear;
+var
+ i: integer;
+begin
+ for i := Count - 1 downto 0 do
+ DeleteList(i);
+ Capacity := 0;
+end;
+
+///////////////
+constructor TThreadNgList.Create;
+begin
+ inherited Create;
+
+ FFilePath := GikoSys.GetNGWordsDir;
+ if not DirectoryExists(FFilePath) then
+ ForceDirectories(FFilePath);
+ if (FFilePath[Length(FFilePath)] <> '\') then
+ FFilePath := FFilePath + '\';
+ FFilePath := FFilePath + THREAD_NG_FILE;
+ Load;
+end;
+
+procedure TThreadNgList.Load;
+begin
+ if (FileExists(FFilePath)) then begin
+ try
+ LoadFromFile(FFilePath);
+ finally
+ end;
+ end;
+end;
+
+procedure TThreadNgList.Save;
+begin
+ try
+ SaveToFile(FFilePath);
+ finally
+ end;
+end;
+
+function TThreadNgList.IsNG(const Title: String): Boolean;
+var
+ Cnt: Integer;
+ MaxCnt: Integer;
+begin
+ MaxCnt := Count - 1;
+ for Cnt := 0 to MaxCnt do begin
+ if (Pos(Strings[Cnt], Title) > 0) then begin
+ Result := True;
+ Exit;
+ end;
+ end;
+ Result := False;
+end;
end.