Show invite menu in wlm chat window immediately
[kdenetwork.git] / kopete / libkopete / kopetemessagehandlerchain.h
blobee9b729a101f149ecbfaf12c11e5ec23f9211bed
1 /*
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 *************************************************************************
8 * *
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. *
13 * *
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"
27 namespace Kopete
30 class MessageEvent;
31 class MessageHandler;
32 class ProcessMessageTask;
34 /**
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
47 Q_OBJECT
48 public:
49 friend class KSharedPtr<MessageHandlerChain>;
50 typedef KSharedPtr<MessageHandlerChain> Ptr;
52 /**
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 );
59 int capabilities();
61 private:
62 MessageHandlerChain();
63 ~MessageHandlerChain();
65 friend class ProcessMessageTask;
66 class Private;
67 Private * const d;
70 /**
71 * @brief A task for processing a message
72 * @author Richard Smith <kde@metafoo.co.uk>
74 class ProcessMessageTask : public Task
76 Q_OBJECT
77 public:
78 MessageEvent *event();
80 public slots:
81 void start();
82 void slotDone();
83 void kill( bool );
85 protected:
86 // Avoid compiler warning about QObject::event
87 using Task::event;
88 private:
89 ProcessMessageTask(MessageHandlerChain::Ptr, MessageEvent *event);
90 ~ProcessMessageTask();
92 friend class MessageHandlerChain;
93 class Private;
94 Private * const d;
99 #endif // KOPETEMESSAGEHANDLERCHAIN_H
101 // vim: set noet ts=4 sts=4 sw=4: