From bcb704366cb5e333a626c18c308c7e0448a8e69f Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features. BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdenetwork@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kopete/libkopete/kopetemessagehandlerchain.h | 96 ++++++++++++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 kopete/libkopete/kopetemessagehandlerchain.h (limited to 'kopete/libkopete/kopetemessagehandlerchain.h') diff --git a/kopete/libkopete/kopetemessagehandlerchain.h b/kopete/libkopete/kopetemessagehandlerchain.h new file mode 100644 index 00000000..5852c2da --- /dev/null +++ b/kopete/libkopete/kopetemessagehandlerchain.h @@ -0,0 +1,96 @@ +/* + kopetefilterchain.h - Kopete Message Filter Chain + + Copyright (c) 2004 by Richard Smith + Kopete (c) 2002-2004 by the Kopete developers + + ************************************************************************* + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Lesser General Public * + * License as published by the Free Software Foundation; either * + * version 2 of the License, or (at your option) any later version. * + * * + ************************************************************************* +*/ + +#ifndef KOPETEFILTERCHAIN_H +#define KOPETEFILTERCHAIN_H + +#include +#include +#include +#include "kopetemessage.h" +#include "kopetetask.h" + +namespace Kopete +{ + +class MessageEvent; +class MessageHandler; +class ProcessMessageTask; + +/** + * @brief A chain of message handlers; the processing layer between protocol and chat view + * + * This class represents a chain of connected message handlers. + * + * This class is the client of the chain of responsibility formed by the + * MessageHandlers, and acts as a facade for that chain, presenting a + * more convenient interface. + * + * @author Richard Smith + */ +class MessageHandlerChain : public QObject, private KShared +{ + Q_OBJECT +public: + friend class KSharedPtr; + typedef KSharedPtr Ptr; + + /** + * Create a new MessageHandlerChain object with the appropriate handlers for + * processing messages entering @p manager in direction @p direction. + */ + static Ptr create( ChatSession *manager, Message::MessageDirection direction ); + + ProcessMessageTask *processMessage( const Message &message ); + int capabilities(); + +private: + MessageHandlerChain(); + ~MessageHandlerChain(); + + friend class ProcessMessageTask; + class Private; + Private *d; +}; + +/** + * @brief A task for processing a message + * @author Richard Smith + */ +class ProcessMessageTask : public Task +{ + Q_OBJECT +public: + MessageEvent *event(); + +private slots: + void slotStart(); + void slotDone(); + +private: + ProcessMessageTask(MessageHandlerChain::Ptr, MessageEvent *event); + ~ProcessMessageTask(); + + friend class MessageHandlerChain; + class Private; + Private *d; +}; + +} + +#endif + +// vim: set noet ts=4 sts=4 sw=4: -- cgit v1.2.1