KVIrc  4.9.2
DeveloperAPIs
DccChatWindow.h
Go to the documentation of this file.
1 #ifndef _CHAT_H_
2 #define _CHAT_H_
3 //=============================================================================
4 //
5 // File : DccChatWindow.h
6 // Creation date : Tue Sep 20 09 2000 15:11:12 by Szymon Stefanek
7 //
8 // This file is part of the KVIrc IRC client distribution
9 // Copyright (C) 2000-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 
27 #include "DccDescriptor.h"
28 #include "DccThread.h"
29 #include "DccWindow.h"
30 
31 #include "KviDataBuffer.h"
32 #include "KviPointerList.h"
33 #include "KviThemedLabel.h"
34 #include "KviCString.h"
35 #include "KviWindow.h"
36 #include "KviError.h"
37 
38 #ifdef COMPILE_SSL_SUPPORT
39 class KviSSL;
40 #endif
41 
42 class DccMarshal;
43 class QSplitter;
44 
45 class DccChatThread : public DccThread
46 {
47 public:
50 
51 protected:
53 
54 protected:
55  virtual void run();
56  bool tryFlushOutBuffers();
57  // This should handle the incoming data buffer
58  // must "eat" some data from data.buffer, memmove the remaining part
59  // to the beginning, kvi_realloc data.buffer and update data.iLen
60  // If bCritical is true, it should handle the whole data buffer
61  // since the thread is going to die
62  // It should return true if the handing was succesfull
63  // or false if the thread should be stopped
64  virtual bool handleIncomingData(KviDccThreadIncomingData * data, bool bCritical);
65 
66 public:
67  virtual void sendRawData(const void * buffer, int len); // mutex (m_pOutBuffers usage)
68 };
69 
70 class DccChatWindow : public DccWindow
71 {
72  Q_OBJECT
73 public:
74  DccChatWindow(DccDescriptor * dcc, const char * name);
76  QFrame * buttonContainer() { return (QFrame *)m_pButtonContainer; };
77 protected:
79  QString m_szTarget;
80  QString m_szLocalNick;
84 
85 protected:
86  virtual const QString & target();
87  virtual void fillCaptionBuffers();
88  virtual void getBaseLogFileName(QString & buffer);
89  virtual QPixmap * myIconPtr();
90  virtual void resizeEvent(QResizeEvent * e);
91  virtual QSize sizeHint() const;
92  virtual const QString & localNick();
93  virtual bool event(QEvent * e);
94  virtual void ownMessage(const QString & text, bool bUserFeedback = true);
95  virtual void ownAction(const QString & text);
96  virtual void triggerCreationEvents();
97  virtual void triggerDestructionEvents();
98  void startConnection();
99  virtual DccThread * getSlaveThread() { return m_pSlaveThread; };
100 protected slots:
101  void handleMarshalError(KviError::Code eError);
102  void connected();
103  void sslError(const char * msg);
104  void connectionInProgress();
105  void startingSSLHandshake();
106  void textViewRightClicked();
107 };
108 
109 #endif //_CHAT_H_
virtual void getBaseLogFileName(QString &buffer)
Definition: DccChatWindow.cpp:295
int kvi_socket_t
Definition: kvi_sockettype.h:40
Toolkit Abstraction Layer: hbox class.
Definition: KviTalHBox.h:44
virtual QSize sizeHint() const
Definition: DccChatWindow.cpp:545
DccChatThread(KviWindow *wnd, kvi_socket_t fd)
Definition: DccChatWindow.cpp:602
virtual bool handleIncomingData(KviDccThreadIncomingData *data, bool bCritical)
Definition: DccChatWindow.cpp:753
KviTalHBox * m_pButtonContainer
Definition: DccChatWindow.h:83
Definition: DccThread.h:49
virtual QPixmap * myIconPtr()
Definition: DccChatWindow.cpp:290
QFrame * buttonContainer()
Definition: DccChatWindow.h:76
void sslError(const char *msg)
Definition: DccChatWindow.cpp:258
Definition: DccWindow.h:34
void startConnection()
Definition: DccChatWindow.cpp:148
virtual void triggerCreationEvents()
Definition: DccChatWindow.cpp:138
KviPointerList< KviDataBuffer > * m_pOutBuffers
Definition: DccChatWindow.h:52
DccChatThread * m_pSlaveThread
Definition: DccChatWindow.h:76
~DccChatWindow()
Definition: DccChatWindow.cpp:121
virtual DccThread * getSlaveThread()
Definition: DccChatWindow.h:99
Definition: DccChatWindow.h:45
#define e
Definition: detector.cpp:69
void handleMarshalError(KviError::Code eError)
Definition: DccChatWindow.cpp:552
Definition: DccMarshal.h:56
Definition: DccDescriptor.h:33
KviThemedLabel * m_pLabel
Definition: DccChatWindow.h:81
Definition: DccThread.h:55
virtual void ownAction(const QString &text)
Definition: DccChatWindow.cpp:390
void connected()
Definition: DccChatWindow.cpp:559
virtual void run()
Definition: DccChatWindow.cpp:615
Code
Contains all error codes.
Definition: KviError.h:47
QString m_szLocalNick
Definition: DccChatWindow.h:80
~DccChatThread()
Definition: DccChatWindow.cpp:609
virtual void fillCaptionBuffers()
Definition: DccChatWindow.cpp:277
virtual const QString & localNick()
Definition: DccChatWindow.cpp:383
void connectionInProgress()
Definition: DccChatWindow.cpp:176
virtual void sendRawData(const void *buffer, int len)
Definition: DccChatWindow.cpp:821
virtual void triggerDestructionEvents()
Definition: DccChatWindow.cpp:143
virtual bool event(QEvent *e)
Definition: DccChatWindow.cpp:419
C++ Template based double linked pointer list class.
Base class for all windows in KVIrc.
Definition: KviWindow.h:74
virtual void ownMessage(const QString &text, bool bUserFeedback=true)
Definition: DccChatWindow.cpp:300
Definition: KviThemedLabel.h:33
QString m_szTarget
Definition: DccChatWindow.h:79
Error List.
QString name()
Definition: KviRuntimeInfo.cpp:655
Contains the KviWindow class.
virtual void resizeEvent(QResizeEvent *e)
Definition: DccChatWindow.cpp:536
DccChatWindow(DccDescriptor *dcc, const char *name)
Definition: DccChatWindow.cpp:76
bool tryFlushOutBuffers()
Definition: DccChatWindow.cpp:828
void textViewRightClicked()
Definition: DccChatWindow.cpp:133
Definition: DccChatWindow.h:70
KviTalHBox * m_pButtonBox
Definition: DccChatWindow.h:82
virtual const QString & target()
Definition: DccChatWindow.cpp:266
void startingSSLHandshake()
Definition: DccChatWindow.cpp:250