#include <IrcMessage>
#include <IrcCommand>
#include <QCoreApplication>
#include <QTimer>
{
bufferModel.setConnection(this);
connect(&bufferModel, SIGNAL(channelsChanged(QStringList)), &parser, SLOT(setChannels(QStringList)));
}
void IrcBot::join(QString channel)
{
}
{
if (message->isPrivate()) {
parser.setTarget(message->nick());
parser.setTriggers(QStringList() << "!" << "");
} else {
parser.setTarget(message->target());
parser.setTriggers(QStringList() << "!" << nickName().append(":"));
}
IrcCommand* cmd = parser.parse(message->content());
if (cmd) {
help(cmd->parameters().mid(1));
} else {
sendCommand(cmd);
connect(this, SIGNAL(disconnected()), qApp, SLOT(quit()));
QTimer::singleShot(1000, qApp, SLOT(quit()));
}
}
}
}
void IrcBot::help(QStringList commands)
{
if (commands.isEmpty())
commands = parser.commands();
QString target = parser.target();
foreach (const QString& command, commands) {
QString syntax = parser.syntax(command);
}
}
Provides the most common commands.
Definition: irccommand.h:45
static Q_INVOKABLE IrcCommand * createJoin(const QString &channel, const QString &key=QString())
Definition: irccommand.cpp:572
static Q_INVOKABLE IrcCommand * createMessage(const QString &target, const QString &message)
Definition: irccommand.cpp:627
@ Nick
A nick command (NICK) is used to give user a nickname or change the previous one.
Definition: irccommand.h:73
@ Custom
A custom command.
Definition: irccommand.h:62
@ Part
A part command (PART) causes the client to be removed from the channel.
Definition: irccommand.h:75
@ Message
A message command (PRIVMSG) is used to send private messages to channels and users.
Definition: irccommand.h:69
@ Join
A join command (JOIN) is used to start listening a specific channel.
Definition: irccommand.h:65
@ CtcpAction
A CTCP action command is used to send an action message to channels and users.
Definition: irccommand.h:59
@ Quit
A quit command (QUIT) is used to end a client connection.
Definition: irccommand.h:78
Provides means to establish a connection to an IRC server.
Definition: ircconnection.h:49
Represents a private message.
Definition: ircmessage.h:512