Show invite menu in wlm chat window immediately
[kdenetwork.git] / kopete / libkopete / kopetesimplemessagehandler.h
blobfac1d82eed89636130e44d6040139f9f2ef81b8e
1 /*
2 kopetesimplemessagehandler.h - Kopete Message Filtering - simple interface
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 KOPETESIMPLEMESSAGEHANDLER_H
18 #define KOPETESIMPLEMESSAGEHANDLER_H
20 #include "kopete_export.h"
21 #include "kopetemessagehandler.h"
23 namespace Kopete
26 /**
27 * @brief A MessageHandlerFactory that creates synchronous MessageHandlers that just call a slot
29 * A concrete MessageHandlerFactory. This class is intended to make writing MessageHandlers simpler;
30 * all that is required is to implement a message processing function and place an instance of this
31 * class in your Plugin-derived class.
33 * Whenever a message passes through a handler created by this factory, the slot passed to the
34 * constructor will be called. The slot should take a single argument of type (non-@p const)
35 * <tt>Message &</tt>.
37 class KOPETE_EXPORT SimpleMessageHandlerFactory : public MessageHandlerFactory
39 public:
40 /**
41 * @param direction The direction this factory should create message handlers for
42 * @param position Where in the chain the handler should be installed
43 * @param target The object to call back to when handling a message
44 * @param slot The slot on @p target to call when handling a message
45 * @see Kopete::MessageHandlerFactory::filterPosition
47 SimpleMessageHandlerFactory( Message::MessageDirection direction, int position,
48 QObject *target, const char *slot );
49 ~SimpleMessageHandlerFactory();
51 /**
52 * Creates and returns a SimpleMessageHandler object.
54 MessageHandler *create( ChatSession *manager, Message::MessageDirection direction );
55 /**
56 * Returns the filter position passed to the constructor if @p direction matches the
57 * direction passed to the constructor, otherwise returns @c StageDoNotCreate.
59 int filterPosition( ChatSession *manager, Message::MessageDirection direction );
61 private:
62 class Private;
63 Private * const d;
66 /**
67 * @internal This class is used to implement SimpleMessageHandlerFactory.
69 class SimpleMessageHandler : public MessageHandler
71 Q_OBJECT
72 public:
73 SimpleMessageHandler();
74 ~SimpleMessageHandler();
76 void handleMessage( MessageEvent *event );
78 signals:
79 void handle( Kopete::Message &message );
81 private:
82 class Private;
83 Private * const d;
88 #endif
90 // vim: set noet ts=4 sts=4 sw=4: