Communi 1.0.0
A cross-platform IRC client library written with Qt 4
|
The IrcSession class provides an IRC session. More...
#include <IrcSession>
Inherits QObject.
Public Slots | |
void | close () |
void | open () |
Signals | |
void | connecting () |
void | disconnected () |
void | hostChanged (const QString &host) |
void | messageReceived (IrcMessage *message) |
void | nickNameChanged (const QString &name) |
void | password (QString *password) |
void | portChanged (int port) |
void | realNameChanged (const QString &name) |
void | socketError (QAbstractSocket::SocketError error) |
void | socketStateChanged (QAbstractSocket::SocketState state) |
void | userNameChanged (const QString &name) |
Public Member Functions | |
IrcSession (QObject *parent=0) | |
virtual | ~IrcSession () |
Q_INVOKABLE bool | sendCommand (IrcCommand *command) |
Q_INVOKABLE bool | sendRaw (const QString &message) |
Properties | |
bool | active |
bool | connected |
QByteArray | encoding |
QString | host |
QString | nickName |
int | port |
QString | realName |
QAbstractSocket | socket |
QString | userName |
The IrcSession class provides an IRC session.
IrcSession provides means to establish a connection to an IRC server.
IrcSession works asynchronously ie. it is non-blocking, emitting signals to notify when the state of connection changes or data has arrived. The asynchronous approach depends on an event loop. See QCoreApplication::exec() for more details.
Example usage:
IrcSession* session = new IrcSession(this); connect(session, SIGNAL(messageReceived(IrcMessage*)), this, SLOT(onMessageReceived(IrcMessage*))); session->setHost("irc.server.com"); session->setUserName("me"); session->setNickName("myself"); session->setRealName("And I"); session->open();
IrcSession::IrcSession | ( | QObject * | parent = 0 | ) | [explicit] |
Constructs a new IRC session with parent.
IrcSession::~IrcSession | ( | ) | [virtual] |
Destructs the IRC session.
void IrcSession::close | ( | ) | [slot] |
Closes the connection to the server.
void IrcSession::connecting | ( | ) | [signal] |
This signal is emitted when the connection is being established.
void IrcSession::disconnected | ( | ) | [signal] |
This signal is emitted when the session has been disconnected.
void IrcSession::hostChanged | ( | const QString & | host | ) | [signal] |
This signal is emitted when the host has changed.
void IrcSession::messageReceived | ( | IrcMessage * | message | ) | [signal] |
This signal is emitted whenever a message is received.
void IrcSession::nickNameChanged | ( | const QString & | name | ) | [signal] |
This signal is emitted when the nick name has changed.
void IrcSession::open | ( | ) | [slot] |
void IrcSession::password | ( | QString * | password | ) | [signal] |
This signal is emitted when the connection password may be set.
void IrcSession::portChanged | ( | int | port | ) | [signal] |
This signal is emitted when the port has changed.
void IrcSession::realNameChanged | ( | const QString & | name | ) | [signal] |
This signal is emitted when the real name has changed.
bool IrcSession::sendCommand | ( | IrcCommand * | command | ) |
Sends a command to the server.
bool IrcSession::sendRaw | ( | const QString & | message | ) |
Sends a raw message to the server.
void IrcSession::socketError | ( | QAbstractSocket::SocketError | error | ) | [signal] |
This signal is emitted whenever a socket error occurs.
void IrcSession::socketStateChanged | ( | QAbstractSocket::SocketState | state | ) | [signal] |
This signal is emitted whenever the socket's state changes.
void IrcSession::userNameChanged | ( | const QString & | name | ) | [signal] |
This signal is emitted when the user name has changed.
bool IrcSession::active [read] |
This property holds whether the session is active.
The session is considered active when the socket state is not QAbstractSocket::UnconnectedState.
bool IrcSession::connected [read] |
This signal is emitted when the connection has been established ie. the welcome message has been received and the server is ready to receive commands.
This property holds whether the session is connected.
The session is considered connected when the welcome message has been received and the server is ready to receive commands.
QByteArray IrcSession::encoding [read, write] |
This property holds the message encoding. See QTextCodec documentation for supported encodings.
Encoding auto-detection can be turned on by passing a null QByteArray. The fallback codec is QTextCodec::codecForLocale().
The default value is a null QByteArray.
QString IrcSession::host [read, write] |
QString IrcSession::nickName [read, write] |
int IrcSession::port [read, write] |
This property holds the server port.
The default value is 6667
.
QString IrcSession::realName [read, write] |
QAbstractSocket * IrcSession::socket [read, write] |
This property holds the socket. IrcSession creates an instance of QTcpSocket by default.
The previously set socket is deleted if its parent is this
.
QString IrcSession::userName [read, write] |