Communi  3.0.0
A cross-platform IRC framework written with Qt
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Macros Groups Pages
Public Types | Public Member Functions | Static Public Member Functions | Properties | List of all members
IrcMessage Class Reference

The base class of all messages. More...

Inherits QObject.

Inherited by IrcCapabilityMessage, IrcErrorMessage, IrcInviteMessage, IrcJoinMessage, IrcKickMessage, IrcModeMessage, IrcMotdMessage, IrcNamesMessage, IrcNickMessage, IrcNoticeMessage, IrcNumericMessage, IrcPartMessage, IrcPingMessage, IrcPongMessage, IrcPrivateMessage, IrcQuitMessage, and IrcTopicMessage.

Public Types

enum  Flag { None = 0x0, Own = 0x1, Identified = 0x2, Unidentified = 0x4 }
 
enum  Type {
  Unknown, Capability, Error, Invite,
  Join, Kick, Mode, Motd,
  Names, Nick, Notice, Numeric,
  Part, Ping, Pong, Private,
  Quit, Topic
}
 

Public Member Functions

Q_INVOKABLE IrcMessage (IrcConnection *connection)
 
virtual ~IrcMessage ()
 
QByteArray encoding () const
 
Q_INVOKABLE QByteArray toData () const
 

Static Public Member Functions

static Q_INVOKABLE IrcMessagefromData (const QByteArray &data, IrcConnection *connection)
 
static Q_INVOKABLE IrcMessagefromParameters (const QString &prefix, const QString &command, const QStringList &parameters, IrcConnection *connection)
 

Properties

QString command
 
IrcConnection connection
 
Flags flags
 
QString host
 
QString ident
 
IrcNetwork network
 
QString nick
 
QStringList parameters
 
QString prefix
 
QDateTime timeStamp
 
Type type
 
bool valid
 

Detailed Description

IRC messages are received from an IRC server. IrcConnection translates received messages into IrcMessage instances and emits the IrcConnection::messageReceived() signal upon message received.

Subclasses of IrcMessage contain specialized accessors for parameters that are specific to the particular type of message. See IrcMessage::Type for the list of supported message types.

See Also
IrcConnection::messageReceived(), IrcMessage::Type

Member Enumeration Documentation

This enum describes the supported message flags.

Enumerator
None 

The message has no flags.

Own 

The message is user's own message.

Identified 

The message is identified.

Unidentified 

The message is unidentified.

This enum describes the supported message types.

Enumerator
Unknown 

An unknown message (IrcMessage).

Capability 

A capability message (IrcCapabilityMessage).

Error 

An error message (IrcErrorMessage).

Invite 

An invite message (IrcInviteMessage).

Join 

A join message (IrcJoinMessage).

Kick 

A kick message (IrcKickMessage).

Mode 

A mode message (IrcModeMessage).

Motd 

A message of the day (IrcMotdMessage).

Names 

A names message (IrcNamesMessage).

Nick 

A nick message (IrcNickMessage).

Notice 

A notice message (IrcNoticeMessage).

Numeric 

A numeric message (IrcNumericMessage).

Part 

A part message (IrcPartMessage).

Ping 

A ping message (IrcPingMessage).

Pong 

A pong message (IrcPongMessage).

Private 

A private message (IrcPrivateMessage).

Quit 

A quit message (IrcQuitMessage).

Topic 

A topic message (IrcTopicMessage).

Constructor & Destructor Documentation

IrcMessage::IrcMessage ( IrcConnection connection)
explicit

Constructs a new IrcMessage with connection.

IrcMessage::~IrcMessage ( )
virtual

Destructs the message.

Member Function Documentation

QByteArray IrcMessage::encoding ( ) const

This property holds the FALLBACK encoding for the message.

The fallback encoding is used when the message is detected not to be valid UTF-8 and the consequent auto-detection of message encoding fails. See QTextCodec::availableCodes() for the list of supported encodings.

The default value is ISO-8859-15.

Access functions:
See Also
QTextCodec::availableCodecs(), QTextCodec::codecForLocale()
IrcMessage * IrcMessage::fromData ( const QByteArray data,
IrcConnection connection 
)
static

Creates a new message from data and connection.

IrcMessage * IrcMessage::fromParameters ( const QString prefix,
const QString command,
const QStringList parameters,
IrcConnection connection 
)
static

Creates a new message from prefix, command and parameters with connection.

QByteArray IrcMessage::toData ( ) const

Returns the message as received from an IRC server.

Property Documentation

QString IrcMessage::command
read

This property holds the message command.

Access functions:
IrcConnection * IrcMessage::connection
read

This property holds the message connection.

Access function:
IrcMessage::Flags IrcMessage::flags
read

This property holds the message flags.

Access function:
QString IrcMessage::host
read

This property holds the message sender host.

Host is part of the sender prefix as specified in RFC 1459:

<nick> [ '!' <ident> ] [ '@' <host> ]
Access function:
QString IrcMessage::ident
read

This property holds the message sender ident.

Ident is part of the sender prefix as specified in RFC 1459:

<nick> [ '!' <ident> ] [ '@' <host> ]
Access function:
IrcNetwork * IrcMessage::network
read

This property holds the message network.

Access function:
QString IrcMessage::nick
read

This property holds the message sender nick.

Nick is part of the sender prefix as specified in RFC 1459:

<nick> [ '!' <ident> ] [ '@' <host> ]
Access function:
QStringList IrcMessage::parameters
readwrite

This property holds the message parameters.

Access functions:
QString IrcMessage::prefix
readwrite

This property holds the message sender prefix.

The prefix consists of nick, ident and host as specified in RFC 1459:

<prefix> ::= <nick> [ '!' <ident> ] [ '@' <host> ]
Access functions:
QDateTime IrcMessage::timeStamp
readwrite

This property holds the message time stamp.

Access functions:
IrcMessage::Type IrcMessage::type
read

This property holds the message type.

Access function:
bool IrcMessage::valid
read

This property is true if the message is valid; otherwise false.

A message is considered valid if the prefix is not empty and the parameters match the message.

Access function:
  • bool isValid() const