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.11 by h677, Sun May 22 09:14:31 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 155  type Line 101  type
101                  FBBSID: string;                                                         //BBSID                  FBBSID: string;                                                         //BBSID
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: string read FRoundName write SetRoundName;                  property RoundName: PChar read FRoundName write SetRoundName;
163                  property RoundDate: TDateTime read FRoundDate write FRoundDate;                  property RoundDate: TDateTime read FRoundDate write FRoundDate;
164                  property LastModified: TDateTime read FLastModified write SetLastModified;                  property LastModified: TDateTime read FLastModified write SetLastModified;
165                  property LastGetTime: TDateTime read FLastGetTime write SetLastGetTime;                  property LastGetTime: TDateTime read FLastGetTime write SetLastGetTime;
# Line 245  type Line 198  type
198                  function GetLogThreadCount: Integer;                  function GetLogThreadCount: Integer;
199                  function GetUserThreadCount: Integer;                  function GetUserThreadCount: Integer;
200                  function GetNewThread(Index: Integer): TThreadItem;                  function GetNewThread(Index: Integer): TThreadItem;
201                  function GetLogThread(Index: Integer): TThreadItem;                  function GetLogThread(Index: Integer): TThreadItem; overload;
202                    function GetLogThread(Index: Integer; Base: Integer): TThreadItem; overload;
203                  function GetUserThread(Index: Integer): TThreadItem;                  function GetUserThread(Index: Integer): TThreadItem;
204    
205                  procedure BeginUpdate;                  procedure BeginUpdate;
# Line 261  type Line 215  type
215                  property IsSETTINGTXT:  boolean read FIsSETTINGTXT write FIsSETTINGTXT;                  property IsSETTINGTXT:  boolean read FIsSETTINGTXT write FIsSETTINGTXT;
216                  property HEADTXTTime: TDateTime read FHEADTXTTime write FHEADTXTTime;                  property HEADTXTTime: TDateTime read FHEADTXTTime write FHEADTXTTime;
217                  property IsHEADTXT:     boolean read FIsHEADTXT write FIsHEADTXT;                  property IsHEADTXT:     boolean read FIsHEADTXT write FIsHEADTXT;
218          property TitlePictureURL: string read FTitlePictureURL write FTitlePictureURL;                  property TitlePictureURL: string read FTitlePictureURL write FTitlePictureURL;
219                  property Multiplicity: Integer read FMultiplicity write FMultiplicity;                  property Multiplicity: Integer read FMultiplicity write FMultiplicity;
220                    property Is2ch  : boolean       read FIs2ch     write FIs2ch;
221                    property NewThreadCount: Integer        read FNewThreadCount write FNewThreadCount;     //新着スレッドの数
222                    property LogThreadCount: Integer        read FLogThreadCount write FLogThreadCount;             //ログ有りスレッドの数
223                    property UserThreadCount: Integer       read FUserThreadCount write FUserThreadCount;   //?
224          end;          end;
225    
226          //スレ          //スレ
# Line 281  type Line 239  type
239                  FNewResCount: Integer;          //スレッド新着数                  FNewResCount: Integer;          //スレッド新着数
240                  FSize: Integer;                                         //スレッドサイズ                  FSize: Integer;                                         //スレッドサイズ
241                  FRound: Boolean;                                        //巡回フラグ                  FRound: Boolean;                                        //巡回フラグ
242                  FRoundName: string;                             //巡回名                  //FRoundName: string;                           //巡回名
243                    FRoundName: PChar;                              //巡回名
244                  FIsLogFile: Boolean;                    //ログ存在フラグ                  FIsLogFile: Boolean;                    //ログ存在フラグ
245                  FParentBoard: TBoard;                   //親ボード                  FParentBoard: TBoard;                   //親ボード
246                  FKokomade: Integer;                             //ココまで読んだ番号                  FKokomade: Integer;                             //ココまで読んだ番号
# Line 296  type Line 255  type
255                  FUpdate: Boolean;                  FUpdate: Boolean;
256                  FExpand: Boolean;                  FExpand: Boolean;
257                  FURL                                    : string;                               // このスレをブラウザで表示する際の URL                  FURL                                    : string;                               // このスレをブラウザで表示する際の URL
258                  FBoardPlugIn    : TBoardPlugIn; // このスレをサポートするプラグイン                  //FBoardPlugIn  : TBoardPlugIn; // このスレをサポートするプラグイン
259                  FFilePath                       : string;                               // このスレが保存されているパス                  //FFilePath                     : string;                               // このスレが保存されているパス
260    
261                  procedure SetLastModified(d: TDateTime);                  procedure SetLastModified(d: TDateTime);
262                  procedure SetRound(b: Boolean);                  procedure SetRound(b: Boolean);
263                  procedure SetRoundName(const s: string);                  //procedure SetRoundName(const s: string);
264                    procedure SetRoundName(const s: PChar);
265                  procedure SetKokomade(i: Integer);                  procedure SetKokomade(i: Integer);
266                  procedure SetUnRead(b: Boolean);                  procedure SetUnRead(b: Boolean);
267                  procedure SetScrollTop(i: Integer);                  procedure SetScrollTop(i: Integer);
268                  procedure Init;                  procedure Init;
269                  function GetCreateDate: TDateTime;                  function GetCreateDate: TDateTime;
270            function GetFilePath: String;
271          public          public
272                  constructor Create( inPlugIn : TBoardPlugIn; inURL : string ); overload;                  constructor Create(const inPlugIn : TBoardPlugIn; const inBoard : TBoard; inURL : string ); overload;
273          constructor Create( is2ch : Boolean; const inURL, inHost, inBBSID, inBBSKey : string ); overload;                  constructor Create(const inPlugIn : TBoardPlugIn; const inBoard : TBoard;
274                                             inURL : string; inExist: Boolean; const inFilename: string ); overload;
275    
276                  destructor Destroy; override;                  destructor Destroy; override;
277    
# Line 336  type Line 298  type
298                  property NewResCount: Integer read FNewResCount write FNewResCount;                  property NewResCount: Integer read FNewResCount write FNewResCount;
299                  property Size: Integer read FSize write FSize;                  property Size: Integer read FSize write FSize;
300                  property Round: Boolean read FRound write SetRound;                  property Round: Boolean read FRound write SetRound;
301                  property RoundName: string read FRoundName write SetRoundName;                  //property RoundName: string read FRoundName write SetRoundName;
302                    property RoundName: PChar read FRoundName write SetRoundName;
303    
304                  property IsLogFile: Boolean read FIsLogFile write FIsLogFile;                  property IsLogFile: Boolean read FIsLogFile write FIsLogFile;
305                  property ParentBoard: TBoard read FParentBoard write FParentBoard;                  property ParentBoard: TBoard read FParentBoard write FParentBoard;
# Line 348  type Line 311  type
311                  property Expand: Boolean read FExpand write FExpand;                  property Expand: Boolean read FExpand write FExpand;
312                  property DownloadHost: string read FDownloadHost write FDownloadHost;                  property DownloadHost: string read FDownloadHost write FDownloadHost;
313                  property AgeSage: TGikoAgeSage read FAgeSage write FAgeSage;                  property AgeSage: TGikoAgeSage read FAgeSage write FAgeSage;
 //              property SPID: string read FSPID write FSPID;  
