summaryrefslogtreecommitdiffstats
path: root/signet/ServerConnectionHandler.cpp
blob: be5d8e536a2c33a2ece455b69a47f0f25dd3f6cf (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
58
59
60
61
62
63
/*
 * Copyright 2008 Ben Boeckel <MathStuf@gmail.com>
 * 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License along
 * with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

// Header include
#include "ServerConnectionHandler.h"

// Signet includes
#include "Server.h"

// KDE includes
#include <KConfigGroup>

Signet::ServerConnectionHandler::ServerConnectionHandler(Server* server, QObject* parent) :
        ConnectionHandler(parent),
        m_server(server)
{
}

void Signet::ServerConnectionHandler::connectToMaster(const KConfigGroup& group)
{
    // TODO: Get the information from the configuration
    // TODO: Connect to the master
//     QHostAddress masterAddress;
//     int port;
//     QString key;
//     int timeout;
//     if (config->hasGroup("Master Server"))
//     {
//         const KConfigGroup& group = config->group("Master Server");
//         QString address = group.readEntry("Address", "");
//         if (!masterAddress.setAddress(address))
//             qFatal(QString("Invalid address for the master server: %1").arg(address));
//         port = group.readEntry("Port", -1);
//         if (port < 0)
//             qFatal(QString("Invalid port for the master server: %1").arg(port));
//         key = group.readEntry("Key", "");
//         timeout = group.readEntry("Timeout", 30000);
//     }
//     else
//     {
//         // TODO: Configuration not complete
//     }
//     // TODO: Proxy support?
//     m_masterServer->connectToHost(masterAddress, port);
//     if (!m_masterServer->waitForConnect(timeout))
//     {
//         // TODO: Connect failed
//     }
}