Develop and Download Open Source Software

Browse CVS Repository

Diff of /gikonavigoeson/gikonavi/BoardGroup.pas

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.59 by h677, Tue Mar 15 16:27:07 2005 UTC revision 1.59.2.14 by h677, Sat Jun 4 02:51:09 2005 UTC
# Line 9  uses Line 9  uses
9  type  type
10          //リストの表示アイテム選択          //リストの表示アイテム選択
11          TGikoViewType = (gvtAll, gvtLog, gvtNew, gvtUser);          TGikoViewType = (gvtAll, gvtLog, gvtNew, gvtUser);
         //リストの取得件数  
         //TGikoListCount = (glc50, glc100, glc200, glc500, glc1000, glcAll);  
         //巡回番号  
         //TGikoRoundNo = (grnNone, grn1, grn2, grn3, grn4, grn5, grnOnce);  
12          //リストの上げ下げ          //リストの上げ下げ
13          TGikoAgeSage = (gasNone, gasAge, gasSage, gasNew, gasNull);          TGikoAgeSage = (gasNone, gasAge, gasSage, gasNew, gasNull);
14    
 {       TFolder = class  
         private  
                 FItemList: TList;       //子アイテムリスト  
                 FLeaf: Boolean;         //下にフォルダを持つことが出来るか  
         public  
                 function Add(Item: TFolder): Integer;  
                 procedure Clear;  
                 procedure Delete(Index: Integer);  
                 procedure Exchange(Index1, Index2: Integer);  
                 procedure Insert(Index: Integer; Item: TFolder);  
                 procedure Move(CurIndex, NewIndex: Integer);  
                 function Remove(Item: TFolder): Integer;  
                 procedure Sort(Compare: TListSortCompare);  
                 property Capacity: Integer read FCapacity write SetCapacity;  
                 property Count: Integer read FCount write SetCount;  
                 property Items[Index: Integer]: TFolder read Get write Put; default;  
   
                 property Leaf: Boolean read FLeaf;  
         end;  
   
         TBBS = class(TFolder)  
         end;  
         TCategory class(TFolder)  
         end;  
         TBoard = class(TFolder)  
         end;  
         TThreadItem = class(TFolder)  
         end;  
 }  
   
 {  
         TBBS = class(TBBS)  
         end;  
         TBoard2ch = class(TBoard)  
         end;  
         TThreadItem2ch = class(TThreadItem)  
         end;  
 }  
   
 //      ITest = interface  
 //      end;  
 //      IBBS = interface  
 //      end;  
 //      ICategory = interface  
 //      end;  
 //      IBoard = interface  
 //      end;  
 //      IThreadItem = interface  
 //      end;  
   
