summaryrefslogtreecommitdiffstats
path: root/kopete/protocols/yahoo/libkyahoo/tests/clientstream_test.cpp
blob: 31a5b99f3c66375f387c58321bd6b0ec27517448 (plain)
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
//Licensed under the GNU General Public License

#include "clientstream_test.h"
#include <kdebug.h>
#include "../ymsgtransfer.h"
#include "../yahootypes.h"

ClientStreamTest::ClientStreamTest(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 );
	myTestObject = new ClientStream( myConnector, myConnector);
	// notify when the transport layer is connected
	connect( myTestObject, TQ_SIGNAL( connected() ), TQ_SLOT( slotConnected() ) );
	// notify and start sending
	//connect( myTestObject, TQ_SIGNAL( warning(int) ), TQ_SLOT( slotWarning(int) ) );

	// do test once the event loop is running
	TQTimer::singleShot( 0, this, TQ_SLOT( slotDoTest() ) );
	connected = false;
}

ClientStreamTest::~ClientStreamTest()
{
	delete myTestObject;
	delete myConnector;
}

void ClientStreamTest::slotDoTest()
{
	TQString server = TQString::fromLatin1("scs.msg.yahoo.com");
	// connect to server
	kdDebug(14180) << k_funcinfo << " connecting to server" << endl;
	myTestObject->connectToServer( server, true ); // fine up to here...
}

void ClientStreamTest::slotConnected()
{
	kdDebug(14180) << k_funcinfo << " connection is up" << endl;
	connected = true;
	YMSGTransfer *t = new YMSGTransfer(Yahoo::ServiceLogon);
	t->setParam( 1, "kopetetest");
	
	myTestObject->write(t);
	while(1);
}

int main(int argc, char ** argv)
{
	ClientStreamTest a( argc, argv );
	a.exec();
	return 0;
}

#include "clientstream_test.moc"