-bool NetworkInfo::operator==(const NetworkInfo &other) const {
- if(networkId != other.networkId) return false;
- if(networkName != other.networkName) return false;
- if(identity != other.identity) return false;
- if(codecForServer != other.codecForServer) return false;
- if(codecForEncoding != other.codecForEncoding) return false;
- if(codecForDecoding != other.codecForDecoding) return false;
- if(serverList != other.serverList) return false;
- if(useRandomServer != other.useRandomServer) return false;
- if(perform != other.perform) return false;
- if(useAutoIdentify != other.useAutoIdentify) return false;
- if(autoIdentifyService != other.autoIdentifyService) return false;
- if(autoIdentifyPassword != other.autoIdentifyPassword) return false;
- if(useAutoReconnect != other.useAutoReconnect) return false;
- if(autoReconnectInterval != other.autoReconnectInterval) return false;
- if(autoReconnectRetries != other.autoReconnectRetries) return false;
- if(unlimitedReconnectRetries != other.unlimitedReconnectRetries) return false;
- if(rejoinChannels != other.rejoinChannels) return false;
- return true;
-}
-
-bool NetworkInfo::operator!=(const NetworkInfo &other) const {
- return !(*this == other);
-}
-
-QDataStream &operator<<(QDataStream &out, const NetworkInfo &info) {
- QVariantMap i;
- i["NetworkId"] = QVariant::fromValue<NetworkId>(info.networkId);
- i["NetworkName"] = info.networkName;
- i["Identity"] = QVariant::fromValue<IdentityId>(info.identity);
- i["CodecForServer"] = info.codecForServer;
- i["CodecForEncoding"] = info.codecForEncoding;
- i["CodecForDecoding"] = info.codecForDecoding;
- i["ServerList"] = info.serverList;
- i["UseRandomServer"] = info.useRandomServer;
- i["Perform"] = info.perform;
- i["UseAutoIdentify"] = info.useAutoIdentify;
- i["AutoIdentifyService"] = info.autoIdentifyService;
- i["AutoIdentifyPassword"] = info.autoIdentifyPassword;
- i["UseAutoReconnect"] = info.useAutoReconnect;
- i["AutoReconnectInterval"] = info.autoReconnectInterval;
- i["AutoReconnectRetries"] = info.autoReconnectRetries;
- i["UnlimitedReconnectRetries"] = info.unlimitedReconnectRetries;
- i["RejoinChannels"] = info.rejoinChannels;
- out << i;
- return out;
-}
-
-QDataStream &operator>>(QDataStream &in, NetworkInfo &info) {
- QVariantMap i;
- in >> i;
- info.networkId = i["NetworkId"].value<NetworkId>();
- info.networkName = i["NetworkName"].toString();
- info.identity = i["Identity"].value<IdentityId>();
- info.codecForServer = i["CodecForServer"].toByteArray();
- info.codecForEncoding = i["CodecForEncoding"].toByteArray();
- info.codecForDecoding = i["CodecForDecoding"].toByteArray();
- info.serverList = i["ServerList"].toList();
- info.useRandomServer = i["UseRandomServer"].toBool();
- info.perform = i["Perform"].toStringList();
- info.useAutoIdentify = i["UseAutoIdentify"].toBool();
- info.autoIdentifyService = i["AutoIdentifyService"].toString();
- info.autoIdentifyPassword = i["AutoIdentifyPassword"].toString();
- info.useAutoReconnect = i["UseAutoReconnect"].toBool();
- info.autoReconnectInterval = i["AutoReconnectInterval"].toUInt();
- info.autoReconnectRetries = i["AutoReconnectRetries"].toInt();
- info.unlimitedReconnectRetries = i["UnlimitedReconnectRetries"].toBool();
- info.rejoinChannels = i["RejoinChannels"].toBool();
- return in;
+NetworkInfo::NetworkInfo()
+ : networkId(0),
+ identity(1),
+ useRandomServer(false),
+ useAutoIdentify(false),
+ autoIdentifyService("NickServ"),
+ useSasl(false),
+ useAutoReconnect(true),
+ autoReconnectInterval(60),
+ autoReconnectRetries(20),
+ unlimitedReconnectRetries(false),
+ rejoinChannels(true)
+{