From: Marcus Eggenberger Date: Sat, 1 Nov 2008 16:00:14 +0000 (+0100) Subject: Fixing BR #374 (hide marked as away messages when using away on detach) X-Git-Tag: 0.3.1~94 X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=commitdiff_plain;h=3c635083917c68f15c10ec56c4a6a9d01a2593f9 Fixing BR #374 (hide marked as away messages when using away on detach) --- diff --git a/src/common/network.cpp b/src/common/network.cpp index 1098b0a3..6c0d2521 100644 --- a/src/common/network.cpp +++ b/src/common/network.cpp @@ -51,7 +51,8 @@ Network::Network(const NetworkId &networkid, QObject *parent) _unlimitedReconnectRetries(false), _codecForServer(0), _codecForEncoding(0), - _codecForDecoding(0) + _codecForDecoding(0), + _autoAwayActive(false) { setObjectName(QString::number(networkid.toInt())); } diff --git a/src/common/network.h b/src/common/network.h index dbc5f35f..4bbd984b 100644 --- a/src/common/network.h +++ b/src/common/network.h @@ -18,8 +18,8 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ -#ifndef NETWORK_H_ -#define NETWORK_H_ +#ifndef NETWORK_H +#define NETWORK_H #include #include @@ -176,6 +176,9 @@ public: static void setDefaultCodecForEncoding(const QByteArray &name); static void setDefaultCodecForDecoding(const QByteArray &name); + bool autoAwayActive() const { return _autoAwayActive; } + void setAutoAwayActive(bool active) { _autoAwayActive = active; } + public slots: void setNetworkName(const QString &networkName); void setCurrentServer(const QString ¤tServer); @@ -338,6 +341,8 @@ private: static QTextCodec *_defaultCodecForServer; static QTextCodec *_defaultCodecForEncoding; static QTextCodec *_defaultCodecForDecoding; + + bool _autoAwayActive; // when this is active handle305 and handle306 don't trigger any output }; //! Stores all editable information about a network (as opposed to runtime state). diff --git a/src/core/coresession.cpp b/src/core/coresession.cpp index acb9aa23..bb4b3dd9 100644 --- a/src/core/coresession.cpp +++ b/src/core/coresession.cpp @@ -560,6 +560,7 @@ void CoreSession::clientsDisconnected() { awayReason = identity->detachAwayReason(); else awayReason = identity->awayReason(); + network->setAutoAwayActive(true); con->userInputHandler()->handleAway(BufferInfo(), awayReason); } } diff --git a/src/core/ircserverhandler.cpp b/src/core/ircserverhandler.cpp index 25e5c446..ea0d6951 100644 --- a/src/core/ircserverhandler.cpp +++ b/src/core/ircserverhandler.cpp @@ -572,8 +572,12 @@ void IrcServerHandler::handle305(const QString &prefix, const QList if(me) me->setAway(false); - if(!params.isEmpty()) - emit displayMsg(Message::Server, BufferInfo::StatusBuffer, "", serverDecode(params[0])); + if(!network()->autoAwayActive()) { + if(!params.isEmpty()) + emit displayMsg(Message::Server, BufferInfo::StatusBuffer, "", serverDecode(params[0])); + } else { + network()->setAutoAwayActive(false); + } } // 306 RPL_NOWAWAY @@ -584,7 +588,7 @@ void IrcServerHandler::handle306(const QString &prefix, const QList if(me) me->setAway(true); - if(!params.isEmpty()) + if(!params.isEmpty() && !network()->autoAwayActive()) emit displayMsg(Message::Server, BufferInfo::StatusBuffer, "", serverDecode(params[0])); }