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.60 by h677, Sat Jun 25 11:27:22 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 166  type Line 113  type
113                  FBoolData: Boolean;                                             //いろんな用途に使うyo                  FBoolData: Boolean;                                             //いろんな用途に使うyo
114                  FSPID: string;                                                          //書き込み用SPID                  FSPID: string;                                                          //書き込み用SPID
115                  FPON: string;                                                                   //書き込み用PON                  FPON: string;                                                                   //書き込み用PON
116                    FCookie: string;                                                //書き込み用Cookie文字列
117                    FExpires: TDateTime;                                    //Cookieの有効期限
118                  FKotehanName: string;                                   //コテハン名前                  FKotehanName: string;                                   //コテハン名前
119                  FKotehanMail: string;                                   //コテハンメール                  FKotehanMail: string;                                   //コテハンメール
120    
# Line 178  type Line 127  type
127                  FIntData                        : Integer;                      // 好きにいじってよし。いろんな用途に使うyo                  FIntData                        : Integer;                      // 好きにいじってよし。いろんな用途に使うyo
128                  FListData                       : TList;                                // 好きにいじってよし。いろんな用途に使うyo                  FListData                       : TList;                                // 好きにいじってよし。いろんな用途に使うyo
129    
130                  FSETTINGTXTTime: TDateTime;     //SETTING.TXTを取得した日時                  FSETTINGTXTTime : TDateTime;    //SETTING.TXTを取得した日時
131                  FIsSETTINGTXT:          boolean;        //SETTING.TXTを取得しているか                  FIsSETTINGTXT   : boolean;      //SETTING.TXTを取得しているか
132                  FHEADTXTTime: TDateTime;                //HEAD.TXTを取得した日時                  FHEADTXTTime    : TDateTime;            //HEAD.TXTを取得した日時
133                  FIsHEADTXT:             boolean;        //HEAD.TXTを取得しているか                  FIsHEADTXT              : boolean;      //HEAD.TXTを取得しているか
134          FTitlePictureURL:       string; //top絵のURL                  FTitlePictureURL: string;       //top絵のURL
135                  FMultiplicity : Integer; //重複しているかどうか?                  FMultiplicity   : Integer; //重複しているかどうか?
136                    FIs2ch                  : Boolean; //hostが2chかどうか
137                    FNewThreadCount: Integer;       //新着スレッドの数
138                    FLogThreadCount: Integer;       //ログ有りスレッドの数
139                    FUserThreadCount: Integer;      //?
140    
141                  function GetThreadItem(index: integer): TThreadItem;                  function GetThreadItem(index: integer): TThreadItem;
142                  procedure SetThreadItem(index: integer; value: TThreadItem);                  procedure SetThreadItem(index: integer; value: TThreadItem);
143                  procedure SetRound(b: Boolean);                  procedure SetRound(b: Boolean);
144                  procedure SetRoundName(s: string);                  procedure SetRoundName(s: string);
145                    //procedure SetRoundName(s: PChar);
146                  procedure SetLastModified(d: TDateTime);                  procedure SetLastModified(d: TDateTime);
147                  procedure SetLastGetTime(d: TDateTime);                  procedure SetLastGetTime(d: TDateTime);
148                  procedure SetUnRead(i: Integer);                  procedure SetUnRead(i: Integer);
# Line 206  type Line 161  type
161                  property BBSID: string read FBBSID write FBBSID;                  property BBSID: string read FBBSID write FBBSID;
162                  property URL: string read FURL write FURL;                  property URL: string read FURL write FURL;
163                  property Round: Boolean read FRound write SetRound;                  property Round: Boolean read FRound write SetRound;
164                    //property RoundName: PChar read FRoundName write SetRoundName;
165                  property RoundName: string read FRoundName write SetRoundName;                  property RoundName: string read FRoundName write SetRoundName;
166                  property RoundDate: TDateTime read FRoundDate write FRoundDate;                  property RoundDate: TDateTime read FRoundDate write FRoundDate;
167                  property LastModified: TDateTime read FLastModified write SetLastModified;                  property LastModified: TDateTime read FLastModified write SetLastModified;
# Line 230  type Line 186  type
186                  function FindThreadFromFileName(const ItemFileName: string): TThreadItem;                  function FindThreadFromFileName(const ItemFileName: string): TThreadItem;
187                  function FindThreadFromURL(const inURL : string ) : TThreadItem;                  function FindThreadFromURL(const inURL : string ) : TThreadItem;
188                  function GetIndexFromFileName(const ItemFileName: string): Integer;                  function GetIndexFromFileName(const ItemFileName: string): Integer;
189                  function GetIndexFromURL(const URL: string): Integer;                  function GetIndexFromURL(const URL: string; reverse : Boolean = False): Integer;
190                  procedure LoadSettings;                  procedure LoadSettings;
191                  procedure SaveSettings;                  procedure SaveSettings;
192                  function GetReadCgiURL: string;                  function GetReadCgiURL: string;
# Line 245  type Line 201  type
201                  function GetLogThreadCount: Integer;                  function GetLogThreadCount: Integer;
202                  function GetUserThreadCount: Integer;                  function GetUserThreadCount: Integer;
203                  function GetNewThread(Index: Integer): TThreadItem;                  function GetNewThread(Index: Integer): TThreadItem;
204                  function GetLogThread(Index: Integer): TThreadItem;                  function GetLogThread(Index: Integer): TThreadItem; overload;
205                    function GetLogThread(Index: Integer; Base: Integer): TThreadItem; overload;
206                  function GetUserThread(Index: Integer): TThreadItem;                  function GetUserThread(Index: Integer): TThreadItem;
207    
208                  procedure BeginUpdate;                  procedure BeginUpdate;
# Line 261  type Line 218  type
218                  property IsSETTINGTXT:  boolean read FIsSETTINGTXT write FIsSETTINGTXT;                  property IsSETTINGTXT:  boolean read FIsSETTINGTXT write FIsSETTINGTXT;
219                  property HEADTXTTime: TDateTime read FHEADTXTTime write FHEADTXTTime;                  property HEADTXTTime: TDateTime read FHEADTXTTime write FHEADTXTTime;
220                  property IsHEADTXT:     boolean read FIsHEADTXT write FIsHEADTXT;                  property IsHEADTXT:     boolean read FIsHEADTXT write FIsHEADTXT;
221          property TitlePictureURL: string read FTitlePictureURL write FTitlePictureURL;                  property TitlePictureURL: string read FTitlePictureURL write FTitlePictureURL;
222                  property Multiplicity: Integer read FMultiplicity write FMultiplicity;                  property Multiplicity: Integer read FMultiplicity write FMultiplicity;
223                    property Is2ch  : boolean       read FIs2ch     write FIs2ch;
224                    property NewThreadCount: Integer        read FNewThreadCount write FNewThreadCount;     //新着スレッドの数
225                    property LogThreadCount: Integer        read FLogThreadCount write FLogThreadCount;             //ログ有りスレッドの数
226                    property UserThreadCount: Integer       read FUserThreadCount write FUserThreadCount;   //?
227                    property Cookie: string                         read FCookie write FCookie;
228                    property Expires: TDateTime                     read FExpires write FExpires;
229          end;          end;
230    
231          //スレ          //スレ
# Line 282  type Line 245  type
245                  FSize: Integer;                                         //スレッドサイズ                  FSize: Integer;                                         //スレッドサイズ
246                  FRound: Boolean;                                        //巡回フラグ                  FRound: Boolean;                                        //巡回フラグ
247                  FRoundName: string;                             //巡回名                  FRoundName: string;                             //巡回名
248                    //FRoundName: PChar;                            //巡回名
249                  FIsLogFile: Boolean;                    //ログ存在フラグ                  FIsLogFile: Boolean;                    //ログ存在フラグ
250                  FParentBoard: TBoard;                   //親ボード                  FParentBoard: TBoard;                   //親ボード
251                  FKokomade: Integer;                             //ココまで読んだ番号                  FKokomade: Integer;                             //ココまで読んだ番号
# Line 296  type Line 260  type
260                  FUpdate: Boolean;                  FUpdate: Boolean;
261                  FExpand: Boolean;                  FExpand: Boolean;
262                  FURL                                    : string;                               // このスレをブラウザで表示する際の URL                  FURL                                    : string;                               // このスレをブラウザで表示する際の URL
263                  FBoardPlugIn    : TBoardPlugIn; // このスレをサポートするプラグイン                  //FBoardPlugIn  : TBoardPlugIn; // このスレをサポートするプラグイン
264                  FFilePath                       : string;                               // このスレが保存されているパス                  //FFilePath                     : string;                               // このスレが保存されているパス
265    
266                  procedure SetLastModified(d: TDateTime);                  procedure SetLastModified(d: TDateTime);
267                  procedure SetRound(b: Boolean);                  procedure SetRound(b: Boolean);
268                  procedure SetRoundName(const s: string);                  procedure SetRoundName(const s: string);
269                    //procedure SetRoundName(const s: PChar);
270                  procedure SetKokomade(i: Integer);                  procedure SetKokomade(i: Integer);
271                  procedure SetUnRead(b: Boolean);                  procedure SetUnRead(b: Boolean);
272                  procedure SetScrollTop(i: Integer);                  procedure SetScrollTop(i: Integer);
273                  procedure Init;                  procedure Init;
274                  function GetCreateDate: TDateTime;                  function GetCreateDate: TDateTime;
275            function GetFilePath: String;
276          public          public
277                  constructor Create( inPlugIn : TBoardPlugIn; inURL : string ); overload;                  constructor Create(const inPlugIn : TBoardPlugIn; const inBoard : TBoard; inURL : string ); overload;
278          constructor Create( is2ch : Boolean; const inURL, inHost, inBBSID, inBBSKey : string ); overload;                  constructor Create(const inPlugIn : TBoardPlugIn; const inBoard : TBoard;
279                                             inURL : string; inExist: Boolean; const inFilename: string ); overload;
280    
281                  destructor Destroy; override;                  destructor Destroy; override;
282    
# Line 337  type Line 304  type
304                  property Size: Integer read FSize write FSize;                  property Size: Integer read FSize write FSize;
305                  property Round: Boolean read FRound write SetRound;                  property Round: Boolean read FRound write SetRound;
306                  property RoundName: string read FRoundName write SetRoundName;                  property RoundName: string read FRoundName write SetRoundName;
307                    //property RoundName: PChar read FRoundName write SetRoundName;
308    
309                  property IsLogFile: Boolean read FIsLogFile write FIsLogFile;                  property IsLogFile: Boolean read FIsLogFile write FIsLogFile;
310                  property ParentBoard: TBoard read FParentBoard write FParentBoard;                  property ParentBoard: TBoard read FParentBoard write FParentBoard;
# Line 348  type Line 316  type
316                  property Expand: Boolean read FExpand write FExpand;                  property Expand: Boolean read FExpand write FExpand;
317                  property DownloadHost: string read FDownloadHost write FDownloadHost;                  property DownloadHost: string read FDownloadHost write FDownloadHost;
318                  property AgeSage: TGikoAgeSage read FAgeSage write FAgeSage;                  property AgeSage: TGikoAgeSage read FAgeSage write FAgeSage;
 //              property SPID: string read FSPID write FSPID;  
