Doomseeker
Wadseeker
Download
Tracker
Git
Docs
Main Page
Plugin API
Related Pages
Modules
Classes
Files
File List
File Members
All
Classes
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Groups
Pages
src
core
irc
constants
ircresponsetype.h
1
//------------------------------------------------------------------------------
2
// ircresponsetype.h
3
//------------------------------------------------------------------------------
4
//
5
// This library is free software; you can redistribute it and/or
6
// modify it under the terms of the GNU Lesser General Public
7
// License as published by the Free Software Foundation; either
8
// version 2.1 of the License, or (at your option) any later version.
9
//
10
// This library is distributed in the hope that it will be useful,
11
// but WITHOUT ANY WARRANTY; without even the implied warranty of
12
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
// Lesser General Public License for more details.
14
//
15
// You should have received a copy of the GNU Lesser General Public
16
// License along with this library; if not, write to the Free Software
17
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18
// 02110-1301 USA
19
//
20
//------------------------------------------------------------------------------
21
// Copyright (C) 2011 "Zalewa" <zalewapl@gmail.com>
22
//------------------------------------------------------------------------------
23
#ifndef __IRCRESPONSETYPE_H__
24
#define __IRCRESPONSETYPE_H__
25
26
#include <QString>
27
33
class
IRCResponseType
34
{
35
public
:
42
enum
MsgType
43
{
44
// === IMPORTANT!!! ===
45
// Remember to fix toRfcString() if values here change!
46
// Also IRCResponseParser::parseMessage() must be
47
// fixed.
48
56
Invalid
= 0,
57
64
HelloClient
,
65
66
// === Here are types with no text representation ===
67
71
RPLISupport
,
72
78
RPLLUserClient
,
79
81
RPLLUserOp
,
82
84
RPLLUserUnknown
,
85
87
RPLLUserChannels
,
88
90
RPLAway
,
91
96
RPLWhoIsRegnick
,
97
104
RPLLUserMe
,
105
107
RPLWhoIsUser
,
108
110
RPLWhoIsServer
,
111
113
RPLWhoIsOperator
,
114
116
RPLWhoIsIdle
,
117
119
RPLEndOfWhoIs
,
120
122
RPLWhoIsChannels
,
123
132
RPLWhoIsSpecial
,
133
135
RPLChannelUrl
,
136
138
RPLCreationTime
,
139
141
RPLWhoIsAccount
,
142
144
RPLTopic
,
145
147
RPLTopicWhoTime
,
148
150
RPLWhoIsBot
,
151
153
RPLWhoIsActually
,
154
156
RPLNamReply
,
157
159
RPLEndOfNames
,
160
162
RPLMOTD
,
163
165
RPLMOTDStart
,
166
168
RPLEndOfMOTD
,
169
171
RPLWhoIsHost
,
172
174
RPLWhoIsModes
,
175
176
// === Here are errors with no text representation ===
177
179
ERRNoSuchNick
,
180
182
ERRCannotSendToChan
,
183
185
ERRErroneousNickname
,
187
ERRNicknameInUse
,
188
189
ERRChannelIsFull,
// 471
190
ERRInviteOnlyChan,
// 473
191
ERRBannedFromChan,
// 474
192
ERRBadChannelKey,
// 475
193
ERRBadChannelMask,
// 476
194
ERRNoChanModes,
// 477
195
197
ERRChanOpPrivIsNeeded
,
198
200
RPLWhoIsSecure
,
201
202
// === Here are types which convert to their string counterparts
203
// === letter-by-letter
204
205
Join,
206
Kick,
207
Kill,
208
Mode,
209
Nick,
210
Notice,
211
Part,
212
Ping,
213
PrivMsg,
214
Quit,
215
Topic,
216
218
NUM_TYPES
219
};
220
229
static
IRCResponseType
fromIntegerResponseValue
(
int
responseType);
230
246
static
int
toRfcNumber
(
MsgType
type);
247
256
static
QString
toRfcString
(
MsgType
type);
257
264
static
MsgType
typeFromRfcString
(
const
QString &typeRepresentation);
265
269
IRCResponseType
();
270
274
IRCResponseType
(
MsgType
type);
275
280
IRCResponseType
(
const
QString &typeRepresentation);
281
287
bool
isCommandResponse
()
const
288
{
289
return
d.numericType >= 200 && d.numericType <= 399;
290
}
291
297
bool
isErrorMessage
()
const
298
{
299
return
d.numericType >= 400;
300
}
301
305
bool
isValid
()
const
306
{
307
return
d.type !=
Invalid
;
308
}
309
310
bool
operator==(
const
IRCResponseType
&other)
const
;
311
bool
operator!=(
const
IRCResponseType
&other)
const
;
312
320
int
numericType
()
const
321
{
322
return
d.numericType;
323
}
324
330
QString
toRfcString
()
const
331
{
332
return
toRfcString
(d.type);
333
}
334
335
MsgType
type()
const
336
{
337
return
d.type;
338
}
339
340
private
:
341
class
PrivData
342
{
343
public
:
348
int
numericType
;
349
MsgType
type;
350
};
351
352
PrivData
d;
353
};
354
355
#endif
Doomseeker © 2009-2024 The Doomseeker Team