blob: 7687f653acb00012fa8db35e3f4ddf79563aeb89 (
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
#ifndef _THREAD_H_
#define _THREAD_H_
//
// File : thread.h
// Creation date : Tue Sep 20 09 2000 18:28:44 by Szymon Stefanek
//
// This file is part of the KVirc irc client distribution
// Copyright (C) 1999-2000 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_thread.h"
#include "kvi_sockettype.h"
#include "kvi_pointerlist.h"
#include <tqobject.h>
#ifdef COMPILE_SSL_SUPPORT
#include "kvi_ssl.h"
#endif
// KviThreadDataEvent<int>
#define KVI_DCC_THREAD_EVENT_ERROR (KVI_THREAD_USER_EVENT_BASE + 1)
// KviThreadDataEvent<KviStr>
#define KVI_DCC_THREAD_EVENT_DATA (KVI_THREAD_USER_EVENT_BASE + 2)
// KviThreadEvent
#define KVI_DCC_THREAD_EVENT_SUCCESS (KVI_THREAD_USER_EVENT_BASE + 3)
// KviThreadDataEvent<KviStr>
#define KVI_DCC_THREAD_EVENT_MESSAGE (KVI_THREAD_USER_EVENT_BASE + 4)
// KviThreadDataEvent<int>
#define KVI_DCC_THREAD_EVENT_ACTION (KVI_THREAD_USER_EVENT_BASE + 5)
typedef struct _KviDccThreadIncomingData
{
int iLen;
char * buffer;
} KviDccThreadIncomingData;
class KviDccThread : public KviSensitiveThread
{
public:
KviDccThread(TQObject * par,kvi_socket_t fd);
~KviDccThread();
protected:
KviMutex * m_pMutex; // OWNED! PROTECTS m_pOutBuffers
kvi_socket_t m_fd;
TQObject * m_pParent; // READ ONLY!
#ifdef COMPILE_SSL_SUPPORT
KviSSL * m_pSSL;
#endif
protected:
bool handleInvalidSocketRead(int readLen);
public:
TQObject * parent(){ return m_pParent; };
void postErrorEvent(int err);
// Warning!..newer call __tr() here!...use __tr_no_lookup()
void postMessageEvent(const char * message);
#ifdef COMPILE_SSL_SUPPORT
void raiseSSLError();
void setSSL(KviSSL * s);
#endif
};
#endif //_THREAD_H_
|