15          TCategory = class;          TCategory = class;
16          TBoard = class;          TBoard = class;
17          TThreadItem = class;          TThreadItem = class;
# Line 156  type Line 102  type
102                  FURL: string;                                                                   //ボードURL                  FURL: string;                                                                   //ボードURL
103                  FRound: Boolean;                                                        //スレッド一覧巡回予約                  FRound: Boolean;                                                        //スレッド一覧巡回予約
104                  FRoundName: string;                                             //巡回名                  FRoundName: string;                                             //巡回名
105                    //FRoundName: PChar;                                            //巡回名
106                  FRoundDate: TDateTime;                          //スレッド一覧を取得した日時(巡回日時)                  FRoundDate: TDateTime;                          //スレッド一覧を取得した日時(巡回日時)
107                  FLastModified: TDateTime;                       //スレッド一覧が更新されている日時(サーバ側日時)                  FLastModified: TDateTime;                       //スレッド一覧が更新されている日時(サーバ側日時)
108                  FLastGetTime: TDateTime;                        //スレッドまたはスレッド一覧を最後に更新した日時(サーバ側日時・書き込み時に使用する)                  FLastGetTime: TDateTime;                        //スレッドまたはスレッド一覧を最後に更新した日時(サーバ側日時・書き込み時に使用する)
# Line 178  type Line 125  type
125                  FIntData                        : Integer;                      // 好きにいじってよし。いろんな用途に使うyo                  FIntData                        : Integer;                      // 好きにいじってよし。いろんな用途に使うyo
126                  FListData                       : TList;                                // 好きにいじってよし。いろんな用途に使うyo                  FListData                       : TList;                                // 好きにいじってよし。いろんな用途に使うyo
127    
128                  FSETTINGTXTTime: TDateTime;     //SETTING.TXTを取得した日時                  FSETTINGTXTTime : TDateTime;    //SETTING.TXTを取得した日時
129                  FIsSETTINGTXT:          boolean;        //SETTING.TXTを取得しているか                  FIsSETTINGTXT   : boolean;      //SETTING.TXTを取得しているか
130                  FHEADTXTTime: TDateTime;                //HEAD.TXTを取得した日時                  FHEADTXTTime    : TDateTime;            //HEAD.TXTを取得した日時
131                  FIsHEADTXT:             boolean;        //HEAD.TXTを取得しているか                  FIsHEADTXT              : boolean;      //HEAD.TXTを取得しているか
132          FTitlePictureURL:       string; //top絵のURL                  FTitlePictureURL: string;       //top絵のURL
133                  FMultiplicity : Integer; //重複しているかどうか?                  FMultiplicity   : Integer; //重複しているかどうか?
134                    FIs2ch                  : Boolean; //hostが2chかどうか
135                    FNewThreadCount: Integer;       //新着スレッドの数
136                    FLogThreadCount: Integer;       //ログ有りスレッドの数
137                    FUserThreadCount: Integer;      //?
138    
139                  function GetThreadItem(index: integer): TThreadItem;                  function GetThreadItem(index: integer): TThreadItem;
140                  procedure SetThreadItem(index: integer; value: TThreadItem);                  procedure SetThreadItem(index: integer; value: TThreadItem);
141                  procedure SetRound(b: Boolean);                  procedure SetRound(b: Boolean);
142                  procedure SetRoundName(s: string);                  procedure SetRoundName(s: string);
143                    //procedure SetRoundName(s: PChar);
144                  procedure SetLastModified(d: TDateTime);                  procedure SetLastModified(d: TDateTime);
145                  procedure SetLastGetTime(d: TDateTime);                  procedure SetLastGetTime(d: TDateTime);
146                  procedure SetUnRead(i: Integer);                  procedure SetUnRead(i: Integer);
# Line 206  type Line 159  type
159                  property BBSID: string read FBBSID write FBBSID;                  property BBSID: string read FBBSID write FBBSID;
160                  property URL: string read FURL write FURL;                  property URL: string read FURL write FURL;
161                  property Round: Boolean read FRound write SetRound;                  property Round: Boolean read FRound write SetRound;
162                    //property RoundName: PChar read FRoundName write SetRoundName;
163                  property RoundName: string read FRoundName write SetRoundName;                  property RoundName: string read FRoundName write SetRoundName;
164                  property RoundDate: TDateTime read FRoundDate write FRoundDate;                  property RoundDate: TDateTime read FRoundDate write FRoundDate;
165                  property LastModified: TDateTime read FLastModified write SetLastModified;                  property LastModified: TDateTime read FLastModified write SetLastModified;
# Line 245  type Line 199  type
199                  function GetLogThreadCount: Integer;                  function GetLogThreadCount: Integer;
200                  function GetUserThreadCount: Integer;                  function GetUserThreadCount: Integer;
201                  function GetNewThread(Index: Integer): TThreadItem;                  function GetNewThread(Index: Integer): TThreadItem;
202                  function GetLogThread(Index: Integer): TThreadItem;                  function GetLogThread(Index: Integer): TThreadItem; overload;
203                    function GetLogThread(Index: Integer; Base: Integer): TThreadItem; overload;
204                  function GetUserThread(Index: Integer): TThreadItem;                  function GetUserThread(Index: Integer): TThreadItem;
205    
206                  procedure BeginUpdate;                  procedure BeginUpdate;
# Line 261  type Line 216  type
216                  property IsSETTINGTXT:  boolean read FIsSETTINGTXT write FIsSETTINGTXT;                  property IsSETTINGTXT:  boolean read FIsSETTINGTXT write FIsSETTINGTXT;
217                  property HEADTXTTime: TDateTime read FHEADTXTTime write FHEADTXTTime;                  property HEADTXTTime: TDateTime read FHEADTXTTime write FHEADTXTTime;
218                  property IsHEADTXT:     boolean read FIsHEADTXT write FIsHEADTXT;                  property IsHEADTXT:     boolean read FIsHEADTXT write FIsHEADTXT;
219          property TitlePictureURL: string read FTitlePictureURL write FTitlePictureURL;                  property TitlePictureURL: string read FTitlePictureURL write FTitlePictureURL;
220                  property Multiplicity: Integer read FMultiplicity write FMultiplicity;                  property Multiplicity: Integer read FMultiplicity write FMultiplicity;
221                    property Is2ch  : boolean       read FIs2ch     write FIs2ch;
222                    property NewThreadCount: Integer        read FNewThreadCount write FNewThreadCount;     //新着スレッドの数
223                    property LogThreadCount: Integer        read FLogThreadCount write FLogThreadCount;             //ログ有りスレッドの数
224                    property UserThreadCount: Integer       read FUserThreadCount write FUserThreadCount;   //?
225          end;          end;
226    
227          //スレ          //スレ
# Line 282  type Line 241  type
241                  FSize: Integer;                                         //スレッドサイズ                  FSize: Integer;                                         //スレッドサイズ
242                  FRound: Boolean;                                        //巡回フラグ                  FRound: Boolean;                                        //巡回フラグ
243                  FRoundName: string;                             //巡回名                  FRoundName: string;                             //巡回名
244                    //FRoundName: PChar;                            //巡回名
245                  FIsLogFile: Boolean;                    //ログ存在フラグ                  FIsLogFile: Boolean;                    //ログ存在フラグ
246                  FParentBoard: TBoard;                   //親ボード                  FParentBoard: TBoard;                   //親ボード
247                  FKokomade: Integer;                             //ココまで読んだ番号                  FKokomade: Integer;                             //ココまで読んだ番号
# Line 296  type Line 256  type
256                  FUpdate: Boolean;                  FUpdate: Boolean;
257                  FExpand: Boolean;                  FExpand: Boolean;
258                  FURL                                    : string;                               // このスレをブラウザで表示する際の URL                  FURL                                    : string;                               // このスレをブラウザで表示する際の URL
259                  FBoardPlugIn    : TBoardPlugIn; // このスレをサポートするプラグイン                  //FBoardPlugIn  : TBoardPlugIn; // このスレをサポートするプラグイン
260                  FFilePath                       : string;                               // このスレが保存されているパス                  //FFilePath                     : string;                               // このスレが保存されているパス
261    
262                  procedure SetLastModified(d: TDateTime);                  procedure SetLastModified(d: TDateTime);
263                  procedure SetRound(b: Boolean);                  procedure SetRound(b: Boolean);
264                  procedure SetRoundName(const s: string);                  procedure SetRoundName(const s: string);
265                    //procedure SetRoundName(const s: PChar);
266                  procedure SetKokomade(i: Integer);                  procedure SetKokomade(i: Integer);
267                  procedure SetUnRead(b: Boolean);                  procedure SetUnRead(b: Boolean);
268                  procedure SetScrollTop(i: Integer);                  procedure SetScrollTop(i: Integer);
269                  procedure Init;                  procedure Init;
270                  function GetCreateDate: TDateTime;                  function GetCreateDate: TDateTime;
271            function GetFilePath: String;
272          public          public
273                  constructor Create( inPlugIn : TBoardPlugIn; inURL : string ); overload;                  constructor Create(const inPlugIn : TBoardPlugIn; const inBoard : TBoard; inURL : string ); overload;
274          constructor Create( is2ch : Boolean; const inURL, inHost, inBBSID, inBBSKey : string ); overload;                  constructor Create(const inPlugIn : TBoardPlugIn; const inBoard : TBoard;
275                                             inURL : string; inExist: Boolean; const inFilename: string ); overload;
276    
277                  destructor Destroy; override;                  destructor Destroy; override;
278    
# Line 337  type Line 300  type
300                  property Size: Integer read FSize write FSize;                  property Size: Integer read FSize write FSize;
301                  property Round: Boolean read FRound write SetRound;                  property Round: Boolean read FRound write SetRound;
302                  property RoundName: string read FRoundName write SetRoundName;                  property RoundName: string read FRoundName write SetRoundName;
303                    //property RoundName: PChar read FRoundName write SetRoundName;
304    
305                  property IsLogFile: Boolean read FIsLogFile write FIsLogFile;                  property IsLogFile: Boolean read FIsLogFile write FIsLogFile;
306                  property ParentBoard: TBoard read FParentBoard write FParentBoard;                  property ParentBoard: TBoard read FParentBoard write FParentBoard;
# Line 348  type Line 312  type
312                  property Expand: Boolean read FExpand write FExpand;                  property Expand: Boolean read FExpand write FExpand;
313                  property DownloadHost: string read FDownloadHost write FDownloadHost;                  property DownloadHost: string read FDownloadHost write FDownloadHost;
314                  property AgeSage: TGikoAgeSage read FAgeSage write FAgeSage;                  property AgeSage: TGikoAgeSage read FAgeSage write FAgeSage;
 //              property SPID: string read FSPID write FSPID;  
