IdDayTimeServer.pas 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. {
  2. $Project$
  3. $Workfile$
  4. $Revision$
  5. $DateUTC$
  6. $Id$
  7. This file is part of the Indy (Internet Direct) project, and is offered
  8. under the dual-licensing agreement described on the Indy website.
  9. (http://www.indyproject.org/)
  10. Copyright:
  11. (c) 1993-2005, Chad Z. Hower and the Indy Pit Crew. All rights reserved.
  12. }
  13. {
  14. $Log$
  15. }
  16. {
  17. Rev 1.4 12/2/2004 4:23:50 PM JPMugaas
  18. Adjusted for changes in Core.
  19. Rev 1.3 1/21/2004 2:12:40 PM JPMugaas
  20. InitComponent
  21. Rev 1.2 1/17/2003 05:35:18 PM JPMugaas
  22. Now compiles with new design.
  23. Rev 1.1 1-1-2003 20:12:48 BGooijen
  24. Changed to support the new TIdContext class
  25. Rev 1.0 11/14/2002 02:17:06 PM JPMugaas
  26. 2000-Apr-22: J Peter Mugass
  27. -Ported to Indy
  28. 1999-Apr-13
  29. -Final Version
  30. 2000-JAN-13 MTL
  31. -Moved to new Palette Scheme (Winshoes Servers)
  32. }
  33. unit IdDayTimeServer;
  34. {
  35. Original Author: Ozz Nixon
  36. }
  37. interface
  38. {$i IdCompilerDefines.inc}
  39. uses
  40. {$IFDEF WORKAROUND_INLINE_CONSTRUCTORS}
  41. Classes,
  42. {$ENDIF}
  43. IdAssignedNumbers,
  44. IdContext,
  45. IdCustomTCPServer;
  46. Type
  47. TIdDayTimeServer = class(TIdCustomTCPServer)
  48. protected
  49. FTimeZone: String;
  50. //
  51. function DoExecute(AContext:TIdContext): boolean; override;
  52. procedure InitComponent; override;
  53. {$IFDEF WORKAROUND_INLINE_CONSTRUCTORS}
  54. public
  55. constructor Create(AOwner: TComponent); reintroduce; overload;
  56. {$ENDIF}
  57. published
  58. property TimeZone: String read FTimeZone write FTimeZone;
  59. property DefaultPort default IdPORT_DAYTIME;
  60. end;
  61. implementation
  62. uses
  63. IdGlobal, SysUtils;
  64. {$IFDEF WORKAROUND_INLINE_CONSTRUCTORS}
  65. constructor TIdDayTimeServer.Create(AOwner: TComponent);
  66. begin
  67. inherited Create(AOwner);
  68. end;
  69. {$ENDIF}
  70. procedure TIdDayTimeServer.InitComponent;
  71. begin
  72. inherited InitComponent;
  73. DefaultPort := IdPORT_DAYTIME;
  74. FTimeZone := 'EST'; {Do not Localize}
  75. end;
  76. function TIdDayTimeServer.DoExecute(AContext:TIdContext ): boolean;
  77. begin
  78. Result := True;
  79. AContext.Connection.IOHandler.WriteLn(FormatDateTime('dddd, mmmm dd, yyyy hh:nn:ss', Now) + '-' + FTimeZone); {Do not Localize}
  80. AContext.Connection.Disconnect;
  81. end;
  82. end.