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"
48 // TODO: ConnectionInfo to propagate and sync the current state of NetworkConnection, encodings etcpp
50 class Network : public SyncableObject
54 Q_ENUMS(ConnectionState)
56 Q_PROPERTY(QString networkName READ networkName WRITE setNetworkName)
57 Q_PROPERTY(QString currentServer READ currentServer WRITE setCurrentServer)
58 Q_PROPERTY(QString myNick READ myNick WRITE setMyNick)
59 Q_PROPERTY(int latency READ latency WRITE setLatency)
60 Q_PROPERTY(QByteArray codecForServer READ codecForServer WRITE setCodecForServer)
61 Q_PROPERTY(QByteArray codecForEncoding READ codecForEncoding WRITE setCodecForEncoding)
62 Q_PROPERTY(QByteArray codecForDecoding READ codecForDecoding WRITE setCodecForDecoding)
63 Q_PROPERTY(IdentityId identityId READ identity WRITE setIdentity)
64 Q_PROPERTY(bool isConnected READ isConnected WRITE setConnected)
65 //Q_PROPERTY(Network::ConnectionState connectionState READ connectionState WRITE setConnectionState)
66 Q_PROPERTY(int connectionState READ connectionState WRITE setConnectionState)
67 Q_PROPERTY(bool useRandomServer READ useRandomServer WRITE setUseRandomServer)
68 Q_PROPERTY(QStringList perform READ perform WRITE setPerform)
69 Q_PROPERTY(bool useAutoIdentify READ useAutoIdentify WRITE setUseAutoIdentify)
70 Q_PROPERTY(QString autoIdentifyService READ autoIdentifyService WRITE setAutoIdentifyService)
71 Q_PROPERTY(QString autoIdentifyPassword READ autoIdentifyPassword WRITE setAutoIdentifyPassword)
72 Q_PROPERTY(bool useSasl READ useSasl WRITE setUseSasl)
73 Q_PROPERTY(QString saslAccount READ saslAccount WRITE setSaslAccount)
74 Q_PROPERTY(QString saslPassword READ saslPassword WRITE setSaslPassword)
75 Q_PROPERTY(bool useAutoReconnect READ useAutoReconnect WRITE setUseAutoReconnect)
76 Q_PROPERTY(quint32 autoReconnectInterval READ autoReconnectInterval WRITE setAutoReconnectInterval)
77 Q_PROPERTY(quint16 autoReconnectRetries READ autoReconnectRetries WRITE setAutoReconnectRetries)
78 Q_PROPERTY(bool unlimitedReconnectRetries READ unlimitedReconnectRetries WRITE setUnlimitedReconnectRetries)
79 Q_PROPERTY(bool rejoinChannels READ rejoinChannels WRITE setRejoinChannels)
80 // Custom rate limiting
81 Q_PROPERTY(bool useCustomMessageRate READ useCustomMessageRate WRITE setUseCustomMessageRate)
82 Q_PROPERTY(quint32 msgRateBurstSize READ messageRateBurstSize WRITE setMessageRateBurstSize)
83 Q_PROPERTY(quint32 msgRateMessageDelay READ messageRateDelay WRITE setMessageRateDelay)
84 Q_PROPERTY(bool unlimitedMessageRate READ unlimitedMessageRate WRITE setUnlimitedMessageRate)
87 enum ConnectionState {
97 // http://www.irc.org/tech_docs/005.html
98 // http://www.irc.org/tech_docs/draft-brocklesby-irc-isupport-03.txt
99 enum ChannelModeType {
100 NOT_A_CHANMODE = 0x00,
107 // Default port assignments according to what many IRC networks have settled on.
108 // Technically not a standard, but it's fairly widespread.
109 // See https://freenode.net/news/port-6697-irc-via-tlsssl
111 PORT_PLAINTEXT = 6667, /// Default port for unencrypted connections
112 PORT_SSL = 6697 /// Default port for encrypted connections
120 bool sslVerify; /// If true, validate SSL certificates
130 // sslVerify only applies when useSsl is true. sslVerify should be enabled by default,
131 // so enabling useSsl offers a more secure default.
132 Server() : port(6667), useSsl(false), sslVerify(true), sslVersion(0), useProxy(false),
133 proxyType(QNetworkProxy::Socks5Proxy), proxyHost("localhost"), proxyPort(8080) {}
135 Server(const QString &host, uint port, const QString &password, bool useSsl,
137 : host(host), port(port), password(password), useSsl(useSsl), sslVerify(sslVerify),
138 sslVersion(0), useProxy(false), proxyType(QNetworkProxy::Socks5Proxy),
139 proxyHost("localhost"), proxyPort(8080) {}
141 bool operator==(const Server &other) const;
142 bool operator!=(const Server &other) const;
144 typedef QList<Server> ServerList;
146 Network(const NetworkId &networkid, QObject *parent = 0);
149 inline NetworkId networkId() const { return _networkId; }
151 inline SignalProxy *proxy() const { return _proxy; }
152 inline void setProxy(SignalProxy *proxy) { _proxy = proxy; }
154 inline bool isMyNick(const QString &nick) const { return (myNick().toLower() == nick.toLower()); }
155 inline bool isMe(IrcUser *ircuser) const { return (ircuser->nick().toLower() == myNick().toLower()); }
157 bool isChannelName(const QString &channelname) const;
160 * Checks if the target counts as a STATUSMSG
162 * Status messages are prefixed with one or more characters from the server-provided STATUSMSG
163 * if available, otherwise "@" and "+" are assumed. Generally, status messages sent to a
164 * channel are only visible to those with the same or higher permissions, e.g. voiced.
166 * @param[in] target Name of destination, e.g. a channel or query
167 * @returns True if a STATUSMSG, otherwise false
169 bool isStatusMsg(const QString &target) const;
171 inline bool isConnected() const { return _connected; }
172 //Network::ConnectionState connectionState() const;
173 inline int connectionState() const { return _connectionState; }
175 QString prefixToMode(const QString &prefix) const;
176 inline QString prefixToMode(const QCharRef &prefix) const { return prefixToMode(QString(prefix)); }
177 QString modeToPrefix(const QString &mode) const;
178 inline QString modeToPrefix(const QCharRef &mode) const { return modeToPrefix(QString(mode)); }
180 ChannelModeType channelModeType(const QString &mode);
181 inline ChannelModeType channelModeType(const QCharRef &mode) { return channelModeType(QString(mode)); }
183 inline const QString &networkName() const { return _networkName; }
184 inline const QString ¤tServer() const { return _currentServer; }
185 inline const QString &myNick() const { return _myNick; }
186 inline int latency() const { return _latency; }
187 inline IrcUser *me() const { return ircUser(myNick()); }
188 inline IdentityId identity() const { return _identity; }
189 QStringList nicks() const;
190 inline QStringList channels() const { return _ircChannels.keys(); }
192 * Gets the list of available capabilities.
194 * @returns QStringList of available capabilities
196 inline const QStringList caps() const { return QStringList(_caps.keys()); }
198 * Gets the list of enabled (acknowledged) capabilities.
200 * @returns QStringList of enabled (acknowledged) capabilities
202 inline const QStringList capsEnabled() const { return _capsEnabled; }
203 inline const ServerList &serverList() const { return _serverList; }
204 inline bool useRandomServer() const { return _useRandomServer; }
205 inline const QStringList &perform() const { return _perform; }
206 inline bool useAutoIdentify() const { return _useAutoIdentify; }
207 inline const QString &autoIdentifyService() const { return _autoIdentifyService; }
208 inline const QString &autoIdentifyPassword() const { return _autoIdentifyPassword; }
209 inline bool useSasl() const { return _useSasl; }
210 inline const QString &saslAccount() const { return _saslAccount; }
211 inline const QString &saslPassword() const { return _saslPassword; }
212 inline bool useAutoReconnect() const { return _useAutoReconnect; }
213 inline quint32 autoReconnectInterval() const { return _autoReconnectInterval; }
214 inline quint16 autoReconnectRetries() const { return _autoReconnectRetries; }
215 inline bool unlimitedReconnectRetries() const { return _unlimitedReconnectRetries; }
216 inline bool rejoinChannels() const { return _rejoinChannels; }
218 // Custom rate limiting
221 * Gets whether or not custom rate limiting is used
223 * @return True if custom rate limiting is enabled, otherwise false.
225 inline bool useCustomMessageRate() const { return _useCustomMessageRate; }
228 * Gets maximum number of messages to send without any delays
232 * Maximum number of messages to send without any delays. A value of 1 disables message
236 inline quint32 messageRateBurstSize() const { return _messageRateBurstSize; }
239 * Gets the delay between messages after the maximum number of undelayed messages have been sent
243 * Delay in milliseconds between messages after the maximum number of undelayed messages have
247 inline quint32 messageRateDelay() const { return _messageRateDelay; }
250 * Gets whether or not all rate limiting is disabled, e.g. for IRC bridges
252 * @return If true, disable rate limiting, otherwise apply configured limits.
254 inline bool unlimitedMessageRate() const { return _unlimitedMessageRate; }
256 NetworkInfo networkInfo() const;
257 void setNetworkInfo(const NetworkInfo &);
259 QString prefixes() const;
260 QString prefixModes() const;
261 void determinePrefixes() const;
263 bool supports(const QString ¶m) const { return _supports.contains(param); }
264 QString support(const QString ¶m) const;
267 * Checks if a given capability is acknowledged and active.
269 * @param[in] capability Name of capability
270 * @returns True if acknowledged (active), otherwise false
272 inline bool capEnabled(const QString &capability) const { return _capsEnabled.contains(capability.toLower()); }
273 // IRCv3 specs all use lowercase capability names
276 * Gets the value of an available capability, e.g. for SASL, "EXTERNAL,PLAIN".
278 * @param[in] capability Name of capability
279 * @returns Value of capability if one was specified, otherwise empty string
281 QString capValue(const QString &capability) const { return _caps.value(capability.toLower()); }
282 // IRCv3 specs all use lowercase capability names
283 // QHash returns the default constructed value if not found, in this case, empty string
284 // See: https://doc.qt.io/qt-4.8/qhash.html#value
287 * Check if the given authentication mechanism is likely to be supported.
289 * This depends on the server advertising SASL support and either declaring available mechanisms
290 * (SASL 3.2), or just indicating something is supported (SASL 3.1).
292 * @param[in] saslMechanism Desired SASL mechanism
293 * @return True if mechanism supported or unknown, otherwise false
295 bool saslMaybeSupports(const QString &saslMechanism) const;
297 IrcUser *newIrcUser(const QString &hostmask, const QVariantMap &initData = QVariantMap());
298 inline IrcUser *newIrcUser(const QByteArray &hostmask) { return newIrcUser(decodeServerString(hostmask)); }
299 IrcUser *ircUser(QString nickname) const;
300 inline IrcUser *ircUser(const QByteArray &nickname) const { return ircUser(decodeServerString(nickname)); }
301 inline QList<IrcUser *> ircUsers() const { return _ircUsers.values(); }
302 inline quint32 ircUserCount() const { return _ircUsers.count(); }
304 IrcChannel *newIrcChannel(const QString &channelname, const QVariantMap &initData = QVariantMap());
305 inline IrcChannel *newIrcChannel(const QByteArray &channelname) { return newIrcChannel(decodeServerString(channelname)); }
306 IrcChannel *ircChannel(QString channelname) const;
307 inline IrcChannel *ircChannel(const QByteArray &channelname) const { return ircChannel(decodeServerString(channelname)); }
308 inline QList<IrcChannel *> ircChannels() const { return _ircChannels.values(); }
309 inline quint32 ircChannelCount() const { return _ircChannels.count(); }
311 QByteArray codecForServer() const;
312 QByteArray codecForEncoding() const;
313 QByteArray codecForDecoding() const;
314 void setCodecForServer(QTextCodec *codec);
315 void setCodecForEncoding(QTextCodec *codec);
316 void setCodecForDecoding(QTextCodec *codec);
318 QString decodeString(const QByteArray &text) const;
319 QByteArray encodeString(const QString &string) const;
320 QString decodeServerString(const QByteArray &text) const;
321 QByteArray encodeServerString(const QString &string) const;
323 static QByteArray defaultCodecForServer();
324 static QByteArray defaultCodecForEncoding();
325 static QByteArray defaultCodecForDecoding();
326 static void setDefaultCodecForServer(const QByteArray &name);
327 static void setDefaultCodecForEncoding(const QByteArray &name);
328 static void setDefaultCodecForDecoding(const QByteArray &name);
330 inline bool autoAwayActive() const { return _autoAwayActive; }
331 inline void setAutoAwayActive(bool active) { _autoAwayActive = active; }
334 void setNetworkName(const QString &networkName);
335 void setCurrentServer(const QString ¤tServer);
336 void setConnected(bool isConnected);
337 void setConnectionState(int state);
338 virtual void setMyNick(const QString &mynick);
339 void setLatency(int latency);
340 void setIdentity(IdentityId);
342 void setServerList(const QVariantList &serverList);
343 void setUseRandomServer(bool);
344 void setPerform(const QStringList &);
345 void setUseAutoIdentify(bool);
346 void setAutoIdentifyService(const QString &);
347 void setAutoIdentifyPassword(const QString &);
348 void setUseSasl(bool);
349 void setSaslAccount(const QString &);
350 void setSaslPassword(const QString &);
351 virtual void setUseAutoReconnect(bool);
352 virtual void setAutoReconnectInterval(quint32);
353 virtual void setAutoReconnectRetries(quint16);
354 void setUnlimitedReconnectRetries(bool);
355 void setRejoinChannels(bool);
357 // Custom rate limiting
360 * Sets whether or not custom rate limiting is used.
362 * Setting limits too low may get you disconnected from the server!
364 * @param[in] useCustomRate If true, use custom rate limits, otherwise use Quassel defaults.
366 void setUseCustomMessageRate(bool useCustomRate);
369 * Sets maximum number of messages to send without any delays
371 * @param[in] burstSize
373 * Maximum number of messages to send without any delays. A value of 1 disables message
374 * bursting. Cannot be less than 1 as sending 0 messages at a time accomplishes nothing.
377 void setMessageRateBurstSize(quint32 burstSize);
380 * Sets the delay between messages after the maximum number of undelayed messages have been sent
382 * @param[in] messageDelay
384 * Delay in milliseconds between messages after the maximum number of undelayed messages have
388 void setMessageRateDelay(quint32 messageDelay);
391 * Sets whether or not all rate limiting is disabled, e.g. for IRC bridges
393 * Don't use with most normal networks.
395 * @param[in] unlimitedRate If true, disable rate limiting, otherwise apply configured limits.
397 void setUnlimitedMessageRate(bool unlimitedRate);
399 void setCodecForServer(const QByteArray &codecName);
400 void setCodecForEncoding(const QByteArray &codecName);
401 void setCodecForDecoding(const QByteArray &codecName);
403 void addSupport(const QString ¶m, const QString &value = QString());
404 void removeSupport(const QString ¶m);
406 // IRCv3 capability negotiation (can be connected to signals)
409 * Add an available capability, optionally providing a value.
411 * This may happen during first connect, or at any time later if a new capability becomes
412 * available (e.g. SASL service starting).
414 * @param[in] capability Name of the capability
417 * Optional value of the capability, e.g. sasl=plain.
420 void addCap(const QString &capability, const QString &value = QString());
423 * Marks a capability as acknowledged (enabled by the IRC server).
425 * @param[in] capability Name of the capability
427 void acknowledgeCap(const QString &capability);
430 * Removes a capability from the list of available capabilities.
432 * This may happen during first connect, or at any time later if an existing capability becomes
433 * unavailable (e.g. SASL service stopping). This also removes the capability from the list
434 * of acknowledged capabilities.
436 * @param[in] capability Name of the capability
438 void removeCap(const QString &capability);
441 * Clears all capabilities from the list of available capabilities.
443 * This also removes the capability from the list of acknowledged capabilities.
447 inline void addIrcUser(const QString &hostmask) { newIrcUser(hostmask); }
448 inline void addIrcChannel(const QString &channel) { newIrcChannel(channel); }
451 QVariantMap initSupports() const;
453 * Get the initial list of available capabilities.
455 * @return QVariantMap of <QString, QString> indicating available capabilities and values
457 QVariantMap initCaps() const;
459 * Get the initial list of enabled (acknowledged) capabilities.
461 * @return QVariantList of QString indicating enabled (acknowledged) capabilities and values
463 QVariantList initCapsEnabled() const { return toVariantList(capsEnabled()); }
464 inline QVariantList initServerList() const { return toVariantList(serverList()); }
465 virtual QVariantMap initIrcUsersAndChannels() const;
468 void initSetSupports(const QVariantMap &supports);
470 * Initialize the list of available capabilities.
472 * @param[in] caps QVariantMap of <QString, QString> indicating available capabilities and values
474 void initSetCaps(const QVariantMap &caps);
476 * Initialize the list of enabled (acknowledged) capabilities.
478 * @param[in] caps QVariantList of QString indicating enabled (acknowledged) capabilities and values
480 inline void initSetCapsEnabled(const QVariantList &capsEnabled) { _capsEnabled = fromVariantList<QString>(capsEnabled); }
481 inline void initSetServerList(const QVariantList &serverList) { _serverList = fromVariantList<Server>(serverList); }
482 virtual void initSetIrcUsersAndChannels(const QVariantMap &usersAndChannels);
485 * Update IrcUser hostmask and username from mask, creating an IrcUser if one does not exist.
487 * @param[in] mask Full nick!user@hostmask string
488 * @return IrcUser of the matching nick if exists, otherwise a new IrcUser
490 IrcUser *updateNickFromMask(const QString &mask);
492 // these slots are to keep the hashlists of all users and the
493 // channel lists up to date
494 void ircUserNickChanged(QString newnick);
496 virtual inline void requestConnect() const { REQUEST(NO_ARG) }
497 virtual inline void requestDisconnect() const { REQUEST(NO_ARG) }
498 virtual inline void requestSetNetworkInfo(const NetworkInfo &info) { REQUEST(ARG(info)) }
500 void emitConnectionError(const QString &);
503 virtual void removeIrcUser(IrcUser *ircuser);
504 virtual void removeIrcChannel(IrcChannel *ircChannel);
505 virtual void removeChansAndUsers();
508 void aboutToBeDestroyed();
509 void networkNameSet(const QString &networkName);
510 void currentServerSet(const QString ¤tServer);
511 void connectedSet(bool isConnected);
512 void connectionStateSet(Network::ConnectionState);
513 // void connectionStateSet(int);
514 void connectionError(const QString &errorMsg);
515 void myNickSet(const QString &mynick);
516 // void latencySet(int latency);
517 void identitySet(IdentityId);
519 void configChanged();
521 // void serverListSet(QVariantList serverList);
522 // void useRandomServerSet(bool);
523 // void performSet(const QStringList &);
524 // void useAutoIdentifySet(bool);
525 // void autoIdentifyServiceSet(const QString &);
526 // void autoIdentifyPasswordSet(const QString &);
527 // void useAutoReconnectSet(bool);
528 // void autoReconnectIntervalSet(quint32);
529 // void autoReconnectRetriesSet(quint16);
530 // void unlimitedReconnectRetriesSet(bool);
531 // void rejoinChannelsSet(bool);
533 // Custom rate limiting (can drive other slots)
536 * Signals enabling or disabling custom rate limiting
538 * @see Network::useCustomMessageRate()
540 * @param[out] useCustomRate
542 void useCustomMessageRateSet(const bool useCustomRate);
545 * Signals a change in maximum number of messages to send without any delays
547 * @see Network::messageRateBurstSize()
549 * @param[out] burstSize
551 void messageRateBurstSizeSet(const quint32 burstSize);
554 * Signals a change in delay between messages after the max. undelayed messages have been sent
556 * @see Network::messageRateDelay()
558 * @param[out] messageDelay
560 void messageRateDelaySet(const quint32 messageDelay);
563 * Signals enabling or disabling all rate limiting
565 * @see Network::unlimitedMessageRate()
567 * @param[out] unlimitedRate
569 void unlimitedMessageRateSet(const bool unlimitedRate);
571 // void codecForServerSet(const QByteArray &codecName);
572 // void codecForEncodingSet(const QByteArray &codecName);
573 // void codecForDecodingSet(const QByteArray &codecName);
575 // void supportAdded(const QString ¶m, const QString &value);
576 // void supportRemoved(const QString ¶m);
578 // IRCv3 capability negotiation (can drive other slots)
580 * Indicates a capability is now available, with optional value in Network::capValue().
582 * @see Network::addCap()
584 * @param[in] capability Name of the capability
586 void capAdded (const QString &capability);
589 * Indicates a capability was acknowledged (enabled by the IRC server).
591 * @see Network::acknowledgeCap()
593 * @param[in] capability Name of the capability
595 void capAcknowledged(const QString &capability);
598 * Indicates a capability was removed from the list of available capabilities.
600 * @see Network::removeCap()
602 * @param[in] capability Name of the capability
604 void capRemoved(const QString &capability);
606 // void ircUserAdded(const QString &hostmask);
607 void ircUserAdded(IrcUser *);
608 // void ircChannelAdded(const QString &channelname);
609 void ircChannelAdded(IrcChannel *);
611 // void connectRequested() const;
612 // void disconnectRequested() const;
613 // void setNetworkInfoRequested(const NetworkInfo &) const;
616 inline virtual IrcChannel *ircChannelFactory(const QString &channelname) { return new IrcChannel(channelname, this); }
617 inline virtual IrcUser *ircUserFactory(const QString &hostmask) { return new IrcUser(hostmask, this); }
620 QPointer<SignalProxy> _proxy;
622 NetworkId _networkId;
623 IdentityId _identity;
627 QString _networkName;
628 QString _currentServer;
630 ConnectionState _connectionState;
632 mutable QString _prefixes;
633 mutable QString _prefixModes;
635 QHash<QString, IrcUser *> _ircUsers; // stores all known nicks for the server
636 QHash<QString, IrcChannel *> _ircChannels; // stores all known channels
637 QHash<QString, QString> _supports; // stores results from RPL_ISUPPORT
639 QHash<QString, QString> _caps; /// Capabilities supported by the IRC server
640 // By synchronizing the supported capabilities, the client could suggest certain behaviors, e.g.
641 // in the Network settings dialog, recommending SASL instead of using NickServ, or warning if
642 // SASL EXTERNAL isn't available.
643 QStringList _capsEnabled; /// Enabled capabilities that received 'CAP ACK'
644 // _capsEnabled uses the same values from the <name>=<value> pairs stored in _caps
646 ServerList _serverList;
647 bool _useRandomServer;
648 QStringList _perform;
650 bool _useAutoIdentify;
651 QString _autoIdentifyService;
652 QString _autoIdentifyPassword;
655 QString _saslAccount;
656 QString _saslPassword;
658 bool _useAutoReconnect;
659 quint32 _autoReconnectInterval;
660 quint16 _autoReconnectRetries;
661 bool _unlimitedReconnectRetries;
662 bool _rejoinChannels;
664 // Custom rate limiting
665 bool _useCustomMessageRate; /// If true, use custom rate limits, otherwise use defaults
666 quint32 _messageRateBurstSize; /// Maximum number of messages to send without any delays
667 quint32 _messageRateDelay; /// Delay in ms. for messages when max. burst messages sent
668 bool _unlimitedMessageRate; /// If true, disable rate limiting, otherwise apply limits
670 QTextCodec *_codecForServer;
671 QTextCodec *_codecForEncoding;
672 QTextCodec *_codecForDecoding;
674 static QTextCodec *_defaultCodecForServer;
675 static QTextCodec *_defaultCodecForEncoding;
676 static QTextCodec *_defaultCodecForDecoding;
678 bool _autoAwayActive; // when this is active handle305 and handle306 don't trigger any output
680 friend class IrcUser;
681 friend class IrcChannel;
685 //! Stores all editable information about a network (as opposed to runtime state).
687 // set some default values, note that this does not initialize e.g. name and id
694 bool useCustomEncodings; // not used!
695 QByteArray codecForServer;
696 QByteArray codecForEncoding;
697 QByteArray codecForDecoding;
699 Network::ServerList serverList;
700 bool useRandomServer;
704 bool useAutoIdentify;
705 QString autoIdentifyService;
706 QString autoIdentifyPassword;
710 QString saslPassword;
712 bool useAutoReconnect;
713 quint32 autoReconnectInterval;
714 quint16 autoReconnectRetries;
715 bool unlimitedReconnectRetries;
718 // Custom rate limiting
719 bool useCustomMessageRate; /// If true, use custom rate limits, otherwise use defaults
720 quint32 messageRateBurstSize; /// Maximum number of messages to send without any delays
721 quint32 messageRateDelay; /// Delay in ms. for messages when max. burst messages sent
722 bool unlimitedMessageRate; /// If true, disable rate limiting, otherwise apply limits
724 bool operator==(const NetworkInfo &other) const;
725 bool operator!=(const NetworkInfo &other) const;
728 QDataStream &operator<<(QDataStream &out, const NetworkInfo &info);
729 QDataStream &operator>>(QDataStream &in, NetworkInfo &info);
730 QDebug operator<<(QDebug dbg, const NetworkInfo &i);
731 Q_DECLARE_METATYPE(NetworkInfo)
733 QDataStream &operator<<(QDataStream &out, const Network::Server &server);
734 QDataStream &operator>>(QDataStream &in, Network::Server &server);
735 QDebug operator<<(QDebug dbg, const Network::Server &server);
736 Q_DECLARE_METATYPE(Network::Server)