315                  property CreateDate: TDateTime read GetCreateDate;                  property CreateDate: TDateTime read GetCreateDate;
316                  property        URL                                     : string                                read FURL write FURL;                  property        URL                                     : string                                read FURL write FURL;
317                  property        BoardPlugIn     : TBoardPlugIn  read FBoardPlugIn;                  property        FilePath                : string        read GetFilePath;
                 property        FilePath                : string                                read FFilePath write FFilePath;  
                 function        IsBoardPlugInAvailable : Boolean;  
318          end;          end;
319    
320            TBoardGroup = class(TStringList)
321        private
322            FBoardPlugIn    : TBoardPlugIn; // この板をサポートするプラグイン
323        public
324            procedure       Clear   ; override;
325            property        BoardPlugIn     : TBoardPlugIn  read FBoardPlugIn write FBoardPlugIn;
326        end;
327    
328    
         //検索結果リスト  
 {       TSearchList = class(TList)  
         private  
                 function GetThreadItem(index: integer): TThreadItem;  
                 procedure SetThreadItem(index: integer; value: TThreadItem);  
         public  
                 constructor Create;  
                 destructor Destroy; override;  
   
                 property Items[index: integer]: TThreadItem read GetThreadItem write SetThreadItem;  
   
                 function Add(item: TThreadItem): integer;  
                 procedure Delete(index: integer);  
                 procedure Clear; override;  
         end;}  
   
329          function        BBSsFindBoardFromBBSID( inBBSID : string ) : TBoard;          function        BBSsFindBoardFromBBSID( inBBSID : string ) : TBoard;
330          function        BBSsFindBoardFromURL( inURL : string ) : TBoard;          function        BBSsFindBoardFromURL( inURL : string ) : TBoard;
331          function        BBSsFindBoardFromTitle( inTitle : string ) : TBoard;          function        BBSsFindBoardFromTitle( inTitle : string ) : TBoard;
# Line 382  type Line 334  type
334    
335  var  var
336          BBSs            : array of TBBS;          BBSs            : array of TBBS;
337        BoardGroups : array of TBoardGroup;
338    
339  implementation  implementation
340    
# Line 411  const Line 364  const
364  function        BBSsFindBoardFromBBSID(  function        BBSsFindBoardFromBBSID(
365          inBBSID : string          inBBSID : string
366  ) : TBoard;  ) : TBoard;
367    var
368            i : Integer;
369            tmpBoard : TBoard;
370  begin  begin
371    
372          Result := BBSs[ 0 ].FindBBSID( inBBSID );  //      Result := BBSs[ 0 ].FindBBSID( inBBSID );
373            Result := nil;
374            if Length(BoardGroups) > 0 then begin
375                    for i := BoardGroups[0].Count - 1 downto 0 do begin
376                            tmpBoard := TBoard(BoardGroups[0].Objects[i]);
377                            if tmpBoard.Is2ch then begin
378                                    if AnsiCompareStr(tmpBoard.BBSID, inBBSID) = 0 then begin
379                                            Result := tmpBoard;
380                                            EXIT;
381                                    end;
382                            end;
383                    end;
384            end;
385    
386  end;  end;
387    {**********************************************
388    この関数は必ず板のURLの形式で渡してください。
389    pluginを使用するならば、ExtractBoardURL( inURL )
390    2chならば、GikoSys.Get2chThreadURL2BoardURL( inURL );
391    で変換してから呼び出してください。
392    **********************************************}
393  function        BBSsFindBoardFromURL(  function        BBSsFindBoardFromURL(
394          inURL   : string          inURL   : string
395  ) : TBoard;  ) : TBoard;
396  var  var
397          i                       : Integer;          i,p                     : Integer;
398            accept          : TAcceptType;
399            protocol, host, path, document, port, bookmark : string;
400  begin  begin
   
         for i := Length( BBSs ) - 1 downto 0 do begin  
                 Result := BBSs[ i ].FindBoardFromURL( inURL );  
                 if Result <> nil then  
                         Exit;  
         end;  
   