319                  property CreateDate: TDateTime read GetCreateDate;                  property CreateDate: TDateTime read GetCreateDate;
320                  property        URL                                     : string                                read FURL write FURL;                  property        URL                                     : string                                read FURL write FURL;
321                  property        BoardPlugIn     : TBoardPlugIn  read FBoardPlugIn;                  property        FilePath                : string        read GetFilePath;
                 property        FilePath                : string                                read FFilePath write FFilePath;  
                 function        IsBoardPlugInAvailable : Boolean;  
322          end;          end;
323    
324            TBoardGroup = class(TStringList)
325        private
326            FBoardPlugIn    : TBoardPlugIn; // この板をサポートするプラグイン
327        public
328            procedure       Clear   ; override;
329            property        BoardPlugIn     : TBoardPlugIn  read FBoardPlugIn write FBoardPlugIn;
330        end;
331    
332    
         //検索結果リスト  
 {       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;}  
   
333          function        BBSsFindBoardFromBBSID( inBBSID : string ) : TBoard;          function        BBSsFindBoardFromBBSID( inBBSID : string ) : TBoard;
334          function        BBSsFindBoardFromURL( inURL : string ) : TBoard;          function        BBSsFindBoardFromURL( inURL : string ) : TBoard;
335          function        BBSsFindBoardFromTitle( inTitle : string ) : TBoard;          function        BBSsFindBoardFromTitle( inTitle : string ) : TBoard;
# Line 382  type Line 338  type
338    
339  var  var
340          BBSs            : array of TBBS;          BBSs            : array of TBBS;
341        BoardGroups : array of TBoardGroup;
342    
343  implementation  implementation
344    
# Line 411  const Line 368  const
368  function        BBSsFindBoardFromBBSID(  function        BBSsFindBoardFromBBSID(
369          inBBSID : string          inBBSID : string
370  ) : TBoard;  ) : TBoard;
371    var
372            i : Integer;
373            tmpBoard : TBoard;
374  begin  begin
375    
376          Result := BBSs[ 0 ].FindBBSID( inBBSID );  //      Result := BBSs[ 0 ].FindBBSID( inBBSID );
377            Result := nil;
378            if Length(BoardGroups) > 0 then begin
379                    for i := BoardGroups[0].Count - 1 downto 0 do begin
380                            tmpBoard := TBoard(BoardGroups[0].Objects[i]);
381                            if tmpBoard.Is2ch then begin
382                                    if AnsiCompareStr(tmpBoard.BBSID, inBBSID) = 0 then begin
383                                            Result := tmpBoard;
384                                            EXIT;
385                                    end;
386                            end;
387                    end;
388            end;
389    
390  end;  end;
391    {**********************************************
392    この関数は必ず板のURLの形式で渡してください。
393    pluginを使用するならば、ExtractBoardURL( inURL )
394    2chならば、GikoSys.Get2chThreadURL2BoardURL( inURL );
395    で変換してから呼び出してください。
396    **********************************************}
397  function        BBSsFindBoardFromURL(  function        BBSsFindBoardFromURL(
398          inURL   : string          inURL   : string
399  ) : TBoard;  ) : TBoard;
400  var  var
401          i                       : Integer;          i,p                     : Integer;
402            accept          : TAcceptType;
403            protocol, host, path, document, port, bookmark : string;
404  begin  begin
   
         for i := Length( BBSs ) - 1 downto 0 do begin  
                 Result := BBSs[ i ].FindBoardFromURL( inURL );  
                 if Result <> nil then  
                         Exit;  
         end;  
   