314                  property CreateDate: TDateTime read GetCreateDate;                  property CreateDate: TDateTime read GetCreateDate;
315                  property        URL                                     : string                                read FURL write FURL;                  property        URL                                     : string                                read FURL write FURL;
316                  property        BoardPlugIn     : TBoardPlugIn  read FBoardPlugIn;                  property        FilePath                : string        read GetFilePath;
                 property        FilePath                : string                                read FFilePath write FFilePath;  
                 function        IsBoardPlugInAvailable : Boolean;  
317          end;          end;
318    
319            TBoardGroup = class(TStringList)
320        private
321            FBoardPlugIn    : TBoardPlugIn; // この板をサポートするプラグイン
322        public
323            procedure       Clear   ; override;
324            property        BoardPlugIn     : TBoardPlugIn  read FBoardPlugIn write FBoardPlugIn;
325        end;
326    
327    
         //検索結果リスト  
 {       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;}  
   
328          function        BBSsFindBoardFromBBSID( inBBSID : string ) : TBoard;          function        BBSsFindBoardFromBBSID( inBBSID : string ) : TBoard;
329          function        BBSsFindBoardFromURL( inURL : string ) : TBoard;          function        BBSsFindBoardFromURL( inURL : string ) : TBoard;
330          function        BBSsFindBoardFromTitle( inTitle : string ) : TBoard;          function        BBSsFindBoardFromTitle( inTitle : string ) : TBoard;
# Line 382  type Line 333  type
333    
334  var  var
335          BBSs            : array of TBBS;          BBSs            : array of TBBS;
336        BoardGroups : array of TBoardGroup;
337    
338  implementation  implementation
339    
# Line 411  const Line 363  const
363  function        BBSsFindBoardFromBBSID(  function        BBSsFindBoardFromBBSID(
364          inBBSID : string          inBBSID : string
365  ) : TBoard;  ) : TBoard;
366    var
367            i : Integer;
368            tmpBoard : TBoard;
369  begin  begin
370    
371          Result := BBSs[ 0 ].FindBBSID( inBBSID );  //      Result := BBSs[ 0 ].FindBBSID( inBBSID );
372            Result := nil;
373            if Length(BoardGroups) > 0 then begin
374                    for i := BoardGroups[0].Count - 1 downto 0 do begin
375                            tmpBoard := TBoard(BoardGroups[0].Objects[i]);
376                            if tmpBoard.Is2ch then begin
377                                    if AnsiCompareStr(tmpBoard.BBSID, inBBSID) = 0 then begin
378                                            Result := tmpBoard;
379                                            EXIT;
380                                    end;
381                            end;
382                    end;
383            end;
384    
385  end;  end;
386    
# Line 421  function       BBSsFindBoardFromURL( Line 388  function       BBSsFindBoardFromURL(
388          inURL   : string          inURL   : string
389  ) : TBoard;  ) : TBoard;
390  var  var
391          i                       : Integer;          i,p                     : Integer;
392            accept          : TAcceptType;
393            protocol, host, path, document, port, bookmark : string;
394            BBSID, BBSKey : string;
395  begin  begin
396            Result := nil;
397          for i := Length( BBSs ) - 1 downto 0 do begin          for i := Length(BoardGroups) - 1 downto 1 do begin
398                  Result := BBSs[ i ].FindBoardFromURL( inURL );                  accept := BoardGroups[i].BoardPlugIn.AcceptURL(inURL);
399                  if Result <> nil then                  if (accept = atBoard) or (accept = atThread) then begin
400                          Exit;                          if BoardGroups[i].Find(inURL, p) then begin
401                                    Result := TBoard(BoardGroups[i].Objects[p]);
402                                    Exit;
403                            end else begin
404                                    inURL := BoardGroups[i].BoardPlugIn.ExtractBoardURL(inURL);
405                                    if BoardGroups[i].Find(inURL, p) then begin
406                                            Result := TBoard(BoardGroups[i].Objects[p]);
407                                            Exit;
408                                    end;
409                            end;
410                    end;
411          end;          end;
412            //ここにきたら、pluginを使わないやつらを調べる
413            if BoardGroups[0].Find(inURL, p) then
414                    Result := TBoard(BoardGroups[0].Objects[p]);
415    
416          Result := nil;          if (Result = nil) then begin
417                    GikoSys.ParseURI( inURL, protocol, host, path, document, port, bookmark );
418                    //ホストが2chならBBSIDで調べる
419                    if GikoSys.Is2chHost(host) then begin
420                            GikoSys.Parse2chURL( inURL, path, document, BBSID, BBSKey );
421                Result := BBSsFindBoardFromBBSID(BBSID);
422                    end;
423    
424            end;
425    
426  end;  end;
427    
# Line 438  function       BBSsFindBoardFromTitle( Line 429  function       BBSsFindBoardFromTitle(
429          inTitle : string          inTitle : string
430  ) : TBoard;  ) : TBoard;
431  var  var
432          i                               : Integer;          i,j                             : Integer;
433            tmpBoard                : TBoard;
434  begin  begin
435        Result := nil;
436          for i := Length( BBSs ) - 1 downto 0 do begin          for i := Length( BBSs ) - 1 downto 0 do begin
437                  Result := BBSs[ i ].FindBoardFromTitle( inTitle );                  for j := BoardGroups[i].Count - 1 downto 0 do begin
438                  if Result <> nil then                          tmpBoard := TBoard(BoardGroups[i].Objects[j]);
439                          Exit;                          if ( AnsiCompareStr(tmpBoard.Title, inTitle) = 0) then begin
440                                    Result := tmpBoard;
441                                    Exit;
442                            end;
443                    end;
444          end;          end;
445    
         Result := nil;  
   
