2 kopetefilterchain.h - Kopete Message Filter Chain
4 Copyright (c) 2004 by Richard Smith <kde@metafoo.co.uk>
5 Kopete (c) 2002-2004 by the Kopete developers <kopete-devel@kde.org>
7 *************************************************************************
9 * This library is free software; you can redistribute it and/or *
10 * modify it under the terms of the GNU Lesser General Public *
11 * License as published by the Free Software Foundation; either *
12 * version 2 of the License, or (at your option) any later version. *
14 *************************************************************************
17 #ifndef KOPETEMESSAGEHANDLERCHAIN_H
18 #define KOPETEMESSAGEHANDLERCHAIN_H
20 #include <QtCore/QObject>
22 #include <kdemacros.h>
23 #include <ksharedptr.h>
24 #include "kopetemessage.h"
25 #include "kopetetask.h"
32 class ProcessMessageTask
;
35 * @brief A chain of message handlers; the processing layer between protocol and chat view
37 * This class represents a chain of connected message handlers.
39 * This class is the client of the chain of responsibility formed by the
40 * MessageHandlers, and acts as a facade for that chain, presenting a
41 * more convenient interface.
43 * @author Richard Smith <kde@metafoo.co.uk>
45 class MessageHandlerChain
: public QObject
, private KShared
49 friend class KSharedPtr
<MessageHandlerChain
>;
50 typedef KSharedPtr
<MessageHandlerChain
> Ptr
;
53 * Create a new MessageHandlerChain object with the appropriate handlers for
54 * processing messages entering @p manager in direction @p direction.
56 static Ptr
create( ChatSession
*manager
, Message::MessageDirection direction
);
58 ProcessMessageTask
*processMessage( const Message
&message
);
62 MessageHandlerChain();
63 ~MessageHandlerChain();
65 friend class ProcessMessageTask
;
71 * @brief A task for processing a message
72 * @author Richard Smith <kde@metafoo.co.uk>
74 class ProcessMessageTask
: public Task
78 MessageEvent
*event();
86 // Avoid compiler warning about QObject::event
89 ProcessMessageTask(MessageHandlerChain::Ptr
, MessageEvent
*event
);
90 ~ProcessMessageTask();
92 friend class MessageHandlerChain
;
99 #endif // KOPETEMESSAGEHANDLERCHAIN_H
101 // vim: set noet ts=4 sts=4 sw=4: