Autor Beitrag
Gandalf
Hält's aus hier
Beiträge: 11



BeitragVerfasst: Do 03.10.02 19:10 
Ich habe eine Herausforderung, die ich nicht bestehen kann.
Ich würde gerne ein Tool schaffen, dass im 20 Sekunden Takt eine Anfrage an den ICQ Server stellt und fragt, ob bestimmte User online sind. Den folgenden Php Code habe ich gefunden:
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
<?php
//usage example for 'icq_online()'
//
//you could also call this example script via
//web browser by using a 'uin' parameter.
//
//example:
// www.myserver.com/icqtest.php3?uin=0
//
require("icqon.inc.php3");

//put an icq uin here ;-)
if (!isset($uin)) $uin = "0";

$state = icq_online($uin);
if  ($state == 1)
     $state = "online";
else $state = "offline";

echo "User $uin is $state.\n";
?>

Mein Problem besteht nur darin, den regelmäßigen Test mit Delphi durchzuführen. Ich weiß nicht, wie ich den Code so interpretieren soll, dass ihn Delphi versteht.

An zweiter Stelle, wäre für mich noch wichtig, wie ich die Ergebnisse in logfiles festhalten kann.

Danke im vorraus

[b](03.10.02 19:46 Tino) Code-Tags hinzugefügt.[b]
matze
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 4613
Erhaltene Danke: 24

XP home, prof
Delphi 2009 Prof,
BeitragVerfasst: Do 03.10.02 19:32 
schau dir mal diese seite an: www.cobans.net/

ich hab die auch grad erst bekommen und noch keine kompos testen können. aber ich denke mal, dass man damit sowas realisieren könnte.

das mit den logfile ist simpel:

du schreibt den aktuellen status in ein memofeld:
memo1.lines.add ('status:....');

speichern tutst du das ganze per
memo1.lines.savetofile ('c:\log.txt');

_________________
In the beginning was the word.
And the word was content-type: text/plain.
Xion
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
EE-Maler
Beiträge: 1952
Erhaltene Danke: 128

Windows XP
Delphi (2005, SmartInspect), SQL, Lua, Java (Eclipse), C++ (Visual Studio 2010, Qt Creator), Python (Blender), Prolog (SWIProlog), Haskell (ghci)
BeitragVerfasst: So 17.09.06 12:51 
Stichwort TICQClient ;)

_________________
a broken heart is like a broken window - it'll never heal
In einem gut regierten Land ist Armut eine Schande, in einem schlecht regierten Reichtum. (Konfuzius)
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: So 17.09.06 13:11 
Hast Du eigentlich vor, jedes Topic zu ICQ rauszukramen, egal wieviel Jahre es alt ist? Eines von 2005, das hier ist sogar von 2002 ... :roll:

_________________
Zwei Worte werden Dir im Leben viele Türen öffnen - "ziehen" und "drücken".
Xion
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
EE-Maler
Beiträge: 1952
Erhaltene Danke: 128

Windows XP
Delphi (2005, SmartInspect), SQL, Lua, Java (Eclipse), C++ (Visual Studio 2010, Qt Creator), Python (Blender), Prolog (SWIProlog), Haskell (ghci)
BeitragVerfasst: So 17.09.06 13:12 
naja, dann sind wenigstens alle beantwortet :P ne, ich hab mirs dann doch verkniffen, ich hab nämlich noch mehr gefunden ;)

_________________
a broken heart is like a broken window - it'll never heal
In einem gut regierten Land ist Armut eine Schande, in einem schlecht regierten Reichtum. (Konfuzius)
Nemesis II
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 49



BeitragVerfasst: Fr 29.09.06 21:36 
Hallo Leute,

bin grad auch über diesen alten Eintrag gestolpert, und also falls dann doch jemand so einen Source-Code sucht, hier:

ausblenden volle Höhe Delphi-Quelltext
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:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Mask, ShellApi, OleCtrls, SHDocVw, ActiveX, ExtCtrls, MMSystem,
  ComCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    WebBrowser1: TWebBrowser;
    Timer1: TTimer;
    GroupBox1: TGroupBox;
    ComboBox1: TComboBox;
    Button2: TButton;
    Label1: TLabel;
    Label2: TLabel;
    procedure Button2Click(Sender: TObject);
    procedure Timer1Timer(Sender: TObject);
    procedure WebBrowser1DownloadComplete(Sender: TObject);
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}
{$R userstatus} //ist der Ton der einen User als online signalisiert

procedure TForm1.Button1Click(Sender: TObject);
begin
if ComboBox1.ItemIndex =-1 then ShowMessage ('please chose or enter an UIN!'else
begin
Label1.Caption := 'scanning...';
WebBrowser1.Navigate('http://web.icq.com/whitepages/online?icq='+ComboBox1.Items.Strings[ComboBox1.ItemIndex]+'&img=x');
end;
end;

procedure TForm1.WebBrowser1DownloadComplete(Sender: TObject);
begin
Timer1.Enabled := true;
end;

procedure TForm1.Timer1Timer(Sender: TObject);
var
hFind, hRes: THandle;
Song: PChar;
i : INTEGER;
begin
if pos('online1',WebBrowser1.LocationURL)>0 then //in der URL von ICQ die gewählt wird erscheint ein Bild, welches den Status des Users anzeigt, dieser Befehl filter die Bezeichnung des Bildes raus, online0 = offline, online1 = online, online2 = Benutzer existiert nicht oder verweigert die Überprüfung von seinem Status
        begin
            hFind:=FindResource(HInstance, 'userstatus''WAVE'); //spielt die Resource-Datei ab
            if hFind<>0 then
                hRes:=LoadResource(HInstance, hFind);
                if hRes<>0 then
                    begin
                        Song:=LockResource(hRes);
                        if Assigned(Song) then
                        SndPlaySound(Song, snd_ASync or snd_Memory);
                        UnlockResource(hRes);
                    end;
                    FreeResource(hFind);
                    Label2.Caption := 'Userstatus: Online';
        end;
Button1.Click;

if pos('online0',WebBrowser1.LocationURL)>0 then
Label2.Caption := 'Userstatus: Offline';
if WebBrowser1.LocationURL = 'http://web.icq.com/whitepages/online?icq='+ComboBox1.Items.Strings[ComboBox1.ItemIndex]+'&img=x' then
begin
Label2.Caption := 'Userstatus:';
Label1.Caption := 'Connection failed';
ShowMessage ('Connection to Internet failed!');;
end;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
Label1.Caption := 'OFF';
Label2.Caption := 'Userstatus:';
Timer1.Enabled := false;
end;

end.


Also die Funktion ist einfach, du gibst in die ComboBox (meine Nummern sind vorgespeichert) deine gewünschte ICQ Nummer ein, drückst auf Start und los gehts, sobald der User online ist wirds durch ein Label signalisiert, und falls du nicht am PC bist ertönt ein Laut, welcher bei mir in der implementation als {$R userstatus} integriert ist. Der Timer aktualisiert den Status so oft, wie du es ihm angibst.