Клиентский код
1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. 26. 27. 28. 29. 30. 31. 32. 33. 34. 35. 36. 37. 38. 39. 40. 41. 42. 43. 44. 45. 46. 47. 48. 49. 50. 51. 52. 53. 54. 55. 56. 57. 58. 59. 60. 61. 62. 63. 64. 65. 66. 67. 68. 69. 70. 71. 72. 73. 74. 75. 76. 77. 78. 79. 80. 81. 82. 83. 84. 85. 86. 87. 88. 89. 90. 91. 92. 93. 94. 95. 96. 97. 98. 99. 100. 101. 102. 103. 104. 105. 106. 107. 108. 109. 110. 111. 112. 113. 114. 115. 116. 117. 118. 119. 120. 121. 122. 123. 124. 125. 126. 127. 128. 129. 130. 131. 132. 133. 134. 135. 136. 137. 138. 139. 140. 141. 142. 143. 144. 145. 146. 147. 148. 149. 150. 151. 152. 153. 154. 155. 156. 157. 158. 159. 160. 161. 162. 163. 164. 165. 166. 167. 168. 169. 170. 171. 172. 173. 174. 175. 176. 177. 178. 179. 180. 181. 182. 183. 184. 185. 186. 187. 188. 189. 190. 191. 192. 193. 194. 195. 196. 197. 198. 199. 200. 201. 202. 203. 204. 205. 206. 207. 208. 209. 210. 211. 212. 213. 214. 215. 216. 217. 218. 219. 220. 221. 222. 223. 224. 225. 226. 227. 228. 229. 230. 231. 232. 233. 234. 235. 236. 237. 238. 239. 240. 241. 242. 243. 244. 245. 246. 247. 248. 249. 250. 251. 252. 253. 254. 255. 256. 257. 258. 259. 260. 261. 262. 263. 264. 265. 266. 267. 268. 269. 270. 271. 272. 273. 274. 275. 276. 277. 278. 279. 280. 281. 282. 283. 284. 285. 286. 287. 288. 289. 290. 291. 292. 293. 294. 295. 296. 297. 298. 299. 300. 301. 302. 303. 304. 305. 306. 307. 308. 309. 310. 311. 312. 313. 314. 315. 316. 317. 318. 319. 320. 321. 322. 323. 324. 325. 326. 327. 328. 329. 330. 331. 332. 333. 334. 335. 336. 337. 338. 339. 340. 341. 342. 343. 344. 345. 346. 347. 348. 349. 350. 351. 352. 353. 354. 355. 356. 357. 358. 359. 360. 361. 362. 363. 364. 365. 366. 367. 368. 369. 370. 371. 372. 373. 374. 375. 376. 377. 378. 379. 380. 381. 382. 383. 384. 385. 386. 387. 388. 389. 390. 391. 392. 393. 394. 395. 396. 397. 398. 399. 400. 401. 402. 403. 404. 405. 406. 407. 408. 409. 410. 411. 412. 413. 414. 415. 416. 417. 418. 419. 420. 421. 422. 423. 424. 425. 426. 427. 428. 429. 430. 431. 432. 433. 434. 435. 436. 437. 438. 439. 440. 441. 442. 443. 444. 445. 446. 447. 448. 449. 450. 451. 452. 453. 454. 455. 456. 457. 458. 459. 460. 461. 462. 463. 464. 465. 466. 467. 468. 469. 470. 471. 472. 473. 474. 475. 476. 477. 478. 479. 480. 481. 482. 483. 484. 485. 486. 487. 488. 489. 490. 491. 492. 493. 494. 495. 496. 497. 498. 499. 500. 501. 502. 503. 504. 505. 506. 507. 508. 509. 510. 511. 512. 513. 514. 515. 516. 517. 518. 519. 520. 521. 522. 523. 524. 525. 526. 527. 528. 529. 530. 531. 532. 533. 534. 535. 536. 537. 538. 539. 540. 541. 542. 543. 544. 545. 546. 547.
unit Unit3;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, IdBaseComponent,
IdComponent, IdTCPConnection, IdTCPClient, IdCmdTCPClient, IdIRC, Vcl.ExtCtrls,
IdContext;
type
TForm3 = class(TForm)
Client: TIdIRC;
Panel1: TPanel;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Button1: TButton;
Button2: TButton;
Memo1: TMemo;
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure ClientAdminInfoReceived(ASender: TIdContext;
AAdminInfo: TStrings);
procedure ClientAfterBind(Sender: TObject);
procedure ClientAfterCommandHandler(ASender: TIdCmdTCPClient;
AContext: TIdContext);
procedure ClientAway(ASender: TIdContext; const ANickname, AHost,
AAwayMessage: string; UserAway: Boolean);
procedure ClientBanListReceived(ASender: TIdContext; const AChannel: string;
ABanList: TStrings);
procedure ClientBeforeBind(Sender: TObject);
procedure ClientBeforeCommandHandler(ASender: TIdCmdTCPClient;
var AData: string; AContext: TIdContext);
procedure ClientBounce(ASender: TIdContext; const AHost: string;
APort: Integer; const AInfo: string);
procedure ClientChannelMode(ASender: TIdContext; const ANickname, AHost,
AChannel, AMode, AParams: string);
procedure ClientConnected(Sender: TObject);
procedure ClientCTCPQuery(ASender: TIdContext; const ANickname, AHost,
ATarget, ACommand, AParams: string);
procedure ClientCTCPReply(ASender: TIdContext; const ANickname, AHost,
ATarget, ACommand, AParams: string);
procedure ClientDCCAccept(ASender: TIdContext; const ANickname, AHost,
AFilename: string; APort: Word; AFilePos: Int64);
procedure ClientDCCChat(ASender: TIdContext; const ANickname, AHost: string;
APort: Integer);
procedure ClientDCCResume(ASender: TIdContext; const ANickname, AHost,
AFilename: string; APort: Word; AFilePos: Int64);
procedure ClientDCCSend(ASender: TIdContext; const ANickname, AHost,
AFilename: string; APort: Word; AFileSize: Int64);
procedure ClientDisconnected(Sender: TObject);
procedure ClientExceptionListReceived(ASender: TIdContext;
const AChannel: string; AExceptList: TStrings);
procedure ClientInvitationListReceived(ASender: TIdContext;
const AChannel: string; AInviteList: TStrings);
procedure ClientInvite(ASender: TIdContext; const ANickname, AHost, ATarget,
AChannel: string);
procedure ClientInviting(ASender: TIdContext; const ANickname,
AHost: string);
procedure ClientIsOnIRC(ASender: TIdContext; const ANickname,
AHost: string);
procedure ClientISupport(ASender: TIdContext; AParameters: TStrings);
procedure ClientJoin(ASender: TIdContext; const ANickname, AHost,
AChannel: string);
procedure ClientKick(ASender: TIdContext; const ANickname, AHost, AChannel,
ATarget, AReason: string);
procedure ClientKill(ASender: TIdContext; const ANickname, AHost,
ATargetNickname, AReason: string);
procedure ClientKillError(ASender: TIdContext);
procedure ClientKnownServersListReceived(ASender: TIdContext;
AKnownServers: TStrings);
procedure ClientMOTD(ASender: TIdContext; AMOTD: TStrings);
procedure ClientMyInfo(ASender: TIdContext; const AServer, AVersion,
AUserModes, AChanModes, AExtra: string);
procedure ClientNicknameChange(ASender: TIdContext; const AOldNickname,
AHost, ANewNickname: string);
procedure ClientNicknameError(ASender: TIdContext; AError: Integer);
procedure ClientNicknamesListReceived(ASender: TIdContext;
const AChannel: string; ANicknameList: TStrings);
procedure ClientNotice(ASender: TIdContext; const ANickname, AHost, ATarget,
ANotice: string);
procedure ClientOp(ASender: TIdContext; const ANickname, AChannel,
AHost: string);
procedure ClientPart(ASender: TIdContext; const ANickname, AHost, AChannel,
APartMessage: string);
procedure ClientPingPong(ASender: TIdContext);
procedure ClientPrivateMessage(ASender: TIdContext; const ANickname, AHost,
ATarget, AMessage: string);
procedure ClientQuit(ASender: TIdContext; const ANickname, AHost,
AReason: string);
procedure ClientRaw(ASender: TIdContext; AIn: Boolean;
const AMessage: string);
procedure ClientRehash(ASender: TIdContext; const ANickname, AHost: string);
procedure ClientServerCreated(ASender: TIdContext; const AMsg: string);
procedure ClientServerError(ASender: TIdContext; AErrorCode: Integer;
const AErrorMessage: string);
procedure ClientServerListReceived(ASender: TIdContext;
AServerList: TStrings);
procedure ClientServerQuit(ASender: TIdContext; const ANickname, AHost,
AServer, AReason: string);
procedure ClientServerStatsReceived(ASender: TIdContext; AStatus: TStrings);
procedure ClientServerTime(ASender: TIdContext; const AHost, ATime: string);
procedure ClientServerUsersListReceived(ASender: TIdContext;
AUsers: TStrings);
procedure ClientServerVersion(ASender: TIdContext; const AVersion, AHost,
AComments: string);
procedure ClientServerWelcome(ASender: TIdContext; const AMsg: string);
procedure ClientService(ASender: TIdContext);
procedure ClientSocketAllocated(Sender: TObject);
procedure ClientStatus(ASender: TObject; const AStatus: TIdStatus;
const AStatusText: string);
procedure ClientSummon(ASender: TIdContext; const ANickname, AHost: string);
procedure ClientTopic(ASender: TIdContext; const ANickname, AHost, AChannel,
ATopic: string);
procedure ClientTrace(ASender: TIdContext; ATraceInfo: TStrings);
procedure ClientUserInfoReceived(ASender: TIdContext;
const AUserInfo: string);
procedure ClientUserMode(ASender: TIdContext; const ANickname, AHost,
AMode: string);
procedure ClientWallops(ASender: TIdContext; const ANickname, AHost,
AMessage: string);
procedure ClientWho(ASender: TIdContext; AWhoResults: TStrings);
procedure ClientWhoIs(ASender: TIdContext; AWhoIsResults: TStrings);
procedure ClientWhoWas(ASender: TIdContext; AWhoWasResults: TStrings);
procedure ClientWork(ASender: TObject; AWorkMode: TWorkMode;
AWorkCount: Int64);
procedure ClientWorkBegin(ASender: TObject; AWorkMode: TWorkMode;
AWorkCountMax: Int64);
procedure ClientWorkEnd(ASender: TObject; AWorkMode: TWorkMode);
procedure ClientYourHost(ASender: TIdContext; const AMsg: string);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form3: TForm3;
implementation
{$R *.dfm}
procedure TForm3.Button1Click(Sender: TObject);
begin
Client.Host:=edit1.Text;
Client.Port:=Integer(edit2.Text);
Client.Nickname:=edit3.Text;
Client.Connect;
end;
procedure TForm3.Button2Click(Sender: TObject);
begin
Client.Disconnect('see you later!)');
end;
procedure TForm3.ClientAdminInfoReceived(ASender: TIdContext;
AAdminInfo: TStrings);
begin
memo1.Lines.Add('ClientAdminInfoReceived');
end;
procedure TForm3.ClientAfterBind(Sender: TObject);
begin
memo1.Lines.Add('ClientAfterBind');
end;
procedure TForm3.ClientAfterCommandHandler(ASender: TIdCmdTCPClient;
AContext: TIdContext);
begin
memo1.Lines.Add('ClientAfterCommandHandler');
end;
procedure TForm3.ClientAway(ASender: TIdContext; const ANickname, AHost,
AAwayMessage: string; UserAway: Boolean);
begin
memo1.Lines.Add('ClientAway');
end;
procedure TForm3.ClientBanListReceived(ASender: TIdContext;
const AChannel: string; ABanList: TStrings);
begin
memo1.Lines.Add('ClientBanListReceived');
end;
procedure TForm3.ClientBeforeBind(Sender: TObject);
begin
memo1.Lines.Add('ClientBeforeBind');
end;
procedure TForm3.ClientBeforeCommandHandler(ASender: TIdCmdTCPClient;
var AData: string; AContext: TIdContext);
begin
memo1.Lines.Add('ClientBeforeCommandHandler');
end;
procedure TForm3.ClientBounce(ASender: TIdContext; const AHost: string;
APort: Integer; const AInfo: string);
begin
memo1.Lines.Add('ClientBounce');
end;
procedure TForm3.ClientChannelMode(ASender: TIdContext; const ANickname, AHost,
AChannel, AMode, AParams: string);
begin
memo1.Lines.Add('ClientChannelMode');
end;
procedure TForm3.ClientConnected(Sender: TObject);
begin
memo1.Lines.Add('ClientConnected');
end;
procedure TForm3.ClientCTCPQuery(ASender: TIdContext; const ANickname, AHost,
ATarget, ACommand, AParams: string);
begin
memo1.Lines.Add('ClientCTCPQuery');
end;
procedure TForm3.ClientCTCPReply(ASender: TIdContext; const ANickname, AHost,
ATarget, ACommand, AParams: string);
begin
memo1.Lines.Add('ClientCTCPReply');
end;
procedure TForm3.ClientDCCAccept(ASender: TIdContext; const ANickname, AHost,
AFilename: string; APort: Word; AFilePos: Int64);
begin
memo1.Lines.Add('ClientDCCAccept');
end;
procedure TForm3.ClientDCCChat(ASender: TIdContext; const ANickname,
AHost: string; APort: Integer);
begin
memo1.Lines.Add('ClientDCCChat');
end;
procedure TForm3.ClientDCCResume(ASender: TIdContext; const ANickname, AHost,
AFilename: string; APort: Word; AFilePos: Int64);
begin
memo1.Lines.Add('ClientDCCResume');
end;
procedure TForm3.ClientDCCSend(ASender: TIdContext; const ANickname, AHost,
AFilename: string; APort: Word; AFileSize: Int64);
begin
memo1.Lines.Add('ClientDCCSend');
end;
procedure TForm3.ClientDisconnected(Sender: TObject);
begin
memo1.Lines.Add('ClientDisconnected');
end;
procedure TForm3.ClientExceptionListReceived(ASender: TIdContext;
const AChannel: string; AExceptList: TStrings);
begin
memo1.Lines.Add('ClientExceptionListReceived');
end;
procedure TForm3.ClientInvitationListReceived(ASender: TIdContext;
const AChannel: string; AInviteList: TStrings);
begin
memo1.Lines.Add('ClientInvitationListReceived');
end;
procedure TForm3.ClientInvite(ASender: TIdContext; const ANickname, AHost,
ATarget, AChannel: string);
begin
memo1.Lines.Add('ClientInvite');
end;
procedure TForm3.ClientInviting(ASender: TIdContext; const ANickname,
AHost: string);
begin
memo1.Lines.Add('ClientInviting');
end;
procedure TForm3.ClientIsOnIRC(ASender: TIdContext; const ANickname,
AHost: string);
begin
memo1.Lines.Add('ClientIsOnIRC');
end;
procedure TForm3.ClientISupport(ASender: TIdContext; AParameters: TStrings);
begin
memo1.Lines.Add('ClientISupport');
end;
procedure TForm3.ClientJoin(ASender: TIdContext; const ANickname, AHost,
AChannel: string);
begin
memo1.Lines.Add('ClientJoin');
end;
procedure TForm3.ClientKick(ASender: TIdContext; const ANickname, AHost,
AChannel, ATarget, AReason: string);
begin
memo1.Lines.Add('ClientKick');
end;
procedure TForm3.ClientKill(ASender: TIdContext; const ANickname, AHost,
ATargetNickname, AReason: string);
begin
memo1.Lines.Add('ClientKill');
end;
procedure TForm3.ClientKillError(ASender: TIdContext);
begin
memo1.Lines.Add('ClientKillError');
end;
procedure TForm3.ClientKnownServersListReceived(ASender: TIdContext;
AKnownServers: TStrings);
begin
memo1.Lines.Add('ClientKnownServersListReceived');
end;
procedure TForm3.ClientMOTD(ASender: TIdContext; AMOTD: TStrings);
begin
memo1.Lines.Add('ClientMOTD');
end;
procedure TForm3.ClientMyInfo(ASender: TIdContext; const AServer, AVersion,
AUserModes, AChanModes, AExtra: string);
begin
memo1.Lines.Add('ClientMyInfo');
end;
procedure TForm3.ClientNicknameChange(ASender: TIdContext; const AOldNickname,
AHost, ANewNickname: string);
begin
memo1.Lines.Add('ClientNicknameChange');
end;
procedure TForm3.ClientNicknameError(ASender: TIdContext; AError: Integer);
begin
memo1.Lines.Add('ClientNicknameError');
end;
procedure TForm3.ClientNicknamesListReceived(ASender: TIdContext;
const AChannel: string; ANicknameList: TStrings);
begin
memo1.Lines.Add('ClientNicknamesListReceived');
end;
procedure TForm3.ClientNotice(ASender: TIdContext; const ANickname, AHost,
ATarget, ANotice: string);
begin
memo1.Lines.Add('ClientNotice');
end;
procedure TForm3.ClientOp(ASender: TIdContext; const ANickname, AChannel,
AHost: string);
begin
memo1.Lines.Add('ClientOp');
end;
procedure TForm3.ClientPart(ASender: TIdContext; const ANickname, AHost,
AChannel, APartMessage: string);
begin
memo1.Lines.Add('ClientPart');
end;
procedure TForm3.ClientPingPong(ASender: TIdContext);
begin
memo1.Lines.Add('ClientPingPong');
end;
procedure TForm3.ClientPrivateMessage(ASender: TIdContext; const ANickname,
AHost, ATarget, AMessage: string);
begin
memo1.Lines.Add('ClientPrivateMessage');
end;
procedure TForm3.ClientQuit(ASender: TIdContext; const ANickname, AHost,
AReason: string);
begin
memo1.Lines.Add('ClientQuit');
end;
procedure TForm3.ClientRaw(ASender: TIdContext; AIn: Boolean;
const AMessage: string);
begin
memo1.Lines.Add('ClientRaw');
end;
procedure TForm3.ClientRehash(ASender: TIdContext; const ANickname,
AHost: string);
begin
memo1.Lines.Add('ClientRehash');
end;
procedure TForm3.ClientServerCreated(ASender: TIdContext; const AMsg: string);
begin
memo1.Lines.Add('ClientServerCreated');
end;
procedure TForm3.ClientServerError(ASender: TIdContext; AErrorCode: Integer;
const AErrorMessage: string);
begin
memo1.Lines.Add('ClientServerError');
end;
procedure TForm3.ClientServerListReceived(ASender: TIdContext;
AServerList: TStrings);
begin
memo1.Lines.Add('ClientServerListReceived');
end;
procedure TForm3.ClientServerQuit(ASender: TIdContext; const ANickname, AHost,
AServer, AReason: string);
begin
memo1.Lines.Add('ClientServerQuit');
end;
procedure TForm3.ClientServerStatsReceived(ASender: TIdContext;
AStatus: TStrings);
begin
memo1.Lines.Add('ClientServerStatsReceived');
end;
procedure TForm3.ClientServerTime(ASender: TIdContext; const AHost,
ATime: string);
begin
memo1.Lines.Add('ClientServerTime');
end;
procedure TForm3.ClientServerUsersListReceived(ASender: TIdContext;
AUsers: TStrings);
begin
memo1.Lines.Add('ClientServerUsersListReceived');
end;
procedure TForm3.ClientServerVersion(ASender: TIdContext; const AVersion, AHost,
AComments: string);
begin
memo1.Lines.Add('ClientServerVersion');
end;
procedure TForm3.ClientServerWelcome(ASender: TIdContext; const AMsg: string);
begin
memo1.Lines.Add('ClientServerWelcome');
end;
procedure TForm3.ClientService(ASender: TIdContext);
begin
memo1.Lines.Add('ClientService');
end;
procedure TForm3.ClientSocketAllocated(Sender: TObject);
begin
memo1.Lines.Add('ClientSocketAllocated');
end;
procedure TForm3.ClientStatus(ASender: TObject; const AStatus: TIdStatus;
const AStatusText: string);
begin
memo1.Lines.Add('ClientStatus');
end;
procedure TForm3.ClientSummon(ASender: TIdContext; const ANickname,
AHost: string);
begin
memo1.Lines.Add('ClientSummon');
end;
procedure TForm3.ClientTopic(ASender: TIdContext; const ANickname, AHost,
AChannel, ATopic: string);
begin
memo1.Lines.Add('ClientTopic');
end;
procedure TForm3.ClientTrace(ASender: TIdContext; ATraceInfo: TStrings);
begin
memo1.Lines.Add('ClientTrace');
end;
procedure TForm3.ClientUserInfoReceived(ASender: TIdContext;
const AUserInfo: string);
begin
memo1.Lines.Add('ClientUserInfoReceived');
end;
procedure TForm3.ClientUserMode(ASender: TIdContext; const ANickname, AHost,
AMode: string);
begin
memo1.Lines.Add('ClientUserMode');
end;
procedure TForm3.ClientWallops(ASender: TIdContext; const ANickname, AHost,
AMessage: string);
begin
memo1.Lines.Add('ClientWallops');
end;
procedure TForm3.ClientWho(ASender: TIdContext; AWhoResults: TStrings);
begin
memo1.Lines.Add('ClientWho');
end;
procedure TForm3.ClientWhoIs(ASender: TIdContext; AWhoIsResults: TStrings);
begin
memo1.Lines.Add('ClientWhoIs');
end;
procedure TForm3.ClientWhoWas(ASender: TIdContext; AWhoWasResults: TStrings);
begin
memo1.Lines.Add('ClientWhoWas');
end;
procedure TForm3.ClientWork(ASender: TObject; AWorkMode: TWorkMode;
AWorkCount: Int64);
begin
memo1.Lines.Add('ClientWork');
end;
procedure TForm3.ClientWorkBegin(ASender: TObject; AWorkMode: TWorkMode;
AWorkCountMax: Int64);
begin
memo1.Lines.Add('ClientWorkBegin');
end;
procedure TForm3.ClientWorkEnd(ASender: TObject; AWorkMode: TWorkMode);
begin
memo1.Lines.Add('ClientWorkEnd');
end;
procedure TForm3.ClientYourHost(ASender: TIdContext; const AMsg: string);
begin
memo1.Lines.Add('ClientYourHost');
end;
procedure TForm3.FormCreate(Sender: TObject);
begin
edit1.Text:='localhost';
edit2.Text:='6667';
edit3.Text:='k.besedin';
end;
end.
Серверный код
1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. 26. 27. 28. 29. 30. 31. 32. 33. 34. 35. 36. 37. 38. 39. 40. 41. 42. 43. 44. 45. 46. 47. 48. 49. 50. 51. 52. 53. 54. 55. 56. 57. 58. 59. 60. 61. 62. 63. 64. 65. 66. 67. 68. 69. 70. 71. 72. 73. 74. 75. 76. 77. 78. 79. 80. 81. 82. 83. 84. 85. 86. 87. 88. 89. 90. 91. 92. 93. 94. 95. 96. 97. 98. 99. 100. 101. 102. 103. 104. 105. 106. 107. 108. 109. 110. 111. 112. 113. 114. 115. 116. 117. 118. 119. 120. 121. 122. 123. 124. 125. 126. 127. 128. 129. 130. 131. 132. 133. 134. 135. 136. 137. 138. 139. 140. 141. 142. 143. 144. 145. 146. 147. 148. 149. 150. 151. 152. 153. 154. 155. 156. 157. 158. 159. 160. 161. 162. 163. 164. 165. 166. 167. 168. 169. 170. 171. 172. 173. 174. 175. 176. 177. 178. 179. 180. 181. 182. 183. 184. 185. 186. 187. 188. 189. 190. 191. 192. 193. 194. 195. 196. 197. 198. 199. 200. 201. 202. 203. 204. 205. 206. 207. 208. 209. 210. 211. 212. 213. 214. 215. 216. 217. 218. 219. 220. 221. 222. 223. 224. 225. 226. 227. 228. 229. 230. 231. 232. 233. 234. 235. 236. 237. 238. 239. 240. 241. 242. 243. 244. 245. 246. 247. 248. 249. 250. 251. 252. 253. 254. 255. 256. 257. 258. 259. 260. 261. 262. 263. 264. 265. 266. 267. 268. 269. 270. 271. 272. 273. 274. 275. 276. 277. 278. 279. 280. 281. 282. 283. 284. 285. 286. 287. 288. 289. 290. 291. 292. 293. 294. 295. 296. 297. 298. 299. 300. 301. 302. 303. 304. 305. 306. 307. 308. 309. 310. 311. 312. 313. 314. 315. 316. 317. 318. 319. 320. 321. 322. 323. 324. 325. 326. 327. 328. 329. 330. 331. 332. 333. 334. 335. 336. 337. 338. 339. 340. 341. 342. 343. 344. 345. 346. 347. 348. 349. 350. 351. 352. 353. 354. 355. 356. 357. 358. 359. 360. 361. 362. 363. 364. 365. 366. 367. 368. 369. 370. 371. 372. 373. 374. 375. 376. 377. 378. 379. 380. 381. 382. 383.
unit Unit3;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, IdCommandHandlers, Vcl.StdCtrls,
IdBaseComponent, IdComponent, IdCustomTCPServer, IdTCPServer, IdCmdTCPServer,
IdIrcServer, IdContext, IdSocketHandle, IdThread, Vcl.ExtCtrls;
type
TForm3 = class(TForm)
Server: TIdIRCServer;
Memo1: TMemo;
Panel1: TPanel;
Button1: TButton;
Button2: TButton;
Edit1: TEdit;
Label1: TLabel;
procedure ServerCommandJoin(AContext: TIdCommand; AParm1,
AParm2: string);
procedure ServerAfterBind(Sender: TObject);
procedure ServerAfterCommandHandler(ASender: TIdCmdTCPServer;
AContext: TIdContext);
procedure ServerBeforeBind(AHandle: TIdSocketHandle);
procedure ServerBeforeCommandHandler(ASender: TIdCmdTCPServer;
var AData: string; AContext: TIdContext);
procedure ServerBeforeListenerRun(AThread: TIdThread);
procedure ServerCommandAdmin(AContext: TIdCommand; AParm: string);
procedure ServerCommandAway(AContext: TIdCommand; AParm: string);
procedure ServerCommandConnect(AContext: TIdCommand; AParm1, AParm2,
AParm3: string);
procedure ServerCommandError(AContext: TIdCommand; AParm: string);
procedure ServerCommandInfo(AContext: TIdCommand; AParm: string);
procedure ServerCommandInvite(AContext: TIdCommand; AParm1, AParm2: string);
procedure ServerCommandIsOn(AContext: TIdCommand; AParm: string);
procedure ServerCommandKick(AContext: TIdCommand; AParm1, AParm2,
AParm3: string);
procedure ServerCommandKill(AContext: TIdCommand; AParm1, AParm2: string);
procedure ServerCommandLinks(AContext: TIdCommand; AParm1, AParm2: string);
procedure ServerCommandList(AContext: TIdCommand; AParm1, AParm2: string);
procedure ServerCommandMode(AContext: TIdCommand; AParm1, AParm2, AParm3,
AParm4, AParm5: string);
procedure ServerCommandNames(AContext: TIdCommand; AParm: string);
procedure ServerCommandNotice(AContext: TIdCommand; AParm1, AParm2: string);
procedure ServerCommandOper(AContext: TIdCommand; AParm1, AParm2: string);
procedure ServerCommandOther(AContext: TIdCommand; Command, AParm: string);
procedure ServerCommandPart(AContext: TIdCommand; AParm: string);
procedure ServerCommandPass(AContext: TIdCommand; AParm: string);
procedure ServerCommandPing(AContext: TIdCommand; AParm1, AParm2: string);
procedure ServerCommandPong(AContext: TIdCommand; AParm1, AParm2: string);
procedure ServerCommandPrivMsg(AContext: TIdCommand; AParm1,
AParm2: string);
procedure ServerCommandQuit(AContext: TIdCommand; AParm: string);
procedure ServerCommandRehash(AContext: TIdCommand);
procedure ServerCommandRestart(AContext: TIdCommand);
procedure ServerCommandServer(AContext: TIdCommand; ServerName, Hopcount,
Info: string);
procedure ServerCommandSQuit(AContext: TIdCommand; AParm1, AParm2: string);
procedure ServerCommandStats(AContext: TIdCommand; AParm1, AParm2: string);
procedure ServerCommandSummon(AContext: TIdCommand; AParm1, AParm2: string);
procedure ServerCommandTime(AContext: TIdCommand; AParm: string);
procedure ServerCommandTopic(AContext: TIdCommand; AParm1, AParm2: string);
procedure ServerCommandTrace(AContext: TIdCommand; AParm: string);
procedure ServerCommandUsers(AContext: TIdCommand; AParm: string);
procedure ServerCommandVersion(AContext: TIdCommand; AParm: string);
procedure ServerCommandWallops(AContext: TIdCommand; AParm: string);
procedure ServerCommandWho(AContext: TIdCommand; AParm1, AParm2: string);
procedure ServerCommandWhoIs(AContext: TIdCommand; AParm1, AParm2: string);
procedure ServerCommandWhoWas(AContext: TIdCommand; AParm1, AParm2,
AParm3: string);
procedure ServerConnect(AContext: TIdContext);
procedure ServerContextCreated(AContext: TIdContext);
procedure ServerDisconnect(AContext: TIdContext);
procedure ServerException(AContext: TIdContext; AException: Exception);
procedure ServerExecute(AContext: TIdContext);
procedure ServerListenException(AThread: TIdListenerThread;
AException: Exception);
procedure ServerStatus(ASender: TObject; const AStatus: TIdStatus;
const AStatusText: string);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form3: TForm3;
implementation
{$R *.dfm}
procedure TForm3.Button1Click(Sender: TObject);
begin
Server.DefaultPort:=integer(edit1.Text);
Server.Active:=true;
end;
procedure TForm3.Button2Click(Sender: TObject);
begin
Server.Active:=false;
end;
procedure TForm3.ServerAfterBind(Sender: TObject);
begin
memo1.Lines.Add('ServerAfterBind');
end;
procedure TForm3.ServerAfterCommandHandler(ASender: TIdCmdTCPServer;
AContext: TIdContext);
begin
memo1.Lines.Add('ServerAfterCommandHandler');
end;
procedure TForm3.ServerBeforeBind(AHandle: TIdSocketHandle);
begin
memo1.Lines.Add('ServerBeforeBind');
end;
procedure TForm3.ServerBeforeCommandHandler(ASender: TIdCmdTCPServer;
var AData: string; AContext: TIdContext);
begin
memo1.Lines.Add('ServerBeforeCommandHandler');
end;
procedure TForm3.ServerBeforeListenerRun(AThread: TIdThread);
begin
memo1.Lines.Add('ServerBeforeListenerRun');
end;
procedure TForm3.ServerCommandAdmin(AContext: TIdCommand; AParm: string);
begin
memo1.Lines.Add('ServerCommandAdmin');
end;
procedure TForm3.ServerCommandAway(AContext: TIdCommand; AParm: string);
begin
memo1.Lines.Add('ServerCommandAway');
end;
procedure TForm3.ServerCommandConnect(AContext: TIdCommand; AParm1, AParm2,
AParm3: string);
begin
memo1.Lines.Add('ServerCommandConnect');
end;
procedure TForm3.ServerCommandError(AContext: TIdCommand; AParm: string);
begin
memo1.Lines.Add('ServerCommandError');
end;
procedure TForm3.ServerCommandInfo(AContext: TIdCommand; AParm: string);
begin
memo1.Lines.Add('ServerCommandInfo');
end;
procedure TForm3.ServerCommandInvite(AContext: TIdCommand; AParm1,
AParm2: string);
begin
memo1.Lines.Add('ServerCommandInvite');
end;
procedure TForm3.ServerCommandIsOn(AContext: TIdCommand; AParm: string);
begin
memo1.Lines.Add('ServerCommandIsOn');
end;
procedure TForm3.ServerCommandJoin(AContext: TIdCommand; AParm1,
AParm2: string);
begin
memo1.Lines.Add('IdIRCServer1CommandJoin');
end;
procedure TForm3.ServerCommandKick(AContext: TIdCommand; AParm1, AParm2,
AParm3: string);
begin
memo1.Lines.Add('ServerCommandKick');
end;
procedure TForm3.ServerCommandKill(AContext: TIdCommand; AParm1,
AParm2: string);
begin
memo1.Lines.Add('ServerCommandKill');
end;
procedure TForm3.ServerCommandLinks(AContext: TIdCommand; AParm1,
AParm2: string);
begin
memo1.Lines.Add('ServerCommandLinks');
end;
procedure TForm3.ServerCommandList(AContext: TIdCommand; AParm1,
AParm2: string);
begin
memo1.Lines.Add('ServerCommandList');
end;
procedure TForm3.ServerCommandMode(AContext: TIdCommand; AParm1, AParm2, AParm3,
AParm4, AParm5: string);
begin
memo1.Lines.Add('ServerCommandMode');
end;
procedure TForm3.ServerCommandNames(AContext: TIdCommand; AParm: string);
begin
memo1.Lines.Add('ServerCommandNames');
end;
procedure TForm3.ServerCommandNotice(AContext: TIdCommand; AParm1,
AParm2: string);
begin
memo1.Lines.Add('ServerCommandNotice');
end;
procedure TForm3.ServerCommandOper(AContext: TIdCommand; AParm1,
AParm2: string);
begin
memo1.Lines.Add('ServerCommandOper');
end;
procedure TForm3.ServerCommandOther(AContext: TIdCommand; Command,
AParm: string);
begin
memo1.Lines.Add('ServerCommandOther');
end;
procedure TForm3.ServerCommandPart(AContext: TIdCommand; AParm: string);
begin
memo1.Lines.Add('ServerCommandPart');
end;
procedure TForm3.ServerCommandPass(AContext: TIdCommand; AParm: string);
begin
memo1.Lines.Add('ServerCommandPass');
end;
procedure TForm3.ServerCommandPing(AContext: TIdCommand; AParm1,
AParm2: string);
begin
memo1.Lines.Add('ServerCommandPing');
end;
procedure TForm3.ServerCommandPong(AContext: TIdCommand; AParm1,
AParm2: string);
begin
memo1.Lines.Add('ServerCommandPong');
end;
procedure TForm3.ServerCommandPrivMsg(AContext: TIdCommand; AParm1,
AParm2: string);
begin
memo1.Lines.Add('ServerCommandPrivMsg');
end;
procedure TForm3.ServerCommandQuit(AContext: TIdCommand; AParm: string);
begin
memo1.Lines.Add('ServerCommandQuit');
end;
procedure TForm3.ServerCommandRehash(AContext: TIdCommand);
begin
memo1.Lines.Add('ServerCommandRehash');
end;
procedure TForm3.ServerCommandRestart(AContext: TIdCommand);
begin
memo1.Lines.Add('ServerCommandRestart');
end;
procedure TForm3.ServerCommandServer(AContext: TIdCommand; ServerName, Hopcount,
Info: string);
begin
memo1.Lines.Add('ServerCommandServer');
end;
procedure TForm3.ServerCommandSQuit(AContext: TIdCommand; AParm1,
AParm2: string);
begin
memo1.Lines.Add('ServerCommandSQuit');
end;
procedure TForm3.ServerCommandStats(AContext: TIdCommand; AParm1,
AParm2: string);
begin
memo1.Lines.Add('ServerCommandStats');
end;
procedure TForm3.ServerCommandSummon(AContext: TIdCommand; AParm1,
AParm2: string);
begin
memo1.Lines.Add('ServerCommandSummon');
end;
procedure TForm3.ServerCommandTime(AContext: TIdCommand; AParm: string);
begin
memo1.Lines.Add('ServerCommandTime');
end;
procedure TForm3.ServerCommandTopic(AContext: TIdCommand; AParm1,
AParm2: string);
begin
memo1.Lines.Add('ServerCommandTopic');
end;
procedure TForm3.ServerCommandTrace(AContext: TIdCommand; AParm: string);
begin
memo1.Lines.Add('ServerCommandTrace');
end;
procedure TForm3.ServerCommandUsers(AContext: TIdCommand; AParm: string);
begin
memo1.Lines.Add('ServerCommandUsers');
end;
procedure TForm3.ServerCommandVersion(AContext: TIdCommand; AParm: string);
begin
memo1.Lines.Add('ServerCommandVersion');
end;
procedure TForm3.ServerCommandWallops(AContext: TIdCommand; AParm: string);
begin
memo1.Lines.Add('ServerCommandWallops');
end;
procedure TForm3.ServerCommandWho(AContext: TIdCommand; AParm1, AParm2: string);
begin
memo1.Lines.Add('ServerCommandWho');
end;
procedure TForm3.ServerCommandWhoIs(AContext: TIdCommand; AParm1,
AParm2: string);
begin
memo1.Lines.Add('ServerCommandWhoIs');
end;
procedure TForm3.ServerCommandWhoWas(AContext: TIdCommand; AParm1, AParm2,
AParm3: string);
begin
memo1.Lines.Add('ServerCommandWhoWas');
end;
procedure TForm3.ServerConnect(AContext: TIdContext);
begin
memo1.Lines.Add('ServerConnect');
end;
procedure TForm3.ServerContextCreated(AContext: TIdContext);
begin
memo1.Lines.Add('ServerContextCreated');
end;
procedure TForm3.ServerDisconnect(AContext: TIdContext);
begin
memo1.Lines.Add('ServerDisconnect');
end;
procedure TForm3.ServerException(AContext: TIdContext; AException: Exception);
begin
memo1.Lines.Add('ServerException');
end;
procedure TForm3.ServerExecute(AContext: TIdContext);
begin
memo1.Lines.Add('ServerExecute');
end;
procedure TForm3.ServerListenException(AThread: TIdListenerThread;
AException: Exception);
begin
memo1.Lines.Add('ServerListenException');
end;
procedure TForm3.ServerStatus(ASender: TObject; const AStatus: TIdStatus;
const AStatusText: string);
begin
memo1.Lines.Add('ServerStatus');
end;
end.
|