libqutim 0.2.80.1
|
00001 /**************************************************************************** 00002 ** 00003 ** qutIM - instant messenger 00004 ** 00005 ** Copyright © 2011 Ruslan Nigmatullin <euroelessar@yandex.ru> 00006 ** 00007 ***************************************************************************** 00008 ** 00009 ** $QUTIM_BEGIN_LICENSE$ 00010 ** This program is free software: you can redistribute it and/or modify 00011 ** it under the terms of the GNU General Public License as published by 00012 ** the Free Software Foundation, either version 3 of the License, or 00013 ** (at your option) any later version. 00014 ** 00015 ** This program is distributed in the hope that it will be useful, 00016 ** but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00018 ** See the GNU General Public License for more details. 00019 ** 00020 ** You should have received a copy of the GNU General Public License 00021 ** along with this program. If not, see http://www.gnu.org/licenses/. 00022 ** $QUTIM_END_LICENSE$ 00023 ** 00024 ****************************************************************************/ 00025 00026 #ifndef MESSAGEHANDLER_H 00027 #define MESSAGEHANDLER_H 00028 00029 #include "message.h" 00030 00031 namespace qutim_sdk_0_3 00032 { 00033 00034 class LIBQUTIM_EXPORT MessageHandler 00035 { 00036 public: 00037 enum Result 00038 { 00039 Accept, 00040 Reject, 00041 Error 00042 }; 00043 enum Priority 00044 { 00045 LowPriority = 0x00000100, 00046 ChatInPriority = 0x00008000, 00047 NormalPriortity = 0x00010000, 00048 ChatOutPriority = 0x00020000, 00049 HighPriority = 0x01000000 00050 }; 00051 00052 virtual ~MessageHandler(); 00053 00054 static void registerHandler(MessageHandler *handler, 00055 int incomingPriority = NormalPriortity, 00056 int outgoingPriority = NormalPriortity); 00057 static void unregisterHandler(MessageHandler *handler); 00058 static Result handle(Message &message, QString *reason = 0); 00059 00060 protected: 00061 virtual Result doHandle(Message &message, QString *reason) = 0; 00062 }; 00063 00064 } 00065 00066 #endif // MESSAGEHANDLER_H 00067