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

Keeps track of buffer status. More...

Inherits QObject.

Inherited by IrcChannel.

Public Slots

virtual void close (const QString &reason=QString())
 
void receiveMessage (IrcMessage *message)
 

Signals

void messageReceived (IrcMessage *message)
 

Public Member Functions

Q_INVOKABLE IrcBuffer (QObject *parent=nullptr)
 
 ~IrcBuffer () override
 
virtual IrcBufferclone (QObject *parent=nullptr)
 
IrcConnectionconnection () const
 
IrcBufferModelmodel () const
 
QString name () const
 
IrcNetworknetwork () const
 
QString prefix () const
 
Q_INVOKABLE bool sendCommand (IrcCommand *command)
 
QString title () const
 
Q_INVOKABLE IrcChanneltoChannel ()
 
QVariantMap userData () const
 

Properties

bool active
 
bool channel
 
bool persistent
 
bool sticky
 

Detailed Description

See also
IrcBufferModel

Constructor & Destructor Documentation

◆ IrcBuffer()

IrcBuffer::IrcBuffer ( QObject *  parent = nullptr)
explicit

Constructs a new buffer object with parent.

◆ ~IrcBuffer()

IrcBuffer::~IrcBuffer ( )
override

Destructs the buffer object.

Member Function Documentation

◆ clone()

IrcBuffer * IrcBuffer::clone ( QObject *  parent = nullptr)
virtual
Since
3.7

Clones the buffer with an optional parent.

Reimplemented in IrcChannel.

◆ close

void IrcBuffer::close ( const QString &  reason = QString())
virtualslot
Since
3.1

Closes the buffer with an optional reason.

The default implementation removes the buffer from its model. Furthermore, IrcChannel parts the channel with reason and custom IrcBuffer subclasses might do some additional tasks.

See also
IrcChannel::close()

◆ connection()

IrcConnection * IrcBuffer::connection ( ) const

This property holds the connection of the buffer.

Access function:

◆ messageReceived

void IrcBuffer::messageReceived ( IrcMessage message)
signal

◆ model()

IrcBufferModel * IrcBuffer::model ( ) const

This property holds the model of the buffer.

Access function:

◆ name()

QString IrcBuffer::name ( ) const

This property holds the name part of the buffer title.

Access functions:
  • QString name() const
  • void setName(const QString& name) [slot]
Notifier signal:
  • void nameChanged(const QString& name)

◆ network()

IrcNetwork * IrcBuffer::network ( ) const

This property holds the network of the buffer.

Access function:

◆ prefix()

QString IrcBuffer::prefix ( ) const

This property holds the prefix part of the buffer title.

Access functions:
  • QString prefix() const
  • void setPrefix(const QString& prefix) [slot]
Notifier signal:
  • void prefixChanged(const QString& prefix)

◆ receiveMessage

void IrcBuffer::receiveMessage ( IrcMessage message)
slot

Emits messageReceived() with message.

IrcBufferModel handles only buffer specific messages and delivers them to the appropriate IrcBuffer instances. When applications decide to handle IrcBuffer::messageReceived(), IrcBufferModel::messageIgnored() makes it easy to implement handling for the rest, non-buffer specific messages. This method can be used to forward such ignored messages to the desired buffers (for instance the one that is currently active in the GUI).

◆ sendCommand()

bool IrcBuffer::sendCommand ( IrcCommand command)

Sends a command to the server.

This method is provided for convenience. It is equal to:

IrcConnection* connection = buffer->connection();
connection->sendCommand(command);
Provides means to establish a connection to an IRC server.
Definition: ircconnection.h:49
bool sendCommand(IrcCommand *command)
Definition: ircconnection.cpp:1442
See also
IrcConnection::sendCommand()

◆ title()

QString IrcBuffer::title ( ) const

This property holds the whole buffer title.

The title consists of prefix and name.

Access function:
  • QString title() const
Notifier signal:
  • void titleChanged(const QString& title)

◆ toChannel()

IrcChannel * IrcBuffer::toChannel ( )

Returns the buffer cast to a IrcChannel, if the class is actually a channel, 0 otherwise.

See also
isChannel()

◆ userData()

QVariantMap IrcBuffer::userData ( ) const
Since
3.1

This property holds arbitrary user data.

Access functions:
  • QVariantMap userData() const
  • void setUserData(const QVariantMap& data)
Notifier signal:
  • void userDataChanged(const QVariantMap& data)

Property Documentation

◆ active

bool IrcBuffer::active
read

This property holds whether the buffer is active.

A buffer is considered active when a connection is established. Furthermore, channel buffers are only considered active when the user is on the channel.

Access function:
  • bool isActive() const
Notifier signal:
  • void activeChanged(bool active)
See also
IrcConnection::connected

◆ channel

bool IrcBuffer::channel
read

This property holds whether the buffer is a channel.

Access function:
  • bool isChannel() const
See also
toChannel()

◆ persistent

bool IrcBuffer::persistent
readwrite

This property holds whether the buffer is persistent.

The default value is false.

A persistent buffer does not get removed and destructed when calling IrcBufferModel::clear(), or when when leaving the corresponding channel. In order to remove a persistent buffer, either explicitly call IrcBufferModel::remove() or delete the buffer.

Access functions:
  • bool isPersistent() const
  • void setPersistent(bool persistent)
Notifier signal:
  • void persistentChanged(bool persistent)

◆ sticky

bool IrcBuffer::sticky
readwrite

This property holds whether the buffer is sticky.

A sticky buffer stays in the beginning (Qt::AscendingOrder) or end (Qt::DescendingOrder) of the list of buffers in IrcBufferModel.

The default value is false.

Access functions:
  • bool isSticky() const
  • void setSticky(bool sticky)
Notifier signal:
  • void stickyChanged(bool sticky)