405          Result := nil;          Result := nil;
406            for i := Length(BoardGroups) - 1 downto 1 do begin
407                    accept := BoardGroups[i].BoardPlugIn.AcceptURL(inURL);
408                    if (accept = atBoard) or (accept = atThread) then begin
409                            if BoardGroups[i].Find(inURL, p) then begin
410                                    Result := TBoard(BoardGroups[i].Objects[p]);
411                                    Exit;
412                            end else begin
413                                    inURL := BoardGroups[i].BoardPlugIn.ExtractBoardURL(inURL);
414                                    if BoardGroups[i].Find(inURL, p) then begin
415                                            Result := TBoard(BoardGroups[i].Objects[p]);
416                                            Exit;
417                                    end;
418                            end;
419                    end;
420            end;
421            //ここにきたら、pluginを使わないやつらを調べる
422            if BoardGroups[0].Find(inURL, p) then
423                    Result := TBoard(BoardGroups[0].Objects[p]);
424                    
425            if (Result = nil) then begin
426                    GikoSys.ParseURI( inURL, protocol, host, path, document, port, bookmark );
427                    //ホストが2chならBBSIDで調べる
428                    if GikoSys.Is2chHost(host) then begin
429                            Result := BBSsFindBoardFromBBSID(GikoSys.URLToID( inURL ));
430                    end;
431            end;
432    
433  end;  end;
434    
# Line 438  function       BBSsFindBoardFromTitle( Line 436  function       BBSsFindBoardFromTitle(
436          inTitle : string          inTitle : string
437  ) : TBoard;  ) : TBoard;
438  var  var
439          i                               : Integer;          i,j                             : Integer;
440            tmpBoard                : TBoard;
441  begin  begin
442        Result := nil;
443          for i := Length( BBSs ) - 1 downto 0 do begin          for i := Length( BBSs ) - 1 downto 0 do begin
444                  Result := BBSs[ i ].FindBoardFromTitle( inTitle );                  for j := BoardGroups[i].Count - 1 downto 0 do begin
445                  if Result <> nil then                          tmpBoard := TBoard(BoardGroups[i].Objects[j]);
446                          Exit;                          if ( AnsiCompareStr(tmpBoard.Title, inTitle) = 0) then begin
447                                    Result := tmpBoard;
448                                    Exit;
449                            end;
450                    end;
451          end;          end;
452    
         Result := nil;  
   
