@@ -14,6 +14,9 @@ interface
1414;
1515
1616type
17+ { TBundleType }
18+ TBundleType = (btReplay, btSearch);
19+
1720{ TReplayThread }
1821 TReplayThread = class (TThread)
1922 private
@@ -26,7 +29,7 @@ TReplayThread = class(TThread)
2629 constructor Create(AIRC: TIdIRC);
2730 destructor Destroy; override;
2831
29- procedure Add (const ANick: String; const AList: TStringList);
32+ procedure Add (const AType: TBundleType; const ANick: String; const AList: TStringList);
3033 published
3134 end ;
3235
@@ -39,13 +42,16 @@ implementation
3942{ TReplayBundle }
4043 TReplayBundle = class (TObject)
4144 private
45+ FBundleType: TBundleType;
4246 FNick: String;
4347 FLines: TStringList;
4448 protected
4549 public
46- constructor Create(const ANick: String; const ALines: TStringList);
50+ constructor Create(const AType: TBundleType; const ANick: String; const ALines: TStringList);
4751 destructor Destroy; override;
4852
53+ property BundleType: TBundleType
54+ read FBundleType;
4955 property Nick: String
5056 read FNick;
5157 property Lines: TStringList
@@ -55,9 +61,10 @@ TReplayBundle = class(TObject)
5561
5662{ TReplayBundle }
5763
58- constructor TReplayBundle.Create(const ANick: String;
64+ constructor TReplayBundle.Create(const AType: TBundleType; const ANick: String;
5965 const ALines: TStringList);
6066begin
67+ FBundleType:= AType;
6168 FNick:= ANick;
6269 FLines:= TStringList.Create;
6370 FLines.Text:= ALines.Text;
@@ -85,6 +92,7 @@ procedure TReplayThread.Execute;
8592 if FQueue.Count > 0 then
8693 begin
8794 bundle:= TReplayBundle.Create(
95+ (FQueue[0 ] as TReplayBundle).BundleType,
8896 (FQueue[0 ] as TReplayBundle).Nick,
8997 (FQueue[0 ] as TReplayBundle).Lines
9098 );
@@ -96,10 +104,18 @@ procedure TReplayThread.Execute;
96104 if Assigned(bundle) then
97105 begin
98106 FIRC.Say(bundle.Nick, ' !! --> To avoid triggering flooding, for each 5 lines, I will pause for 5 seconds <-- !!' );
99- FIRC.Say(bundle.Nick, Format(' *** Here are the last %d lines ***' , [bundle.Lines.Count]));
107+ case bundle.BundleType of
108+ btReplay:begin
109+ FIRC.Say(bundle.Nick, Format(' *** Here are the last %d lines ***' , [bundle.Lines.Count]));
110+ end ;
111+ btSearch:begin
112+ FIRC.Say(bundle.Nick, Format(' *** Here are the last %d lines of your search ***' , [bundle.Lines.Count]));
113+ end ;
114+ end ;
100115 index:= 1 ;
101116 for line in bundle.Lines do
102117 begin
118+ If Terminated then exit;
103119 debug(' Sending #%d: "%s".' , [index, line]);
104120 Inc(index);
105121 FIRC.Say(bundle.Nick, line);
@@ -109,7 +125,14 @@ procedure TReplayThread.Execute;
109125 Sleep(5000 );
110126 end ;
111127 end ;
112- FIRC.Say(bundle.Nick, Format(' *** End of the last %d lines ***' , [bundle.Lines.Count]));
128+ case bundle.BundleType of
129+ btReplay:begin
130+ FIRC.Say(bundle.Nick, Format(' *** End of the last %d lines ***' , [bundle.Lines.Count]));
131+ end ;
132+ btSearch:begin
133+ FIRC.Say(bundle.Nick, Format(' *** End of the last %d lines of your search ***' , [bundle.Lines.Count]));
134+ end ;
135+ end ;
113136 bundle.Free;
114137 end
115138 else
@@ -120,13 +143,14 @@ procedure TReplayThread.Execute;
120143 end ;
121144end ;
122145
123- procedure TReplayThread.Add (const ANick: String; const AList: TStringList);
146+ procedure TReplayThread.Add (const AType: TBundleType; const ANick: String;
147+ const AList: TStringList);
124148var
125149 bundle: TReplayBundle;
126150begin
127151 FCriticalSection.Acquire;
128152 try
129- bundle:= TReplayBundle.Create(ANick, AList);
153+ bundle:= TReplayBundle.Create(AType, ANick, AList);
130154 debug(Format(' Adding %d lines for "%s".' , [
131155 AList.Count,
132156 ANick
0 commit comments