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

Provides network information and capability management. More...

Inherits QObject.

Public Types

Public Slots

bool requestCapabilities (const QStringList &capabilities)
 
bool requestCapability (const QString &capability)
 

Signals

void requestingCapabilities ()
 

Public Member Functions

Q_INVOKABLE int channelLimit (const QString &type) const
 
Q_INVOKABLE QStringList channelModes (IrcNetwork::ModeTypes types) const
 
Q_INVOKABLE bool hasCapability (const QString &capability) const
 
Q_INVOKABLE bool isCapable (const QString &capability) const
 
Q_INVOKABLE bool isChannel (const QString &name) const
 
Q_INVOKABLE int modeLimit (const QString &mode) const
 
Q_INVOKABLE QString modeToPrefix (const QString &mode) const
 
Q_INVOKABLE int numericLimit (IrcNetwork::Limit limit) const
 
Q_INVOKABLE QString prefixToMode (const QString &prefix) const
 
Q_INVOKABLE int targetLimit (const QString &command) const
 

Properties

QStringList activeCapabilities
 
QStringList availableCapabilities
 
QStringList channelTypes
 
bool initialized
 
QStringList modes
 
QString name
 
QStringList prefixes
 
QStringList requestedCapabilities
 
QStringList statusPrefixes
 

Detailed Description

Network information

IrcNetwork provides various information about the IRC network of a connection. This includes the network name, supported channel types, channel user mode characters and prefix letters and status prefixes, and various numeric limitations, such as the maximum nick, channel, topic and message lengths.

Furthermore, IrcNetwork provides convenient methods for converting channel user modes to prefixes and vice versa and testing whether a target name is a channel.

Note
Most properties have empty values until the network information has been initialized.

Capability management

IrcNetwork also provides means for capability management. It maintais a list of available and active capabilities, automatically requests desired capabilities, and provides convenient methods for manual capability requests.

See also
IrcConnection::network, Irc::supportedCapabilities, IRCv3 support

Member Enumeration Documentation

This enum describes the numeric limit types.

Enumerator
NickLength 

The maximum nick name length.

ChannelLength 

The maximum channel name length.

TopicLength 

The maximum channel topic length.

MessageLength 

The maximum message length.

KickReasonLength 

The maximum kick reason length.

AwayReasonLength 

The maximum away reason length.

ModeCount 

The maximum number of channel modes allowed per mode command.

MonitorCount 

The maximum amount of targets a client may have in their monitor list.

Since
3.4

This enum describes the channel mode types.

Enumerator
TypeA 

Type A modes.

Modes that add or remove an address to or from a list. These modes always take a parameter when sent by the server to a client; when sent by a client, they may be specified without a parameter, which requests the server to display the current contents of the corresponding list on the channel to the client.

TypeB 

Type B modes.

Modes that change a setting on the channel. These modes always take a parameter.

TypeC 

Type C modes.

Modes that change a setting on the channel. These modes take a parameter only when set; the parameter is absent when the mode is removed both in the client's and server's MODE command.

TypeD 

Type D modes.

Modes that change a setting on the channel. These modes never take a parameter.

AllTypes 

All type modes.

Member Function Documentation

int IrcNetwork::channelLimit ( const QString type) const

Returns the limit for a type of channels, or -1 if the limitation is not known.

See also
channelTypes()
QStringList IrcNetwork::channelModes ( IrcNetwork::ModeTypes  types) const

Returns the supported channel modes for specified types.

See also
ModeType
bool IrcNetwork::hasCapability ( const QString capability) const

Returns true if the capability is available.

See also
availableCapabilities
bool IrcNetwork::isCapable ( const QString capability) const

Returns true if the capability is active.

See also
activeCapabilities
bool IrcNetwork::isChannel ( const QString name) const

Returns true if the name is a channel.

QString name = ...;
if (connection->network()->isChannel(name))
doSomeChannelAction(name);
See also
channelTypes
int IrcNetwork::modeLimit ( const QString mode) const

Returns the limit of entries in the list per mode, or -1 if the limitation is not known.

See also
modes()
QString IrcNetwork::modeToPrefix ( const QString mode) const

Converts a channel user mode letter to a prefix character.

See also
modes, prefixToMode()
int IrcNetwork::numericLimit ( IrcNetwork::Limit  limit) const

Returns a numeric type of limit, or -1 if the limitation is not known.

See also
modeLimit(), channelLimit(), targetLimit()
QString IrcNetwork::prefixToMode ( const QString prefix) const

Converts a channel mode prefix character to a mode letter.

See also
prefixes, modeToPrefix()
bool IrcNetwork::requestCapabilities ( const QStringList capabilities)
slot

Requests the specified capabilities.

Note
The capabilities are NOT added to the list of requested capabilities to avoid them "piling up".
bool IrcNetwork::requestCapability ( const QString capability)
slot

Requests the specified capability.

Note
The capability is NOT added to the list of requested capabilities to avoid them "piling up".
void IrcNetwork::requestingCapabilities ( )
signal

This signal is emitted when capabilities are being requested.

Normally it is enough to add the desired capabilities to the list of requested capabilities. Connect to this signal in order to implement more advanced capability handling eg. based on which capabilities are available.

See also
requestedCapabilities, availableCapabilities
int IrcNetwork::targetLimit ( const QString command) const

Returns the limit of targets for a command, or -1 if the limitation is not known.

Property Documentation

QStringList IrcNetwork::activeCapabilities
read

This property holds the active capabilities.

Access function:
Notifier signal:
  • void activeCapabilitiesChanged(const QStringList& capabilities)
See also
requestedCapabilities, availableCapabilities
QStringList IrcNetwork::availableCapabilities
read

This property holds the available capabilities.

Access function:
Notifier signal:
  • void availableCapabilitiesChanged(const QStringList& capabilities)
See also
requestedCapabilities, activeCapabilities
QStringList IrcNetwork::channelTypes
read

This property holds the supported channel type prefix characters.

Examples of typical channel types:

Description Type Example
Normal channel # #communi
Local channel & &foo
Access function:
Notifier signal:
bool IrcNetwork::initialized
read

This property holds whether the network information has been initialized.

Most properties have empty values until the server provides the relevant network information during the client-server handshake.

Access function:
  • bool isInitialized() const
Notifier signal:
  • void initialized()
QStringList IrcNetwork::modes
read

This property holds the supported channel user mode letters.

Examples of typical channel user modes:

Description Mode Prefix
Channel operator o @
Voiced user v +
Access function:
Notifier signal:
See also
prefixes, modeToPrefix()
QString IrcNetwork::name
read

This property holds the network name.

Access function:
Notifier signal:
  • void nameChanged(const QString& name)
QStringList IrcNetwork::prefixes
read

This property holds the supported channel user mode prefix characters.

Examples of typical channel user modes:

Description Mode Prefix
Channel operator o @
Voiced user v +
Access function:
Notifier signal:
See also
modes, prefixToMode(), statusPrefixes
QStringList IrcNetwork::requestedCapabilities
readwrite

This property holds the requested capabilities.

These capabilities are automatically requested during the handshake, right after requestingCapabilities() has been emitted.

Access functions:
Notifier signal:
  • void requestedCapabilitiesChanged(const QStringList& capabilities)
See also
availableCapabilities, activeCapabilities
QStringList IrcNetwork::statusPrefixes
read
Since
3.4

This property holds the supported message status prefixes.

The server supports messaging channel members who have a certain status or higher.

Access function:
Notifier signal:
  • void statusPrefixesChanged(const QStringList& prefixes)
See also
prefixes