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
|
/*
Kopete Yahoo Protocol Tests
Copyright (c) 2004 Duncan Mac-Vicar P. <[email protected]>
Based on code
Copyright (c) 2004 Matt Rogers <[email protected]>
Kopete (c) 2002-2004 by the Kopete developers <[email protected]>
*************************************************************************
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
*************************************************************************
*/
#include "logintest.h"
#include <kdebug.h>
#include "../ymsgtransfer.h"
#include "../yahootypes.h"
LoginTest::LoginTest(int argc, char ** argv) : TQApplication( argc, argv )
{
// set up client stream
myConnector = new KNetworkConnector( 0 );
//myConnector->setOptHostPort( "localhost", 8300 );
myConnector->setOptHostPort( "scs.msg.yahoo.com", 5050 );
myClientStream = new ClientStream( myConnector, myConnector);
// notify when the transport layer is connected
myClient = new Client();
// do test once the event loop is running
TQTimer::singleShot( 0, this, TQ_SLOT( slotDoTest() ) );
connected = false;
}
LoginTest::~LoginTest()
{
delete myClientStream;
delete myConnector;
delete myClient;
}
void LoginTest::slotDoTest()
{
TQString server = TQString::fromLatin1("scs.msg.yahoo.com");
// connect to server
kdDebug(14180) << k_funcinfo << " connecting to server" << endl;
connect( myClient, TQ_SIGNAL( connected() ), TQ_SLOT( slotConnected() ) );
myClient->start( server, 5050, "duncanmacvicar", "**********" );
myClient->connectToServer( myClientStream, server, true );
}
void LoginTest::slotConnected()
{
kdDebug(14180) << k_funcinfo << " connection is up" << endl;
connected = true;
}
int main(int argc, char ** argv)
{
LoginTest a( argc, argv );
a.exec();
if ( !a.isConnected() )
return 0;
}
#include "logintest.moc"
|