401          Result := nil;          Result := nil;
402            for i := Length(BoardGroups) - 1 downto 1 do begin
403                    accept := BoardGroups[i].BoardPlugIn.AcceptURL(inURL);
404                    if (accept = atBoard) or (accept = atThread) then begin
405                            if BoardGroups[i].Find(inURL, p) then begin
406                                    Result := TBoard(BoardGroups[i].Objects[p]);
407                                    Exit;
408                            end else begin
409                                    inURL := BoardGroups[i].BoardPlugIn.ExtractBoardURL(inURL);
410                                    if BoardGroups[i].Find(inURL, p) then begin
411                                            Result := TBoard(BoardGroups[i].Objects[p]);
412                                            Exit;
413                                    end;
414                            end;
415                    end;
416            end;
417            //ここにきたら、pluginを使わないやつらを調べる
418            if BoardGroups[0].Find(inURL, p) then
419                    Result := TBoard(BoardGroups[0].Objects[p]);
420                    
421            if (Result = nil) then begin
422                    GikoSys.ParseURI( inURL, protocol, host, path, document, port, bookmark );
423                    //ホストが2chならBBSIDで調べる
424                    if GikoSys.Is2chHost(host) then begin
425                            Result := BBSsFindBoardFromBBSID(GikoSys.URLToID( inURL ));
426                    end;
427            end;
428    
429  end;  end;
430    
# Line 438  function       BBSsFindBoardFromTitle( Line 432  function       BBSsFindBoardFromTitle(
432          inTitle : string          inTitle : string
433  ) : TBoard;  ) : TBoard;
434  var  var
435          i                               : Integer;          i,j                             : Integer;
436            tmpBoard                : TBoard;
437  begin  begin
438        Result := nil;
439          for i := Length( BBSs ) - 1 downto 0 do begin          for i := Length( BBSs ) - 1 downto 0 do begin
440                  Result := BBSs[ i ].FindBoardFromTitle( inTitle );                  for j := BoardGroups[i].Count - 1 downto 0 do begin
441                  if Result <> nil then                          tmpBoard := TBoard(BoardGroups[i].Objects[j]);
442                          Exit;                          if ( AnsiCompareStr(tmpBoard.Title, inTitle) = 0) then begin
443                                    Result := tmpBoard;
444                                    Exit;
445                            end;
446                    end;
447          end;          end;
448    
         Result := nil;  
   
