Communi  3.7.0
A cross-platform IRC framework written with Qt
Public Slots | Public Member Functions | Protected Slots | List of all members
IrcProtocol Class Reference

Implements the IRC protocol and provides means for implementing support for custom protocols. More...

Inherits QObject.

Public Slots

void receiveMessage (IrcMessage *message)
 

Public Member Functions

 IrcProtocol (IrcConnection *connection)
 
 ~IrcProtocol () override
 
virtual void close ()
 
IrcConnectionconnection () const
 
virtual void open ()
 
virtual void read ()
 
QAbstractSocket * socket () const
 
virtual bool write (const QByteArray &data)
 

Protected Slots

void setActiveCapabilities (const QSet< QString > &capabilities)
 
void setAvailableCapabilities (const QSet< QString > &capabilities)
 
void setInfo (const QHash< QString, QString > &info)
 
void setNickName (const QString &name)
 
void setStatus (IrcConnection::Status status)
 

Detailed Description

Since
3.2
See also
IrcConnection::protocol

Constructor & Destructor Documentation

◆ IrcProtocol()

IrcProtocol::IrcProtocol ( IrcConnection connection)
explicit

Constructs a new IRC protocol for connection.

◆ ~IrcProtocol()

IrcProtocol::~IrcProtocol ( )
override

Destructs the IRC protocol.

Member Function Documentation

◆ close()

void IrcProtocol::close ( )
virtual

This method is called when the connection has been lost.

◆ connection()

IrcConnection * IrcProtocol::connection ( ) const

This property holds the connection.

Access function:

◆ open()

void IrcProtocol::open ( )
virtual

This method is called when the connection has been established.

The default implementation sends the NICK, USER and PASSWORD commands as defined in RFC 1459.

Furthermore, it sends a CAP LS command as specified in IRC Client Capabilities Extension.

◆ read()

void IrcProtocol::read ( )
virtual

This method is called when the socket has new data available for read.

The default implementation reads lines as specified in RFC 1459.

See also
socket

◆ receiveMessage

void IrcProtocol::receiveMessage ( IrcMessage message)
slot

This method should be called by the protocol implementation to make the underlying IRC connection receive a message.

See also
IrcConnection::messageReceived()

◆ setActiveCapabilities

void IrcProtocol::setActiveCapabilities ( const QSet< QString > &  capabilities)
protectedslot

This method should be called by the protocol implementation to notify the underlying IRC network about a change in active capabilities.

See also
IrcNetwork::activeCapabilities

◆ setAvailableCapabilities

void IrcProtocol::setAvailableCapabilities ( const QSet< QString > &  capabilities)
protectedslot

This method should be called by the protocol implementation to notify the underlying IRC network about a change in available capabilities.

See also
IrcNetwork::availableCapabilities

◆ setInfo

void IrcProtocol::setInfo ( const QHash< QString, QString > &  info)
protectedslot

This method should be called by the protocol implementation to initialize the underlying IRC network connection info.

See also
IrcNetwork::initialized

◆ setNickName

void IrcProtocol::setNickName ( const QString &  name)
protectedslot

This method should be called by the protocol implementation to notify the underlying IRC connection about a nick name change.

See also
IrcConnection::nickName

◆ setStatus

void IrcProtocol::setStatus ( IrcConnection::Status  status)
protectedslot

This method should be called by the protocol implementation to notify the underlying IRC connection about a status change.

See also
IrcConnection::status

◆ socket()

QAbstractSocket * IrcProtocol::socket ( ) const

This property holds the socket.

Access functions:
  • QAbstractSocket* socket() const

◆ write()

bool IrcProtocol::write ( const QByteArray &  data)
virtual

This method is called when raw data should be written to the socket.

The default implementation writes the data and appends "\r\n" as specified in RFC 1459.

See also
socket