453  end;  end;
454    
455  function        BBSsFindThreadFromURL(  function        BBSsFindThreadFromURL(
# Line 457  function       BBSsFindThreadFromURL( Line 458  function       BBSsFindThreadFromURL(
458  var  var
459          board                   : TBoard;          board                   : TBoard;
460          boardURL        : string;          boardURL        : string;
461            protocol, host, path, document, port, bookmark : string;
462            BBSID, BBSKey : string;
463    //      i : Integer;
464  begin  begin
465    
466          boardURL        := GikoSys.GetThreadURL2BoardURL( inURL );          boardURL        := GikoSys.GetThreadURL2BoardURL( inURL );
467          board                   := BBSsFindBoardFromURL( boardURL );          board                   := BBSsFindBoardFromURL( boardURL );
468          if board = nil then          if board = nil then
469                  Result := nil                  Result := nil
470          else          else begin
471                  Result := board.FindThreadFromURL( inURL );                  Result := board.FindThreadFromURL( inURL );
472                    //もしも2chの板なら
473                    if (Result = nil) and (board.Is2ch) then begin
474                            GikoSys.ParseURI( inURL, protocol, host, path, document, port, bookmark );
475                            GikoSys.Parse2chURL( inURL, path, document, BBSID, BBSKey );
476                            Result := board.FindThreadFromFileName(BBSKey + '.dat');
477                    end;
478            end;
479    
480  end;  end;
481    
# Line 553  var Line 564  var
564          i: Integer;          i: Integer;
565  begin  begin
566          if not IsBoardFileRead then          if not IsBoardFileRead then
567          GikoSys.ReadBoardFile( Self );          GikoSys.ReadBoardFile( Self );
568          for i := Count - 1 downto 0 do begin          for i := Count - 1 downto 0 do begin
569                  Result := Items[ i ].FindBoardFromTitle(Title);                  Result := Items[ i ].FindBoardFromTitle(Title);
570                  if Result <> nil then                  if Result <> nil then
# Line 570  var Line 581  var
581          i                                       : Integer;          i                                       : Integer;
582  begin  begin
583          if not IsBoardFileRead then          if not IsBoardFileRead then
584          GikoSys.ReadBoardFile( Self );          GikoSys.ReadBoardFile( Self );
585          for i := Count - 1 downto 0 do begin          for i := Count - 1 downto 0 do begin
586                  Result := Items[ i ].FindBoardFromURL( inURL );                  Result := Items[ i ].FindBoardFromURL( inURL );
587                  if Result <> nil then                  if Result <> nil then
# Line 677  end; Line 688  end;
688    
689  procedure TCategory.Delete(index: integer);  procedure TCategory.Delete(index: integer);
690  begin  begin
691          if (Items[index] <> nil) then begin          {if (Items[index] <> nil) then begin
692                  try                  try
693                          if TBoard(Items[index]).Multiplicity = 0 then                          if TBoard(Items[index]).Multiplicity = 0 then
694                                  TBoard(Items[index]).Free                                  TBoard(Items[index]).Free
# Line 686  begin Line 697  begin
697                  except                  except
698                  end;                  end;
699          end;          end;
700          inherited Delete(index);          }
701        inherited Delete(index);
702  end;  end;
703    
704  procedure TCategory.Clear;  procedure TCategory.Clear;
# Line 841  begin Line 853  begin
853          if inPlugIn = nil then begin          if inPlugIn = nil then begin
854                  // subject.txt の保存パスを設定                  // subject.txt の保存パスを設定
855                  GikoSys.ParseURI( inURL, protocol, host, path, document, port, bookmark );                  GikoSys.ParseURI( inURL, protocol, host, path, document, port, bookmark );
856                  if GikoSys.Is2chHost( host ) then                  if GikoSys.Is2chHost( host ) then begin
857                            Self.Is2ch := True;
858                          FilePath :=                          FilePath :=
859                                  GikoSys.Setting.LogFolderP  +                                  GikoSys.Setting.LogFolderP  +
860                                  BBS2CH_LOG_FOLDER + PATH_DELIM + BBSID + PATH_DELIM + SUBJECT_FILENAME                                  BBS2CH_LOG_FOLDER + PATH_DELIM + BBSID + PATH_DELIM + SUBJECT_FILENAME
861                  else                  end else begin
862                            Self.Is2ch := False;
863                          FilePath :=                          FilePath :=
864                                  GikoSys.Setting.LogFolderP +                                  GikoSys.Setting.LogFolderP +
865                                  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
866                    end;
867          end else begin          end else begin
868                  // プラグインに TBoardItem が作成されたことを伝える                  // プラグインに TBoardItem が作成されたことを伝える
869                  inPlugIn.CreateBoardItem( DWORD( Self ) );                  inPlugIn.CreateBoardItem( DWORD( Self ) );
870                    //Self.Is2ch := False;  //plugin側で設定する
871          end;          end;
872    
873  end;  end;
# Line 969  begin Line 985  begin
985          end;          end;
986  end;  end;
987    
988  function TBoard.GetIndexFromURL(const URL: string): Integer;  function TBoard.GetIndexFromURL(const URL: string; reverse : Boolean = False): Integer;
989    var
990            i : Integer;
991  begin  begin
992          Result := IndexOf( URL );          if not reverse then
993                    Result := IndexOf( URL )
994            else begin
995            Result := -1;
996                    for i := Self.Count - 1 downto 0 do begin
997                            if Strings[i] = URL then begin
998                                    Result := i;
999                                    break;
1000                            end;
1001                    end;
1002            end;
1003  end;  end;
1004    
1005  function TBoard.FindThreadFromURL(const inURL : string ) : TThreadItem;  function TBoard.FindThreadFromURL(const inURL : string ) : TThreadItem;
# Line 1040  begin Line 1068  begin
1068                  FUnRead := ini.ReadInteger('Status', 'UnRead', 0);                  FUnRead := ini.ReadInteger('Status', 'UnRead', 0);
1069                  FSPID := ini.ReadString('Cookie', 'SPID', '');                  FSPID := ini.ReadString('Cookie', 'SPID', '');
1070                  FPON := ini.ReadString('Cookie', 'PON', '');                  FPON := ini.ReadString('Cookie', 'PON', '');
1071                    FCookie  := ini.ReadString('Cookie', 'Cookie', '');
1072                    tmp := ini.ReadString('Cookie', 'Expires', DateTimeToStr(ZERO_DATE));
1073                    FExpires := ConvertDateTimeString(tmp);
1074                  FKotehanName := ini.ReadString('Kotehan', 'Name', '');                  FKotehanName := ini.ReadString('Kotehan', 'Name', '');
1075                  FKotehanMail := ini.ReadString('Kotehan', 'Mail', '');                  FKotehanMail := ini.ReadString('Kotehan', 'Mail', '');
1076    
# Line 1074  begin Line 1105  begin
1105                  ini.WriteInteger('Status', 'UnRead', FUnRead);                  ini.WriteInteger('Status', 'UnRead', FUnRead);
1106                  ini.WriteString('Cookie', 'SPID', FSPID);                  ini.WriteString('Cookie', 'SPID', FSPID);
1107                  ini.WriteString('Cookie', 'PON', FPON);                  ini.WriteString('Cookie', 'PON', FPON);
1108                    ini.WriteString('Cookie', 'Cookie', FCookie);
1109                    ini.WriteDateTime('Cookie', 'Expires', FExpires);
1110                  ini.WriteString('Kotehan', 'Name', FKotehanName);                  ini.WriteString('Kotehan', 'Name', FKotehanName);
1111                  ini.WriteString('Kotehan', 'Mail', FKotehanMail);                  ini.WriteString('Kotehan', 'Mail', FKotehanMail);
1112    
# Line 1212  end; Line 1245  end;
1245    
1246  // スレ立て送信URL  // スレ立て送信URL
1247  function TBoard.GetSendURL: string;  function TBoard.GetSendURL: string;
1248  var  //var
1249          Protocol, Host, Path, Document, Port, Bookmark : string;  //      Protocol, Host, Path, Document, Port, Bookmark : string;
1250  begin  begin
1251      Result := GikoSys.UrlToServer(URL);      Result := GikoSys.UrlToServer(URL);
1252      GikoSys.ParseURI( URL, Protocol,Host, Path, Document, Port, Bookmark );          //GikoSys.ParseURI( URL, Protocol,Host, Path, Document, Port, Bookmark );
1253      if GikoSys.Is2chHost(Host) then          //if GikoSys.Is2chHost(Host) then
1254            if Self.Is2ch then
1255          Result := Result + 'test/bbs.cgi'          Result := Result + 'test/bbs.cgi'
1256      else      else
1257          Result := Result + 'test/subbbs.cgi';          Result := Result + 'test/subbbs.cgi';
# Line 1243  begin Line 1277  begin
1277          if FUpdate then          if FUpdate then
1278                  FModified := True;                  FModified := True;
1279  end;  end;
1280    {
1281    procedure TBoard.SetRoundName(s: PChar);
1282    begin
1283            if FRoundName = s then Exit;
1284            FRoundName := s;
1285            if FUpdate then
1286                    FModified := True;
1287    end;
1288    }
1289  procedure TBoard.SetLastModified(d: TDateTime);  procedure TBoard.SetLastModified(d: TDateTime);
1290  begin  begin
1291          if FLastModified = d then Exit;          if FLastModified = d then Exit;
# Line 1422  begin Line 1464  begin
1464          end;          end;
1465          Result := nil;          Result := nil;
1466  end;  end;
1467    function TBoard.GetLogThread(Index: Integer; Base: Integer): TThreadItem;
1468    var
1469            i: Integer;
1470            Cnt: Integer;
1471    begin
1472            Cnt := 0;
1473            if Length( ParentCategory.ParenTBBS.ShortSelectText ) = 0 then
1474            begin
1475                    for i := Base to Count - 1 do begin
1476                            if Items[i].IsLogFile then
1477                                                                            begin
1478                                    if Index = Cnt then begin
1479                                            Result := Items[i];
1480                                            Exit;
1481                                    end;
1482                                    inc(Cnt);
1483                            end;
1484                    end;
1485            end else begin
1486                    for i := Base to Count - 1 do begin
1487                            if Items[i].IsLogFile then
1488                                    begin
1489                                            if Items[i].ShortTitle = '' then
1490                                                    Items[i].ShortTitle := ZenToHan(Items[i].Title);
1491                                            if AnsiPos(ParentCategory.ParenTBBS.ShortSelectText, Items[i].ShortTitle) <> 0 then begin
1492                                                    if Index = Cnt then begin
1493                                                            Result := Items[i];
1494                                                            Exit;
1495                                            end;
1496                                            inc(Cnt);
1497                                    end;
1498                            end;
1499                    end;
1500            end;
1501            Result := nil;
1502    end;
1503  function TBoard.GetUserThread(Index: Integer): TThreadItem;  function TBoard.GetUserThread(Index: Integer): TThreadItem;
1504  var  var
1505          i: Integer;          i: Integer;
# Line 1496  begin Line 1573  begin
1573    
1574          FUpdate := True;          FUpdate := True;
1575          FURL := '';          FURL := '';
1576          FBoardPlugIn := nil;          //FBoardPlugIn := nil;
1577  end;  end;
1578    
1579  // *************************************************************************  // *************************************************************************
1580  // 外部板プラグインを指定したコンストラクタ  // 外部板プラグインを指定したコンストラクタ
1581  // *************************************************************************  // *************************************************************************
1582  constructor TThreadItem.Create(  constructor TThreadItem.Create(
1583          inPlugIn        : TBoardPlugIn;          const inPlugIn : TBoardPlugIn;
1584          inURL                   : string          const inBoard : TBoard;
1585            inURL : string
1586  );  );
1587  var  var
1588          foundPos                        : Integer;          foundPos                        : Integer;
# Line 1516  begin Line 1594  begin
1594    
1595          inherited Create;          inherited Create;
1596          Init;          Init;
1597            FParentBoard    := inBoard;
1598          FBoardPlugIn    := inPlugIn;          //FBoardPlugIn  := inPlugIn;
1599          URL                                             := inURL;          URL                             := inURL;
1600    
1601          if inPlugIn = nil then begin          if inPlugIn = nil then begin
1602                  foundPos := Pos( READ_PATH, inURL );                  foundPos := Pos( READ_PATH, inURL );
# Line 1526  begin Line 1604  begin
1604                          // dat の保存パスを設定                          // dat の保存パスを設定
1605                          GikoSys.ParseURI( inURL, protocol, host, path, document, port, bookmark );                          GikoSys.ParseURI( inURL, protocol, host, path, document, port, bookmark );
1606                          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';  
1607                          FileName        := BBSKey + '.dat';                          FileName        := BBSKey + '.dat';
1608                          IsLogFile       := FileExists( FilePath );                          IsLogFile       := FileExists( FilePath );
1609                          URL                             := GikoSys.Get2chBrowsableThreadURL( inURL );                          URL                             := GikoSys.Get2chBrowsableThreadURL( inURL );
# Line 1544  begin Line 1614  begin
1614          end;          end;
1615    
1616  end;  end;
   
1617  // *************************************************************************  // *************************************************************************
1618  // プラグインを利用しないコンストラクタ  // 外部板プラグインを指定したコンストラクタ Log有りかどうか判断済み
1619    // FileNameも取得済み → ReadSubject用
1620  // *************************************************************************  // *************************************************************************
1621  constructor TThreadItem.Create(  constructor TThreadItem.Create(
1622          is2ch : Boolean;          const inPlugIn : TBoardPlugIn;
1623      const inURL, inHost, inBBSID, inBBSKey : string          const inBoard : TBoard;
1624            inURL : string;
1625            inExist: Boolean;
1626            const inFilename: string
1627  );  );
 var  
         foundPos                        : Integer;  
 const  
         READ_PATH                                                       = '/test/read.cgi';  
1628  begin  begin
1629    
1630          inherited Create;          inherited Create;
1631          Init;          Init;
1632            FParentBoard    := inBoard;
1633            URL                             := inURL;
1634    
1635          FBoardPlugIn    := nil;          if inPlugIn = nil then begin
1636                    // dat の保存パスを設定
1637      foundPos := Pos( READ_PATH, inURL );                  FileName        := inFilename;
1638      if foundPos > 0 then begin                  IsLogFile       := inExist;
1639          // dat の保存パスを設定                  URL                             := GikoSys.Get2chBrowsableThreadURL( inURL );
1640          if is2ch then          end else begin
1641              FilePath :=                  // プラグインに TThreadItem が作成されたことを伝える
1642                    inPlugIn.CreateThreadItem( DWORD( Self ) );
1643                  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;  
1644    
1645  end;  end;
1646  // *************************************************************************  // *************************************************************************
# Line 1589  destructor TThreadItem.Destroy; Line 1650  destructor TThreadItem.Destroy;
1650  begin  begin
1651    
1652          // プラグインに TThreadItem が破棄されたことを伝える          // プラグインに TThreadItem が破棄されたことを伝える
1653          if IsBoardPlugInAvailable then          if Self.ParentBoard.IsBoardPlugInAvailable then
1654                  FBoardPlugIn.DisposeThreadItem( DWORD( Self ) );                  Self.ParentBoard.BoardPlugIn.DisposeThreadItem( DWORD( Self ) );
1655    
1656          inherited;          inherited;
1657    
# Line 1599  end; Line 1660  end;
1660  // *************************************************************************  // *************************************************************************
1661  // 外部板プラグインが使用可能か  // 外部板プラグインが使用可能か
1662  // *************************************************************************  // *************************************************************************
1663    {
1664  function        TThreadItem.IsBoardPlugInAvailable : Boolean;  function        TThreadItem.IsBoardPlugInAvailable : Boolean;
1665  begin  begin
1666    
# Line 1616  begin Line 1678  begin
1678          Result := False;          Result := False;
1679    
1680  end;  end;
1681    }
1682  function TThreadItem.GetDatURL: string;  function TThreadItem.GetDatURL: string;
1683  var  var
1684          Protocol, Host, Path, Document, Port, Bookmark: string;          Protocol, Host, Path, Document, Port, Bookmark: string;
# Line 1802  begin Line 1864  begin
1864          if FUpdate and (ParentBoard <> nil) then          if FUpdate and (ParentBoard <> nil) then
1865                  ParentBoard.FModified := True;                  ParentBoard.FModified := True;
1866  end;  end;
1867    {
1868    procedure TThreadItem.SetRoundName(const s: PChar);
1869    begin
1870            if FRoundName = s then Exit;
1871            FRoundName := s;
1872            if FUpdate and (ParentBoard <> nil) then
1873                    ParentBoard.FModified := True;
1874    end;
1875    }
1876  procedure TThreadItem.SetKokomade(i: Integer);  procedure TThreadItem.SetKokomade(i: Integer);
1877  begin  begin
1878          if FKokomade = i then Exit;          if FKokomade = i then Exit;
# Line 1877  begin Line 1947  begin
1947                          Result := ZERO_DATE;                          Result := ZERO_DATE;
1948          end;          end;
1949  end;  end;
1950    function TThreadItem.GetFilePath: String;
1951    var
1952            path : String;
1953    begin
1954            path := ExtractFilePath(Self.ParentBoard.FilePath) + Self.FileName;
1955        Result := path;
1956    end;
1957    
1958    procedure       TBoardGroup.Clear;
1959    var
1960            i       : Integer;
1961    begin
1962            for i := Self.Count - 1 downto 0 do begin
1963            TBoard(Self.Objects[i]).Free;
1964        end;
1965        inherited Clear;
1966        Self.Capacity := 0;
1967    end;
1968    
1969    
1970  end.  end.
1971    

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

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