1 /***************************************************************************
2 * Copyright (C) 2005-08 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 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19 ***************************************************************************/
27 QTextCodec *Network::_defaultCodecForServer = 0;
28 QTextCodec *Network::_defaultCodecForEncoding = 0;
29 QTextCodec *Network::_defaultCodecForDecoding = 0;
30 // ====================
32 // ====================
33 Network::Network(const NetworkId &networkid, QObject *parent)
34 : SyncableObject(parent),
36 _networkId(networkid),
40 _networkName(QString("<not initialized>")),
41 _currentServer(QString()),
43 _connectionState(Disconnected),
45 _prefixModes(QString()),
46 _useRandomServer(false),
47 _useAutoIdentify(false),
48 _useAutoReconnect(false),
49 _autoReconnectInterval(60),
50 _autoReconnectRetries(10),
51 _unlimitedReconnectRetries(false),
55 _autoAwayActive(false)
57 setObjectName(QString::number(networkid.toInt()));
61 emit aboutToBeDestroyed();
64 bool Network::isChannelName(const QString &channelname) const {
65 if(channelname.isEmpty())
68 if(supports("CHANTYPES"))
69 return support("CHANTYPES").contains(channelname[0]);
71 return QString("#&!+").contains(channelname[0]);
74 NetworkInfo Network::networkInfo() const {
76 info.networkName = networkName();
77 info.networkId = networkId();
78 info.identity = identity();
79 info.codecForServer = codecForServer();
80 info.codecForEncoding = codecForEncoding();
81 info.codecForDecoding = codecForDecoding();
82 info.serverList = serverList();
83 info.useRandomServer = useRandomServer();
84 info.perform = perform();
85 info.useAutoIdentify = useAutoIdentify();
86 info.autoIdentifyService = autoIdentifyService();
87 info.autoIdentifyPassword = autoIdentifyPassword();
88 info.useAutoReconnect = useAutoReconnect();
89 info.autoReconnectInterval = autoReconnectInterval();
90 info.autoReconnectRetries = autoReconnectRetries();
91 info.unlimitedReconnectRetries = unlimitedReconnectRetries();
92 info.rejoinChannels = rejoinChannels();
96 void Network::setNetworkInfo(const NetworkInfo &info) {
97 // we don't set our ID!
98 if(!info.networkName.isEmpty() && info.networkName != networkName()) setNetworkName(info.networkName);
99 if(info.identity > 0 && info.identity != identity()) setIdentity(info.identity);
100 if(info.codecForServer != codecForServer()) setCodecForServer(QTextCodec::codecForName(info.codecForServer));
101 if(info.codecForEncoding != codecForEncoding()) setCodecForEncoding(QTextCodec::codecForName(info.codecForEncoding));
102 if(info.codecForDecoding != codecForDecoding()) setCodecForDecoding(QTextCodec::codecForName(info.codecForDecoding));
103 if(info.serverList.count()) setServerList(info.serverList); // FIXME compare components
104 if(info.useRandomServer != useRandomServer()) setUseRandomServer(info.useRandomServer);
105 if(info.perform != perform()) setPerform(info.perform);
106 if(info.useAutoIdentify != useAutoIdentify()) setUseAutoIdentify(info.useAutoIdentify);
107 if(info.autoIdentifyService != autoIdentifyService()) setAutoIdentifyService(info.autoIdentifyService);
108 if(info.autoIdentifyPassword != autoIdentifyPassword()) setAutoIdentifyPassword(info.autoIdentifyPassword);
109 if(info.useAutoReconnect != useAutoReconnect()) setUseAutoReconnect(info.useAutoReconnect);
110 if(info.autoReconnectInterval != autoReconnectInterval()) setAutoReconnectInterval(info.autoReconnectInterval);
111 if(info.autoReconnectRetries != autoReconnectRetries()) setAutoReconnectRetries(info.autoReconnectRetries);
112 if(info.unlimitedReconnectRetries != unlimitedReconnectRetries()) setUnlimitedReconnectRetries(info.unlimitedReconnectRetries);
113 if(info.rejoinChannels != rejoinChannels()) setRejoinChannels(info.rejoinChannels);
116 QString Network::prefixToMode(const QString &prefix) {
117 if(prefixes().contains(prefix))
118 return QString(prefixModes()[prefixes().indexOf(prefix)]);
123 QString Network::modeToPrefix(const QString &mode) {
124 if(prefixModes().contains(mode))
125 return QString(prefixes()[prefixModes().indexOf(mode)]);
130 QStringList Network::nicks() const {
131 // we don't use _ircUsers.keys() since the keys may be
132 // not up to date after a nick change
134 foreach(IrcUser *ircuser, _ircUsers.values()) {
135 nicks << ircuser->nick();
140 QString Network::prefixes() {
141 if(_prefixes.isNull())
147 QString Network::prefixModes() {
148 if(_prefixModes.isNull())
154 // example Unreal IRCD: CHANMODES=beI,kfL,lj,psmntirRcOAQKVCuzNSMTG
155 Network::ChannelModeType Network::channelModeType(const QString &mode) {
157 return NOT_A_CHANMODE;
159 QString chanmodes = support("CHANMODES");
160 if(chanmodes.isEmpty())
161 return NOT_A_CHANMODE;
163 ChannelModeType modeType = A_CHANMODE;
164 for(int i = 0; i < chanmodes.count(); i++) {
165 if(chanmodes[i] == mode[0])
167 else if(chanmodes[i] == ',')
168 modeType = (ChannelModeType)(modeType << 1);
170 if(modeType > D_CHANMODE) {
171 qWarning() << "Network" << networkId() << "supplied invalid CHANMODES:" << chanmodes;
172 modeType = NOT_A_CHANMODE;
177 QString Network::support(const QString ¶m) const {
178 QString support_ = param.toUpper();
179 if(_supports.contains(support_))
180 return _supports[support_];
185 IrcUser *Network::newIrcUser(const QString &hostmask, const QVariantMap &initData) {
186 QString nick(nickFromMask(hostmask).toLower());
187 if(!_ircUsers.contains(nick)) {
188 IrcUser *ircuser = new IrcUser(hostmask, this);
189 if(!initData.isEmpty()) {
190 ircuser->fromVariantMap(initData);
191 ircuser->setInitialized();
195 proxy()->synchronize(ircuser);
197 qWarning() << "unable to synchronize new IrcUser" << hostmask << "forgot to call Network::setProxy(SignalProxy *)?";
199 connect(ircuser, SIGNAL(nickSet(QString)), this, SLOT(ircUserNickChanged(QString)));
200 connect(ircuser, SIGNAL(destroyed()), this, SLOT(ircUserDestroyed()));
201 if(!ircuser->isInitialized())
202 connect(ircuser, SIGNAL(initDone()), this, SLOT(ircUserInitDone()));
204 _ircUsers[nick] = ircuser;
206 emit ircUserAdded(hostmask);
207 emit ircUserAdded(ircuser);
208 if(ircuser->isInitialized())
209 emit ircUserInitDone(ircuser);
212 return _ircUsers[nick];
215 void Network::ircUserDestroyed() {
216 IrcUser *ircUser = static_cast<IrcUser *>(sender());
220 QHash<QString, IrcUser *>::iterator ircUserIter = _ircUsers.begin();
221 while(ircUserIter != _ircUsers.end()) {
222 if(ircUser == *ircUserIter) {
223 ircUserIter = _ircUsers.erase(ircUserIter);
230 void Network::removeIrcUser(IrcUser *ircuser) {
231 QString nick = _ircUsers.key(ircuser);
235 _ircUsers.remove(nick);
236 disconnect(ircuser, 0, this, 0);
237 emit ircUserRemoved(nick);
238 emit ircUserRemoved(ircuser);
239 ircuser->deleteLater();
242 void Network::removeIrcUser(const QString &nick) {
244 if((ircuser = ircUser(nick)) != 0)
245 removeIrcUser(ircuser);
248 void Network::removeChansAndUsers() {
249 QList<IrcUser *> users = ircUsers();
250 foreach(IrcUser *user, users) {
253 QList<IrcChannel *> channels = ircChannels();
254 foreach(IrcChannel *channel, channels) {
255 removeIrcChannel(channel);
259 IrcUser *Network::ircUser(QString nickname) const {
260 nickname = nickname.toLower();
261 if(_ircUsers.contains(nickname))
262 return _ircUsers[nickname];
267 IrcChannel *Network::newIrcChannel(const QString &channelname, const QVariantMap &initData) {
268 if(!_ircChannels.contains(channelname.toLower())) {
269 IrcChannel *channel = ircChannelFactory(channelname);
270 if(!initData.isEmpty()) {
271 channel->fromVariantMap(initData);
272 channel->setInitialized();
276 proxy()->synchronize(channel);
278 qWarning() << "unable to synchronize new IrcChannel" << channelname << "forgot to call Network::setProxy(SignalProxy *)?";
280 connect(channel, SIGNAL(destroyed()), this, SLOT(channelDestroyed()));
281 if(!channel->isInitialized())
282 connect(channel, SIGNAL(initDone()), this, SLOT(ircChannelInitDone()));
284 _ircChannels[channelname.toLower()] = channel;
286 emit ircChannelAdded(channelname);
287 emit ircChannelAdded(channel);
288 if(channel->isInitialized())
289 emit ircChannelInitDone(channel);
291 return _ircChannels[channelname.toLower()];
294 IrcChannel *Network::ircChannel(QString channelname) const {
295 channelname = channelname.toLower();
296 if(_ircChannels.contains(channelname))
297 return _ircChannels[channelname];
302 QByteArray Network::defaultCodecForServer() {
303 if(_defaultCodecForServer)
304 return _defaultCodecForServer->name();
308 void Network::setDefaultCodecForServer(const QByteArray &name) {
309 _defaultCodecForServer = QTextCodec::codecForName(name);
312 QByteArray Network::defaultCodecForEncoding() {
313 if(_defaultCodecForEncoding)
314 return _defaultCodecForEncoding->name();
318 void Network::setDefaultCodecForEncoding(const QByteArray &name) {
319 _defaultCodecForEncoding = QTextCodec::codecForName(name);
322 QByteArray Network::defaultCodecForDecoding() {
323 if(_defaultCodecForDecoding)
324 return _defaultCodecForDecoding->name();
328 void Network::setDefaultCodecForDecoding(const QByteArray &name) {
329 _defaultCodecForDecoding = QTextCodec::codecForName(name);
332 QByteArray Network::codecForServer() const {
334 return _codecForServer->name();
338 void Network::setCodecForServer(const QByteArray &name) {
339 setCodecForServer(QTextCodec::codecForName(name));
342 void Network::setCodecForServer(QTextCodec *codec) {
343 _codecForServer = codec;
344 emit codecForServerSet(codecForServer());
347 QByteArray Network::codecForEncoding() const {
348 if(_codecForEncoding)
349 return _codecForEncoding->name();
353 void Network::setCodecForEncoding(const QByteArray &name) {
354 setCodecForEncoding(QTextCodec::codecForName(name));
357 void Network::setCodecForEncoding(QTextCodec *codec) {
358 _codecForEncoding = codec;
359 emit codecForEncodingSet(codecForEncoding());
362 QByteArray Network::codecForDecoding() const {
363 if(_codecForDecoding)
364 return _codecForDecoding->name();
365 else return QByteArray();
368 void Network::setCodecForDecoding(const QByteArray &name) {
369 setCodecForDecoding(QTextCodec::codecForName(name));
372 void Network::setCodecForDecoding(QTextCodec *codec) {
373 _codecForDecoding = codec;
374 emit codecForDecodingSet(codecForDecoding());
377 // FIXME use server encoding if appropriate
378 QString Network::decodeString(const QByteArray &text) const {
379 if(_codecForDecoding)
380 return ::decodeString(text, _codecForDecoding);
381 else return ::decodeString(text, _defaultCodecForDecoding);
384 QByteArray Network::encodeString(const QString &string) const {
385 if(_codecForEncoding) {
386 return _codecForEncoding->fromUnicode(string);
388 if(_defaultCodecForEncoding) {
389 return _defaultCodecForEncoding->fromUnicode(string);
391 return string.toAscii();
394 QString Network::decodeServerString(const QByteArray &text) const {
396 return ::decodeString(text, _codecForServer);
398 return ::decodeString(text, _defaultCodecForServer);
401 QByteArray Network::encodeServerString(const QString &string) const {
402 if(_codecForServer) {
403 return _codecForServer->fromUnicode(string);
405 if(_defaultCodecForServer) {
406 return _defaultCodecForServer->fromUnicode(string);
408 return string.toAscii();
411 // ====================
413 // ====================
414 void Network::setNetworkName(const QString &networkName) {
415 _networkName = networkName;
416 emit networkNameSet(networkName);
419 void Network::setCurrentServer(const QString ¤tServer) {
420 _currentServer = currentServer;
421 emit currentServerSet(currentServer);
424 void Network::setConnected(bool connected) {
425 if(_connected == connected)
428 _connected = connected;
430 setMyNick(QString());
431 setCurrentServer(QString());
432 removeChansAndUsers();
434 emit connectedSet(connected);
437 //void Network::setConnectionState(ConnectionState state) {
438 void Network::setConnectionState(int state) {
439 _connectionState = (ConnectionState)state;
440 //qDebug() << "netstate" << networkId() << networkName() << state;
441 emit connectionStateSet(state);
442 emit connectionStateSet(_connectionState);
445 void Network::setMyNick(const QString &nickname) {
447 if(!_myNick.isEmpty() && !ircUser(myNick())) {
448 newIrcUser(myNick());
450 emit myNickSet(nickname);
453 void Network::setLatency(int latency) {
454 if(_latency == latency)
457 emit latencySet(latency);
460 void Network::setIdentity(IdentityId id) {
462 emit identitySet(id);
465 void Network::setServerList(const QVariantList &serverList) {
466 _serverList = serverList;
467 emit serverListSet(serverList);
470 void Network::setUseRandomServer(bool use) {
471 _useRandomServer = use;
472 emit useRandomServerSet(use);
475 void Network::setPerform(const QStringList &perform) {
477 emit performSet(perform);
480 void Network::setUseAutoIdentify(bool use) {
481 _useAutoIdentify = use;
482 emit useAutoIdentifySet(use);
485 void Network::setAutoIdentifyService(const QString &service) {
486 _autoIdentifyService = service;
487 emit autoIdentifyServiceSet(service);
490 void Network::setAutoIdentifyPassword(const QString &password) {
491 _autoIdentifyPassword = password;
492 emit autoIdentifyPasswordSet(password);
495 void Network::setUseAutoReconnect(bool use) {
496 _useAutoReconnect = use;
497 emit useAutoReconnectSet(use);
500 void Network::setAutoReconnectInterval(quint32 interval) {
501 _autoReconnectInterval = interval;
502 emit autoReconnectIntervalSet(interval);
505 void Network::setAutoReconnectRetries(quint16 retries) {
506 _autoReconnectRetries = retries;
507 emit autoReconnectRetriesSet(retries);
510 void Network::setUnlimitedReconnectRetries(bool unlimited) {
511 _unlimitedReconnectRetries = unlimited;
512 emit unlimitedReconnectRetriesSet(unlimited);
515 void Network::setRejoinChannels(bool rejoin) {
516 _rejoinChannels = rejoin;
517 emit rejoinChannelsSet(rejoin);
520 void Network::addSupport(const QString ¶m, const QString &value) {
521 if(!_supports.contains(param)) {
522 _supports[param] = value;
523 emit supportAdded(param, value);
527 void Network::removeSupport(const QString ¶m) {
528 if(_supports.contains(param)) {
529 _supports.remove(param);
530 emit supportRemoved(param);
534 QVariantMap Network::initSupports() const {
535 QVariantMap supports;
536 QHashIterator<QString, QString> iter(_supports);
537 while(iter.hasNext()) {
539 supports[iter.key()] = iter.value();
544 QVariantMap Network::initIrcUsersAndChannels() const {
545 QVariantMap usersAndChannels;
547 QVariantMap channels;
549 QHash<QString, IrcUser *>::const_iterator userIter = _ircUsers.constBegin();
550 QHash<QString, IrcUser *>::const_iterator userIterEnd = _ircUsers.constEnd();
551 while(userIter != userIterEnd) {
552 users[userIter.value()->hostmask()] = userIter.value()->toVariantMap();
555 usersAndChannels["users"] = users;
557 QHash<QString, IrcChannel *>::const_iterator channelIter = _ircChannels.constBegin();
558 QHash<QString, IrcChannel *>::const_iterator channelIterEnd = _ircChannels.constEnd();
559 while(channelIter != channelIterEnd) {
560 channels[channelIter.value()->name()] = channelIter.value()->toVariantMap();
563 usersAndChannels["channels"] = channels;
565 return usersAndChannels;
568 void Network::initSetIrcUsersAndChannels(const QVariantMap &usersAndChannels) {
570 if(isInitialized()) {
571 qWarning() << "Network" << networkId() << "received init data for users and channels allthough there allready are known users or channels!";
575 QVariantMap users = usersAndChannels.value("users").toMap();
576 QVariantMap::const_iterator userIter = users.constBegin();
577 QVariantMap::const_iterator userIterEnd = users.constEnd();
578 while(userIter != userIterEnd) {
579 newIrcUser(userIter.key(), userIter.value().toMap());
583 QVariantMap channels = usersAndChannels.value("channels").toMap();
584 QVariantMap::const_iterator channelIter = channels.constBegin();
585 QVariantMap::const_iterator channelIterEnd = channels.constEnd();
586 while(channelIter != channelIterEnd) {
587 newIrcChannel(channelIter.key(), channelIter.value().toMap());
593 void Network::initSetSupports(const QVariantMap &supports) {
594 QMapIterator<QString, QVariant> iter(supports);
595 while(iter.hasNext()) {
597 addSupport(iter.key(), iter.value().toString());
601 IrcUser *Network::updateNickFromMask(const QString &mask) {
602 QString nick(nickFromMask(mask).toLower());
605 if(_ircUsers.contains(nick)) {
606 ircuser = _ircUsers[nick];
607 ircuser->updateHostmask(mask);
609 ircuser = newIrcUser(mask);
614 void Network::ircUserNickChanged(QString newnick) {
615 QString oldnick = _ircUsers.key(qobject_cast<IrcUser*>(sender()));
620 if(newnick.toLower() != oldnick) _ircUsers[newnick.toLower()] = _ircUsers.take(oldnick);
622 if(myNick().toLower() == oldnick)
626 void Network::ircUserInitDone() {
627 IrcUser *ircuser = static_cast<IrcUser *>(sender());
629 connect(ircuser, SIGNAL(initDone()), this, SLOT(ircUserInitDone()));
630 emit ircUserInitDone(ircuser);
633 void Network::ircChannelInitDone() {
634 IrcChannel *ircChannel = static_cast<IrcChannel *>(sender());
635 Q_ASSERT(ircChannel);
636 disconnect(ircChannel, SIGNAL(initDone()), this, SLOT(ircChannelInitDone()));
637 emit ircChannelInitDone(ircChannel);
640 void Network::removeIrcChannel(IrcChannel *channel) {
641 QString chanName = _ircChannels.key(channel);
642 if(chanName.isNull())
645 _ircChannels.remove(chanName);
646 disconnect(channel, 0, this, 0);
647 emit ircChannelRemoved(chanName);
648 emit ircChannelRemoved(channel);
649 channel->deleteLater();
652 void Network::removeIrcChannel(const QString &channel) {
654 if((chan = ircChannel(channel)) != 0)
655 removeIrcChannel(chan);
658 void Network::channelDestroyed() {
659 IrcChannel *channel = static_cast<IrcChannel *>(sender());
661 _ircChannels.remove(_ircChannels.key(channel));
662 emit ircChannelRemoved(channel);
665 void Network::emitConnectionError(const QString &errorMsg) {
666 emit connectionError(errorMsg);
669 // ====================
671 // ====================
672 void Network::determinePrefixes() {
673 // seems like we have to construct them first
674 QString prefix = support("PREFIX");
676 if(prefix.startsWith("(") && prefix.contains(")")) {
677 _prefixes = prefix.section(")", 1);
678 _prefixModes = prefix.mid(1).section(")", 0, 0);
680 QString defaultPrefixes("~&@%+");
681 QString defaultPrefixModes("qaohv");
683 if(prefix.isEmpty()) {
684 _prefixes = defaultPrefixes;
685 _prefixModes = defaultPrefixModes;
689 // we just assume that in PREFIX are only prefix chars stored
690 for(int i = 0; i < defaultPrefixes.size(); i++) {
691 if(prefix.contains(defaultPrefixes[i])) {
692 _prefixes += defaultPrefixes[i];
693 _prefixModes += defaultPrefixModes[i];
697 if(!_prefixes.isNull())
700 // well... our assumption was obviously wrong...
701 // check if it's only prefix modes
702 for(int i = 0; i < defaultPrefixes.size(); i++) {
703 if(prefix.contains(defaultPrefixModes[i])) {
704 _prefixes += defaultPrefixes[i];
705 _prefixModes += defaultPrefixModes[i];
708 // now we've done all we've could...
712 /************************************************************************
714 ************************************************************************/
716 bool NetworkInfo::operator==(const NetworkInfo &other) const {
717 if(networkId != other.networkId) return false;
718 if(networkName != other.networkName) return false;
719 if(identity != other.identity) return false;
720 if(codecForServer != other.codecForServer) return false;
721 if(codecForEncoding != other.codecForEncoding) return false;
722 if(codecForDecoding != other.codecForDecoding) return false;
723 if(serverList != other.serverList) return false;
724 if(useRandomServer != other.useRandomServer) return false;
725 if(perform != other.perform) return false;
726 if(useAutoIdentify != other.useAutoIdentify) return false;
727 if(autoIdentifyService != other.autoIdentifyService) return false;
728 if(autoIdentifyPassword != other.autoIdentifyPassword) return false;
729 if(useAutoReconnect != other.useAutoReconnect) return false;
730 if(autoReconnectInterval != other.autoReconnectInterval) return false;
731 if(autoReconnectRetries != other.autoReconnectRetries) return false;
732 if(unlimitedReconnectRetries != other.unlimitedReconnectRetries) return false;
733 if(rejoinChannels != other.rejoinChannels) return false;
737 bool NetworkInfo::operator!=(const NetworkInfo &other) const {
738 return !(*this == other);
741 QDataStream &operator<<(QDataStream &out, const NetworkInfo &info) {
743 i["NetworkId"] = QVariant::fromValue<NetworkId>(info.networkId);
744 i["NetworkName"] = info.networkName;
745 i["Identity"] = QVariant::fromValue<IdentityId>(info.identity);
746 i["CodecForServer"] = info.codecForServer;
747 i["CodecForEncoding"] = info.codecForEncoding;
748 i["CodecForDecoding"] = info.codecForDecoding;
749 i["ServerList"] = info.serverList;
750 i["UseRandomServer"] = info.useRandomServer;
751 i["Perform"] = info.perform;
752 i["UseAutoIdentify"] = info.useAutoIdentify;
753 i["AutoIdentifyService"] = info.autoIdentifyService;
754 i["AutoIdentifyPassword"] = info.autoIdentifyPassword;
755 i["UseAutoReconnect"] = info.useAutoReconnect;
756 i["AutoReconnectInterval"] = info.autoReconnectInterval;
757 i["AutoReconnectRetries"] = info.autoReconnectRetries;
758 i["UnlimitedReconnectRetries"] = info.unlimitedReconnectRetries;
759 i["RejoinChannels"] = info.rejoinChannels;
764 QDataStream &operator>>(QDataStream &in, NetworkInfo &info) {
767 info.networkId = i["NetworkId"].value<NetworkId>();
768 info.networkName = i["NetworkName"].toString();
769 info.identity = i["Identity"].value<IdentityId>();
770 info.codecForServer = i["CodecForServer"].toByteArray();
771 info.codecForEncoding = i["CodecForEncoding"].toByteArray();
772 info.codecForDecoding = i["CodecForDecoding"].toByteArray();
773 info.serverList = i["ServerList"].toList();
774 info.useRandomServer = i["UseRandomServer"].toBool();
775 info.perform = i["Perform"].toStringList();
776 info.useAutoIdentify = i["UseAutoIdentify"].toBool();
777 info.autoIdentifyService = i["AutoIdentifyService"].toString();
778 info.autoIdentifyPassword = i["AutoIdentifyPassword"].toString();
779 info.useAutoReconnect = i["UseAutoReconnect"].toBool();
780 info.autoReconnectInterval = i["AutoReconnectInterval"].toUInt();
781 info.autoReconnectRetries = i["AutoReconnectRetries"].toInt();
782 info.unlimitedReconnectRetries = i["UnlimitedReconnectRetries"].toBool();
783 info.rejoinChannels = i["RejoinChannels"].toBool();
787 QDebug operator<<(QDebug dbg, const NetworkInfo &i) {
788 dbg.nospace() << "(id = " << i.networkId << " name = " << i.networkName << " identity = " << i.identity
789 << " codecForServer = " << i.codecForServer << " codecForEncoding = " << i.codecForEncoding << " codecForDecoding = " << i.codecForDecoding
790 << " serverList = " << i.serverList << " useRandomServer = " << i.useRandomServer << " perform = " << i.perform
791 << " useAutoIdentify = " << i.useAutoIdentify << " autoIdentifyService = " << i.autoIdentifyService << " autoIdentifyPassword = " << i.autoIdentifyPassword
792 << " useAutoReconnect = " << i.useAutoReconnect << " autoReconnectInterval = " << i.autoReconnectInterval
793 << " autoReconnectRetries = " << i.autoReconnectRetries << " unlimitedReconnectRetries = " << i.unlimitedReconnectRetries
794 << " rejoinChannels = " << i.rejoinChannels << ")";