446  end;  end;
447    
448  function        BBSsFindThreadFromURL(  function        BBSsFindThreadFromURL(
# Line 457  function       BBSsFindThreadFromURL( Line 451  function       BBSsFindThreadFromURL(
451  var  var
452          board                   : TBoard;          board                   : TBoard;
453          boardURL        : string;          boardURL        : string;
454            protocol, host, path, document, port, bookmark : string;
455            BBSID, BBSKey : string;
456    //      i : Integer;
457  begin  begin
458    
459          boardURL        := GikoSys.GetThreadURL2BoardURL( inURL );          boardURL        := GikoSys.GetThreadURL2BoardURL( inURL );
460          board                   := BBSsFindBoardFromURL( boardURL );          board                   := BBSsFindBoardFromURL( boardURL );
461          if board = nil then          if board = nil then
462                  Result := nil                  Result := nil
463          else          else begin
464                  Result := board.FindThreadFromURL( inURL );                  Result := board.FindThreadFromURL( inURL );
465                    //もしも2chの板なら
466                    if (Result = nil) and (board.Is2ch) then begin
467                            GikoSys.ParseURI( inURL, protocol, host, path, document, port, bookmark );
468                            GikoSys.Parse2chURL( inURL, path, document, BBSID, BBSKey );
469                            Result := board.FindThreadFromFileName(BBSKey + '.dat');
470                    end;
471            end;
472    
473  end;  end;
474    
# Line 553  var Line 557  var
557          i: Integer;          i: Integer;
558  begin  begin
559          if not IsBoardFileRead then          if not IsBoardFileRead then
560          GikoSys.ReadBoardFile( Self );          GikoSys.ReadBoardFile( Self );
561          for i := Count - 1 downto 0 do begin          for i := Count - 1 downto 0 do begin
562                  Result := Items[ i ].FindBoardFromTitle(Title);                  Result := Items[ i ].FindBoardFromTitle(Title);
563                  if Result <> nil then                  if Result <> nil then
# Line 570  var Line 574  var
574          i                                       : Integer;          i                                       : Integer;
575  begin  begin
576          if not IsBoardFileRead then          if not IsBoardFileRead then
577          GikoSys.ReadBoardFile( Self );          GikoSys.ReadBoardFile( Self );
578          for i := Count - 1 downto 0 do begin          for i := Count - 1 downto 0 do begin
579                  Result := Items[ i ].FindBoardFromURL( inURL );                  Result := Items[ i ].FindBoardFromURL( inURL );
580                  if Result <> nil then                  if Result <> nil then
# Line 677  end; Line 681  end;
681    
682  procedure TCategory.Delete(index: integer);  procedure TCategory.Delete(index: integer);
683  begin  begin
684          if (Items[index] <> nil) then begin          {if (Items[index] <> nil) then begin
685                  try                  try
686                          if TBoard(Items[index]).Multiplicity = 0 then                          if TBoard(Items[index]).Multiplicity = 0 then
687                                  TBoard(Items[index]).Free                                  TBoard(Items[index]).Free
# Line 686  begin Line 690  begin
690                  except                  except
691                  end;                  end;
692          end;          end;
693          inherited Delete(index);          }
694        inherited Delete(index);
695  end;  end;
696    
697  procedure TCategory.Clear;  procedure TCategory.Clear;
# Line 841  begin Line 846  begin
846          if inPlugIn = nil then begin          if inPlugIn = nil then begin
847                  // subject.txt の保存パスを設定                  // subject.txt の保存パスを設定
848                  GikoSys.ParseURI( inURL, protocol, host, path, document, port, bookmark );                  GikoSys.ParseURI( inURL, protocol, host, path, document, port, bookmark );
849                  if GikoSys.Is2chHost( host ) then                  if GikoSys.Is2chHost( host ) then begin
850                            Self.Is2ch := True;
851                          FilePath :=                          FilePath :=
852                                  GikoSys.Setting.LogFolderP  +                                  GikoSys.Setting.LogFolderP  +
853                                  BBS2CH_LOG_FOLDER + PATH_DELIM + BBSID + PATH_DELIM + SUBJECT_FILENAME                                  BBS2CH_LOG_FOLDER + PATH_DELIM + BBSID + PATH_DELIM + SUBJECT_FILENAME
854                  else                  end else begin
855                            Self.Is2ch := False;
856                          FilePath :=                          FilePath :=
857                                  GikoSys.Setting.LogFolderP +                                  GikoSys.Setting.LogFolderP +
858                                  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
859                    end;
860          end else begin          end else begin
861                  // プラグインに TBoardItem が作成されたことを伝える                  // プラグインに TBoardItem が作成されたことを伝える
862                  inPlugIn.CreateBoardItem( DWORD( Self ) );                  inPlugIn.CreateBoardItem( DWORD( Self ) );
863                    Self.Is2ch := False;
864          end;          end;
865    
866  end;  end;
# Line 1212  end; Line 1221  end;
1221    
1222  // スレ立て送信URL  // スレ立て送信URL
1223  function TBoard.GetSendURL: string;  function TBoard.GetSendURL: string;
1224  var  //var
1225          Protocol, Host, Path, Document, Port, Bookmark : string;  //      Protocol, Host, Path, Document, Port, Bookmark : string;
1226  begin  begin
1227      Result := GikoSys.UrlToServer(URL);      Result := GikoSys.UrlToServer(URL);
1228      GikoSys.ParseURI( URL, Protocol,Host, Path, Document, Port, Bookmark );          //GikoSys.ParseURI( URL, Protocol,Host, Path, Document, Port, Bookmark );
1229      if GikoSys.Is2chHost(Host) then          //if GikoSys.Is2chHost(Host) then
1230            if Self.Is2ch then
1231          Result := Result + 'test/bbs.cgi'          Result := Result + 'test/bbs.cgi'
1232      else      else
1233          Result := Result + 'test/subbbs.cgi';          Result := Result + 'test/subbbs.cgi';
# Line 1235  begin Line 1245  begin
1245          if FUpdate then          if FUpdate then
1246                  FModified := True;                  FModified := True;
1247  end;  end;
1248    {
1249  procedure TBoard.SetRoundName(s: string);  procedure TBoard.SetRoundName(s: string);
1250  begin  begin
1251          if FRoundName = s then Exit;          if FRoundName = s then Exit;
# Line 1243  begin Line 1253  begin
1253          if FUpdate then          if FUpdate then
1254                  FModified := True;                  FModified := True;
1255  end;  end;
1256    }
1257    procedure TBoard.SetRoundName(s: PChar);
1258    begin
1259            if FRoundName = s then Exit;
1260            FRoundName := s;
1261            if FUpdate then
1262                    FModified := True;
1263    end;
1264    
1265  procedure TBoard.SetLastModified(d: TDateTime);  procedure TBoard.SetLastModified(d: TDateTime);
1266  begin  begin
# Line 1422  begin Line 1440  begin
1440          end;          end;
1441          Result := nil;          Result := nil;
1442  end;  end;
1443    function TBoard.GetLogThread(Index: Integer; Base: Integer): TThreadItem;
1444    var
1445            i: Integer;
1446            Cnt: Integer;
1447    begin
1448            Cnt := 0;
1449            if Length( ParentCategory.ParenTBBS.ShortSelectText ) = 0 then
1450            begin
1451                    for i := Base to Count - 1 do begin
1452                            if Items[i].IsLogFile then
1453                                                                            begin
1454                                    if Index = Cnt then begin
1455                                            Result := Items[i];
1456                                            Exit;
1457                                    end;
1458                                    inc(Cnt);
1459                            end;
1460                    end;
1461            end else begin
1462                    for i := Base to Count - 1 do begin
1463                            if Items[i].IsLogFile then
1464                                    begin
1465                                            if Items[i].ShortTitle = '' then
1466                                                    Items[i].ShortTitle := ZenToHan(Items[i].Title);
1467                                            if AnsiPos(ParentCategory.ParenTBBS.ShortSelectText, Items[i].ShortTitle) <> 0 then begin
1468                                                    if Index = Cnt then begin
1469                                                            Result := Items[i];
1470                                                            Exit;
1471                                            end;
1472                                            inc(Cnt);
1473                                    end;
1474                            end;
1475                    end;
1476            end;
1477            Result := nil;
1478    end;
1479  function TBoard.GetUserThread(Index: Integer): TThreadItem;  function TBoard.GetUserThread(Index: Integer): TThreadItem;
1480  var  var
1481          i: Integer;          i: Integer;
# Line 1496  begin Line 1549  begin
1549    
1550          FUpdate := True;          FUpdate := True;
1551          FURL := '';          FURL := '';
1552          FBoardPlugIn := nil;          //FBoardPlugIn := nil;
1553  end;  end;
1554    
1555  // *************************************************************************  // *************************************************************************
1556  // 外部板プラグインを指定したコンストラクタ  // 外部板プラグインを指定したコンストラクタ
1557  // *************************************************************************  // *************************************************************************
1558  constructor TThreadItem.Create(  constructor TThreadItem.Create(
1559          inPlugIn        : TBoardPlugIn;          const inPlugIn : TBoardPlugIn;
1560          inURL                   : string          const inBoard : TBoard;
1561            inURL : string
1562  );  );
1563  var  var
1564          foundPos                        : Integer;          foundPos                        : Integer;
# Line 1516  begin Line 1570  begin
1570    
1571          inherited Create;          inherited Create;
1572          Init;          Init;
1573            FParentBoard    := inBoard;
1574          FBoardPlugIn    := inPlugIn;          //FBoardPlugIn  := inPlugIn;
1575          URL                                             := inURL;          URL                             := inURL;
1576    
1577          if inPlugIn = nil then begin          if inPlugIn = nil then begin
1578                  foundPos := Pos( READ_PATH, inURL );                  foundPos := Pos( READ_PATH, inURL );
# Line 1526  begin Line 1580  begin
1580                          // dat の保存パスを設定                          // dat の保存パスを設定
1581                          GikoSys.ParseURI( inURL, protocol, host, path, document, port, bookmark );                          GikoSys.ParseURI( inURL, protocol, host, path, document, port, bookmark );
1582                          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';  
1583                          FileName        := BBSKey + '.dat';                          FileName        := BBSKey + '.dat';
1584                          IsLogFile       := FileExists( FilePath );                          IsLogFile       := FileExists( FilePath );
1585                          URL                             := GikoSys.Get2chBrowsableThreadURL( inURL );                          URL                             := GikoSys.Get2chBrowsableThreadURL( inURL );
# Line 1544  begin Line 1590  begin
1590          end;          end;
1591    
1592  end;  end;
   
1593  // *************************************************************************  // *************************************************************************
1594  // プラグインを利用しないコンストラクタ  // 外部板プラグインを指定したコンストラクタ Log有りかどうか判断済み
1595    // FileNameも取得済み → ReadSubject用
1596  // *************************************************************************  // *************************************************************************
1597  constructor TThreadItem.Create(  constructor TThreadItem.Create(
1598          is2ch : Boolean;          const inPlugIn : TBoardPlugIn;
1599      const inURL, inHost, inBBSID, inBBSKey : string          const inBoard : TBoard;
1600            inURL : string;
1601            inExist: Boolean;
1602            const inFilename: string
1603  );  );
 var  
         foundPos                        : Integer;  
 const  
         READ_PATH                                                       = '/test/read.cgi';  
1604  begin  begin
1605    
1606          inherited Create;          inherited Create;
1607          Init;          Init;
1608            FParentBoard    := inBoard;
1609            URL                             := inURL;
1610    
1611          FBoardPlugIn    := nil;          if inPlugIn = nil then begin
1612                    // dat の保存パスを設定
1613      foundPos := Pos( READ_PATH, inURL );                  FileName        := inFilename;
1614      if foundPos > 0 then begin                  IsLogFile       := inExist;
1615          // dat の保存パスを設定                  URL                             := GikoSys.Get2chBrowsableThreadURL( inURL );
1616          if is2ch then          end else begin
1617              FilePath :=                  // プラグインに TThreadItem が作成されたことを伝える
1618                    inPlugIn.CreateThreadItem( DWORD( Self ) );
1619                  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;  
1620    
1621  end;  end;
1622  // *************************************************************************  // *************************************************************************
# Line 1589  destructor TThreadItem.Destroy; Line 1626  destructor TThreadItem.Destroy;
1626  begin  begin
1627    
1628          // プラグインに TThreadItem が破棄されたことを伝える          // プラグインに TThreadItem が破棄されたことを伝える
1629          if IsBoardPlugInAvailable then          if Self.ParentBoard.IsBoardPlugInAvailable then
1630                  FBoardPlugIn.DisposeThreadItem( DWORD( Self ) );                  Self.ParentBoard.BoardPlugIn.DisposeThreadItem( DWORD( Self ) );
1631    
1632          inherited;          inherited;
1633    
# Line 1599  end; Line 1636  end;
1636  // *************************************************************************  // *************************************************************************
1637  // 外部板プラグインが使用可能か  // 外部板プラグインが使用可能か
1638  // *************************************************************************  // *************************************************************************
1639    {
1640  function        TThreadItem.IsBoardPlugInAvailable : Boolean;  function        TThreadItem.IsBoardPlugInAvailable : Boolean;
1641  begin  begin
1642    
# Line 1616  begin Line 1654  begin
1654          Result := False;          Result := False;
1655    
1656  end;  end;
1657    }
1658  function TThreadItem.GetDatURL: string;  function TThreadItem.GetDatURL: string;
1659  var  var
1660          Protocol, Host, Path, Document, Port, Bookmark: string;          Protocol, Host, Path, Document, Port, Bookmark: string;
# Line 1794  begin Line 1832  begin
1832          if FUpdate and (ParentBoard <> nil) then          if FUpdate and (ParentBoard <> nil) then
1833                  ParentBoard.FModified := True;                  ParentBoard.FModified := True;
1834  end;  end;
1835    {
1836  procedure TThreadItem.SetRoundName(const s: string);  procedure TThreadItem.SetRoundName(const s: string);
1837  begin  begin
1838          if FRoundName = s then Exit;          if FRoundName = s then Exit;
# Line 1802  begin Line 1840  begin
1840          if FUpdate and (ParentBoard <> nil) then          if FUpdate and (ParentBoard <> nil) then
1841                  ParentBoard.FModified := True;                  ParentBoard.FModified := True;
1842  end;  end;
1843    }
1844    procedure TThreadItem.SetRoundName(const s: PChar);
1845    begin
1846            if FRoundName = s then Exit;
1847            FRoundName := s;
1848            if FUpdate and (ParentBoard <> nil) then
1849                    ParentBoard.FModified := True;
1850    end;
1851  procedure TThreadItem.SetKokomade(i: Integer);  procedure TThreadItem.SetKokomade(i: Integer);
1852  begin  begin
1853          if FKokomade = i then Exit;          if FKokomade = i then Exit;
# Line 1877  begin Line 1922  begin
1922                          Result := ZERO_DATE;                          Result := ZERO_DATE;
1923          end;          end;
1924  end;  end;
1925    function TThreadItem.GetFilePath: String;
1926    var
1927            path : String;
1928    begin
1929            path := ExtractFilePath(Self.ParentBoard.FilePath) + Self.FileName;
1930        Result := path;
1931    end;
1932    
1933    procedure       TBoardGroup.Clear;
1934    var
1935            i       : Integer;
1936    begin
1937            for i := Self.Count - 1 downto 0 do begin
1938            TBoard(Self.Objects[i]).Free;
1939        end;
1940        inherited Clear;
1941        Self.Capacity := 0;
1942    end;
1943    
1944    
1945  end.  end.
1946    

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

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