From: Manuel Nickschas Date: Thu, 7 Oct 2010 07:04:31 +0000 (+0200) Subject: Introduce a flag EventManager::Silent X-Git-Tag: 0.8-beta1~97 X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=commitdiff_plain;h=46a76ffbf0e9e7af3d4ceb074c0b8dff461b4a86 Introduce a flag EventManager::Silent If this is set, the EventStringifier won't generate a MessageEvent for this event. This is thought for the CoreSessionEventProcessor (and possibly scripts) to hide messages in certain cases, without circumventing further processing of the event. Example would be suppressing WHO messages on autowho. --- diff --git a/src/common/eventmanager.h b/src/common/eventmanager.h index a41dbe5d..4030cffa 100644 --- a/src/common/eventmanager.h +++ b/src/common/eventmanager.h @@ -46,7 +46,8 @@ public: }; enum EventFlag { - Backlog = 0x40, + Backlog = 0x20, + Silent = 0x40, ///< Don't generate a MessageEvent Stopped = 0x80 }; Q_DECLARE_FLAGS(EventFlags, EventFlag) diff --git a/src/core/coresessioneventprocessor.cpp b/src/core/coresessioneventprocessor.cpp index fb9f903c..bc7d1fbf 100644 --- a/src/core/coresessioneventprocessor.cpp +++ b/src/core/coresessioneventprocessor.cpp @@ -222,8 +222,10 @@ void CoreSessionEventProcessor::processIrcEvent305(IrcEvent *e) { if(me) me->setAway(false); - if(e->network()->autoAwayActive()) + if(e->network()->autoAwayActive()) { e->network()->setAutoAwayActive(false); + e->setFlag(EventManager::Silent); + } } /* RPL_NOWAWAY - ":You have been marked as being away" */ diff --git a/src/core/eventstringifier.cpp b/src/core/eventstringifier.cpp index 64e70038..c29a457b 100644 --- a/src/core/eventstringifier.cpp +++ b/src/core/eventstringifier.cpp @@ -32,6 +32,9 @@ EventStringifier::EventStringifier(CoreSession *parent) : QObject(parent), void EventStringifier::displayMsg(NetworkEvent *event, Message::Type msgType, const QString &msg, const QString &sender, const QString &target, Message::Flags msgFlags) { + if(event->flags().testFlag(EventManager::Silent)) + return; + MessageEvent *msgEvent = createMessageEvent(event, msgType, msg, sender, target, msgFlags); sendMessageEvent(msgEvent); } @@ -194,10 +197,8 @@ void EventStringifier::processIrcEvent301(IrcEvent *e) { } /* RPL_UNAWAY */ -void EventStringifier::earlyProcessIrcEvent305(IrcEvent *e) { - // needs to be called early so we still get the old autoAwayActive state! - if(!e->network()->autoAwayActive()) - displayMsg(e, Message::Server, tr("You are no longer marked as being away")); +void EventStringifier::processIrcEvent305(IrcEvent *e) { + displayMsg(e, Message::Server, tr("You are no longer marked as being away")); } /* RPL_NOWAWAY */ diff --git a/src/core/eventstringifier.h b/src/core/eventstringifier.h index 6dbfc0ff..fd7a2f58 100644 --- a/src/core/eventstringifier.h +++ b/src/core/eventstringifier.h @@ -58,7 +58,7 @@ public: Q_INVOKABLE void processIrcEventTopic(IrcEvent *event); Q_INVOKABLE void processIrcEvent301(IrcEvent *event); // RPL_AWAY - Q_INVOKABLE void earlyProcessIrcEvent305(IrcEvent *event); // RPL_UNAWAY + Q_INVOKABLE void processIrcEvent305(IrcEvent *event); // RPL_UNAWAY Q_INVOKABLE void processIrcEvent306(IrcEvent *event); // RPL_NOWAWAY // Q_INVOKABLE void processIrcEvent(IrcEvent *event);