diff --git a/StompClient.pas b/StompClient.pas index cb725c1..2c5249c 100644 --- a/StompClient.pas +++ b/StompClient.pas @@ -136,8 +136,11 @@ implementation uses // Windows, // Remove windows unit for compiling on ios - IdGlobal, - Character; + IdGlobal +{$IF CompilerVersion > 15} + , Character +{$IFEND} + ; {$ENDIF} @@ -167,7 +170,8 @@ procedure TStompClient.Ack(const MessageID: string; const TransactionIdentifier: begin Frame := TStompFrame.Create; Frame.SetCommand('ACK'); - Frame.GetHeaders.Add(TStompHeaders.MESSAGE_ID, MessageID); + Frame.GetHeaders.Add( + {$IF CompilerVersion <= 15}StompTypes{$ELSE}TStompHeaders{$IFEND}.MESSAGE_ID, MessageID); if TransactionIdentifier <> '' then Frame.GetHeaders.Add('transaction', TransactionIdentifier); SendFrame(Frame); @@ -502,25 +506,35 @@ function TStompClient.Receive(ATimeout: Integer): IStompFrame; function InternalReceiveINDY(ATimeout: Integer): IStompFrame; var c: char; +{$IF CompilerVersion <= 15} + sb: string; +{$ELSE} sb: TStringBuilder; +{$IFEND} tout: boolean; FirstValidChar: boolean; // UTF8Encoding: TEncoding; -{$IF CompilerVersion < 24} +{$IF CompilerVersion <= 15} + UTF8Encoding: IIdTextEncoding; +{$ELSEIF CompilerVersion < 24} UTF8Encoding: TIdTextEncoding; {$ELSE} UTF8Encoding: IIdTextEncoding; {$IFEND} begin -{$IF CompilerVersion < 24} +{$IF CompilerVersion <= 15} + UTF8Encoding := IndyTextEncoding_UTF8; +{$ELSEIF CompilerVersion < 24} UTF8Encoding := TEncoding.UTF8; -{$ELSE} +{$ELSEIF CompilerVersion >= 24} UTF8Encoding := IndyTextEncoding_UTF8(); -{$ENDIF} +{$IFEND} tout := False; Result := nil; try +{$IF CompilerVersion > 15} sb := TStringBuilder.Create(1024 * 4); +{$IFEND} try FTCP.ReadTimeout := ATimeout; try @@ -533,7 +547,11 @@ function TStompClient.Receive(ATimeout: Integer): IStompFrame; Continue; FirstValidChar := True; if c <> CHAR0 then + {$IF CompilerVersion <= 15} + sb := sb + c + {$ELSE} sb.Append(c) + {$IFEND} else begin // FTCP.IOHandler.ReadChar(TEncoding.UTF8); @@ -547,20 +565,20 @@ function TStompClient.Receive(ATimeout: Integer): IStompFrame; end; on E: Exception do begin - if sb.Length > 0 then - raise EStomp.Create(E.message + sLineBreak + sb.toString) + if {$IF CompilerVersion <= 15}Length(sb){$ELSE}sb.Length{$IFEND} > 0 then + raise EStomp.Create(E.message + sLineBreak + sb{$IF CompilerVersion > 15}.toString{$IFEND}) else raise; end; end; if not tout then begin - Result := StompUtils.CreateFrame(sb.toString + CHAR0); + Result := StompUtils.CreateFrame(sb{$IF CompilerVersion > 15}.toString{$IFEND} + CHAR0); if Result.GetCommand = 'ERROR' then raise EStomp.Create(Result.GetHeaders.Value('message')); end; finally - sb.Free; + {$IF CompilerVersion > 15}sb.Free;{$IFEND} end; except on E: Exception do @@ -632,7 +650,7 @@ procedure TStompClient.SendFrame(AFrame: IStompFrame); FOnBeforeSendFrame(AFrame); {$IF CompilerVersion < 25} - FTCP.IOHandler.write(TEncoding.UTF8.GetBytes(AFrame.output)); + FTCP.IOHandler.write({$IF CompilerVersion <= 15}IndyTextEncoding_UTF8{$ELSE}TEncoding.UTF8{$IFEND}.GetBytes(AFrame.output)); {$IFEND} {$IF CompilerVersion >= 25} FTCP.IOHandler.write(IndyTextEncoding_UTF8.GetBytes(AFrame.output)); diff --git a/StompTypes.pas b/StompTypes.pas index a16c308..3fbcb9a 100644 --- a/StompTypes.pas +++ b/StompTypes.pas @@ -115,9 +115,11 @@ TStompHeaders = class(TInterfacedObject, IStompHeaders) class function NewReplyToHeader(const DestinationName: string): TKeyValue; /// /////////////////////////////////////////////7 + {$IF CompilerVersion > 15} const MESSAGE_ID: string = 'message-id'; TRANSACTION: string = 'transaction'; + {$IFEND} /// / function Add(Key, Value: string): IStompHeaders; overload; function Add(HeaderItem: TKeyValue): IStompHeaders; overload; @@ -181,7 +183,7 @@ TAddress = record end; TStompClientListener = class(TThread, IStompListener) - strict protected + {$IF CompilerVersion > 15}strict{$IFEND} protected FStompClientListener: IStompClientListener; FStompClient: IStompClient; procedure Execute; override; @@ -210,11 +212,21 @@ StompUtils = class AcceptVersion: TStompAcceptProtocol = STOMP_Version_1_0): IStompClient; end; +{$IF CompilerVersion <= 15} +const + MESSAGE_ID: string = 'message-id'; + TRANSACTION: string = 'transaction'; +{$IFEND} + implementation uses Dateutils, - StompClient; + StompClient + {$IF CompilerVersion <= 15} + , IdGlobal + {$IFEND} + ; class function StompUtils.NewStomp(Host: string = '127.0.0.1'; Port: Integer = DEFAULT_STOMP_PORT; ClientID: string = ''; @@ -314,7 +326,7 @@ function TStompFrame.GetHeaders: IStompHeaders; function TStompFrame.MessageID: string; begin - Result := self.GetHeaders.Value(TStompHeaders.MESSAGE_ID); + Result := self.GetHeaders.Value({$IF CompilerVersion <= 15}StompTypes{$ELSE}TStompHeaders{$IFEND}.MESSAGE_ID); end; function TStompFrame.Output: string; @@ -331,7 +343,7 @@ function TStompFrame.ContentLength: Integer; procedure TStompFrame.SetBody(const Value: string); begin FBody := Value; - FContentLength := Length(TEncoding.UTF8.GetBytes(FBody)); + FContentLength := Length({$IF CompilerVersion <= 15}IndyTextEncoding_UTF8{$ELSE}TEncoding.UTF8{$IFEND}.GetBytes(FBody)); end; procedure TStompFrame.SetCommand(const Value: string); @@ -406,7 +418,7 @@ class function StompUtils.CreateFrame(Buf: string): TStompFrame; contLen := StrToInt(sContLen); other := StripLastChar(other, COMMAND_END); - if TEncoding.UTF8.GetByteCount(other) <> contLen then + if {$IF CompilerVersion <= 15}IndyTextEncoding_UTF8{$ELSE}TEncoding.UTF8{$IFEND}.GetByteCount(other) <> contLen then // there is still the command_end raise EStomp.Create('frame too short'); Result.Body := other; diff --git a/examples/Chat/ChatClient/ChatClient.dpr b/examples/Chat/ChatClient/ChatClient.dpr index 6f6f125..8317361 100644 --- a/examples/Chat/ChatClient/ChatClient.dpr +++ b/examples/Chat/ChatClient/ChatClient.dpr @@ -10,7 +10,7 @@ uses begin Application.Initialize; - Application.MainFormOnTaskbar := True; +// Application.MainFormOnTaskbar := True; Application.CreateForm(TForm5, Form5); Application.Run; end. diff --git a/examples/Chat/ChatClient/ChatClient.res b/examples/Chat/ChatClient/ChatClient.res index d070105..d6cf632 100644 Binary files a/examples/Chat/ChatClient/ChatClient.res and b/examples/Chat/ChatClient/ChatClient.res differ diff --git a/examples/Chat/ChatClient/MainFormClient.dfm b/examples/Chat/ChatClient/MainFormClient.dfm index 961e099..8dfd3a3 100644 --- a/examples/Chat/ChatClient/MainFormClient.dfm +++ b/examples/Chat/ChatClient/MainFormClient.dfm @@ -22,7 +22,7 @@ object Form5: TForm5 Width = 137 Height = 21 TabOrder = 0 - Text = 'localhost' + Text = '192.168.2.68' end object Edit2: TEdit Left = 150 @@ -52,8 +52,8 @@ object Form5: TForm5 object Memo1: TMemo Left = 9 Top = 39 - Width = 494 - Height = 314 + Width = 478 + Height = 276 Anchors = [akLeft, akTop, akRight, akBottom] Color = clMenuBar Font.Charset = ANSI_CHARSET @@ -67,8 +67,8 @@ object Form5: TForm5 end object Memo2: TMemo Left = 8 - Top = 359 - Width = 389 + Top = 321 + Width = 373 Height = 68 Anchors = [akLeft, akRight, akBottom] Enabled = False @@ -82,8 +82,8 @@ object Form5: TForm5 OnKeyUp = Memo2KeyUp end object Button2: TButton - Left = 403 - Top = 359 + Left = 387 + Top = 321 Width = 100 Height = 68 Anchors = [akRight, akBottom] diff --git a/examples/Chat/ChatClient/MainFormClient.pas b/examples/Chat/ChatClient/MainFormClient.pas index 1cbf771..1ef1883 100644 --- a/examples/Chat/ChatClient/MainFormClient.pas +++ b/examples/Chat/ChatClient/MainFormClient.pas @@ -85,6 +85,7 @@ procedure TForm5.tmrTimer(Sender: TObject); if assigned(f) then begin Memo1.Lines.Add('[' + f.GetHeaders.Value('datetime') + ' ' + f.GetHeaders.Value('sender') + ']' + sLineBreak + f.GetBody); +{$IF CompilerVersion > 15} if (WindowState = wsMinimized) or (Application.ActiveFormHandle <> self.Handle) then begin fw.cbSize := SizeOf(FLASHWINFO); @@ -94,6 +95,7 @@ procedure TForm5.tmrTimer(Sender: TObject); fw.dwTimeout := 500; FlashWindowEx(fw); end; +{$IFEND} end; end; diff --git a/examples/GlobalDemo/GlobalDemo/GlobalDemo.res b/examples/GlobalDemo/GlobalDemo/GlobalDemo.res index 290ba59..d6cf632 100644 Binary files a/examples/GlobalDemo/GlobalDemo/GlobalDemo.res and b/examples/GlobalDemo/GlobalDemo/GlobalDemo.res differ diff --git a/examples/GlobalDemo/GlobalDemo/Receiver.res b/examples/GlobalDemo/GlobalDemo/Receiver.res index 290ba59..d6cf632 100644 Binary files a/examples/GlobalDemo/GlobalDemo/Receiver.res and b/examples/GlobalDemo/GlobalDemo/Receiver.res differ diff --git a/examples/QueueAck/Receiver/Receiver.dpr b/examples/QueueAck/Receiver/Receiver.dpr index 5c887f0..ab8253d 100644 --- a/examples/QueueAck/Receiver/Receiver.dpr +++ b/examples/QueueAck/Receiver/Receiver.dpr @@ -1,7 +1,7 @@ program Receiver; uses - Vcl.Forms, + Forms, ReceiverForm in 'ReceiverForm.pas' {ReceiverMainForm}, ThreadReceiver in 'ThreadReceiver.pas'; @@ -9,7 +9,7 @@ uses begin Application.Initialize; - Application.MainFormOnTaskbar := True; + //Application.MainFormOnTaskbar := True; Application.CreateForm(TReceiverMainForm, ReceiverMainForm); Application.Run; end. diff --git a/examples/QueueAck/Receiver/Receiver.dproj b/examples/QueueAck/Receiver/Receiver.dproj index d685b68..a4f578b 100644 --- a/examples/QueueAck/Receiver/Receiver.dproj +++ b/examples/QueueAck/Receiver/Receiver.dproj @@ -67,6 +67,9 @@ true + 1033 + ..\..\..;$(DCC_UnitSearchPath) + true false @@ -132,402 +135,349 @@ - Microsoft Office 2000 Sample Automation Server Wrapper Components - Microsoft Office XP Sample Automation Server Wrapper Components - Embarcadero C++Builder Office 2000 Servers Package - Embarcadero C++Builder Office XP Servers Package + Microsoft Office 2000 Sample Automation Server Wrapper Components + Microsoft Office XP Sample Automation Server Wrapper Components + + + res\drawable-normal + 1 + + + + 1 + .dylib + 0 .dll;.bpl - - 1 - .dylib - Contents\MacOS 1 .dylib - - 1 - .dylib - 1 .dylib - + - Contents\Resources + Contents 1 - - - classes + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF 1 - - - Contents\MacOS - 0 - - - 1 - - - Contents\MacOS + + 1 - - 1 - - 1 - - + + + + library\lib\mips 1 - + - res\drawable-xxhdpi + library\lib\x86 1 - + - library\lib\mips + library\lib\armeabi-v7a 1 - - - 0 - - + + + ../ 1 - - Contents\MacOS + + + 1 - + 1 - - library\lib\armeabi-v7a + + + 1 1 - + + + 1 + .dylib + 0 + .bpl Contents\MacOS 1 - .framework + .dylib - - 1 - - - 1 - - - 1 + .dylib - - - 1 - - + + + res\drawable-xhdpi 1 - + + + + res\drawable-xxhdpi 1 - - - ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + + 1 - - ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 - + - library\lib\x86 + res\drawable-xlarge 1 - - + + + res\drawable 1 - + + + + Contents\MacOS 1 + .framework - - 1 + + 0 - - + + + Contents\MacOS 1 - + 1 - - 1 + + 0 - + - library\lib\armeabi + res\drawable-small 1 - - - 0 - - + + + ../ 1 + + Contents\MacOS 1 - - 1 - - 1 - - - 1 - - - - - res\drawable-normal - 1 + + Contents\MacOS + 0 - + - res\drawable-xhdpi + classes 1 - - - res\drawable-large + + 1 - - 1 - - 1 - - - 1 - - - - ../ + + 1 - - ../ + 1 - + - res\drawable-hdpi + library\lib\armeabi-v7a 1 - + - library\lib\armeabi-v7a + res\drawable 1 - + - Contents + Contents\Resources 1 - - - ../ + + 1 - - - 1 - - + + 1 - + 1 - - - res\values + + 1 - - - res\drawable-small + library\lib\armeabi-v7a 1 - - - - res\drawable - 1 + + 0 - - - + + Contents\MacOS 1 - + 1 - + + + + library\lib\armeabi 1 - + + res\drawable-large 1 - - - res\drawable + + + 1 + + 1 - - 0 - - + 0 - - Contents\Resources\StartUp\ + 0 - + 0 - + + Contents\MacOS 0 0 - + - library\lib\armeabi-v7a + res\values 1 - - - 0 - .bpl - - - 1 - .dylib - - - Contents\MacOS + + + res\drawable-ldpi 1 - .dylib - + + + 1 - .dylib 1 - .dylib - + - res\drawable-mdpi + res\drawable-hdpi 1 - + - res\drawable-xlarge + res\drawable-mdpi 1 - + - res\drawable-ldpi - 1 - - - - - 1 - - 1 + + + + - - - - + True @@ -540,3 +490,11 @@ + + diff --git a/examples/QueueAck/Receiver/Receiver.res b/examples/QueueAck/Receiver/Receiver.res index 290ba59..de063c3 100644 Binary files a/examples/QueueAck/Receiver/Receiver.res and b/examples/QueueAck/Receiver/Receiver.res differ diff --git a/examples/QueueAck/Receiver/ReceiverForm.dfm b/examples/QueueAck/Receiver/ReceiverForm.dfm index 76bfbf3..d0dbc44 100644 --- a/examples/QueueAck/Receiver/ReceiverForm.dfm +++ b/examples/QueueAck/Receiver/ReceiverForm.dfm @@ -1,9 +1,9 @@ object ReceiverMainForm: TReceiverMainForm Left = 0 Top = 0 + Width = 511 + Height = 493 Caption = 'Receiver Message' - ClientHeight = 455 - ClientWidth = 478 Color = clBtnFace Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText diff --git a/examples/QueueAck/Receiver/ReceiverForm.pas b/examples/QueueAck/Receiver/ReceiverForm.pas index c9f5cc8..a0ac5e5 100644 --- a/examples/QueueAck/Receiver/ReceiverForm.pas +++ b/examples/QueueAck/Receiver/ReceiverForm.pas @@ -3,9 +3,9 @@ interface uses - Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, - System.Classes, Vcl.Graphics, - Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, StompClient, StompTypes, + Windows, Messages, SysUtils, Variants, + Classes, Graphics, + Controls, Forms, Dialogs, StdCtrls, StompClient, StompTypes, ThreadReceiver; type @@ -104,7 +104,7 @@ procedure TReceiverMainForm.SubscribeButtonClick(Sender: TObject); begin StompClient.Subscribe(QueueEdit.Text, amClientIndividual); // StompClient.Subscribe(QueueEdit.Text,amAuto); - ThReceiver.Start; + ThReceiver.Resume; end; end; @@ -116,7 +116,7 @@ procedure TReceiverMainForm.UnsubscribeButtonClick(Sender: TObject); if StompClient.Connected then begin StompClient.Unsubscribe(QueueEdit.Text); - ThReceiver.Start; + ThReceiver.Resume; end; end; diff --git a/examples/QueueAck/Receiver/ThreadReceiver.pas b/examples/QueueAck/Receiver/ThreadReceiver.pas index fdbfddb..7140c1c 100644 --- a/examples/QueueAck/Receiver/ThreadReceiver.pas +++ b/examples/QueueAck/Receiver/ThreadReceiver.pas @@ -3,7 +3,7 @@ interface uses - System.Classes, + Classes, StompClient, StompTypes; @@ -56,7 +56,7 @@ implementation } -uses ReceiverForm; +uses ReceiverForm, SysUtils; { TThreadReceiver } @@ -68,7 +68,7 @@ constructor TThreadReceiver.Create(CreateSuspended: Boolean); procedure TThreadReceiver.Execute; begin - NameThreadForDebugging('ThreadReceiver'); + //NameThreadForDebugging('ThreadReceiver'); while not Terminated do begin diff --git a/examples/QueueAck/SendMessage/SendMessage.dpr b/examples/QueueAck/SendMessage/SendMessage.dpr index c36e9ac..d8fed60 100644 --- a/examples/QueueAck/SendMessage/SendMessage.dpr +++ b/examples/QueueAck/SendMessage/SendMessage.dpr @@ -1,14 +1,14 @@ program SendMessage; uses - Vcl.Forms, + Forms, SendMessageForm in 'SendMessageForm.pas' {SendMessageMainForm}; {$R *.res} begin Application.Initialize; - Application.MainFormOnTaskbar := True; +// Application.MainFormOnTaskbar := True; Application.CreateForm(TSendMessageMainForm, SendMessageMainForm); Application.Run; end. diff --git a/examples/QueueAck/SendMessage/SendMessage.dproj b/examples/QueueAck/SendMessage/SendMessage.dproj index fca3165..e6ba268 100644 --- a/examples/QueueAck/SendMessage/SendMessage.dproj +++ b/examples/QueueAck/SendMessage/SendMessage.dproj @@ -67,6 +67,9 @@ true + 1033 + ..\..\..;$(DCC_UnitSearchPath) + true false @@ -131,402 +134,349 @@ - Microsoft Office 2000 Sample Automation Server Wrapper Components - Microsoft Office XP Sample Automation Server Wrapper Components - Embarcadero C++Builder Office 2000 Servers Package - Embarcadero C++Builder Office XP Servers Package + Microsoft Office 2000 Sample Automation Server Wrapper Components + Microsoft Office XP Sample Automation Server Wrapper Components + + + res\drawable-normal + 1 + + + + 1 + .dylib + 0 .dll;.bpl - - 1 - .dylib - Contents\MacOS 1 .dylib - - 1 - .dylib - 1 .dylib - + - Contents\Resources + Contents 1 - - - classes + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF 1 - - - Contents\MacOS - 0 - - - 1 - - - Contents\MacOS + + 1 - - 1 - - 1 - - + + + + library\lib\mips 1 - + - res\drawable-xxhdpi + library\lib\x86 1 - + - library\lib\mips + library\lib\armeabi-v7a 1 - - - 0 - - + + + ../ 1 - - Contents\MacOS + + + 1 - + 1 - - library\lib\armeabi-v7a + + + 1 1 - + + + 1 + .dylib + 0 + .bpl Contents\MacOS 1 - .framework + .dylib - - 1 - - - 1 - - - 1 + .dylib - - - 1 - - + + + res\drawable-xhdpi 1 - + + + + res\drawable-xxhdpi 1 - - - ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + + 1 - - ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 - + - library\lib\x86 + res\drawable-xlarge 1 - - + + + res\drawable 1 - + + + + Contents\MacOS 1 + .framework - - 1 + + 0 - - + + + Contents\MacOS 1 - + 1 - - 1 + + 0 - + - library\lib\armeabi + res\drawable-small 1 - - - 0 - - + + + ../ 1 + + Contents\MacOS 1 - - 1 - - 1 - - - 1 - - - - - res\drawable-normal - 1 + + Contents\MacOS + 0 - + - res\drawable-xhdpi + classes 1 - - - res\drawable-large + + 1 - - 1 - - 1 - - - 1 - - - - ../ + + 1 - - ../ + 1 - + - res\drawable-hdpi + library\lib\armeabi-v7a 1 - + - library\lib\armeabi-v7a + res\drawable 1 - + - Contents + Contents\Resources 1 - - - ../ + + 1 - - - 1 - - + + 1 - + 1 - - - res\values + + 1 - - - res\drawable-small + library\lib\armeabi-v7a 1 - - - - res\drawable - 1 + + 0 - - - + + Contents\MacOS 1 - + 1 - + + + + library\lib\armeabi 1 - + + res\drawable-large 1 - - - res\drawable + + + 1 + + 1 - - 0 - - + 0 - - Contents\Resources\StartUp\ + 0 - + 0 - + + Contents\MacOS 0 0 - + - library\lib\armeabi-v7a + res\values 1 - - - 0 - .bpl - - - 1 - .dylib - - - Contents\MacOS + + + res\drawable-ldpi 1 - .dylib - + + + 1 - .dylib 1 - .dylib - + - res\drawable-mdpi + res\drawable-hdpi 1 - + - res\drawable-xlarge + res\drawable-mdpi 1 - + - res\drawable-ldpi - 1 - - - - - 1 - - 1 + + + + - - - - + True @@ -539,3 +489,11 @@ + + diff --git a/examples/QueueAck/SendMessage/SendMessage.res b/examples/QueueAck/SendMessage/SendMessage.res index 290ba59..de063c3 100644 Binary files a/examples/QueueAck/SendMessage/SendMessage.res and b/examples/QueueAck/SendMessage/SendMessage.res differ diff --git a/examples/QueueAck/SendMessage/SendMessageForm.dfm b/examples/QueueAck/SendMessage/SendMessageForm.dfm index 54cab7c..d4cf2fe 100644 --- a/examples/QueueAck/SendMessage/SendMessageForm.dfm +++ b/examples/QueueAck/SendMessage/SendMessageForm.dfm @@ -1,9 +1,9 @@ object SendMessageMainForm: TSendMessageMainForm Left = 0 Top = 0 + Width = 459 + Height = 371 Caption = 'Send Message' - ClientHeight = 333 - ClientWidth = 426 Color = clBtnFace Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText @@ -45,7 +45,7 @@ object SendMessageMainForm: TSendMessageMainForm end object SendMessageButton: TButton Left = 8 - Top = 269 + Top = 271 Width = 138 Height = 56 Caption = 'Send Message' diff --git a/examples/QueueAck/SendMessage/SendMessageForm.pas b/examples/QueueAck/SendMessage/SendMessageForm.pas index 7c1e4ea..ad346bb 100644 --- a/examples/QueueAck/SendMessage/SendMessageForm.pas +++ b/examples/QueueAck/SendMessage/SendMessageForm.pas @@ -3,9 +3,9 @@ interface uses - Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, - Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, StompClient, StompTypes, - Vcl.ExtCtrls; + Windows, Messages, SysUtils, Variants, Classes, Graphics, + Controls, Forms, Dialogs, StdCtrls, StompClient, StompTypes, + ExtCtrls; type TSendMessageMainForm = class(TForm) diff --git a/examples/SimpleMessaging/SimpleMessaging.dpr b/examples/SimpleMessaging/SimpleMessaging.dpr index be351c8..b1e5718 100644 --- a/examples/SimpleMessaging/SimpleMessaging.dpr +++ b/examples/SimpleMessaging/SimpleMessaging.dpr @@ -6,16 +6,12 @@ program SimpleMessaging; {$APPTYPE CONSOLE} {$ENDIF} -uses -{$IFDEF FPC} -{$IFDEF UNIX} - cthreads, +{%File '..\..\..\DelphiStompClient'} -{$ENDIF} -{$ENDIF} +uses SysUtils, - StompClient, - StompTypes; + StompClient in '..\..\StompClient.pas', + StompTypes in '..\..\StompTypes.pas'; procedure Example_Durable_Subscription; var @@ -27,19 +23,19 @@ begin StompHeaders.Add(TStompHeaders.NewDurableSubscriptionHeader('my-unique-id')); WriteLn('==> Example_Durable_Subscription'); - StompSubscriber := StompUtils.NewStomp('127.0.0.1', 61613, 'client-id', 'guest', 'guest'); + StompSubscriber := StompUtils.NewStomp('192.168.3.51', 61613, 'client-id', 'admin', 'admin'); // default port StompSubscriber.Subscribe('/queue/durable01', amAuto, StompHeaders); // StompSubscriber.Disconnect; StompSubscriber := nil; - StompPub := StompUtils.NewStomp('127.0.0.1', 61613, '', 'guest', 'guest'); // default port + StompPub := StompUtils.NewStomp('192.168.3.51', 61613, '', 'admin', 'admin'); // default port StompPub.Send('/queue/durable01', 'this message has been sent when the subscriber client was disconnected'); // StompPub.Disconnect; StompPub := nil; - StompSubscriber := StompUtils.NewStomp('127.0.0.1', 61613, 'client-id', 'guest', 'guest'); + StompSubscriber := StompUtils.NewStomp('192.168.3.51', 61613, 'client-id', 'admin', 'admin'); StompSubscriber.Subscribe('/queue/durable01', amAuto, StompHeaders); // default port repeat @@ -57,10 +53,10 @@ var StompFrame: IStompFrame; begin WriteLn('==> Example_Pub_Subscriber'); - StompSubscriber := StompUtils.NewStomp('127.0.0.1', 61613, '', 'guest', 'guest'); + StompSubscriber := StompUtils.NewStomp('192.168.3.51', 61613, '', 'admin', 'admin'); // default port StompSubscriber.Subscribe('/topic/dummy'); - StompPub := StompUtils.NewStomp('127.0.0.1', 61613, '', 'guest', 'guest'); // default port + StompPub := StompUtils.NewStomp('192.168.3.51', 61613, '', 'admin', 'admin'); // default port StompPub.Send('/topic/dummy', 'Some test message'); repeat StompFrame := StompSubscriber.Receive; @@ -75,13 +71,13 @@ var StompFrame: IStompFrame; begin WriteLn('==> Example_OnePub_TwoSubscriber'); - StompSub1 := StompUtils.NewStomp('127.0.0.1', 61613, '', 'guest', 'guest'); // default port - StompSub2 := StompUtils.NewStomp('127.0.0.1', 61613, '', 'guest', 'guest'); // default port + StompSub1 := StompUtils.NewStomp('192.168.3.51', 61613, '', 'admin', 'admin'); // default port + StompSub2 := StompUtils.NewStomp('192.168.3.51', 61613, '', 'admin', 'admin'); // default port StompSub1.Subscribe('/topic/dummy'); StompSub2.Subscribe('/topic/dummy'); // - StompPub := StompUtils.NewStomp('127.0.0.1', 61613, '', 'guest', 'guest'); // default port + StompPub := StompUtils.NewStomp('192.168.3.51', 61613, '', 'admin', 'admin'); // default port StompPub.Send('/topic/dummy', 'First test message on a topic'); StompPub.Send('/topic/dummy', 'Second test message on a topic'); @@ -107,13 +103,13 @@ var StompFrame: IStompFrame; begin WriteLn('==> Example_PointToPoint'); - StompSub1 := StompUtils.NewStomp('127.0.0.1', 61613, '', 'guest', 'guest'); // default port - StompSub2 := StompUtils.NewStomp('127.0.0.1', 61613, '', 'guest', 'guest'); // default port + StompSub1 := StompUtils.NewStomp('192.168.3.51', 61613, '', 'admin', 'admin'); // default port + StompSub2 := StompUtils.NewStomp('192.168.3.51', 61613, '', 'admin', 'admin'); // default port StompSub1.Subscribe('/queue/dummy'); StompSub2.Subscribe('/queue/dummy'); // - StompPub := StompUtils.NewStomp('127.0.0.1', 61613, '', 'guest', 'guest'); // default port + StompPub := StompUtils.NewStomp('192.168.3.51', 61613, '', 'admin', 'admin'); // default port StompPub.Send('/queue/dummy', 'First test message on a queue'); StompPub.Send('/queue/dummy', 'Second test message on a queue'); diff --git a/examples/SimpleMessaging/SimpleMessaging.dproj b/examples/SimpleMessaging/SimpleMessaging.dproj index 3447db6..059d90c 100644 --- a/examples/SimpleMessaging/SimpleMessaging.dproj +++ b/examples/SimpleMessaging/SimpleMessaging.dproj @@ -19,16 +19,6 @@ Base true - - true - Base - true - - - true - Base - true - true Base @@ -49,18 +39,6 @@ Base true - - true - Cfg_2 - true - true - - - true - Cfg_2 - true - true - true Cfg_2 @@ -110,44 +88,6 @@ true true - - $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_2048x1536.png - $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_80x80.png - $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_1024x768.png - true - $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_152x152.png - $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_40x40.png - $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_40x40.png - $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_1536x2048.png - $(MSBuildProjectName) - $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_768x1024.png - Debug - $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_76x76.png - $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_60x60.png - $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_80x80.png - $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_120x120.png - CFBundleName=$(MSBuildProjectName);CFBundleDevelopmentRegion=en;CFBundleDisplayName=$(MSBuildProjectName);CFBundleIdentifier=$(MSBuildProjectName);CFBundleInfoDictionaryVersion=7.1;CFBundleVersion=1.0.0.0;CFBundlePackageType=APPL;CFBundleSignature=????;LSRequiresIPhoneOS=true;CFBundleAllowMixedLocalizations=YES;CFBundleExecutable=$(MSBuildProjectName);UIDeviceFamily=iPhone & iPad;CFBundleResourceSpecification=ResourceRules.plist;NSLocationAlwaysUsageDescription=The reason for accessing the location information of the user;NSLocationWhenInUseUsageDescription=The reason for accessing the location information of the user;FMLocalNotificationPermission=false;UIBackgroundModes= - iPhoneAndiPad - - - $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_2048x1536.png - $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_80x80.png - $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_1024x768.png - true - $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_152x152.png - $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_40x40.png - $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_40x40.png - $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_1536x2048.png - $(MSBuildProjectName) - $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_768x1024.png - Debug - $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_76x76.png - $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_60x60.png - $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_80x80.png - $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_120x120.png - CFBundleName=$(MSBuildProjectName);CFBundleDevelopmentRegion=en;CFBundleDisplayName=$(MSBuildProjectName);CFBundleIdentifier=$(MSBuildProjectName);CFBundleInfoDictionaryVersion=7.1;CFBundleVersion=1.0.0.0;CFBundlePackageType=APPL;CFBundleSignature=????;LSRequiresIPhoneOS=true;CFBundleAllowMixedLocalizations=YES;CFBundleExecutable=$(MSBuildProjectName);UIDeviceFamily=iPhone & iPad;CFBundleResourceSpecification=ResourceRules.plist;NSLocationAlwaysUsageDescription=The reason for accessing the location information of the user;NSLocationWhenInUseUsageDescription=The reason for accessing the location information of the user;FMLocalNotificationPermission=false;UIBackgroundModes= - iPhoneAndiPad - $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_80x80.png $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_2048x1536.png @@ -178,12 +118,6 @@ DEBUG;$(DCC_Define) - - true - - - true - true @@ -247,8 +181,6 @@ False - False - False False False True @@ -259,3 +191,11 @@ + +