KVIrc  4.9.2
DeveloperAPIs
KviIrcConnectionStateData.h
Go to the documentation of this file.
1 #ifndef _KVI_IRCCONNECTIONSTATEDATA_H_
2 #define _KVI_IRCCONNECTIONSTATEDATA_H_
3 //=============================================================================
4 //
5 // File : KviIrcConnectionStateData.h
6 // Creation date : Sat 26 Jun 2004 09:31:52 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 
27 #include "kvi_settings.h"
28 #include "KviTimeUtils.h"
29 #include "KviQString.h"
30 
31 #include <QStringList>
32 
33 //
34 // This class is used as container for miscellaneous connection state variables
35 // that do not have a class for their own.
36 // If you need to add some "minor" variable to the connection state then
37 // this is the right place for it.
38 //
39 
41 {
42  friend class KviIrcConnection;
43  friend class KviIrcServerParser;
44  friend class KviUserParser;
45 
46 public:
49 
50 protected:
51  // The members of this enum must be in the correct
52  // order since the nickname selection algorithm
53  // uses their numeric values for comparisons.
55  {
71  UsedManualNickname // Given up assigning it automatically
72  };
73 
78 
79  bool m_bInsideInitialCapLs; // true if there's a CAP LS request pending
89  bool m_bIgnoreOneYouHaveNotRegisteredError; // true if we have sent a CAP LS request followed by a PING which will generate an error (and we need to ignore it)
90  bool m_bInsideInitialCapReq; // true if there's a CAP REQ request pending
91  bool m_bInsideAuthenticate; // true if there's a AUTHENTICATE request pending
92  bool m_bSentStartTls; // the state of STARTTLS protocol
93  bool m_bSentQuit; // have we sent the quit message for this connection ?
94  QString m_szCommandToExecAfterConnect; // yes.. this is a special command to execute after connection
95  bool m_bSimulateUnexpectedDisconnect; // this is set to true if we have to simulate an unexpected disconnect even if we have sent a normal quit message
96  kvi_time_t m_tLastReceivedChannelWhoReply; // the time that we have received our last channel who reply
97  kvi_time_t m_tLastSentChannelWhoRequest; // the time that we have sent our last channel who request
98  kvi_time_t m_tLastReceivedWhoisReply; // the time that we have received the last whois reply, reset to 0 when we receive an /END OF WHOIS
99  QStringList m_lEnabledCaps; // the CAPs currently enabled
100  bool m_bIdentifyMsgCapabilityEnabled; // do we have the msg-identity CAP enabled ?
101 public:
105  void setLoginNickNameState(const LoginNickNameState & eLoginNickNameState)
106  {
107  m_eLoginNickNameState = eLoginNickNameState;
108  }
109 
114  {
115  return m_eLoginNickNameState;
116  }
117 
118  const QStringList & enabledCaps() { return m_lEnabledCaps; };
119  void changeEnabledCapList(const QString & szCapList);
120 
122  {
123  return m_bIdentifyMsgCapabilityEnabled;
124  };
125 
126  bool sentStartTls() { return m_bSentStartTls; };
127  void setSentStartTls() { m_bSentStartTls = true; };
128 
129  bool isInsideAuthenticate() { return m_bInsideAuthenticate; };
130  void setInsideAuthenticate(bool bInside) { m_bInsideAuthenticate = bInside; };
131 
132  bool isInsideInitialCapLs() { return m_bInsideInitialCapLs; };
133  void setInsideInitialCapLs(bool bInside) { m_bInsideInitialCapLs = bInside; };
134 
135  bool isInsideInitialStartTls() { return m_bInsideInitialStartTls; };
136  void setInsideInitialStartTls(bool bInside) { m_bInsideInitialStartTls = bInside; };
137 
139  {
140  m_bIgnoreOneYouHaveNotRegisteredError = bIgnore;
141  };
143  {
144  return m_bIgnoreOneYouHaveNotRegisteredError;
145  };
146 
147  bool isInsideInitialCapReq() { return m_bInsideInitialCapReq; };
148  void setInsideInitialCapReq(bool bInside) { m_bInsideInitialCapReq = bInside; };
149 
150  bool sentQuit() { return m_bSentQuit; };
151  void setSentQuit() { m_bSentQuit = true; };
152 
153  kvi_time_t lastReceivedChannelWhoReply() { return m_tLastReceivedChannelWhoReply; };
154  void setLastReceivedChannelWhoReply(kvi_time_t tTime) { m_tLastReceivedChannelWhoReply = tTime; };
155 
156  kvi_time_t lastSentChannelWhoRequest() { return m_tLastSentChannelWhoRequest; };
157  void setLastSentChannelWhoRequest(kvi_time_t tTime) { m_tLastSentChannelWhoRequest = tTime; };
158 
159  kvi_time_t lastReceivedWhoisReply() { return m_tLastReceivedWhoisReply; };
160  void setLastReceivedWhoisReply(kvi_time_t tTime) { m_tLastReceivedWhoisReply = tTime; };
161 
162  bool simulateUnexpectedDisconnect() { return m_bSimulateUnexpectedDisconnect; };
163  void setSimulateUnexpectedDisconnect(bool bSimulate) { m_bSimulateUnexpectedDisconnect = bSimulate; };
164 
165  const QString & commandToExecAfterConnect() { return m_szCommandToExecAfterConnect; };
166  void setCommandToExecAfterConnect(const QString & szCmd) { m_szCommandToExecAfterConnect = szCmd; };
167 };
168 
169 #endif
kvi_time_t lastSentChannelWhoRequest()
Definition: KviIrcConnectionStateData.h:156
Definition: KviIrcConnectionStateData.h:66
void setInsideInitialCapReq(bool bInside)
Definition: KviIrcConnectionStateData.h:148
bool m_bIgnoreOneYouHaveNotRegisteredError
Definition: KviIrcConnectionStateData.h:89
Definition: KviIrcConnectionStateData.h:57
bool m_bSimulateUnexpectedDisconnect
Definition: KviIrcConnectionStateData.h:95
const QString & commandToExecAfterConnect()
Definition: KviIrcConnectionStateData.h:165
#define KVIRC_API
Definition: kvi_settings.h:128
bool ignoreOneYouHaveNotRegisteredError() const
Definition: KviIrcConnectionStateData.h:142
bool isInsideInitialStartTls()
Definition: KviIrcConnectionStateData.h:135
kvi_time_t m_tLastReceivedChannelWhoReply
Definition: KviIrcConnectionStateData.h:96
bool isInsideInitialCapReq()
Definition: KviIrcConnectionStateData.h:147
Definition: KviIrcConnectionStateData.h:69
An abstraction of a connection to an IRC server.
Definition: KviIrcConnection.h:95
kvi_time_t m_tLastSentChannelWhoRequest
Definition: KviIrcConnectionStateData.h:97
const LoginNickNameState & loginNickNameState() const
Definition: KviIrcConnectionStateData.h:113
Definition: KviIrcConnectionStateData.h:70
void setInsideAuthenticate(bool bInside)
Definition: KviIrcConnectionStateData.h:130
void setInsideInitialStartTls(bool bInside)
Definition: KviIrcConnectionStateData.h:136
bool isInsideInitialCapLs()
Definition: KviIrcConnectionStateData.h:132
Definition: KviIrcConnectionStateData.h:56
Definition: KviIrcConnectionStateData.h:68
#define kvi_time_t
Definition: KviTimeUtils.h:43
kvi_time_t lastReceivedChannelWhoReply()
Definition: KviIrcConnectionStateData.h:153
void setSentQuit()
Definition: KviIrcConnectionStateData.h:151
bool m_bIdentifyMsgCapabilityEnabled
Definition: KviIrcConnectionStateData.h:100
QStringList m_lEnabledCaps
Definition: KviIrcConnectionStateData.h:99
bool m_bSentQuit
Definition: KviIrcConnectionStateData.h:93
void setSimulateUnexpectedDisconnect(bool bSimulate)
Definition: KviIrcConnectionStateData.h:163
bool m_bInsideInitialStartTls
Definition: KviIrcConnectionStateData.h:88
bool sentStartTls()
Definition: KviIrcConnectionStateData.h:126
void setLastReceivedChannelWhoReply(kvi_time_t tTime)
Definition: KviIrcConnectionStateData.h:154
void setCommandToExecAfterConnect(const QString &szCmd)
Definition: KviIrcConnectionStateData.h:166
bool identifyMsgCapabilityEnabled() const
Definition: KviIrcConnectionStateData.h:121
LoginNickNameState m_eLoginNickNameState
Definition: KviIrcConnectionStateData.h:77
bool m_bInsideInitialCapReq
Definition: KviIrcConnectionStateData.h:90
bool sentQuit()
Definition: KviIrcConnectionStateData.h:150
Definition: KviIrcConnectionStateData.h:65
Definition: KviIrcConnectionStateData.h:67
bool m_bInsideInitialCapLs
Definition: KviIrcConnectionStateData.h:79
Time management.
void setLastReceivedWhoisReply(kvi_time_t tTime)
Definition: KviIrcConnectionStateData.h:160
void setInsideInitialCapLs(bool bInside)
Definition: KviIrcConnectionStateData.h:133
void setLoginNickNameState(const LoginNickNameState &eLoginNickNameState)
Definition: KviIrcConnectionStateData.h:105
bool simulateUnexpectedDisconnect()
Definition: KviIrcConnectionStateData.h:162
bool m_bInsideAuthenticate
Definition: KviIrcConnectionStateData.h:91
void setIgnoreOneYouHaveNotRegisteredError(bool bIgnore)
Definition: KviIrcConnectionStateData.h:138
Definition: KviIrcConnectionStateData.h:63
const QStringList & enabledCaps()
Definition: KviIrcConnectionStateData.h:118
Definition: KviIrcConnectionStateData.h:59
Definition: KviIrcConnectionStateData.h:40
Definition: KviIrcServerParser.h:115
void setSentStartTls()
Definition: KviIrcConnectionStateData.h:127
Definition: KviIrcConnectionStateData.h:64
kvi_time_t lastReceivedWhoisReply()
Definition: KviIrcConnectionStateData.h:159
QString m_szCommandToExecAfterConnect
Definition: KviIrcConnectionStateData.h:94
void setLastSentChannelWhoRequest(kvi_time_t tTime)
Definition: KviIrcConnectionStateData.h:157
This file contains compile time settings.
bool isInsideAuthenticate()
Definition: KviIrcConnectionStateData.h:129
bool m_bSentStartTls
Definition: KviIrcConnectionStateData.h:92
Helper functions for the QString class.
kvi_time_t m_tLastReceivedWhoisReply
Definition: KviIrcConnectionStateData.h:98
Definition: KviIrcConnectionStateData.h:61
LoginNickNameState
Definition: KviIrcConnectionStateData.h:54