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
93
94
95
96
|
/*
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 2 of the License, or
(at your option) any later version.
*/
/*
Copyright (C) 2008 Eike Hein <hein@kde.org>
*/
#ifndef CONNECTIONMANAGER_H
#define CONNECTIONMANAGER_H
#include "server.h"
#include "identity.h"
#include <tqobject.h>
class ConnectionSettings;
class ConnectionManager : public TQObject
{
Q_OBJECT
TQ_OBJECT
public:
explicit ConnectionManager(TQObject* tqparent = 0);
~ConnectionManager();
uint connectionCount() const { return m_connectionList.count(); }
TQPtrList<Server> getServerList();
Server* getServerByConnectionId(int connectionId);
Server* getServerByName(const TQString& name);
Server* getAnyServer();
void quitServers();
void toggleGlobalAway();
public slots:
void connectTo(Konversation::ConnectionFlag flag,
const TQString& target,
const TQString& port = "",
const TQString& password = "",
const TQString& nick = "",
const TQString& channel = "",
bool useSSL = false);
void connectTo(Konversation::ConnectionFlag flag, int serverGroupId);
void connectTo(Konversation::ConnectionFlag flag, ConnectionSettings& settings);
signals:
void connectionChangedState(Server* server, Konversation::ConnectionState state);
void connectionChangedAwayState(bool away);
void requestReconnect(Server* server);
void identityOnline(int identityId);
void identityOffline(int identityId);
void closeServerList();
private slots:
void delistConnection(int connectionId);
void handleConnectionStateChange(Server* server, Konversation::ConnectionState state);
void handleReconnect(Server* server);
private:
void enlistConnection(int connectionId, Server* server);
void decodeIrcUrl(const TQString& url, ConnectionSettings& settings);
void decodeAddress(const TQString& address,
ConnectionSettings& settings,
bool checkIfServerGroup = true);
bool reuseExistingConnection(ConnectionSettings& settings, bool interactive);
bool validateIdentity(IdentityPtr identity, bool interactive = true);
TQMap<int, Server*> m_connectionList;
TQValueList<uint> m_activeIdentities;
enum ConnectionDupe { SameServer, SameServerGroup };
};
#endif
|