Provides network information and capability management. More...
Inherits QObject.
Public Types | |
enum | Limit { NickLength, ChannelLength, TopicLength, MessageLength, KickReasonLength, AwayReasonLength, ModeCount } |
enum | ModeType { TypeA = 0x1, TypeB = 0x2, TypeC = 0x4, TypeD = 0x8, AllTypes = 0xf } |
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 |
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 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.
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.
enum IrcNetwork::Limit |
This enum describes the numeric limit types.
enum IrcNetwork::ModeType |
This enum describes the channel mode types.
int IrcNetwork::channelLimit | ( | const QString & | type | ) | const |
Returns the limit for a type of channels, or -1
if the limitation is not known.
QStringList IrcNetwork::channelModes | ( | IrcNetwork::ModeTypes | types | ) | const |
Returns the supported channel modes for specified types.
bool IrcNetwork::hasCapability | ( | const QString & | capability | ) | const |
Returns true
if the capability is available.
bool IrcNetwork::isCapable | ( | const QString & | capability | ) | const |
Returns true
if the capability is active.
bool IrcNetwork::isChannel | ( | const QString & | name | ) | const |
Returns true
if the name is a channel.
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.
Converts a channel user mode letter to a prefix character.
int IrcNetwork::numericLimit | ( | IrcNetwork::Limit | limit | ) | const |
Returns a numeric type of limit, or -1
if the limitation is not known.
Converts a channel mode prefix character to a mode letter.
|
slot |
Requests the specified capabilities.
|
slot |
Requests the specified capability.
|
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.
int IrcNetwork::targetLimit | ( | const QString & | command | ) | const |
Returns the limit of targets for a command, or -1
if the limitation is not known.
|
read |
This property holds the active capabilities.
|
read |
This property holds the available capabilities.
|
read |
This property holds the supported channel type prefix characters.
Examples of typical channel types:
Description | Type | Example |
---|---|---|
Normal channel | # | #communi |
Local channel | & | &foo |
|
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.
|
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 | + |
|
read |
|
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 | + |
|
readwrite |
This property holds the requested capabilities.
These capabilities are automatically requested during the handshake, right after requestingCapabilities() has been emitted.