Defines types of IRC network response message. More...
#include <ircresponsetype.h>
Public Types | |
enum | MsgType { Invalid = 0, HelloClient, RPLISupport, RPLLUserClient, RPLLUserOp, RPLLUserUnknown, RPLLUserChannels, RPLAway, RPLWhoIsRegnick, RPLLUserMe, RPLWhoIsUser, RPLWhoIsServer, RPLWhoIsOperator, RPLWhoIsIdle, RPLEndOfWhoIs, RPLWhoIsChannels, RPLWhoIsSpecial, RPLChannelUrl, RPLCreationTime, RPLWhoIsAccount, RPLTopic, RPLTopicWhoTime, RPLWhoIsBot, RPLWhoIsActually, RPLNamReply, RPLEndOfNames, RPLMOTD, RPLMOTDStart, RPLEndOfMOTD, RPLWhoIsHost, RPLWhoIsModes, ERRNoSuchNick, ERRCannotSendToChan, ERRErroneousNickname, ERRNicknameInUse, ERRChannelIsFull, ERRInviteOnlyChan, ERRBannedFromChan, ERRBadChannelKey, ERRBadChannelMask, ERRNoChanModes, ERRChanOpPrivIsNeeded, RPLWhoIsSecure, Join, Kick, Kill, Mode, Nick, Notice, Part, Ping, PrivMsg, Quit, Topic, NUM_TYPES } |
Represents types defined by RFC 1459. More... | |
Public Member Functions | |
IRCResponseType () | |
Initializes an invalid IRCResponseType object. | |
IRCResponseType (MsgType type) | |
Initializes object with specified type. | |
IRCResponseType (const QString &typeRepresentation) | |
Initializes object by attempting to convert specified string to MsgType through typeFromRfcString(). | |
bool | isCommandResponse () const |
Check if numeric value is between 200 and 399 (inclusive). | |
bool | isErrorMessage () const |
Check if numeric value is equal to or above 400. | |
bool | isValid () const |
Response is valid if type is different than Invalid. | |
int | numericType () const |
If message type can be represented as number, this will contain its value. | |
bool | operator!= (const IRCResponseType &other) const |
bool | operator== (const IRCResponseType &other) const |
QString | toRfcString () const |
String representation of the message type. | |
MsgType | type () const |
Static Public Member Functions | |
static IRCResponseType | fromIntegerResponseValue (int responseType) |
Creates IRCResponseType objects taking numeric value as the more important here. | |
static int | toRfcNumber (MsgType type) |
If type can be represented as an integer, this will convert it. | |
static QString | toRfcString (MsgType type) |
String representation of specified message type. | |
static MsgType | typeFromRfcString (const QString &typeRepresentation) |
Returns MsgType basing on typeRepresentation. | |
Defines types of IRC network response message.
Types are compliant to the response types defined by RFC 1459.
Definition at line 33 of file ircresponsetype.h.
Represents types defined by RFC 1459.
In order to learn what each type represents please refer to RFC 1459 document.
Enumerator | |
---|---|
Invalid |
Type unknown to this IRC client. Messages with Invalid types may still be valid IRC messages that are complaint with the RFC 1459 document. However they may not be supported by this client. |
HelloClient |
001 - sent when client connects. This is the first thing delivered after successful client registration. |
RPLISupport |
005 - all sorts of server flags. |
RPLLUserClient |
251 - how many users on how many servers
|
RPLLUserOp |
252 - how many ops |
RPLLUserUnknown |
253 - how many unknown connections |
RPLLUserChannels |
254 - how many channels, |
RPLAway |
301 |
RPLWhoIsRegnick |
307 - no idea what this is, but we'll treat it the same way we treat RPLWhoIsSpecial. |
RPLLUserMe |
255 - how many clients on how many servers, Server must send that and RPLLUserClient (251). Other values in between are sent only if they are not zero. |
RPLWhoIsUser |
311 |
RPLWhoIsServer |
312 |
RPLWhoIsOperator |
313 |
RPLWhoIsIdle |
317 |
RPLEndOfWhoIs |
318 |
RPLWhoIsChannels |
319 |
RPLWhoIsSpecial |
320 - it's inconclusive what this code means. This source https://www.alien.net.au/irc/irc2numerics.html specified that this can have more than one meaning. I'm not sure what to expect here, but this message will be treated the same as a generic WHOIS reply. |
RPLChannelUrl |
328 |
RPLCreationTime |
329 |
RPLWhoIsAccount |
330 |
RPLTopic |
332 |
RPLTopicWhoTime |
333 |
RPLWhoIsBot |
335 - non-standard |
RPLWhoIsActually |
338 |
RPLNamReply |
353 - names list for a channel |
RPLEndOfNames |
366 - end of names list |
RPLMOTD |
372 - message of the day |
RPLMOTDStart |
375 - start of the message of the day |
RPLEndOfMOTD |
376 - end of the message of the day |
RPLWhoIsHost |
378 |
RPLWhoIsModes |
379 |
ERRNoSuchNick |
401 |
ERRCannotSendToChan |
404 |
ERRErroneousNickname |
432 |
ERRNicknameInUse |
433 |
ERRChanOpPrivIsNeeded |
482 |
RPLWhoIsSecure |
671 |
NUM_TYPES |
Not a real type, denotes number of all types. |
Definition at line 42 of file ircresponsetype.h.
IRCResponseType::IRCResponseType | ( | ) |
Initializes an invalid IRCResponseType object.
Definition at line 25 of file ircresponsetype.cpp.
IRCResponseType::IRCResponseType | ( | MsgType | type | ) |
Initializes object with specified type.
Definition at line 31 of file ircresponsetype.cpp.
IRCResponseType::IRCResponseType | ( | const QString & | typeRepresentation | ) |
Initializes object by attempting to convert specified string to MsgType through typeFromRfcString().
Definition at line 37 of file ircresponsetype.cpp.
|
static |
Creates IRCResponseType objects taking numeric value as the more important here.
The MsgType, returned by type(), in the created object may still point to Invalid value but the numericValue() will be set to whatever was specified as the parameter of this method.
Definition at line 49 of file ircresponsetype.cpp.
|
inline |
Check if numeric value is between 200 and 399 (inclusive).
See: RFC 1459.
Definition at line 287 of file ircresponsetype.h.
|
inline |
Check if numeric value is equal to or above 400.
See: RFC 1459.
Definition at line 297 of file ircresponsetype.h.
|
inline |
Response is valid if type is different than Invalid.
Definition at line 305 of file ircresponsetype.h.
|
inline |
If message type can be represented as number, this will contain its value.
Numeric types values are stored to easilly distinct a message family. For example all errors start with 400 and above.
Definition at line 320 of file ircresponsetype.h.
|
static |
If type can be represented as an integer, this will convert it.
Some IRC message types are represented by words like KILL or PING, but some are represented by numbers like 001, 311, 401, etc. This method will convert MsgType value to numeric value, if such value can be found.
Internally, type is converted to string using the toRfcString() method and then that string is converted to integer.
Definition at line 76 of file ircresponsetype.cpp.
|
static |
String representation of specified message type.
This returns the RFC 1459 representation of the message type!
Definition at line 89 of file ircresponsetype.cpp.
|
inline |
String representation of the message type.
This returns the RFC 1459 representation of the message type!
Definition at line 330 of file ircresponsetype.h.
|
static |
Returns MsgType basing on typeRepresentation.
It is either one of the known and implemented types or Invalid
if string cannot be successfuly converted.
Definition at line 258 of file ircresponsetype.cpp.