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 ***************************************************************************/
22 #include "signalproxy.h"
24 #include "ircchannel.h"
31 QTextCodec *Network::_defaultCodecForServer = 0;
32 QTextCodec *Network::_defaultCodecForEncoding = 0;
33 QTextCodec *Network::_defaultCodecForDecoding = 0;
35 // ====================
37 // ====================
38 Network::Network(const NetworkId &networkid, QObject *parent) : SyncableObject(parent),
40 _networkId(networkid),
43 _networkName(QString("<not initialized>")),
44 _currentServer(QString()),
46 _connectionState(Disconnected),
48 _prefixModes(QString()),
49 _useRandomServer(false),
50 _useAutoIdentify(false),
51 _useAutoReconnect(false),
52 _autoReconnectInterval(60),
53 _autoReconnectRetries(10),
54 _unlimitedReconnectRetries(false),
59 setObjectName(QString::number(networkid.toInt()));
62 // I think this is unnecessary since IrcUsers have us as their daddy :)
65 emit aboutToBeDestroyed();
66 // QHashIterator<QString, IrcUser *> ircuser(_ircUsers);
67 // while (ircuser.hasNext()) {
69 // delete ircuser.value();
71 // qDebug() << "Destroying net" << networkName() << networkId();
75 NetworkId Network::networkId() const {
79 SignalProxy *Network::proxy() const {
83 void Network::setProxy(SignalProxy *proxy) {
85 //proxy->synchronize(this); // we should to this explicitly from the outside!
88 bool Network::isMyNick(const QString &nick) const {
89 return (myNick().toLower() == nick.toLower());
92 bool Network::isMe(IrcUser *ircuser) const {
93 return (ircuser->nick().toLower() == myNick().toLower());
96 bool Network::isChannelName(const QString &channelname) const {
97 if(channelname.isEmpty())
100 if(supports("CHANTYPES"))
101 return support("CHANTYPES").contains(channelname[0]);
103 return QString("#&!+").contains(channelname[0]);
106 bool Network::isConnected() const {
110 //Network::ConnectionState Network::connectionState() const {
111 int Network::connectionState() const {
112 return _connectionState;
115 NetworkInfo Network::networkInfo() const {
117 info.networkName = networkName();
118 info.networkId = networkId();
119 info.identity = identity();
120 info.codecForEncoding = codecForEncoding();
121 info.codecForDecoding = codecForDecoding();
122 info.serverList = serverList();
123 info.useRandomServer = useRandomServer();
124 info.perform = perform();
125 info.useAutoIdentify = useAutoIdentify();
126 info.autoIdentifyService = autoIdentifyService();
127 info.autoIdentifyPassword = autoIdentifyPassword();
128 info.useAutoReconnect = useAutoReconnect();
129 info.autoReconnectInterval = autoReconnectInterval();
130 info.autoReconnectRetries = autoReconnectRetries();
131 info.rejoinChannels = rejoinChannels();
135 void Network::setNetworkInfo(const NetworkInfo &info) {
136 // we don't set our ID!
137 if(!info.networkName.isEmpty() && info.networkName != networkName()) setNetworkName(info.networkName);
138 if(info.identity > 0 && info.identity != identity()) setIdentity(info.identity);
139 if(info.codecForServer != codecForServer()) setCodecForServer(QTextCodec::codecForName(info.codecForServer));
140 if(info.codecForEncoding != codecForEncoding()) setCodecForEncoding(QTextCodec::codecForName(info.codecForEncoding));
141 if(info.codecForDecoding != codecForDecoding()) setCodecForDecoding(QTextCodec::codecForName(info.codecForDecoding));
142 if(info.serverList.count()) setServerList(info.serverList); // FIXME compare components
143 if(info.useRandomServer != useRandomServer()) setUseRandomServer(info.useRandomServer);
144 if(info.perform != perform()) setPerform(info.perform);
145 if(info.useAutoIdentify != useAutoIdentify()) setUseAutoIdentify(info.useAutoIdentify);
146 if(info.autoIdentifyService != autoIdentifyService()) setAutoIdentifyService(info.autoIdentifyService);
147 if(info.autoIdentifyPassword != autoIdentifyPassword()) setAutoIdentifyPassword(info.autoIdentifyPassword);
148 if(info.useAutoReconnect != useAutoReconnect()) setUseAutoReconnect(info.useAutoReconnect);
149 if(info.autoReconnectInterval != autoReconnectInterval()) setAutoReconnectInterval(info.autoReconnectInterval);
150 if(info.autoReconnectRetries != autoReconnectRetries()) setAutoReconnectRetries(info.autoReconnectRetries);
151 if(info.unlimitedReconnectRetries != unlimitedReconnectRetries()) setUnlimitedReconnectRetries(info.unlimitedReconnectRetries);
152 if(info.rejoinChannels != rejoinChannels()) setRejoinChannels(info.rejoinChannels);
155 QString Network::prefixToMode(const QString &prefix) {
156 if(prefixes().contains(prefix))
157 return QString(prefixModes()[prefixes().indexOf(prefix)]);
162 QString Network::prefixToMode(const QCharRef &prefix) {
163 return prefixToMode(QString(prefix));
166 QString Network::modeToPrefix(const QString &mode) {
167 if(prefixModes().contains(mode))
168 return QString(prefixes()[prefixModes().indexOf(mode)]);
173 QString Network::modeToPrefix(const QCharRef &mode) {
174 return modeToPrefix(QString(mode));
177 QString Network::networkName() const {
181 QString Network::currentServer() const {
182 return _currentServer;
185 QString Network::myNick() const {
189 IdentityId Network::identity() const {
193 QStringList Network::nicks() const {
194 // we don't use _ircUsers.keys() since the keys may be
195 // not up to date after a nick change
197 foreach(IrcUser *ircuser, _ircUsers.values()) {
198 nicks << ircuser->nick();
203 QStringList Network::channels() const {
204 return _ircChannels.keys();
207 QVariantList Network::serverList() const {
211 bool Network::useRandomServer() const {
212 return _useRandomServer;
215 QStringList Network::perform() const {
219 bool Network::useAutoIdentify() const {
220 return _useAutoIdentify;
223 QString Network::autoIdentifyService() const {
224 return _autoIdentifyService;
227 QString Network::autoIdentifyPassword() const {
228 return _autoIdentifyPassword;
231 bool Network::useAutoReconnect() const {
232 return _useAutoReconnect;
235 quint32 Network::autoReconnectInterval() const {
236 return _autoReconnectInterval;
239 quint16 Network::autoReconnectRetries() const {
240 return _autoReconnectRetries;
243 bool Network::unlimitedReconnectRetries() const {
244 return _unlimitedReconnectRetries;
247 bool Network::rejoinChannels() const {
248 return _rejoinChannels;
251 QString Network::prefixes() {
252 if(_prefixes.isNull())
258 QString Network::prefixModes() {
259 if(_prefixModes.isNull())
265 bool Network::supports(const QString ¶m) const {
266 return _supports.contains(param);
269 QString Network::support(const QString ¶m) const {
270 QString support_ = param.toUpper();
271 if(_supports.contains(support_))
272 return _supports[support_];
277 IrcUser *Network::newIrcUser(const QString &hostmask) {
278 QString nick(nickFromMask(hostmask).toLower());
279 if(!_ircUsers.contains(nick)) {
280 IrcUser *ircuser = new IrcUser(hostmask, this);
281 // mark IrcUser as already initialized to keep the SignalProxy from requesting initData
282 //if(isInitialized())
283 // ircuser->setInitialized();
285 proxy()->synchronize(ircuser);
287 qWarning() << "unable to synchronize new IrcUser" << hostmask << "forgot to call Network::setProxy(SignalProxy *)?";
289 connect(ircuser, SIGNAL(nickSet(QString)), this, SLOT(ircUserNickChanged(QString)));
290 connect(ircuser, SIGNAL(initDone()), this, SLOT(ircUserInitDone()));
291 _ircUsers[nick] = ircuser;
292 emit ircUserAdded(hostmask);
293 emit ircUserAdded(ircuser);
295 return _ircUsers[nick];
298 IrcUser *Network::newIrcUser(const QByteArray &hostmask) {
299 return newIrcUser(decodeServerString(hostmask));
302 void Network::removeIrcUser(IrcUser *ircuser) {
303 QString nick = _ircUsers.key(ircuser);
307 _ircUsers.remove(nick);
308 disconnect(ircuser, 0, this, 0);
309 emit ircUserRemoved(nick);
310 emit ircUserRemoved(ircuser);
311 ircuser->deleteLater();
314 void Network::removeChansAndUsers() {
315 QList<IrcUser *> users = ircUsers();
316 foreach(IrcUser *user, users) {
319 QList<IrcChannel *> channels = ircChannels();
320 foreach(IrcChannel *channel, channels) {
321 removeIrcChannel(channel);
325 void Network::removeIrcUser(const QString &nick) {
327 if((ircuser = ircUser(nick)) != 0)
328 removeIrcUser(ircuser);
331 IrcUser *Network::ircUser(QString nickname) const {
332 nickname = nickname.toLower();
333 if(_ircUsers.contains(nickname))
334 return _ircUsers[nickname];
339 IrcUser *Network::ircUser(const QByteArray &nickname) const {
340 return ircUser(decodeServerString(nickname));
343 QList<IrcUser *> Network::ircUsers() const {
344 return _ircUsers.values();
347 quint32 Network::ircUserCount() const {
348 return _ircUsers.count();
351 IrcChannel *Network::newIrcChannel(const QString &channelname) {
352 if(!_ircChannels.contains(channelname.toLower())) {
353 IrcChannel *channel = new IrcChannel(channelname, this);
354 // mark IrcUser as already initialized to keep the SignalProxy from requesting initData
355 //if(isInitialized())
356 // channel->setInitialized();
359 proxy()->synchronize(channel);
361 qWarning() << "unable to synchronize new IrcChannel" << channelname << "forgot to call Network::setProxy(SignalProxy *)?";
363 connect(channel, SIGNAL(initDone()), this, SLOT(ircChannelInitDone()));
364 connect(channel, SIGNAL(destroyed()), this, SLOT(channelDestroyed()));
365 _ircChannels[channelname.toLower()] = channel;
366 emit ircChannelAdded(channelname);
367 emit ircChannelAdded(channel);
369 return _ircChannels[channelname.toLower()];
372 IrcChannel *Network::newIrcChannel(const QByteArray &channelname) {
373 return newIrcChannel(decodeServerString(channelname));
376 IrcChannel *Network::ircChannel(QString channelname) const {
377 channelname = channelname.toLower();
378 if(_ircChannels.contains(channelname))
379 return _ircChannels[channelname];
384 IrcChannel *Network::ircChannel(const QByteArray &channelname) const {
385 return ircChannel(decodeServerString(channelname));
389 QList<IrcChannel *> Network::ircChannels() const {
390 return _ircChannels.values();
393 quint32 Network::ircChannelCount() const {
394 return _ircChannels.count();
397 QByteArray Network::defaultCodecForServer() {
398 if(_defaultCodecForServer) return _defaultCodecForServer->name();
402 void Network::setDefaultCodecForServer(const QByteArray &name) {
403 _defaultCodecForServer = QTextCodec::codecForName(name);
406 QByteArray Network::defaultCodecForEncoding() {
407 if(_defaultCodecForEncoding) return _defaultCodecForEncoding->name();
411 void Network::setDefaultCodecForEncoding(const QByteArray &name) {
412 _defaultCodecForEncoding = QTextCodec::codecForName(name);
415 QByteArray Network::defaultCodecForDecoding() {
416 if(_defaultCodecForDecoding) return _defaultCodecForDecoding->name();
420 void Network::setDefaultCodecForDecoding(const QByteArray &name) {
421 _defaultCodecForDecoding = QTextCodec::codecForName(name);
424 QByteArray Network::codecForServer() const {
425 if(_codecForServer) return _codecForServer->name();
429 void Network::setCodecForServer(const QByteArray &name) {
430 setCodecForServer(QTextCodec::codecForName(name));
433 void Network::setCodecForServer(QTextCodec *codec) {
434 _codecForServer = codec;
435 emit codecForServerSet(codecForServer());
438 QByteArray Network::codecForEncoding() const {
439 if(_codecForEncoding) return _codecForEncoding->name();
443 void Network::setCodecForEncoding(const QByteArray &name) {
444 setCodecForEncoding(QTextCodec::codecForName(name));
447 void Network::setCodecForEncoding(QTextCodec *codec) {
448 _codecForEncoding = codec;
449 emit codecForEncodingSet(codecForEncoding());
452 QByteArray Network::codecForDecoding() const {
453 if(_codecForDecoding) return _codecForDecoding->name();
454 else return QByteArray();
457 void Network::setCodecForDecoding(const QByteArray &name) {
458 setCodecForDecoding(QTextCodec::codecForName(name));
461 void Network::setCodecForDecoding(QTextCodec *codec) {
462 _codecForDecoding = codec;
463 emit codecForDecodingSet(codecForDecoding());
466 // FIXME use server encoding if appropriate
467 QString Network::decodeString(const QByteArray &text) const {
468 if(_codecForDecoding) return ::decodeString(text, _codecForDecoding);
469 else return ::decodeString(text, _defaultCodecForDecoding);
472 QByteArray Network::encodeString(const QString &string) const {
473 if(_codecForEncoding) {
474 return _codecForEncoding->fromUnicode(string);
476 if(_defaultCodecForEncoding) {
477 return _defaultCodecForEncoding->fromUnicode(string);
479 return string.toAscii();
482 QString Network::decodeServerString(const QByteArray &text) const {
483 if(_codecForServer) return ::decodeString(text, _codecForServer);
484 else return ::decodeString(text, _defaultCodecForServer);
487 QByteArray Network::encodeServerString(const QString &string) const {
488 if(_codecForServer) {
489 return _codecForServer->fromUnicode(string);
491 if(_defaultCodecForServer) {
492 return _defaultCodecForServer->fromUnicode(string);
494 return string.toAscii();
497 // ====================
499 // ====================
500 void Network::setNetworkName(const QString &networkName) {
501 _networkName = networkName;
502 emit networkNameSet(networkName);
505 void Network::setCurrentServer(const QString ¤tServer) {
506 _currentServer = currentServer;
507 emit currentServerSet(currentServer);
510 void Network::setConnected(bool connected) {
511 _connected = connected;
513 removeChansAndUsers();
514 setCurrentServer(QString());
516 emit connectedSet(connected);
519 //void Network::setConnectionState(ConnectionState state) {
520 void Network::setConnectionState(int state) {
521 _connectionState = (ConnectionState)state;
522 //qDebug() << "netstate" << networkId() << networkName() << state;
523 emit connectionStateSet(state);
524 emit connectionStateSet(_connectionState);
527 void Network::setMyNick(const QString &nickname) {
529 emit myNickSet(nickname);
532 void Network::setIdentity(IdentityId id) {
534 emit identitySet(id);
537 void Network::setServerList(const QVariantList &serverList) {
538 _serverList = serverList;
539 emit serverListSet(serverList);
542 void Network::setUseRandomServer(bool use) {
543 _useRandomServer = use;
544 emit useRandomServerSet(use);
547 void Network::setPerform(const QStringList &perform) {
549 emit performSet(perform);
552 void Network::setUseAutoIdentify(bool use) {
553 _useAutoIdentify = use;
554 emit useAutoIdentifySet(use);
557 void Network::setAutoIdentifyService(const QString &service) {
558 _autoIdentifyService = service;
559 emit autoIdentifyServiceSet(service);
562 void Network::setAutoIdentifyPassword(const QString &password) {
563 _autoIdentifyPassword = password;
564 emit autoIdentifyPasswordSet(password);
567 void Network::setUseAutoReconnect(bool use) {
568 _useAutoReconnect = use;
569 emit useAutoReconnectSet(use);
572 void Network::setAutoReconnectInterval(quint32 interval) {
573 _autoReconnectInterval = interval;
574 emit autoReconnectIntervalSet(interval);
577 void Network::setAutoReconnectRetries(quint16 retries) {
578 _autoReconnectRetries = retries;
579 emit autoReconnectRetriesSet(retries);
582 void Network::setUnlimitedReconnectRetries(bool unlimited) {
583 _unlimitedReconnectRetries = unlimited;
584 emit unlimitedReconnectRetriesSet(unlimited);
587 void Network::setRejoinChannels(bool rejoin) {
588 _rejoinChannels = rejoin;
589 emit rejoinChannelsSet(rejoin);
592 void Network::addSupport(const QString ¶m, const QString &value) {
593 if(!_supports.contains(param)) {
594 _supports[param] = value;
595 emit supportAdded(param, value);
599 void Network::removeSupport(const QString ¶m) {
600 if(_supports.contains(param)) {
601 _supports.remove(param);
602 emit supportRemoved(param);
606 QVariantMap Network::initSupports() const {
607 QVariantMap supports;
608 QHashIterator<QString, QString> iter(_supports);
609 while(iter.hasNext()) {
611 supports[iter.key()] = iter.value();
616 QVariantList Network::initServerList() const {
620 QStringList Network::initIrcUsers() const {
621 QStringList hostmasks;
622 foreach(IrcUser *ircuser, ircUsers()) {
623 hostmasks << ircuser->hostmask();
628 QStringList Network::initIrcChannels() const {
629 return _ircChannels.keys();
632 void Network::initSetSupports(const QVariantMap &supports) {
633 QMapIterator<QString, QVariant> iter(supports);
634 while(iter.hasNext()) {
636 addSupport(iter.key(), iter.value().toString());
640 void Network::initSetServerList(const QVariantList & serverList) {
641 setServerList(serverList);
644 void Network::initSetIrcUsers(const QStringList &hostmasks) {
645 if(!_ircUsers.empty())
647 foreach(QString hostmask, hostmasks) {
648 newIrcUser(hostmask);
652 void Network::initSetChannels(const QStringList &channels) {
653 if(!_ircChannels.empty())
655 foreach(QString channel, channels)
656 newIrcChannel(channel);
659 IrcUser *Network::updateNickFromMask(const QString &mask) {
660 QString nick(nickFromMask(mask).toLower());
663 if(_ircUsers.contains(nick)) {
664 ircuser = _ircUsers[nick];
665 ircuser->updateHostmask(mask);
667 ircuser = newIrcUser(mask);
672 void Network::ircUserNickChanged(QString newnick) {
673 QString oldnick = _ircUsers.key(qobject_cast<IrcUser*>(sender()));
678 if(newnick.toLower() != oldnick) _ircUsers[newnick.toLower()] = _ircUsers.take(oldnick);
680 if(myNick().toLower() == oldnick)
684 void Network::ircUserInitDone() {
685 IrcUser *ircuser = static_cast<IrcUser *>(sender());
687 emit ircUserInitDone(ircuser);
690 void Network::ircChannelInitDone() {
691 IrcChannel *ircchannel = static_cast<IrcChannel *>(sender());
692 Q_ASSERT(ircchannel);
693 emit ircChannelInitDone(ircchannel);
696 void Network::removeIrcChannel(IrcChannel *channel) {
697 QString chanName = _ircChannels.key(channel);
698 if(chanName.isNull())
701 _ircChannels.remove(chanName);
702 disconnect(channel, 0, this, 0);
703 emit ircChannelRemoved(chanName);
704 emit ircChannelRemoved(channel);
705 channel->deleteLater();
708 void Network::removeIrcChannel(const QString &channel) {
710 if((chan = ircChannel(channel)) != 0)
711 removeIrcChannel(chan);
714 void Network::channelDestroyed() {
715 IrcChannel *channel = static_cast<IrcChannel *>(sender());
717 _ircChannels.remove(_ircChannels.key(channel));
718 emit ircChannelRemoved(channel);
721 void Network::requestConnect() const {
723 if(proxy()->proxyMode() == SignalProxy::Client) emit connectRequested(); // on the client this triggers calling this slot on the core
725 if(connectionState() != Disconnected) {
726 qWarning() << "Requesting connect while not being disconnected!";
729 emit connectRequested(networkId()); // and this is for CoreSession :)
733 void Network::requestDisconnect() const {
735 if(proxy()->proxyMode() == SignalProxy::Client) emit disconnectRequested(); // on the client this triggers calling this slot on the core
737 if(connectionState() == Disconnected) {
738 qWarning() << "Requesting disconnect while not being connected!";
741 emit disconnectRequested(networkId()); // and this is for CoreSession :)
745 void Network::emitConnectionError(const QString &errorMsg) {
746 emit connectionError(errorMsg);
749 // ====================
751 // ====================
752 void Network::determinePrefixes() {
753 // seems like we have to construct them first
754 QString PREFIX = support("PREFIX");
756 if(PREFIX.startsWith("(") && PREFIX.contains(")")) {
757 _prefixes = PREFIX.section(")", 1);
758 _prefixModes = PREFIX.mid(1).section(")", 0, 0);
760 QString defaultPrefixes("~&@%+");
761 QString defaultPrefixModes("qaohv");
763 // we just assume that in PREFIX are only prefix chars stored
764 for(int i = 0; i < defaultPrefixes.size(); i++) {
765 if(PREFIX.contains(defaultPrefixes[i])) {
766 _prefixes += defaultPrefixes[i];
767 _prefixModes += defaultPrefixModes[i];
771 if(!_prefixes.isNull())
774 // well... our assumption was obviously wrong...
775 // check if it's only prefix modes
776 for(int i = 0; i < defaultPrefixes.size(); i++) {
777 if(PREFIX.contains(defaultPrefixModes[i])) {
778 _prefixes += defaultPrefixes[i];
779 _prefixModes += defaultPrefixModes[i];
782 // now we've done all we've could...
786 /************************************************************************
788 ************************************************************************/
790 bool NetworkInfo::operator==(const NetworkInfo &other) const {
791 if(networkId != other.networkId) return false;
792 if(networkName != other.networkName) return false;
793 if(identity != other.identity) return false;
794 if(codecForServer != other.codecForServer) return false;
795 if(codecForEncoding != other.codecForEncoding) return false;
796 if(codecForDecoding != other.codecForDecoding) return false;
797 if(serverList != other.serverList) return false;
798 if(useRandomServer != other.useRandomServer) return false;
799 if(perform != other.perform) return false;
800 if(useAutoIdentify != other.useAutoIdentify) return false;
801 if(autoIdentifyService != other.autoIdentifyService) return false;
802 if(autoIdentifyPassword != other.autoIdentifyPassword) return false;
803 if(useAutoReconnect != other.useAutoReconnect) return false;
804 if(autoReconnectInterval != other.autoReconnectInterval) return false;
805 if(autoReconnectRetries != other.autoReconnectRetries) return false;
806 if(unlimitedReconnectRetries != other.unlimitedReconnectRetries) return false;
807 if(rejoinChannels != other.rejoinChannels) return false;
811 bool NetworkInfo::operator!=(const NetworkInfo &other) const {
812 return !(*this == other);
815 QDataStream &operator<<(QDataStream &out, const NetworkInfo &info) {
817 i["NetworkId"] = QVariant::fromValue<NetworkId>(info.networkId);
818 i["NetworkName"] = info.networkName;
819 i["Identity"] = QVariant::fromValue<IdentityId>(info.identity);
820 i["CodecForServer"] = info.codecForServer;
821 i["CodecForEncoding"] = info.codecForEncoding;
822 i["CodecForDecoding"] = info.codecForDecoding;
823 i["ServerList"] = info.serverList;
824 i["UseRandomServer"] = info.useRandomServer;
825 i["Perform"] = info.perform;
826 i["UseAutoIdentify"] = info.useAutoIdentify;
827 i["AutoIdentifyService"] = info.autoIdentifyService;
828 i["AutoIdentifyPassword"] = info.autoIdentifyPassword;
829 i["UseAutoReconnect"] = info.useAutoReconnect;
830 i["AutoReconnectInterval"] = info.autoReconnectInterval;
831 i["AutoReconnectRetries"] = info.autoReconnectRetries;
832 i["UnlimitedReconnectRetries"] = info.unlimitedReconnectRetries;
833 i["RejoinChannels"] = info.rejoinChannels;
838 QDataStream &operator>>(QDataStream &in, NetworkInfo &info) {
841 info.networkId = i["NetworkId"].value<NetworkId>();
842 info.networkName = i["NetworkName"].toString();
843 info.identity = i["Identity"].value<IdentityId>();
844 info.codecForServer = i["CodecForServer"].toByteArray();
845 info.codecForEncoding = i["CodecForEncoding"].toByteArray();
846 info.codecForDecoding = i["CodecForDecoding"].toByteArray();
847 info.serverList = i["ServerList"].toList();
848 info.useRandomServer = i["UseRandomServer"].toBool();
849 info.perform = i["Perform"].toStringList();
850 info.useAutoIdentify = i["UseAutoIdentify"].toBool();
851 info.autoIdentifyService = i["AutoIdentifyService"].toString();
852 info.autoIdentifyPassword = i["AutoIdentifyPassword"].toString();
853 info.useAutoReconnect = i["UseAutoReconnect"].toBool();
854 info.autoReconnectInterval = i["AutoReconnectInterval"].toUInt();
855 info.autoReconnectRetries = i["AutoReconnectRetries"].toInt();
856 info.unlimitedReconnectRetries = i["UnlimitedReconnectRetries"].toBool();
857 info.rejoinChannels = i["RejoinChannels"].toBool();