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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
|
#ifndef _KVI_IRCSERVER_H_
#define _KVI_IRCSERVER_H_
//=============================================================================
//
// File : kvi_ircserver.h
// Creation date : Mon Jul 10 2000 03:24:11 by Szymon Stefanek
//
// This file is part of the KVirc irc client distribution
// Copyright (C) 1999-2004 Szymon Stefanek (pragma at kvirc dot net)
//
// 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 opinion) 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, write to the Free Software Foundation,
// Inc. ,51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
//
//=============================================================================
#include "kvi_settings.h"
#include "kvi_heapobject.h"
#include "kvi_qstring.h"
#include "kvi_pointerlist.h"
#include <qstringlist.h>
class KviConfig;
class KviNickServRuleSet;
class KviProxy;
class KviProxyDataBase;
class KviIrcServer;
#define KVI_IRCSERVER_FLAG_IPV6 1
#define KVI_IRCSERVER_FLAG_CACHEIP 2
#define KVI_IRCSERVER_FLAG_SSL 4
class KVILIB_API KviIrcServerReconnectInfo {
public:
QString m_szNick;
QString m_szAwayReason;
QString m_szJoinChannels;
QStringList m_szOpenQueryes;
bool m_bIsAway;
};
class KVILIB_API KviIrcServer : public KviHeapObject
{
public:
KviIrcServer();
KviIrcServer(const KviIrcServer &serv);
~KviIrcServer();
public:
KviIrcServerReconnectInfo *m_pReconnectInfo;
QString m_szHostname; // the server hostname (or ip eventually)
QString m_szIp; // the server's cached ip (if we're caching)
QString m_szDescription; // the server description
kvi_u32_t m_uPort; // the server's port
unsigned short int m_uFlags; // flags
// Extended data
QString m_szUserIdentityId; // The user identity to use for this server: if empty
// Then use the network identity instead
QString m_szUser; // special username
QString m_szPass; // special password
QString m_szNick; // special nickname
QString m_szRealName; // special real name
QString m_szInitUMode; // special user mode
QString m_szOnConnectCommand; // the command to run on connect
QString m_szOnLoginCommand; // the command to run after login
QString m_szLinkFilter; // the link filter object
QString m_szEncoding; // if empty, use network encoding
QStringList * m_pChannelList; // Channels to auto join
bool m_bAutoConnect; // autoconnect
QString m_szId; // the server's may-be-unique id, may be auto-generated
int m_iProxy; // proxy server's id
public:
int proxy() { return m_iProxy; };
KviProxy* proxyServer(KviProxyDataBase * pDb);
kvi_u32_t port() const { return m_uPort; };
const QString & ipAddress() const { return m_szIp; };
const QString & password() const { return m_szPass; };
const QString & nickName() const { return m_szNick; };
const QString & initUMode() const { return m_szInitUMode; };
const QString & hostName() const { return m_szHostname; };
const QString & ip() const { return m_szIp; };
const QString & onLoginCommand() const { return m_szOnLoginCommand; };
const QString & onConnectCommand() const { return m_szOnConnectCommand; };
const QString & userName() const { return m_szUser; };
const QString & realName() const { return m_szRealName; };
const QString & linkFilter() const { return m_szLinkFilter; };
const QString & description() const { return m_szDescription; };
const QString & encoding() const { return m_szEncoding; };
const QString & id() const { return m_szId; };
const QString & userIdentityId() const { return m_szUserIdentityId; };
bool autoConnect() const { return m_bAutoConnect; };
QStringList* autoJoinChannelList(){ return m_pChannelList; };
bool isIpV6() const { return (m_uFlags & KVI_IRCSERVER_FLAG_IPV6); };
bool useSSL() const { return (m_uFlags & KVI_IRCSERVER_FLAG_SSL); };
bool cacheIp() const { return (m_uFlags & KVI_IRCSERVER_FLAG_CACHEIP); };
void setProxy(int p){ m_iProxy = p; };
void setIpAddress(const QString &a){ m_szIp = a; };
void setPort(kvi_u32_t p){ m_uPort = p; };
void setHostName(const QString &n){ m_szHostname = n; };
void setDescription(const QString &d){ m_szDescription = d; };
void setUserName(const QString &u){ m_szUser = u; };
void setPassword(const QString &p){ m_szPass = p; };
void setNickName(const QString &n){ m_szNick = n; };
void setRealName(const QString &r){ m_szRealName = r; };
void setEncoding(const QString &e){ m_szEncoding = e; };
void setInitUMode(const QString &u){ m_szInitUMode = u; };
void setOnConnectCommand(const QString &cmd){ m_szOnConnectCommand = cmd; };
void setOnLoginCommand(const QString &cmd){ m_szOnLoginCommand = cmd; };
void setLinkFilter(const QString &f){ m_szLinkFilter = f; };
// the channel list must be allocated with new!
void setAutoJoinChannelList(QStringList * pNewChannelList);
void setAutoConnect(bool autoconnect) { m_bAutoConnect = autoconnect; };
void setUserIdentityId(const QString &szUserIdentityId){ m_szUserIdentityId = szUserIdentityId; };
void setIpV6(bool bSet)
{
if(bSet)m_uFlags |= KVI_IRCSERVER_FLAG_IPV6;
else m_uFlags &= ((unsigned short)~KVI_IRCSERVER_FLAG_IPV6);
};
void setUseSSL(bool bSet)
{
if(bSet)m_uFlags |= KVI_IRCSERVER_FLAG_SSL;
else m_uFlags &= ((unsigned short)~KVI_IRCSERVER_FLAG_SSL);
};
void setCacheIp(bool bSet)
{
if(bSet)m_uFlags |= KVI_IRCSERVER_FLAG_CACHEIP;
else m_uFlags &= ((unsigned short)~KVI_IRCSERVER_FLAG_CACHEIP);
};
void operator =(const KviIrcServer &s);
bool load(KviConfig * cfg,const QString &prefix);
void save(KviConfig * cfg,const QString &prefix);
void generateUniqueId();
void setId(const QString &szId){ m_szId = szId; if(m_szId.isEmpty())generateUniqueId(); };
QString ircUri();
};
class KVILIB_API KviIrcNetwork : public KviHeapObject
{
friend class KviIrcServerDataBase;
public:
KviIrcNetwork(const KviIrcNetwork &src);
KviIrcNetwork(const QString &name);
~KviIrcNetwork();
protected:
QString m_szName;
QString m_szDescription;
QString m_szEncoding; // if empty, use system default
QString m_szNickName; // preferred nick name
QString m_szUserName; // preferred user name
QString m_szRealName; // preferred real name
QString m_szOnConnectCommand; // the command to run on connect
QString m_szOnLoginCommand; // the command to run after login
QStringList * m_pChannelList; // Channels to auto join
KviNickServRuleSet * m_pNickServRuleSet; // set of nick serv rules
bool m_bAutoConnect; // autoconnect
QString m_szUserIdentityId; // The user identity to use for this server: if empty
// Then use the global primary identity
public:
const QString & name() const { return m_szName; };
const QString & encoding() const { return m_szEncoding; };
const QString & description() const { return m_szDescription; };
const QString & nickName() const { return m_szNickName; };
const QString & realName() const { return m_szRealName; };
const QString & userName() const { return m_szUserName; };
const QString & onLoginCommand() const { return m_szOnLoginCommand; };
const QString & onConnectCommand() const { return m_szOnConnectCommand; };
const QString & userIdentityId() const { return m_szUserIdentityId; };
bool autoConnect() const { return m_bAutoConnect; };
QStringList* autoJoinChannelList(){ return m_pChannelList; };
KviNickServRuleSet * nickServRuleSet(){ return m_pNickServRuleSet; };
void setNickServRuleSet(KviNickServRuleSet * s);
void copyFrom(const KviIrcNetwork &d);
void setName(const QString &szName){ m_szName = szName; };
void setEncoding(const QString &szEncoding){ m_szEncoding = szEncoding; };
void setDescription(const QString &szDescription){ m_szDescription = szDescription; };
void setOnConnectCommand(const QString &cmd){ m_szOnConnectCommand = cmd; };
void setOnLoginCommand(const QString &cmd){ m_szOnLoginCommand = cmd; };
void setNickName(const QString &n){ m_szNickName = n; };
void setRealName(const QString &r){ m_szRealName = r; };
void setUserName(const QString &u){ m_szUserName = u; };
void setAutoJoinChannelList(QStringList * pNewChannelList);
void setAutoConnect(bool bAutoConnect){ m_bAutoConnect = bAutoConnect; };
void setUserIdentityId(const QString &szUserIdentityId){ m_szUserIdentityId = szUserIdentityId; };
};
#endif //_KVI_IRCSERVER_H_
|