KVIrc 5.2.0
Developer APIs
KviIrcLink.h
Go to the documentation of this file.
1#ifndef _KVI_IRCLINK_H_
2#define _KVI_IRCLINK_H_
3//=============================================================================
4//
5// File : KviIrcLink.h
6// Creation date : Mon 03 May 2004 01:45:42 by Szymon Stefanek
7//
8// This file is part of the KVIrc IRC client distribution
9// Copyright (C) 2004-2010 Szymon Stefanek <pragma at kvirc dot net>
10//
11// This program is FREE software. You can redistribute it and/or
12// modify it under the terms of the GNU General Public License
13// as published by the Free Software Foundation; either version 2
14// of the License, or (at your option) any later version.
15//
16// This program is distributed in the HOPE that it will be USEFUL,
17// but WITHOUT ANY WARRANTY; without even the implied warranty of
18// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
19// See the GNU General Public License for more details.
20//
21// You should have received a copy of the GNU General Public License
22// along with this program. If not, write to the Free Software Foundation,
23// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24//
25//=============================================================================
26
33#include "kvi_settings.h"
34#include "KviQString.h"
35
36#include <QObject>
37
39class KviIrcServer;
40class KviProxy;
41class KviIrcSocket;
42class KviDnsResolver;
46class KviDataBuffer;
48
55class KVIRC_API KviIrcLink : public QObject
56{
57 friend class KviIrcConnection; // upper protocol in the stack
58 friend class KviIrcSocket; // lower protocol in the stack
59 Q_OBJECT
60public:
64 enum State
65 {
68 Connected
69 };
70
71protected:
84 KviIrcLink(KviIrcConnection * pConnection);
85
90
91private:
92 KviIrcConnection * m_pConnection; // shallow, never null
93 KviIrcConnectionTarget * m_pTarget; // shallow, never null
94 KviConsoleWindow * m_pConsole; // shallow, never null
95 KviIrcSocket * m_pSocket = nullptr; // owned, may be null!
96 KviMexLinkFilter * m_pLinkFilter = nullptr; // owned, may be null!
97
98 State m_eState = Idle;
99
100 char * m_pReadBuffer = nullptr; // incoming data buffer
101 unsigned int m_uReadBufferLen = 0; // incoming data buffer length
102 unsigned int m_uReadPackets = 0; // total packets read per session
103
104 KviIrcConnectionTargetResolver * m_pResolver = nullptr; // owned
105public:
112 KviIrcSocket * socket() const { return m_pSocket; }
113
120 KviIrcConnection * connection() const { return m_pConnection; }
121
128 KviConsoleWindow * console() const { return m_pConsole; }
129
134 State state() const { return m_eState; }
135protected:
146 virtual bool sendPacket(KviDataBuffer * pData);
147
153 virtual void clearOutputQueue(bool bPrivateMessagesOnly);
154
159 unsigned int outputQueueSize();
160
165 void abort();
166
167protected:
177 void start();
178
179protected:
190 void processData(char * buffer, int iLength);
191
196 void socketStateChange();
197protected slots:
205 void linkFilterDestroyed();
206
207private:
212 void destroySocket();
213
219 void createSocket(const QString & szLinkFilterName);
220signals:
226private slots:
231 void resolverTerminated();
232};
233
234#endif //_KVI_IRCLINK_H_
Helper functions for the QString class.
m_pSocket
Definition KvsObject_socket.cpp:314
Definition Idle.h:33
Definition KviConsoleWindow.h:74
Definition KviDataBuffer.h:31
The KviDnsResolver class.
Definition KviDnsResolver.h:90
Definition KviIrcConnectionTargetResolver.h:53
Definition KviIrcConnectionTarget.h:36
An abstraction of a connection to an IRC server.
Definition KviIrcConnection.h:97
The class which manages the irc servers.
Definition KviIrcServer.h:52
This class is the lowest level of the KVIrc networking stack.
Definition KviIrcSocket.h:75
Definition KviMexLinkFilter.h:35
Definition KviProxy.h:37
This file contains compile time settings.
#define KVIRC_API
Definition kvi_settings.h:127