1 /***************************************************************************
2 * Copyright (C) 2005-2016 by the Quassel Project *
3 * devel@quassel-irc.org *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) version 3. *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
19 ***************************************************************************/
25 #include <QStringList>
27 #include <QNetworkProxy>
29 #include <QVariantMap>
36 #include "syncableobject.h"
38 #include "signalproxy.h"
40 #include "ircchannel.h"
45 // TODO: ConnectionInfo to propagate and sync the current state of NetworkConnection, encodings etcpp
47 class Network : public SyncableObject
51 Q_ENUMS(ConnectionState)
53 Q_PROPERTY(QString networkName READ networkName WRITE setNetworkName)
54 Q_PROPERTY(QString currentServer READ currentServer WRITE setCurrentServer)
55 Q_PROPERTY(QString myNick READ myNick WRITE setMyNick)
56 Q_PROPERTY(int latency READ latency WRITE setLatency)
57 Q_PROPERTY(QByteArray codecForServer READ codecForServer WRITE setCodecForServer)
58 Q_PROPERTY(QByteArray codecForEncoding READ codecForEncoding WRITE setCodecForEncoding)
59 Q_PROPERTY(QByteArray codecForDecoding READ codecForDecoding WRITE setCodecForDecoding)
60 Q_PROPERTY(IdentityId identityId READ identity WRITE setIdentity)
61 Q_PROPERTY(bool isConnected READ isConnected WRITE setConnected)
62 //Q_PROPERTY(Network::ConnectionState connectionState READ connectionState WRITE setConnectionState)
63 Q_PROPERTY(int connectionState READ connectionState WRITE setConnectionState)
64 Q_PROPERTY(bool useRandomServer READ useRandomServer WRITE setUseRandomServer)
65 Q_PROPERTY(QStringList perform READ perform WRITE setPerform)
66 Q_PROPERTY(bool useAutoIdentify READ useAutoIdentify WRITE setUseAutoIdentify)
67 Q_PROPERTY(QString autoIdentifyService READ autoIdentifyService WRITE setAutoIdentifyService)
68 Q_PROPERTY(QString autoIdentifyPassword READ autoIdentifyPassword WRITE setAutoIdentifyPassword)
69 Q_PROPERTY(bool useSasl READ useSasl WRITE setUseSasl)
70 Q_PROPERTY(QString saslAccount READ saslAccount WRITE setSaslAccount)
71 Q_PROPERTY(QString saslPassword READ saslPassword WRITE setSaslPassword)
72 Q_PROPERTY(bool useAutoReconnect READ useAutoReconnect WRITE setUseAutoReconnect)
73 Q_PROPERTY(quint32 autoReconnectInterval READ autoReconnectInterval WRITE setAutoReconnectInterval)
74 Q_PROPERTY(quint16 autoReconnectRetries READ autoReconnectRetries WRITE setAutoReconnectRetries)
75 Q_PROPERTY(bool unlimitedReconnectRetries READ unlimitedReconnectRetries WRITE setUnlimitedReconnectRetries)
76 Q_PROPERTY(bool rejoinChannels READ rejoinChannels WRITE setRejoinChannels)
77 // Custom rate limiting
78 Q_PROPERTY(bool useCustomMessageRate READ useCustomMessageRate WRITE setUseCustomMessageRate)
79 Q_PROPERTY(quint32 msgRateBurstSize READ messageRateBurstSize WRITE setMessageRateBurstSize)
80 Q_PROPERTY(quint32 msgRateMessageDelay READ messageRateDelay WRITE setMessageRateDelay)
81 Q_PROPERTY(bool unlimitedMessageRate READ unlimitedMessageRate WRITE setUnlimitedMessageRate)
84 enum ConnectionState {
94 // http://www.irc.org/tech_docs/005.html
95 // http://www.irc.org/tech_docs/draft-brocklesby-irc-isupport-03.txt
96 enum ChannelModeType {
97 NOT_A_CHANMODE = 0x00,
104 // Default port assignments according to what many IRC networks have settled on.
105 // Technically not a standard, but it's fairly widespread.
106 // See https://freenode.net/news/port-6697-irc-via-tlsssl
108 PORT_PLAINTEXT = 6667, /// Default port for unencrypted connections
109 PORT_SSL = 6697 /// Default port for encrypted connections
117 bool sslVerify; /// If true, validate SSL certificates
127 // sslVerify only applies when useSsl is true. sslVerify should be enabled by default,
128 // so enabling useSsl offers a more secure default.
129 Server() : port(6667), useSsl(false), sslVerify(true), sslVersion(0), useProxy(false),
130 proxyType(QNetworkProxy::Socks5Proxy), proxyHost("localhost"), proxyPort(8080) {}
132 Server(const QString &host, uint port, const QString &password, bool useSsl,
134 : host(host), port(port), password(password), useSsl(useSsl), sslVerify(sslVerify),
135 sslVersion(0), useProxy(false), proxyType(QNetworkProxy::Socks5Proxy),
136 proxyHost("localhost"), proxyPort(8080) {}
138 bool operator==(const Server &other) const;
139 bool operator!=(const Server &other) const;
141 typedef QList<Server> ServerList;
143 Network(const NetworkId &networkid, QObject *parent = 0);
146 inline NetworkId networkId() const { return _networkId; }
148 inline SignalProxy *proxy() const { return _proxy; }
149 inline void setProxy(SignalProxy *proxy) { _proxy = proxy; }
151 inline bool isMyNick(const QString &nick) const { return (myNick().toLower() == nick.toLower()); }
152 inline bool isMe(IrcUser *ircuser) const { return (ircuser->nick().toLower() == myNick().toLower()); }
154 bool isChannelName(const QString &channelname) const;
157 * Checks if the target counts as a STATUSMSG
159 * Status messages are prefixed with one or more characters from the server-provided STATUSMSG
160 * if available, otherwise "@" and "+" are assumed. Generally, status messages sent to a
161 * channel are only visible to those with the same or higher permissions, e.g. voiced.
163 * @param[in] target Name of destination, e.g. a channel or query
164 * @returns True if a STATUSMSG, otherwise false
166 bool isStatusMsg(const QString &target) const;
168 inline bool isConnected() const { return _connected; }
169 //Network::ConnectionState connectionState() const;
170 inline int connectionState() const { return _connectionState; }
172 QString prefixToMode(const QString &prefix) const;
173 inline QString prefixToMode(const QCharRef &prefix) const { return prefixToMode(QString(prefix)); }
174 QString modeToPrefix(const QString &mode) const;
175 inline QString modeToPrefix(const QCharRef &mode) const { return modeToPrefix(QString(mode)); }
177 ChannelModeType channelModeType(const QString &mode);
178 inline ChannelModeType channelModeType(const QCharRef &mode) { return channelModeType(QString(mode)); }
180 inline const QString &networkName() const { return _networkName; }
181 inline const QString ¤tServer() const { return _currentServer; }
182 inline const QString &myNick() const { return _myNick; }
183 inline int latency() const { return _latency; }
184 inline IrcUser *me() const { return ircUser(myNick()); }
185 inline IdentityId identity() const { return _identity; }
186 QStringList nicks() const;
187 inline QStringList channels() const { return _ircChannels.keys(); }
189 * Gets the list of available capabilities.
191 * @returns QStringList of available capabilities
193 inline const QStringList caps() const { return QStringList(_caps.keys()); }
195 * Gets the list of enabled (acknowledged) capabilities.
197 * @returns QStringList of enabled (acknowledged) capabilities
199 inline const QStringList capsEnabled() const { return _capsEnabled; }
200 inline const ServerList &serverList() const { return _serverList; }
201 inline bool useRandomServer() const { return _useRandomServer; }
202 inline const QStringList &perform() const { return _perform; }
203 inline bool useAutoIdentify() const { return _useAutoIdentify; }
204 inline const QString &autoIdentifyService() const { return _autoIdentifyService; }
205 inline const QString &autoIdentifyPassword() const { return _autoIdentifyPassword; }
206 inline bool useSasl() const { return _useSasl; }
207 inline const QString &saslAccount() const { return _saslAccount; }
208 inline const QString &saslPassword() const { return _saslPassword; }
209 inline bool useAutoReconnect() const { return _useAutoReconnect; }
210 inline quint32 autoReconnectInterval() const { return _autoReconnectInterval; }
211 inline quint16 autoReconnectRetries() const { return _autoReconnectRetries; }
212 inline bool unlimitedReconnectRetries() const { return _unlimitedReconnectRetries; }
213 inline bool rejoinChannels() const { return _rejoinChannels; }
215 // Custom rate limiting
218 * Gets whether or not custom rate limiting is used
220 * @return True if custom rate limiting is enabled, otherwise false.
222 inline bool useCustomMessageRate() const { return _useCustomMessageRate; }
225 * Gets maximum number of messages to send without any delays
229 * Maximum number of messages to send without any delays. A value of 1 disables message
233 inline quint32 messageRateBurstSize() const { return _messageRateBurstSize; }
236 * Gets the delay between messages after the maximum number of undelayed messages have been sent
240 * Delay in milliseconds between messages after the maximum number of undelayed messages have
244 inline quint32 messageRateDelay() const { return _messageRateDelay; }
247 * Gets whether or not all rate limiting is disabled, e.g. for IRC bridges
249 * @return If true, disable rate limiting, otherwise apply configured limits.
251 inline bool unlimitedMessageRate() const { return _unlimitedMessageRate; }
253 NetworkInfo networkInfo() const;
254 void setNetworkInfo(const NetworkInfo &);
256 QString prefixes() const;
257 QString prefixModes() const;
258 void determinePrefixes() const;
260 bool supports(const QString ¶m) const { return _supports.contains(param); }
261 QString support(const QString ¶m) const;
264 * Checks if a given capability is acknowledged and active.
266 * @param[in] capability Name of capability
267 * @returns True if acknowledged (active), otherwise false
269 inline bool capEnabled(const QString &capability) const { return _capsEnabled.contains(capability.toLower()); }
270 // IRCv3 specs all use lowercase capability names
273 * Gets the value of an available capability, e.g. for SASL, "EXTERNAL,PLAIN".
275 * @param[in] capability Name of capability
276 * @returns Value of capability if one was specified, otherwise empty string
278 QString capValue(const QString &capability) const { return _caps.value(capability.toLower()); }
279 // IRCv3 specs all use lowercase capability names
280 // QHash returns the default constructed value if not found, in this case, empty string
281 // See: https://doc.qt.io/qt-4.8/qhash.html#value
283 IrcUser *newIrcUser(const QString &hostmask, const QVariantMap &initData = QVariantMap());
284 inline IrcUser *newIrcUser(const QByteArray &hostmask) { return newIrcUser(decodeServerString(hostmask)); }
285 IrcUser *ircUser(QString nickname) const;
286 inline IrcUser *ircUser(const QByteArray &nickname) const { return ircUser(decodeServerString(nickname)); }
287 inline QList<IrcUser *> ircUsers() const { return _ircUsers.values(); }
288 inline quint32 ircUserCount() const { return _ircUsers.count(); }
290 IrcChannel *newIrcChannel(const QString &channelname, const QVariantMap &initData = QVariantMap());
291 inline IrcChannel *newIrcChannel(const QByteArray &channelname) { return newIrcChannel(decodeServerString(channelname)); }
292 IrcChannel *ircChannel(QString channelname) const;
293 inline IrcChannel *ircChannel(const QByteArray &channelname) const { return ircChannel(decodeServerString(channelname)); }
294 inline QList<IrcChannel *> ircChannels() const { return _ircChannels.values(); }
295 inline quint32 ircChannelCount() const { return _ircChannels.count(); }
297 QByteArray codecForServer() const;
298 QByteArray codecForEncoding() const;
299 QByteArray codecForDecoding() const;
300 void setCodecForServer(QTextCodec *codec);
301 void setCodecForEncoding(QTextCodec *codec);
302 void setCodecForDecoding(QTextCodec *codec);
304 QString decodeString(const QByteArray &text) const;
305 QByteArray encodeString(const QString &string) const;
306 QString decodeServerString(const QByteArray &text) const;
307 QByteArray encodeServerString(const QString &string) const;
309 static QByteArray defaultCodecForServer();
310 static QByteArray defaultCodecForEncoding();
311 static QByteArray defaultCodecForDecoding();
312 static void setDefaultCodecForServer(const QByteArray &name);
313 static void setDefaultCodecForEncoding(const QByteArray &name);
314 static void setDefaultCodecForDecoding(const QByteArray &name);
316 inline bool autoAwayActive() const { return _autoAwayActive; }
317 inline void setAutoAwayActive(bool active) { _autoAwayActive = active; }
320 void setNetworkName(const QString &networkName);
321 void setCurrentServer(const QString ¤tServer);
322 void setConnected(bool isConnected);
323 void setConnectionState(int state);
324 virtual void setMyNick(const QString &mynick);
325 void setLatency(int latency);
326 void setIdentity(IdentityId);
328 void setServerList(const QVariantList &serverList);
329 void setUseRandomServer(bool);
330 void setPerform(const QStringList &);
331 void setUseAutoIdentify(bool);
332 void setAutoIdentifyService(const QString &);
333 void setAutoIdentifyPassword(const QString &);
334 void setUseSasl(bool);
335 void setSaslAccount(const QString &);
336 void setSaslPassword(const QString &);
337 virtual void setUseAutoReconnect(bool);
338 virtual void setAutoReconnectInterval(quint32);
339 virtual void setAutoReconnectRetries(quint16);
340 void setUnlimitedReconnectRetries(bool);
341 void setRejoinChannels(bool);
343 // Custom rate limiting
346 * Sets whether or not custom rate limiting is used.
348 * Setting limits too low may get you disconnected from the server!
350 * @param[in] useCustomRate If true, use custom rate limits, otherwise use Quassel defaults.
352 void setUseCustomMessageRate(bool useCustomRate);
355 * Sets maximum number of messages to send without any delays
357 * @param[in] burstSize
359 * Maximum number of messages to send without any delays. A value of 1 disables message
360 * bursting. Cannot be less than 1 as sending 0 messages at a time accomplishes nothing.
363 void setMessageRateBurstSize(quint32 burstSize);
366 * Sets the delay between messages after the maximum number of undelayed messages have been sent
368 * @param[in] messageDelay
370 * Delay in milliseconds between messages after the maximum number of undelayed messages have
374 void setMessageRateDelay(quint32 messageDelay);
377 * Sets whether or not all rate limiting is disabled, e.g. for IRC bridges
379 * Don't use with most normal networks.
381 * @param[in] unlimitedRate If true, disable rate limiting, otherwise apply configured limits.
383 void setUnlimitedMessageRate(bool unlimitedRate);
385 void setCodecForServer(const QByteArray &codecName);
386 void setCodecForEncoding(const QByteArray &codecName);
387 void setCodecForDecoding(const QByteArray &codecName);
389 void addSupport(const QString ¶m, const QString &value = QString());
390 void removeSupport(const QString ¶m);
392 // IRCv3 capability negotiation (can be connected to signals)
395 * Add an available capability, optionally providing a value.
397 * This may happen during first connect, or at any time later if a new capability becomes
398 * available (e.g. SASL service starting).
400 * @param[in] capability Name of the capability
403 * Optional value of the capability, e.g. sasl=plain.
406 void addCap(const QString &capability, const QString &value = QString());
409 * Marks a capability as acknowledged (enabled by the IRC server).
411 * @param[in] capability Name of the capability
413 void acknowledgeCap(const QString &capability);
416 * Removes a capability from the list of available capabilities.
418 * This may happen during first connect, or at any time later if an existing capability becomes
419 * unavailable (e.g. SASL service stopping). This also removes the capability from the list
420 * of acknowledged capabilities.
422 * @param[in] capability Name of the capability
424 void removeCap(const QString &capability);
427 * Clears all capabilities from the list of available capabilities.
429 * This also removes the capability from the list of acknowledged capabilities.
433 inline void addIrcUser(const QString &hostmask) { newIrcUser(hostmask); }
434 inline void addIrcChannel(const QString &channel) { newIrcChannel(channel); }
437 QVariantMap initSupports() const;
439 * Get the initial list of available capabilities.
441 * @return QVariantMap of <QString, QString> indicating available capabilities and values
443 QVariantMap initCaps() const;
445 * Get the initial list of enabled (acknowledged) capabilities.
447 * @return QVariantList of QString indicating enabled (acknowledged) capabilities and values
449 QVariantList initCapsEnabled() const { return toVariantList(capsEnabled()); }
450 inline QVariantList initServerList() const { return toVariantList(serverList()); }
451 virtual QVariantMap initIrcUsersAndChannels() const;
454 void initSetSupports(const QVariantMap &supports);
456 * Initialize the list of available capabilities.
458 * @param[in] caps QVariantMap of <QString, QString> indicating available capabilities and values
460 void initSetCaps(const QVariantMap &caps);
462 * Initialize the list of enabled (acknowledged) capabilities.
464 * @param[in] caps QVariantList of QString indicating enabled (acknowledged) capabilities and values
466 inline void initSetCapsEnabled(const QVariantList &capsEnabled) { _capsEnabled = fromVariantList<QString>(capsEnabled); }
467 inline void initSetServerList(const QVariantList &serverList) { _serverList = fromVariantList<Server>(serverList); }
468 virtual void initSetIrcUsersAndChannels(const QVariantMap &usersAndChannels);
471 * Update IrcUser hostmask and username from mask, creating an IrcUser if one does not exist.
473 * @param[in] mask Full nick!user@hostmask string
474 * @return IrcUser of the matching nick if exists, otherwise a new IrcUser
476 IrcUser *updateNickFromMask(const QString &mask);
478 // these slots are to keep the hashlists of all users and the
479 // channel lists up to date
480 void ircUserNickChanged(QString newnick);
482 virtual inline void requestConnect() const { REQUEST(NO_ARG) }
483 virtual inline void requestDisconnect() const { REQUEST(NO_ARG) }
484 virtual inline void requestSetNetworkInfo(const NetworkInfo &info) { REQUEST(ARG(info)) }
486 void emitConnectionError(const QString &);
489 virtual void removeIrcUser(IrcUser *ircuser);
490 virtual void removeIrcChannel(IrcChannel *ircChannel);
491 virtual void removeChansAndUsers();
494 void aboutToBeDestroyed();
495 void networkNameSet(const QString &networkName);
496 void currentServerSet(const QString ¤tServer);
497 void connectedSet(bool isConnected);
498 void connectionStateSet(Network::ConnectionState);
499 // void connectionStateSet(int);
500 void connectionError(const QString &errorMsg);
501 void myNickSet(const QString &mynick);
502 // void latencySet(int latency);
503 void identitySet(IdentityId);
505 void configChanged();
507 // void serverListSet(QVariantList serverList);
508 // void useRandomServerSet(bool);
509 // void performSet(const QStringList &);
510 // void useAutoIdentifySet(bool);
511 // void autoIdentifyServiceSet(const QString &);
512 // void autoIdentifyPasswordSet(const QString &);
513 // void useAutoReconnectSet(bool);
514 // void autoReconnectIntervalSet(quint32);
515 // void autoReconnectRetriesSet(quint16);
516 // void unlimitedReconnectRetriesSet(bool);
517 // void rejoinChannelsSet(bool);
519 // Custom rate limiting (can drive other slots)
522 * Signals enabling or disabling custom rate limiting
524 * @see Network::useCustomMessageRate()
526 * @param[out] useCustomRate
528 void useCustomMessageRateSet(const bool useCustomRate);
531 * Signals a change in maximum number of messages to send without any delays
533 * @see Network::messageRateBurstSize()
535 * @param[out] burstSize
537 void messageRateBurstSizeSet(const quint32 burstSize);
540 * Signals a change in delay between messages after the max. undelayed messages have been sent
542 * @see Network::messageRateDelay()
544 * @param[out] messageDelay
546 void messageRateDelaySet(const quint32 messageDelay);
549 * Signals enabling or disabling all rate limiting
551 * @see Network::unlimitedMessageRate()
553 * @param[out] unlimitedRate
555 void unlimitedMessageRateSet(const bool unlimitedRate);
557 // void codecForServerSet(const QByteArray &codecName);
558 // void codecForEncodingSet(const QByteArray &codecName);
559 // void codecForDecodingSet(const QByteArray &codecName);
561 // void supportAdded(const QString ¶m, const QString &value);
562 // void supportRemoved(const QString ¶m);
564 // IRCv3 capability negotiation (can drive other slots)
566 * Indicates a capability is now available, with optional value in Network::capValue().
568 * @see Network::addCap()
570 * @param[in] capability Name of the capability
572 void capAdded (const QString &capability);
575 * Indicates a capability was acknowledged (enabled by the IRC server).
577 * @see Network::acknowledgeCap()
579 * @param[in] capability Name of the capability
581 void capAcknowledged(const QString &capability);
584 * Indicates a capability was removed from the list of available capabilities.
586 * @see Network::removeCap()
588 * @param[in] capability Name of the capability
590 void capRemoved(const QString &capability);
592 // void ircUserAdded(const QString &hostmask);
593 void ircUserAdded(IrcUser *);
594 // void ircChannelAdded(const QString &channelname);
595 void ircChannelAdded(IrcChannel *);
597 // void connectRequested() const;
598 // void disconnectRequested() const;
599 // void setNetworkInfoRequested(const NetworkInfo &) const;
602 inline virtual IrcChannel *ircChannelFactory(const QString &channelname) { return new IrcChannel(channelname, this); }
603 inline virtual IrcUser *ircUserFactory(const QString &hostmask) { return new IrcUser(hostmask, this); }
606 QPointer<SignalProxy> _proxy;
608 NetworkId _networkId;
609 IdentityId _identity;
613 QString _networkName;
614 QString _currentServer;
616 ConnectionState _connectionState;
618 mutable QString _prefixes;
619 mutable QString _prefixModes;
621 QHash<QString, IrcUser *> _ircUsers; // stores all known nicks for the server
622 QHash<QString, IrcChannel *> _ircChannels; // stores all known channels
623 QHash<QString, QString> _supports; // stores results from RPL_ISUPPORT
625 QHash<QString, QString> _caps; /// Capabilities supported by the IRC server
626 // By synchronizing the supported capabilities, the client could suggest certain behaviors, e.g.
627 // in the Network settings dialog, recommending SASL instead of using NickServ, or warning if
628 // SASL EXTERNAL isn't available.
629 QStringList _capsEnabled; /// Enabled capabilities that received 'CAP ACK'
630 // _capsEnabled uses the same values from the <name>=<value> pairs stored in _caps
632 ServerList _serverList;
633 bool _useRandomServer;
634 QStringList _perform;
636 bool _useAutoIdentify;
637 QString _autoIdentifyService;
638 QString _autoIdentifyPassword;
641 QString _saslAccount;
642 QString _saslPassword;
644 bool _useAutoReconnect;
645 quint32 _autoReconnectInterval;
646 quint16 _autoReconnectRetries;
647 bool _unlimitedReconnectRetries;
648 bool _rejoinChannels;
650 // Custom rate limiting
651 bool _useCustomMessageRate; /// If true, use custom rate limits, otherwise use defaults
652 quint32 _messageRateBurstSize; /// Maximum number of messages to send without any delays
653 quint32 _messageRateDelay; /// Delay in ms. for messages when max. burst messages sent
654 bool _unlimitedMessageRate; /// If true, disable rate limiting, otherwise apply limits
656 QTextCodec *_codecForServer;
657 QTextCodec *_codecForEncoding;
658 QTextCodec *_codecForDecoding;
660 static QTextCodec *_defaultCodecForServer;
661 static QTextCodec *_defaultCodecForEncoding;
662 static QTextCodec *_defaultCodecForDecoding;
664 bool _autoAwayActive; // when this is active handle305 and handle306 don't trigger any output
666 friend class IrcUser;
667 friend class IrcChannel;
671 //! Stores all editable information about a network (as opposed to runtime state).
673 // set some default values, note that this does not initialize e.g. name and id
680 bool useCustomEncodings; // not used!
681 QByteArray codecForServer;
682 QByteArray codecForEncoding;
683 QByteArray codecForDecoding;
685 Network::ServerList serverList;
686 bool useRandomServer;
690 bool useAutoIdentify;
691 QString autoIdentifyService;
692 QString autoIdentifyPassword;
696 QString saslPassword;
698 bool useAutoReconnect;
699 quint32 autoReconnectInterval;
700 quint16 autoReconnectRetries;
701 bool unlimitedReconnectRetries;
704 // Custom rate limiting
705 bool useCustomMessageRate; /// If true, use custom rate limits, otherwise use defaults
706 quint32 messageRateBurstSize; /// Maximum number of messages to send without any delays
707 quint32 messageRateDelay; /// Delay in ms. for messages when max. burst messages sent
708 bool unlimitedMessageRate; /// If true, disable rate limiting, otherwise apply limits
710 bool operator==(const NetworkInfo &other) const;
711 bool operator!=(const NetworkInfo &other) const;
714 QDataStream &operator<<(QDataStream &out, const NetworkInfo &info);
715 QDataStream &operator>>(QDataStream &in, NetworkInfo &info);
716 QDebug operator<<(QDebug dbg, const NetworkInfo &i);
717 Q_DECLARE_METATYPE(NetworkInfo)
719 QDataStream &operator<<(QDataStream &out, const Network::Server &server);
720 QDataStream &operator>>(QDataStream &in, Network::Server &server);
721 QDebug operator<<(QDebug dbg, const Network::Server &server);
722 Q_DECLARE_METATYPE(Network::Server)