~ubuntu-branches/ubuntu/saucy/kopete/saucy-proposed

« back to all changes in this revision

Viewing changes to protocols/yahoo/libkyahoo/tests/logintest.cpp

  • Committer: Package Import Robot
  • Author(s): Jonathan Riddell
  • Date: 2013-06-21 02:22:39 UTC
  • Revision ID: package-import@ubuntu.com-20130621022239-63l3zc8p0nf26pt6
Tags: upstream-4.10.80
ImportĀ upstreamĀ versionĀ 4.10.80

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
    Kopete Yahoo Protocol Tests
 
3
    
 
4
    Copyright (c) 2004 Duncan Mac-Vicar P. <duncan@kde.org>
 
5
    
 
6
    Based on code 
 
7
    Copyright (c) 2004 Matt Rogers <matt.rogers@kdemail.net>
 
8
    
 
9
    Kopete (c) 2002-2004 by the Kopete developers <kopete-devel@kde.org>
 
10
 
 
11
    *************************************************************************
 
12
    *                                                                       *
 
13
    * This library is free software; you can redistribute it and/or         *
 
14
    * modify it under the terms of the GNU Lesser General Public            *
 
15
    * License as published by the Free Software Foundation; either          *
 
16
    * version 2 of the License, or (at your option) any later version.      *
 
17
    *                                                                       *
 
18
    *************************************************************************
 
19
*/
 
20
 
 
21
#include "logintest.h"
 
22
#include <kdebug.h>
 
23
#include "../ymsgtransfer.h"
 
24
#include "../yahootypes.h"
 
25
 
 
26
LoginTest::LoginTest(int argc, char ** argv) : QApplication( argc, argv )
 
27
{
 
28
        // set up client stream
 
29
        myConnector = new KNetworkConnector( 0 );
 
30
        //myConnector->setOptHostPort( "localhost", 8300 );
 
31
        myConnector->setOptHostPort( "scs.msg.yahoo.com", 5050 );
 
32
        myClientStream = new ClientStream( myConnector, myConnector);
 
33
        // notify when the transport layer is connected
 
34
        myClient = new Client();
 
35
        // do test once the event loop is running
 
36
        QTimer::singleShot( 0, this, SLOT(slotDoTest()) );
 
37
        connected = false;
 
38
}
 
39
 
 
40
LoginTest::~LoginTest()
 
41
{
 
42
        delete myClientStream;
 
43
        delete myConnector;
 
44
        delete myClient;
 
45
}
 
46
 
 
47
void LoginTest::slotDoTest()
 
48
{
 
49
        QLatin1String server("scs.msg.yahoo.com");
 
50
        // connect to server
 
51
        kDebug(14180) << " connecting to server";
 
52
        
 
53
        connect( myClient, SIGNAL(connected()), SLOT(slotConnected()) );
 
54
        myClient->start( server, 5050, "duncanmacvicar", "**********" );
 
55
        myClient->connectToServer( myClientStream, server, true );
 
56
}
 
57
 
 
58
void LoginTest::slotConnected()
 
59
{       
 
60
        kDebug(14180) << " connection is up";
 
61
        connected = true;
 
62
}
 
63
 
 
64
int main(int argc, char ** argv)
 
65
{
 
66
        LoginTest a( argc, argv );
 
67
        a.exec();
 
68
        if ( !a.isConnected() )
 
69
                return 0;
 
70
}
 
71
 
 
72
#include "logintest.moc"