X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fcommon%2Fnetwork.cpp;h=ed14be8ba9d785a86c715d8f8234f7e3476f8abf;hb=9c15e81b15a20e861c707e240c2cfee56bdf4bc9;hp=5dccc18f0f7a68dc1bede59112f02c4dfe3857ac;hpb=3da47d9186d1d40dc8fe998a130813b84345760d;p=quassel.git diff --git a/src/common/network.cpp b/src/common/network.cpp index 5dccc18f..ed14be8b 100644 --- a/src/common/network.cpp +++ b/src/common/network.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-09 by the Quassel Project * + * Copyright (C) 2005-2010 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -122,14 +122,14 @@ void Network::setNetworkInfo(const NetworkInfo &info) { if(info.rejoinChannels != rejoinChannels()) setRejoinChannels(info.rejoinChannels); } -QString Network::prefixToMode(const QString &prefix) { +QString Network::prefixToMode(const QString &prefix) const { if(prefixes().contains(prefix)) return QString(prefixModes()[prefixes().indexOf(prefix)]); else return QString(); } -QString Network::modeToPrefix(const QString &mode) { +QString Network::modeToPrefix(const QString &mode) const { if(prefixModes().contains(mode)) return QString(prefixes()[prefixModes().indexOf(mode)]); else @@ -146,14 +146,14 @@ QStringList Network::nicks() const { return nicks; } -QString Network::prefixes() { +QString Network::prefixes() const { if(_prefixes.isNull()) determinePrefixes(); return _prefixes; } -QString Network::prefixModes() { +QString Network::prefixModes() const { if(_prefixModes.isNull()) determinePrefixes(); @@ -194,7 +194,7 @@ QString Network::support(const QString ¶m) const { IrcUser *Network::newIrcUser(const QString &hostmask, const QVariantMap &initData) { QString nick(nickFromMask(hostmask).toLower()); if(!_ircUsers.contains(nick)) { - IrcUser *ircuser = new IrcUser(hostmask, this); + IrcUser *ircuser = ircUserFactory(hostmask); if(!initData.isEmpty()) { ircuser->fromVariantMap(initData); ircuser->setInitialized(); @@ -475,14 +475,6 @@ NetworkInfo Network::networkInfoFromPreset(const QString &networkName) { return info; } -QByteArray Network::bufferKey(const QString &recipient) const { - return _keyHash[recipient.toLower()]; -} - -void Network::setBufferKey(const QString &recipient, const QByteArray &key) { - _keyHash[recipient.toLower()] = key; -} - // ==================== // Public Slots: // ==================== @@ -740,7 +732,7 @@ void Network::emitConnectionError(const QString &errorMsg) { // ==================== // Private: // ==================== -void Network::determinePrefixes() { +void Network::determinePrefixes() const { // seems like we have to construct them first QString prefix = support("PREFIX"); @@ -756,12 +748,15 @@ void Network::determinePrefixes() { _prefixModes = defaultPrefixModes; return; } + // clear the existing modes, just in case we're run multiple times + _prefixes = QString(); + _prefixModes = QString(); // we just assume that in PREFIX are only prefix chars stored for(int i = 0; i < defaultPrefixes.size(); i++) { if(prefix.contains(defaultPrefixes[i])) { - _prefixes += defaultPrefixes[i]; - _prefixModes += defaultPrefixModes[i]; + _prefixes += defaultPrefixes[i]; + _prefixModes += defaultPrefixModes[i]; } } // check for success @@ -772,8 +767,8 @@ void Network::determinePrefixes() { // check if it's only prefix modes for(int i = 0; i < defaultPrefixes.size(); i++) { if(prefix.contains(defaultPrefixModes[i])) { - _prefixes += defaultPrefixes[i]; - _prefixModes += defaultPrefixModes[i]; + _prefixes += defaultPrefixes[i]; + _prefixModes += defaultPrefixModes[i]; } } // now we've done all we've could... @@ -882,13 +877,13 @@ QDataStream &operator>>(QDataStream &in, NetworkInfo &info) { 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 + << " 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 << " useSasl = " << i.useSasl << " saslAccount = " << i.saslAccount << " saslPassword = " << i.saslPassword << " useAutoReconnect = " << i.useAutoReconnect << " autoReconnectInterval = " << i.autoReconnectInterval - << " autoReconnectRetries = " << i.autoReconnectRetries << " unlimitedReconnectRetries = " << i.unlimitedReconnectRetries - << " rejoinChannels = " << i.rejoinChannels << ")"; + << " autoReconnectRetries = " << i.autoReconnectRetries << " unlimitedReconnectRetries = " << i.unlimitedReconnectRetries + << " rejoinChannels = " << i.rejoinChannels << ")"; return dbg.space(); }