29 #ifndef IRCCONNECTION_H 30 #define IRCCONNECTION_H 35 #include <QtCore/qobject.h> 36 #include <QtCore/qvariant.h> 37 #include <QtCore/qmetatype.h> 38 #include <QtCore/qstringlist.h> 39 #include <QtCore/qscopedpointer.h> 40 #include <QtNetwork/qabstractsocket.h> 46 class IrcConnectionPrivate;
52 Q_PROPERTY(QString host READ host WRITE setHost NOTIFY hostChanged)
53 Q_PROPERTY(
int port READ port WRITE setPort NOTIFY portChanged)
54 Q_PROPERTY(QStringList servers READ servers WRITE setServers NOTIFY serversChanged)
55 Q_PROPERTY(QString userName READ userName WRITE setUserName NOTIFY userNameChanged)
56 Q_PROPERTY(QString nickName READ nickName WRITE setNickName NOTIFY nickNameChanged)
57 Q_PROPERTY(QString realName READ realName WRITE setRealName NOTIFY realNameChanged)
58 Q_PROPERTY(QString password READ password WRITE setPassword NOTIFY passwordChanged)
59 Q_PROPERTY(QStringList nickNames READ nickNames WRITE setNickNames NOTIFY nickNamesChanged)
60 Q_PROPERTY(QString displayName READ displayName WRITE setDisplayName NOTIFY displayNameChanged)
61 Q_PROPERTY(QVariantMap userData READ userData WRITE setUserData NOTIFY userDataChanged)
62 Q_PROPERTY(QByteArray encoding READ encoding WRITE setEncoding)
63 Q_PROPERTY(
Status status READ status NOTIFY statusChanged)
64 Q_PROPERTY(
bool active READ isActive NOTIFY statusChanged)
65 Q_PROPERTY(
bool connected READ isConnected NOTIFY statusChanged)
66 Q_PROPERTY(
bool enabled READ isEnabled WRITE setEnabled NOTIFY enabledChanged)
67 Q_PROPERTY(
int reconnectDelay READ reconnectDelay WRITE setReconnectDelay NOTIFY reconnectDelayChanged)
68 Q_PROPERTY(QAbstractSocket* socket READ socket WRITE setSocket)
69 Q_PROPERTY(
bool secure READ isSecure WRITE setSecure NOTIFY secureChanged)
70 Q_PROPERTY(
bool secureSupported READ isSecureSupported)
71 Q_PROPERTY(QString saslMechanism READ saslMechanism WRITE setSaslMechanism NOTIFY saslMechanismChanged)
72 Q_PROPERTY(QStringList supportedSaslMechanisms READ supportedSaslMechanisms CONSTANT)
73 Q_PROPERTY(QVariantMap ctcpReplies READ ctcpReplies WRITE setCtcpReplies NOTIFY ctcpRepliesChanged)
75 Q_PROPERTY(
IrcProtocol* protocol READ protocol WRITE setProtocol)
80 explicit
IrcConnection(const QString& host, QObject* parent = 0);
86 void setHost(const QString& host);
89 void setPort(
int port);
91 QStringList servers() const;
92 void setServers(const QStringList& servers);
94 Q_INVOKABLE static
bool isValidServer(const QString& server);
96 QString userName() const;
97 void setUserName(const QString& name);
99 QString nickName() const;
100 void setNickName(const QString& name);
102 QString realName() const;
103 void setRealName(const QString& name);
105 QString password() const;
106 void setPassword(const QString& password);
108 QStringList nickNames() const;
109 void setNickNames(const QStringList& names);
111 QString displayName() const;
112 void setDisplayName(const QString& name);
114 QVariantMap userData() const;
115 void setUserData(const QVariantMap& data);
117 QByteArray encoding() const;
118 void setEncoding(const QByteArray& encoding);
129 Status status()
const;
130 bool isActive()
const;
131 bool isConnected()
const;
132 bool isEnabled()
const;
134 int reconnectDelay()
const;
135 void setReconnectDelay(
int seconds);
137 QAbstractSocket* socket()
const;
138 void setSocket(QAbstractSocket* socket);
140 bool isSecure()
const;
141 void setSecure(
bool secure);
142 static bool isSecureSupported();
144 QString saslMechanism()
const;
145 void setSaslMechanism(
const QString& mechanism);
147 static QStringList supportedSaslMechanisms();
149 QVariantMap ctcpReplies()
const;
150 void setCtcpReplies(
const QVariantMap& replies);
157 void installMessageFilter(QObject* filter);
158 void removeMessageFilter(QObject* filter);
160 void installCommandFilter(QObject* filter);
161 void removeCommandFilter(QObject* filter);
163 Q_INVOKABLE QByteArray saveState(
int version = 0)
const;
164 Q_INVOKABLE
bool restoreState(
const QByteArray& state,
int version = 0);
169 void quit(
const QString& reason = QString());
170 void setEnabled(
bool enabled =
true);
171 void setDisabled(
bool disabled =
true);
174 bool sendData(
const QByteArray& data);
175 bool sendRaw(
const QString& message);
182 void socketError(QAbstractSocket::SocketError error);
183 void socketStateChanged(QAbstractSocket::SocketState state);
186 void nickNameReserved(QString* alternate);
187 void nickNameRequired(
const QString& reserved, QString* alternate);
188 void channelKeyRequired(
const QString& channel, QString* key);
217 void hostChanged(
const QString& host);
218 void portChanged(
int port);
219 void serversChanged(
const QStringList& servers);
220 void userNameChanged(
const QString& name);
221 void nickNameChanged(
const QString& name);
222 void realNameChanged(
const QString& name);
223 void passwordChanged(
const QString& password);
224 void nickNamesChanged(
const QStringList& names);
225 void displayNameChanged(
const QString& name);
226 void userDataChanged(
const QVariantMap& data);
227 void reconnectDelayChanged(
int seconds);
228 void enabledChanged(
bool enabled);
229 void secureChanged(
bool secure);
230 void saslMechanismChanged(
const QString& mechanism);
231 void ctcpRepliesChanged(
const QVariantMap& replies);
240 friend class IrcProtocolPrivate;
241 QScopedPointer<IrcConnectionPrivate> d_ptr;
245 Q_PRIVATE_SLOT(d_func(),
void _irc_connected())
246 Q_PRIVATE_SLOT(d_func(),
void _irc_disconnected())
247 Q_PRIVATE_SLOT(d_func(),
void _irc_error(QAbstractSocket::SocketError))
248 Q_PRIVATE_SLOT(d_func(),
void _irc_state(QAbstractSocket::SocketState))
249 Q_PRIVATE_SLOT(d_func(),
void _irc_sslErrors())
250 Q_PRIVATE_SLOT(d_func(),
void _irc_reconnect())
251 Q_PRIVATE_SLOT(d_func(),
void _irc_readData())
252 Q_PRIVATE_SLOT(d_func(),
void _irc_filterDestroyed(QObject*))
255 #ifndef QT_NO_DEBUG_STREAM 257 IRC_CORE_EXPORT QDebug operator<<(QDebug debug,
const IrcConnection* connection);
258 #endif // QT_NO_DEBUG_STREAM 265 #endif // IRCCONNECTION_H Represents an invite message.
Definition: ircmessage.h:278
Represents a private message.
Definition: ircmessage.h:511
Represents a names list message.
Definition: ircmessage.h:383
Represents a reply message to a WHOIS command.
Definition: ircmessage.h:573
Provides means to establish a connection to an IRC server.
Definition: ircconnection.h:48
Represents a host change message.
Definition: ircmessage.h:260
Provides network information and capability management.
Definition: ircnetwork.h:43
Represents a batch message.
Definition: ircmessage.h:205
The connection is being established.
Definition: ircconnection.h:123
Represents a reply message to a WHOWAS command.
Definition: ircmessage.h:607
Represents a numeric message.
Definition: ircmessage.h:443
Represents an error message.
Definition: ircmessage.h:244
Represents a quit message.
Definition: ircmessage.h:537
Represents a join message.
Definition: ircmessage.h:298
The connection is being closed.
Definition: ircconnection.h:125
Represents a pong message.
Definition: ircmessage.h:495
Represents a nick message.
Definition: ircmessage.h:401
Represents a ping message.
Definition: ircmessage.h:479
The connection is inactive.
Definition: ircconnection.h:121
The connection has been established.
Definition: ircconnection.h:124
Provides the most common commands.
Definition: irccommand.h:44
Status
Definition: ircconnection.h:120
The connection has been closed.
Definition: ircconnection.h:126
Represents a kick message.
Definition: ircmessage.h:318
Implements the IRC protocol and provides means for implementing support for custom protocols...
Definition: ircprotocol.h:45
Represents a reply message to a WHO command.
Definition: ircmessage.h:629
Represents a capability message.
Definition: ircmessage.h:226
Represents an account notify message.
Definition: ircmessage.h:169
Represents a part message.
Definition: ircmessage.h:461
Represents a topic message.
Definition: ircmessage.h:553
The base class of all messages.
Definition: ircmessage.h:47
Represents an away message.
Definition: ircmessage.h:185
Represents a mode message.
Definition: ircmessage.h:338
Represents a message of the day.
Definition: ircmessage.h:367
The connection is waiting for a reconnect.
Definition: ircconnection.h:122
Represents a notice message.
Definition: ircmessage.h:419