KVIrc  4.9.2
DeveloperAPIs
DccBroker.h
Go to the documentation of this file.
1 #ifndef _BROKER_H_
2 #define _BROKER_H_
3 //=============================================================================
4 //
5 // File : DccBroker.h
6 // Creation date : Tue Sep 19 09 2000 10:20:01 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 
29 #include "kvi_settings.h"
30 #include "KviCString.h"
31 #include "KviPointerList.h"
32 #include "KviIrcServerParser.h"
33 #include "KviPointerHashTable.h"
34 
35 #include <QDateTime>
36 #include <QObject>
37 
38 class KviConsoleWindow;
39 class DccBroker;
40 class KviWindow;
41 class DccDialog;
42 
43 // #define COMPILE_DCC_CANVAS
44 
46 {
47 public:
48  QDateTime m_tTimestamp;
49  QString m_szTag;
50  unsigned long m_uFileSize; // outgoing file size, valid only for file transfers obviously
51  unsigned long m_uResumePosition; // if 0 = no resume, valid only for file transfers obviously
52 };
53 
54 class DccBroker : public QObject
55 {
56  Q_OBJECT
57 public:
58  DccBroker();
59  ~DccBroker();
60 
61 protected:
65 
66 public:
68  KviDccZeroPortTag * findZeroPortTag(const QString & szTag);
69  void removeZeroPortTag(const QString & szTag);
70 
71  unsigned int dccWindowsCount() { return m_pDccWindowList->count(); };
72  unsigned int dccBoxCount();
73 
74  void unregisterDccBox(DccDialog * box);
75  void unregisterDccWindow(KviWindow * dcc);
76 
77  void rsendManage(DccDescriptor * dcc);
79 
80  void handleChatRequest(DccDescriptor * dcc);
81 
82 #ifdef COMPILE_DCC_CANVAS
83  void activeCanvasManage(DccDescriptor * dcc);
84  void passiveCanvasExecute(DccDescriptor * dcc);
85 #endif
86 
87  void activeVoiceManage(DccDescriptor * dcc);
89 
90  void activeVideoManage(DccDescriptor * dcc);
92 
93  void recvFileManage(DccDescriptor * dcc);
94  void sendFileManage(DccDescriptor * dcc);
95 
96  bool handleResumeAccepted(const char * filename, const char * port, const char * szZeroPortTag);
97  bool handleResumeRequest(KviDccRequest * dcc, const char * filename, const char * port, unsigned long filePos, const char * szZeroPortTag);
98 
99 public slots:
100  void rsendExecute(DccDialog * box, DccDescriptor * dcc);
101  void rsendExecute(DccDescriptor * dcc);
102 
103  // void activeChatExecute(DccDialog * box,DccDescriptor * dcc);
104  void executeChat(DccDialog * box, DccDescriptor * dcc);
105 
106  void activeCanvasExecute(DccDialog * box, DccDescriptor * dcc);
107  void activeVoiceExecute(DccDialog * box, DccDescriptor * dcc);
108  void activeVideoExecute(DccDialog * box, DccDescriptor * dcc);
109 
110  void sendFileExecute(DccDialog * box, DccDescriptor * dcc);
111  void recvFileExecute(DccDialog * box, DccDescriptor * dcc);
112 
113  void chooseSaveFileName(DccDialog * box, DccDescriptor * dcc);
114  void renameOverwriteResume(DccDialog * box, DccDescriptor * dcc);
115  void renameDccSendFile(DccDialog * box, DccDescriptor * dcc);
116 
117  void cancelDcc(DccDialog * box, DccDescriptor * dcc);
118  void cancelDcc(DccDescriptor * dcc);
119 
120 public:
121  bool canUnload();
122 };
123 
124 #endif
bool canUnload()
Definition: DccBroker.cpp:986
void executeChat(DccDialog *box, DccDescriptor *dcc)
Definition: DccBroker.cpp:332
unsigned int dccWindowsCount()
Definition: DccBroker.h:71
Definition: KviConsoleWindow.h:75
void activeVideoExecute(DccDialog *box, DccDescriptor *dcc)
Definition: DccBroker.cpp:453
unsigned int dccBoxCount()
Definition: DccBroker.cpp:123
DccBroker()
Definition: DccBroker.cpp:61
bool handleResumeRequest(KviDccRequest *dcc, const char *filename, const char *port, unsigned long filePos, const char *szZeroPortTag)
Definition: DccBroker.cpp:1001
void handleChatRequest(DccDescriptor *dcc)
Definition: DccBroker.cpp:285
unsigned int count() const
Returns the count of the items in the list.
Definition: KviPointerList.h:625
KviPointerList< DccDialog > * m_pBoxList
Definition: DccBroker.h:62
Definition: DccBroker.h:45
void activeVoiceManage(DccDescriptor *dcc)
Definition: DccBroker.cpp:359
Definition: DccDialog.h:31
KviPointerList< KviWindow > * m_pDccWindowList
Definition: DccBroker.h:63
Pointer Hash Table.
Definition: DccDescriptor.h:33
QDateTime m_tTimestamp
Definition: DccBroker.h:48
void recvFileManage(DccDescriptor *dcc)
Definition: DccBroker.cpp:577
Definition: KviIrcServerParser.h:74
void removeZeroPortTag(const QString &szTag)
Definition: DccBroker.cpp:118
void rsendManage(DccDescriptor *dcc)
Definition: DccBroker.cpp:157
void passiveVoiceExecute(DccDescriptor *dcc)
Definition: DccBroker.cpp:411
KviDccZeroPortTag * addZeroPortTag()
Definition: DccBroker.cpp:90
KviPointerHashTable< QString, KviDccZeroPortTag > * m_pZeroPortTags
Definition: DccBroker.h:64
void sendFileManage(DccDescriptor *dcc)
Definition: DccBroker.cpp:918
void renameDccSendFile(DccDialog *box, DccDescriptor *dcc)
Definition: DccBroker.cpp:858
C++ Template based double linked pointer list class.
void unregisterDccBox(DccDialog *box)
Definition: DccBroker.cpp:133
Base class for all windows in KVIrc.
Definition: KviWindow.h:74
void passiveVideoExecute(DccDescriptor *dcc)
Definition: DccBroker.cpp:483
void cancelDcc(DccDialog *box, DccDescriptor *dcc)
Definition: DccBroker.cpp:145
void activeVoiceExecute(DccDialog *box, DccDescriptor *dcc)
Definition: DccBroker.cpp:386
unsigned long m_uFileSize
Definition: DccBroker.h:50
void unregisterDccWindow(KviWindow *dcc)
Definition: DccBroker.cpp:128
void renameOverwriteResume(DccDialog *box, DccDescriptor *dcc)
Definition: DccBroker.cpp:765
KviDccZeroPortTag * findZeroPortTag(const QString &szTag)
Definition: DccBroker.cpp:104
QString m_szTag
Definition: DccBroker.h:49
void activeVideoManage(DccDescriptor *dcc)
Definition: DccBroker.cpp:426
This file contains compile time settings.
void recvFileExecute(DccDialog *box, DccDescriptor *dcc)
Definition: DccBroker.cpp:900
void activeCanvasExecute(DccDialog *box, DccDescriptor *dcc)
Definition: DccBroker.cpp:552
bool handleResumeAccepted(const char *filename, const char *port, const char *szZeroPortTag)
Definition: DccBroker.cpp:996
void rsendExecute(DccDialog *box, DccDescriptor *dcc)
Definition: DccBroker.cpp:274
~DccBroker()
Definition: DccBroker.cpp:77
Definition: DccBroker.h:54
void rsendAskForFileName(DccDescriptor *dcc)
Definition: DccBroker.cpp:167
void chooseSaveFileName(DccDialog *box, DccDescriptor *dcc)
Definition: DccBroker.cpp:666
unsigned long m_uResumePosition
Definition: DccBroker.h:51
void sendFileExecute(DccDialog *box, DccDescriptor *dcc)
Definition: DccBroker.cpp:954