procedure TForm1.TcpServer1Accept(sender: TObject;
ClientSocket: TCustomIpClient);
var
s:
string;
nick:
string;
DataThread: TClientDataThread;
begin
// create thread
DataThread:= TClientDataThread.Create(true);
// set the TagetList to the gui list that you
// with to synch with.
DataThread.TargetList := memRecv.lines;
// Load the Threads ListBuffer
nick := ClientSocket.Receiveln;
s := ClientSocket.Receiveln;
while s <> '
'
do
begin
DataThread.ListBuffer.Add( nick + '
-' + TimeToStr(Time) +'
@' + ClientSocket.RemoteHost);
DataThread.ListBuffer.Add(s);
s := ClientSocket.Receiveln;
DataThread.ListBuffer.Add('
');
JvTrayIcon1.BalloonHint('
Neue Nachricht','
Neue Nachricht von ' + nick + '
erhalten.');
end;
// Call Resume which will execute and synch the
// ListBuffer with the TargetList
DataThread.Resume;
memrecv.perform( EM_SCROLLCARET, 0, 0 );
If edtRemoteHost.Items.IndexOf (ClientSocket.Remotehost) = -1
Then
begin
if (Application.MessageBox(
'
Wollen Sie die Absender-IP zu ihrer Empfängerliste hinzufügen?',
'
Neuer Absender',
MB_YESNO + MB_ICONQUESTION) = ID_YES)
then
begin
edtremotehost.Items.Add(ClientSocket.Remotehost);
end
else
end
else
end;