449  end;  end;
450    
451  function        BBSsFindThreadFromURL(  function        BBSsFindThreadFromURL(
# Line 457  function       BBSsFindThreadFromURL( Line 454  function       BBSsFindThreadFromURL(
454  var  var
455          board                   : TBoard;          board                   : TBoard;
456          boardURL        : string;          boardURL        : string;
457            protocol, host, path, document, port, bookmark : string;
458            BBSID, BBSKey : string;
459    //      i : Integer;
460  begin  begin
461    
462          boardURL        := GikoSys.GetThreadURL2BoardURL( inURL );          boardURL        := GikoSys.GetThreadURL2BoardURL( inURL );
463          board                   := BBSsFindBoardFromURL( boardURL );          board                   := BBSsFindBoardFromURL( boardURL );
464          if board = nil then          if board = nil then
465                  Result := nil                  Result := nil
466          else          else begin
467                  Result := board.FindThreadFromURL( inURL );                  Result := board.FindThreadFromURL( inURL );
468                    //もしも2chの板なら
469                    if (Result = nil) and (board.Is2ch) then begin
470                            GikoSys.ParseURI( inURL, protocol, host, path, document, port, bookmark );
471                            GikoSys.Parse2chURL( inURL, path, document, BBSID, BBSKey );
472                            Result := board.FindThreadFromFileName(BBSKey + '.dat');
473                    end;
474            end;
475    
476  end;  end;
477    
# Line 553  var Line 560  var
560          i: Integer;          i: Integer;
561  begin  begin
562          if not IsBoardFileRead then          if not IsBoardFileRead then
563          GikoSys.ReadBoardFile( Self );          GikoSys.ReadBoardFile( Self );
564          for i := Count - 1 downto 0 do begin          for i := Count - 1 downto 0 do begin
565                  Result := Items[ i ].FindBoardFromTitle(Title);                  Result := Items[ i ].FindBoardFromTitle(Title);
566                  if Result <> nil then                  if Result <> nil then
# Line 570  var Line 577  var
577          i                                       : Integer;          i                                       : Integer;
578  begin  begin
579          if not IsBoardFileRead then          if not IsBoardFileRead then
580          GikoSys.ReadBoardFile( Self );          GikoSys.ReadBoardFile( Self );
581          for i := Count - 1 downto 0 do begin          for i := Count - 1 downto 0 do begin
582                  Result := Items[ i ].FindBoardFromURL( inURL );                  Result := Items[ i ].FindBoardFromURL( inURL );
583                  if Result <> nil then                  if Result <> nil then
# Line 677  end; Line 684  end;
684    
685  procedure TCategory.Delete(index: integer);  procedure TCategory.Delete(index: integer);
686  begin  begin
687          if (Items[index] <> nil) then begin          {if (Items[index] <> nil) then begin
688                  try                  try
689                          if TBoard(Items[index]).Multiplicity = 0 then                          if TBoard(Items[index]).Multiplicity = 0 then
690                                  TBoard(Items[index]).Free                                  TBoard(Items[index]).Free
# Line 686  begin Line 693  begin
693                  except                  except
694                  end;                  end;
695          end;          end;
696          inherited Delete(index);          }
697        inherited Delete(index);
698  end;  end;
699    
700  procedure TCategory.Clear;  procedure TCategory.Clear;
# Line 841  begin Line 849  begin
849          if inPlugIn = nil then begin          if inPlugIn = nil then begin
850                  // subject.txt の保存パスを設定                  // subject.txt の保存パスを設定
851                  GikoSys.ParseURI( inURL, protocol, host, path, document, port, bookmark );                  GikoSys.ParseURI( inURL, protocol, host, path, document, port, bookmark );
852                  if GikoSys.Is2chHost( host ) then                  if GikoSys.Is2chHost( host ) then begin
853                            Self.Is2ch := True;
854                          FilePath :=                          FilePath :=
855                                  GikoSys.Setting.LogFolderP  +                                  GikoSys.Setting.LogFolderP  +
856                                  BBS2CH_LOG_FOLDER + PATH_DELIM + BBSID + PATH_DELIM + SUBJECT_FILENAME                                  BBS2CH_LOG_FOLDER + PATH_DELIM + BBSID + PATH_DELIM + SUBJECT_FILENAME
857                  else                  end else begin
858                            Self.Is2ch := False;
859                          FilePath :=                          FilePath :=
860                                  GikoSys.Setting.LogFolderP +                                  GikoSys.Setting.LogFolderP +
861                                  EXTERNAL_LOG_FOLDER + PATH_DELIM + host + PATH_DELIM + BBSID + PATH_DELIM + SUBJECT_FILENAME                                  EXTERNAL_LOG_FOLDER + PATH_DELIM + host + PATH_DELIM + BBSID + PATH_DELIM + SUBJECT_FILENAME
862                    end;
863          end else begin          end else begin
864                  // プラグインに TBoardItem が作成されたことを伝える                  // プラグインに TBoardItem が作成されたことを伝える
865                  inPlugIn.CreateBoardItem( DWORD( Self ) );                  inPlugIn.CreateBoardItem( DWORD( Self ) );
866                    Self.Is2ch := False;
867          end;          end;
868    
869  end;  end;
# Line 1212  end; Line 1224  end;
1224    
1225  // スレ立て送信URL  // スレ立て送信URL
1226  function TBoard.GetSendURL: string;  function TBoard.GetSendURL: string;
1227  var  //var
1228          Protocol, Host, Path, Document, Port, Bookmark : string;  //      Protocol, Host, Path, Document, Port, Bookmark : string;
1229  begin  begin
1230      Result := GikoSys.UrlToServer(URL);      Result := GikoSys.UrlToServer(URL);
1231      GikoSys.ParseURI( URL, Protocol,Host, Path, Document, Port, Bookmark );          //GikoSys.ParseURI( URL, Protocol,Host, Path, Document, Port, Bookmark );
1232      if GikoSys.Is2chHost(Host) then          //if GikoSys.Is2chHost(Host) then
1233            if Self.Is2ch then
1234          Result := Result + 'test/bbs.cgi'          Result := Result + 'test/bbs.cgi'
1235      else      else
1236          Result := Result + 'test/subbbs.cgi';          Result := Result + 'test/subbbs.cgi';
# Line 1243  begin Line 1256  begin
1256          if FUpdate then          if FUpdate then
1257                  FModified := True;                  FModified := True;
1258  end;  end;
1259    {
1260    procedure TBoard.SetRoundName(s: PChar);
1261    begin
1262            if FRoundName = s then Exit;
1263            FRoundName := s;
1264            if FUpdate then
1265                    FModified := True;
1266    end;
1267    }
1268  procedure TBoard.SetLastModified(d: TDateTime);  procedure TBoard.SetLastModified(d: TDateTime);
1269  begin  begin
1270          if FLastModified = d then Exit;          if FLastModified = d then Exit;
# Line 1422  begin Line 1443  begin
1443          end;          end;
1444          Result := nil;          Result := nil;
1445  end;  end;
1446    function TBoard.GetLogThread(Index: Integer; Base: Integer): TThreadItem;
1447    var
1448            i: Integer;
1449            Cnt: Integer;
1450    begin
1451            Cnt := 0;
1452            if Length( ParentCategory.ParenTBBS.ShortSelectText ) = 0 then
1453            begin
1454                    for i := Base to Count - 1 do begin
1455                            if Items[i].IsLogFile then
1456                                                                            begin
1457                                    if Index = Cnt then begin
1458                                            Result := Items[i];
1459                                            Exit;
1460                                    end;
1461                                    inc(Cnt);
1462                            end;
1463                    end;
1464            end else begin
1465                    for i := Base to Count - 1 do begin
1466                            if Items[i].IsLogFile then
1467                                    begin
1468                                            if Items[i].ShortTitle = '' then
1469                                                    Items[i].ShortTitle := ZenToHan(Items[i].Title);
1470                                            if AnsiPos(ParentCategory.ParenTBBS.ShortSelectText, Items[i].ShortTitle) <> 0 then begin
1471                                                    if Index = Cnt then begin
1472                                                            Result := Items[i];
1473                                                            Exit;
1474                                            end;
1475                                            inc(Cnt);
1476                                    end;
1477                            end;
1478                    end;
1479            end;
1480            Result := nil;
1481    end;
1482  function TBoard.GetUserThread(Index: Integer): TThreadItem;  function TBoard.GetUserThread(Index: Integer): TThreadItem;
1483  var  var
1484          i: Integer;          i: Integer;
# Line 1496  begin Line 1552  begin
1552    
1553          FUpdate := True;          FUpdate := True;
1554          FURL := '';          FURL := '';
1555          FBoardPlugIn := nil;          //FBoardPlugIn := nil;
1556  end;  end;
1557    
1558  // *************************************************************************  // *************************************************************************
1559  // 外部板プラグインを指定したコンストラクタ  // 外部板プラグインを指定したコンストラクタ
1560  // *************************************************************************  // *************************************************************************
1561  constructor TThreadItem.Create(  constructor TThreadItem.Create(
1562          inPlugIn        : TBoardPlugIn;          const inPlugIn : TBoardPlugIn;
1563          inURL                   : string          const inBoard : TBoard;
1564            inURL : string
1565  );  );
1566  var  var
1567          foundPos                        : Integer;          foundPos                        : Integer;
# Line 1516  begin Line 1573  begin
1573    
1574          inherited Create;          inherited Create;
1575          Init;          Init;
1576            FParentBoard    := inBoard;
1577          FBoardPlugIn    := inPlugIn;          //FBoardPlugIn  := inPlugIn;
1578          URL                                             := inURL;          URL                             := inURL;
1579    
1580          if inPlugIn = nil then begin          if inPlugIn = nil then begin
1581                  foundPos := Pos( READ_PATH, inURL );                  foundPos := Pos( READ_PATH, inURL );
# Line 1526  begin Line 1583  begin
1583                          // dat の保存パスを設定                          // dat の保存パスを設定
1584                          GikoSys.ParseURI( inURL, protocol, host, path, document, port, bookmark );                          GikoSys.ParseURI( inURL, protocol, host, path, document, port, bookmark );
1585                          GikoSys.Parse2chURL( inURL, path, document, BBSID, BBSKey );                          GikoSys.Parse2chURL( inURL, path, document, BBSID, BBSKey );
                         if GikoSys.Is2chHost( host ) then  
                                 FilePath :=  
                                         GikoSys.Setting.LogFolderP +  
                                         BBS2CH_LOG_FOLDER + PATH_DELIM + BBSID + PATH_DELIM + BBSKey + '.dat'  
                         else  
                                 FilePath :=  
                                         GikoSys.Setting.LogFolderP +  
                                         EXTERNAL_LOG_FOLDER + PATH_DELIM + host + PATH_DELIM + BBSID + PATH_DELIM + BBSKey + '.dat';  
1586                          FileName        := BBSKey + '.dat';                          FileName        := BBSKey + '.dat';
1587                          IsLogFile       := FileExists( FilePath );                          IsLogFile       := FileExists( FilePath );
1588                          URL                             := GikoSys.Get2chBrowsableThreadURL( inURL );                          URL                             := GikoSys.Get2chBrowsableThreadURL( inURL );
# Line 1544  begin Line 1593  begin
1593          end;          end;
1594    
1595  end;  end;
   
1596  // *************************************************************************  // *************************************************************************
1597  // プラグインを利用しないコンストラクタ  // 外部板プラグインを指定したコンストラクタ Log有りかどうか判断済み
1598    // FileNameも取得済み → ReadSubject用
1599  // *************************************************************************  // *************************************************************************
1600  constructor TThreadItem.Create(  constructor TThreadItem.Create(
1601          is2ch : Boolean;          const inPlugIn : TBoardPlugIn;
1602      const inURL, inHost, inBBSID, inBBSKey : string          const inBoard : TBoard;
1603            inURL : string;
1604            inExist: Boolean;
1605            const inFilename: string
1606  );  );
 var  
         foundPos                        : Integer;  
 const  
         READ_PATH                                                       = '/test/read.cgi';  
1607  begin  begin
1608    
1609          inherited Create;          inherited Create;
1610          Init;          Init;
1611            FParentBoard    := inBoard;
1612            URL                             := inURL;
1613    
1614          FBoardPlugIn    := nil;          if inPlugIn = nil then begin
1615                    // dat の保存パスを設定
1616      foundPos := Pos( READ_PATH, inURL );                  FileName        := inFilename;
1617      if foundPos > 0 then begin                  IsLogFile       := inExist;
1618          // dat の保存パスを設定                  URL                             := GikoSys.Get2chBrowsableThreadURL( inURL );
1619          if is2ch then          end else begin
1620              FilePath :=                  // プラグインに TThreadItem が作成されたことを伝える
1621                    inPlugIn.CreateThreadItem( DWORD( Self ) );
1622                  GikoSys.Setting.LogFolderP +          end;
                 BBS2CH_LOG_FOLDER + PATH_DELIM + inBBSID + PATH_DELIM + inBBSKey + '.dat'  
         else  
             FilePath :=  
                 GikoSys.Setting.LogFolderP +  
                 EXTERNAL_LOG_FOLDER + PATH_DELIM + inHost + PATH_DELIM + inBBSID + PATH_DELIM + inBBSKey + '.dat';  
         FileName        := inBBSKey + '.dat';  
         IsLogFile       := FileExists( FilePath );  
         URL                             := GikoSys.Get2chBrowsableThreadURL( inURL );  
     end else  
         URL                             := inURL;  
1623    
1624  end;  end;
1625  // *************************************************************************  // *************************************************************************
# Line 1589  destructor TThreadItem.Destroy; Line 1629  destructor TThreadItem.Destroy;
1629  begin  begin
1630    
1631          // プラグインに TThreadItem が破棄されたことを伝える          // プラグインに TThreadItem が破棄されたことを伝える
1632          if IsBoardPlugInAvailable then          if Self.ParentBoard.IsBoardPlugInAvailable then
1633                  FBoardPlugIn.DisposeThreadItem( DWORD( Self ) );                  Self.ParentBoard.BoardPlugIn.DisposeThreadItem( DWORD( Self ) );
1634    
1635          inherited;          inherited;
1636    
# Line 1599  end; Line 1639  end;
1639  // *************************************************************************  // *************************************************************************
1640  // 外部板プラグインが使用可能か  // 外部板プラグインが使用可能か
1641  // *************************************************************************  // *************************************************************************
1642    {
1643  function        TThreadItem.IsBoardPlugInAvailable : Boolean;  function        TThreadItem.IsBoardPlugInAvailable : Boolean;
1644  begin  begin
1645    
# Line 1616  begin Line 1657  begin
1657          Result := False;          Result := False;
1658    
1659  end;  end;
1660    }
1661  function TThreadItem.GetDatURL: string;  function TThreadItem.GetDatURL: string;
1662  var  var
1663          Protocol, Host, Path, Document, Port, Bookmark: string;          Protocol, Host, Path, Document, Port, Bookmark: string;
# Line 1802  begin Line 1843  begin
1843          if FUpdate and (ParentBoard <> nil) then          if FUpdate and (ParentBoard <> nil) then
1844                  ParentBoard.FModified := True;                  ParentBoard.FModified := True;
1845  end;  end;
1846    {
1847    procedure TThreadItem.SetRoundName(const s: PChar);
1848    begin
1849            if FRoundName = s then Exit;
1850            FRoundName := s;
1851            if FUpdate and (ParentBoard <> nil) then
1852                    ParentBoard.FModified := True;
1853    end;
1854    }
1855  procedure TThreadItem.SetKokomade(i: Integer);  procedure TThreadItem.SetKokomade(i: Integer);
1856  begin  begin
1857          if FKokomade = i then Exit;          if FKokomade = i then Exit;
# Line 1877  begin Line 1926  begin
1926                          Result := ZERO_DATE;                          Result := ZERO_DATE;
1927          end;          end;
1928  end;  end;
1929    function TThreadItem.GetFilePath: String;
1930    var
1931            path : String;
1932    begin
1933            path := ExtractFilePath(Self.ParentBoard.FilePath) + Self.FileName;
1934        Result := path;
1935    end;
1936    
1937    procedure       TBoardGroup.Clear;
1938    var
1939            i       : Integer;
1940    begin
1941            for i := Self.Count - 1 downto 0 do begin
1942            TBoard(Self.Objects[i]).Free;
1943        end;
1944        inherited Clear;
1945        Self.Capacity := 0;
1946    end;
1947    
1948    
1949  end.  end.
1950    

Legend:
Removed from v.1.59  
changed lines
  Added in v.1.59.2.14

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26