X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fcommon%2Fnetwork.cpp;h=b1a17a664f957b9e6424b9d6435ed352004269fb;hb=dcba0652ac1275877b98b06d6482924ee6df0cd1;hp=3162bd4c43ef6300f4e3012b451dea0aa540b8d5;hpb=1f02b7201ab7b86238e705d2ce5b22f50bf6acfe;p=quassel.git diff --git a/src/common/network.cpp b/src/common/network.cpp index 3162bd4c..b1a17a66 100644 --- a/src/common/network.cpp +++ b/src/common/network.cpp @@ -631,6 +631,14 @@ QStringList Network::initIrcChannels() const { return _ircChannels.keys(); } +QStringList Network::initPersistentChannels() const { + QStringList list; + foreach(QString chan, _persistentChannels.keys()) { + list << QString("%1/%2").arg(chan).arg(_persistentChannels.value(chan)); + } + return list; +} + void Network::initSetSupports(const QVariantMap &supports) { QMapIterator iter(supports); while(iter.hasNext()) { @@ -651,13 +659,39 @@ void Network::initSetIrcUsers(const QStringList &hostmasks) { } } -void Network::initSetChannels(const QStringList &channels) { +void Network::initSetIrcChannels(const QStringList &channels) { + // FIXME This does not work correctly, "received data for unknown User" triggers + // So we disable this for now + return; + if(!_ircChannels.empty()) return; foreach(QString channel, channels) newIrcChannel(channel); } +void Network::initSetPersistentChannels(const QStringList &channels) { + foreach(QString chan, channels) { + QStringList l = chan.split("/"); + _persistentChannels[l[0]] = l[1]; + } +} + +void Network::addPersistentChannel(const QString &channel, const QString &key) { + _persistentChannels[channel.toLower()] = key; + emit persistentChannelAdded(channel, key); +} + +void Network::removePersistentChannel(const QString &channel) { + _persistentChannels.remove(channel.toLower()); + emit persistentChannelRemoved(channel); +} + +void Network::setPersistentChannelKey(const QString &channel, const QString &key) { + _persistentChannels[channel.toLower()] = key; + emit persistentChannelKeySet(channel, key); +} + IrcUser *Network::updateNickFromMask(const QString &mask) { QString nick(nickFromMask(mask).toLower()); IrcUser *ircuser; @@ -725,7 +759,7 @@ void Network::requestConnect() const { if(proxy()->proxyMode() == SignalProxy::Client) emit connectRequested(); // on the client this triggers calling this slot on the core else { if(connectionState() != Disconnected) { - qWarning() << "Requesting connect while not being disconnected!"; + qWarning() << "Requesting connect while already being connected!"; return; } emit connectRequested(networkId()); // and this is for CoreSession :) @@ -860,11 +894,16 @@ QDataStream &operator>>(QDataStream &in, NetworkInfo &info) { return in; } - - - - - +QDebug operator<<(QDebug dbg, const NetworkInfo &i) { + dbg.nospace() << "(id = " << i.networkId << " name = " << i.networkName << " identity = " << i.identity + << " codecForServer = " << i.codecForServer << " codecForEncoding = " << i.codecForEncoding << " codecForDecoding = " << i.codecForDecoding + << " serverList = " << i.serverList << " useRandomServer = " << i.useRandomServer << " perform = " << i.perform + << " useAutoIdentify = " << i.useAutoIdentify << " autoIdentifyService = " << i.autoIdentifyService << " autoIdentifyPassword = " << i.autoIdentifyPassword + << " useAutoReconnect = " << i.useAutoReconnect << " autoReconnectInterval = " << i.autoReconnectInterval + << " autoReconnectRetries = " << i.autoReconnectRetries << " unlimitedReconnectRetries = " << i.unlimitedReconnectRetries + << " rejoinChannels = " << i.rejoinChannels << ")"; + return dbg.space(); +}