libqutim  0.3.1.0
messagehandler.h
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** qutIM - instant messenger
4 **
5 ** Copyright © 2011 Ruslan Nigmatullin <euroelessar@yandex.ru>
6 **
7 *****************************************************************************
8 **
9 ** $QUTIM_BEGIN_LICENSE$
10 ** This program is free software: you can redistribute it and/or modify
11 ** it under the terms of the GNU General Public License as published by
12 ** the Free Software Foundation, either version 3 of the License, or
13 ** (at your option) any later version.
14 **
15 ** This program is distributed in the hope that it will be useful,
16 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 ** See the GNU General Public License for more details.
19 **
20 ** You should have received a copy of the GNU General Public License
21 ** along with this program. If not, see http://www.gnu.org/licenses/.
22 ** $QUTIM_END_LICENSE$
23 **
24 ****************************************************************************/
25 
26 #ifndef MESSAGEHANDLER_H
27 #define MESSAGEHANDLER_H
28 
29 #include "message.h"
30 
31 namespace qutim_sdk_0_3
32 {
33 
35 {
36 public:
37  enum Result
38  {
41  Error
42  };
43  enum Priority
44  {
45  LowPriority = 0x00000100,
46  ChatInPriority = 0x00008000,
47  NormalPriortity = 0x00010000,
48  ChatOutPriority = 0x00020000,
49  HighPriority = 0x01000000,
50  SenderPriority = 0x02000000
51  };
52 
53  virtual ~MessageHandler();
54 
55  static void registerHandler(MessageHandler *handler,
56  int incomingPriority = NormalPriortity,
57  int outgoingPriority = NormalPriortity);
58  static void registerHandler(MessageHandler *handler, const QString &name,
59  int incomingPriority = NormalPriortity,
60  int outgoingPriority = NormalPriortity);
61  static void unregisterHandler(MessageHandler *handler);
62  static Result handle(Message &message, QString *reason = 0);
63  static void traceHandlers();
64 
65 protected:
66  virtual Result doHandle(Message &message, QString *reason) = 0;
67 };
68 
69 }
70 
71 #endif // MESSAGEHANDLER_H
72 

Generated by Doxygen