Provides the most common commands. More...
Inherits QObject.
Public Types | |
enum | Type { Admin, Away, Capability, CtcpAction, CtcpReply, CtcpRequest, Custom, Info, Invite, Join, Kick, Knock, List, Message, Mode, Motd, Names, Nick, Notice, Part , Quit, Quote, Stats, Time, Topic, Trace, Users, Version, Who, Whois, Whowas } |
Public Member Functions | |
IrcCommand (QObject *parent=0) | |
virtual | ~IrcCommand () |
Q_INVOKABLE IrcMessage * | toMessage (const QString &prefix, IrcConnection *connection) const |
virtual QString | toString () const |
Static Public Member Functions | |
static Q_INVOKABLE IrcCommand * | createAdmin (const QString &server=QString()) |
static Q_INVOKABLE IrcCommand * | createAway (const QString &reason=QString()) |
static Q_INVOKABLE IrcCommand * | createCapability (const QString &subCommand, const QString &capability) |
static Q_INVOKABLE IrcCommand * | createCapability (const QString &subCommand, const QStringList &capabilities=QStringList()) |
static Q_INVOKABLE IrcCommand * | createCtcpAction (const QString &target, const QString &action) |
static Q_INVOKABLE IrcCommand * | createCtcpReply (const QString &target, const QString &reply) |
static Q_INVOKABLE IrcCommand * | createCtcpRequest (const QString &target, const QString &request) |
static Q_INVOKABLE IrcCommand * | createInfo (const QString &server=QString()) |
static Q_INVOKABLE IrcCommand * | createInvite (const QString &user, const QString &channel) |
static Q_INVOKABLE IrcCommand * | createJoin (const QString &channel, const QString &key=QString()) |
static Q_INVOKABLE IrcCommand * | createJoin (const QStringList &channels, const QStringList &keys=QStringList()) |
static Q_INVOKABLE IrcCommand * | createKick (const QString &channel, const QString &user, const QString &reason=QString()) |
static Q_INVOKABLE IrcCommand * | createKnock (const QString &channel, const QString &message=QString()) |
static Q_INVOKABLE IrcCommand * | createList (const QStringList &channels=QStringList(), const QString &server=QString()) |
static Q_INVOKABLE IrcCommand * | createMessage (const QString &target, const QString &message) |
static Q_INVOKABLE IrcCommand * | createMode (const QString &target, const QString &mode=QString(), const QString &arg=QString()) |
static Q_INVOKABLE IrcCommand * | createMonitor (const QString &command, const QString &target=QString()) |
static Q_INVOKABLE IrcCommand * | createMonitor (const QString &command, const QStringList &targets) |
static Q_INVOKABLE IrcCommand * | createMotd (const QString &server=QString()) |
static Q_INVOKABLE IrcCommand * | createNames (const QString &channel=QString(), const QString &server=QString()) |
static Q_INVOKABLE IrcCommand * | createNames (const QStringList &channels, const QString &server=QString()) |
static Q_INVOKABLE IrcCommand * | createNick (const QString &nick) |
static Q_INVOKABLE IrcCommand * | createNotice (const QString &target, const QString ¬ice) |
static Q_INVOKABLE IrcCommand * | createPart (const QString &channel, const QString &reason=QString()) |
static Q_INVOKABLE IrcCommand * | createPart (const QStringList &channels, const QString &reason=QString()) |
static Q_INVOKABLE IrcCommand * | createPing (const QString &argument) |
static Q_INVOKABLE IrcCommand * | createPong (const QString &argument) |
static Q_INVOKABLE IrcCommand * | createQuit (const QString &reason=QString()) |
static Q_INVOKABLE IrcCommand * | createQuote (const QString &raw) |
static Q_INVOKABLE IrcCommand * | createQuote (const QStringList ¶meters) |
static Q_INVOKABLE IrcCommand * | createStats (const QString &query, const QString &server=QString()) |
static Q_INVOKABLE IrcCommand * | createTime (const QString &server=QString()) |
static Q_INVOKABLE IrcCommand * | createTopic (const QString &channel, const QString &topic=QString()) |
static Q_INVOKABLE IrcCommand * | createTrace (const QString &target=QString()) |
static Q_INVOKABLE IrcCommand * | createUsers (const QString &server=QString()) |
static Q_INVOKABLE IrcCommand * | createVersion (const QString &user=QString()) |
static Q_INVOKABLE IrcCommand * | createWho (const QString &mask, bool operators=false) |
static Q_INVOKABLE IrcCommand * | createWhois (const QString &user) |
static Q_INVOKABLE IrcCommand * | createWhowas (const QString &user, int count=1) |
Properties | |
IrcConnection | connection |
QByteArray | encoding |
QStringList | parameters |
Type | type |
The IrcCommand class supports the most common IRC commands out of the box, and can be extended for custom commands as well. See IrcCommand::Type for the list of built-in command types. IRC commands, as in IrcCommand instances, are sent to the IRC server via IrcConnection::sendCommand().
It is recommended to create IrcCommand instances via static IrcCommand::createXxx() methods.
A "custom command" here refers to command types not listed in IrcCommand::Type, the list of built-in command types. There are two ways to send custom commands:
Example implementation of a custom command:
enum IrcCommand::Type |
This enum describes the built-in command types.
|
explicit |
Constructs a new IrcCommand with parent.
|
virtual |
Destructs the IRC command.
|
static |
Creates a new ADMIN command with type IrcCommand::Admin and optional parameter server.
This command shows admin info for the specified server, or the current server if not specified.
|
static |
Creates a new AWAY command with type IrcCommand::Away and optional parameter reason.
Provides the server with reason to automatically send in reply to a private message directed at the user. If reason is omitted, the away status is removed.
|
static |
Creates a new capability command with type IrcCommand::Capability and parameters subCommand and a capability.
Available subcommands are: LS, LIST, REQ, ACK, NAK, CLEAR and END.
|
static |
Creates a new capability command with type IrcCommand::Capability and parameters subCommand and optional capabilities.
Available subcommands are: LS, LIST, REQ, ACK, NAK, CLEAR and END.
|
static |
Creates a new CTCP action command with type IrcCommand::CtcpAction and parameters target and action.
|
static |
Creates a new CTCP reply command with type IrcCommand::CtcpReply and parameters target and reply.
|
static |
Creates a new CTCP request command with type IrcCommand::CtcpRequest and parameters target and request.
|
static |
Creates a new INFO command with type IrcCommand::Info and optional parameter server.
This command shows info for the specified server, or the current server if not specified.
|
static |
Creates a new INVITE command with type IrcCommand::Invite and parameters user and channel.
This command invites user to the channel. The channel does not have to exist, but if it does, only members of the channel are allowed to invite other clients. if the channel mode +i (invite-only) is set, only channel operators may invite other clients.
|
static |
Creates a new JOIN command with type IrcCommand::Join and parameters channel and optional key.
This command joins the channel using key if specified. If the channel does not exist, it will be created.
|
static |
This overload is provided for convenience.
|
static |
Creates a new KICK command with type IrcCommand::Kick and parameters channel, user and optional reason.
This command forcibly removes user from channel, and may only be issued by channel operators.
|
static |
Creates a new KNOCK command with type IrcCommand::Knock and parameters channel and optional message.
This command sends an invitation request to a channel with an optional message.
|
static |
Creates a new LIST command with type IrcCommand::List and optional parameters channels and server.
This command lists all channels on the server. If channels are given, it will list the channel topics. If server is given, the command will be forwarded to server for evaluation.
|
static |
Creates a new PRIVMSG command with type IrcCommand::Message and parameters target and message.
This command sends message to target, which is usually a user or channel.
|
static |
Creates a new MODE command with type IrcCommand::Mode and parameters target and optional mode and arg.
This command is used to set both user and channel modes.
|
static |
Creates a new MONITOR command with type IrcCommand::Monitor and parameters command and and optional target.
Available commands are:
+
- Adds the given list of targets to the list of targets being monitored. +
- Removes the given list of targets from the list of targets being monitored. No output will be returned for use of this command. C
- Clears the list of targets being monitored. No output will be returned for use of this command. L
- Outputs the current list of targets being monitored. All output will use RPL_MONLIST, and the output will be terminated with RPL_ENDOFMONLIST. S
- Outputs for each target in the list being monitored, whether the client is online or offline. All targets that are online will be sent using RPL_MONONLINE, all targets that are offline will be sent using RPL_MONOFFLINE.
|
static |
Creates a new MONITOR command with type IrcCommand::Monitor and parameters command and targets.
Available commands are:
+
- Adds the given list of targets to the list of targets being monitored. +
- Removes the given list of targets from the list of targets being monitored. No output will be returned for use of this command. C
- Clears the list of targets being monitored. No output will be returned for use of this command. L
- Outputs the current list of targets being monitored. All output will use RPL_MONLIST, and the output will be terminated with RPL_ENDOFMONLIST. S
- Outputs for each target in the list being monitored, whether the client is online or offline. All targets that are online will be sent using RPL_MONONLINE, all targets that are offline will be sent using RPL_MONOFFLINE.
|
static |
Creates a new MOTD command with type IrcCommand::Motd and optional parameter server.
This command shows the message of the day on the specified server, or the current server if not specified.
|
static |
Creates a new NAMES command with type IrcCommand::Names and parameter channel.
This command lists all users on the channel, optionally limiting to the given server.
If channel is omitted, all users are shown, grouped by channel name with all users who are not on a channel being shown as part of channel "*". If server is specified, the command is sent to server for evaluation.
|
static |
This overload is provided for convenience.
|
static |
Creates a new NICK command with type IrcCommand::Nick and parameter nick.
This command allows a client to change their IRC nickname.
|
static |
Creates a new NOTICE command with type IrcCommand::Notice and parameters target and message.
This command sends notice to target, which is usually a user or channel.
|
static |
Creates a new PART command with type IrcCommand::Part and parameters channel and optional reason.
This command causes the client to leave the specified channel.
|
static |
This overload is provided for convenience.
|
static |
Creates a new PING command with type IrcCommand::Ping and argument.
|
static |
Creates a new PONG command with type IrcCommand::Pong and argument.
|
static |
Creates a new QUIT command with type IrcCommand::Quit and optional parameter reason.
|
static |
Creates a new QUOTE command with type IrcCommand::Quote and raw.
|
static |
Creates a new QUOTE command with type IrcCommand::Quote and parameters.
|
static |
Creates a new STATS command with type IrcCommand::Stats and parameters query and optional server.
This command queries statistics about the specified server, or the current server if not specified.
|
static |
Creates a new TIME command with type IrcCommand::Time and optional parameter server.
This command queries local time of the specified server, or the current server if not specified.
|
static |
Creates a new TOPIC command with type IrcCommand::Topic and parameters channel and optional topic.
This command allows the client to query or set the channel topic on channel. If topic is given, it sets the channel topic to topic. If channel mode +t is set, only a channel operator may set the topic.
|
static |
Creates a new TRACE command with type IrcCommand::Trace and optional parameter target.
This command traces the connection path across the IRC network to the current server or to a specific target (server or client) in a similar method to traceroute.
|
static |
Creates a new USERS command with type IrcCommand::Users and optional parameter server.
This command queries the users of the specified server, or the current server if not specified.
|
static |
Creates a new command with type IrcCommand::Version and optional parameter user.
This command queries the version of the specified user's client (CTCP REQUEST VERSION), or the current server (VERSION) if not specified.
|
static |
Creates a new WHO command with type IrcCommand::Who and parameters mask and optional operators.
This command returns a list of users who match mask, optionally matching only IRC operators.
|
static |
Creates a new WHOIS command with type IrcCommand::Whois and parameter user.
This command returns information about user.
|
static |
Creates a new WHOWAS command with type IrcCommand::Whowas and parameters user and optional count.
This command returns information about a user that is no longer online (due to client disconnection, or nickname changes). If given, the server will return information from the last count times the nickname has been used.
IrcMessage * IrcCommand::toMessage | ( | const QString & | prefix, |
IrcConnection * | connection | ||
) | const |
Creates a new message from this command for prefix and connection.
Notice that IRC servers do not echo sent message commands back to the client. This function is particularly useful for converting sent message commands as messages for presentation purposes.
|
virtual |
|
read |
This property holds the connection that this command was sent to.
The connection is only set if the command has been passed to IrcConnection::sendCommand(). It is mostly usable to know the associated connection in IrcCommandFilter::commandFilter().
|
readwrite |
This property holds the encoding that is used when sending the command via IrcConnection::sendCommand().
See QTextCodec::availableCodes() for the list of supported encodings. The default value is "UTF-8"
.
|
readwrite |
This property holds the command parameters.
|
readwrite |
This property holds the command type.