libqutim
0.3.2.0
|
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 ROSTERSTORAGE_H 00027 #define ROSTERSTORAGE_H 00028 00029 #include "libqutim_global.h" 00030 #include <QVariantMap> 00031 00032 namespace qutim_sdk_0_3 00033 { 00034 class RosterStoragePrivate; 00035 class Contact; 00036 class Account; 00037 00038 class LIBQUTIM_EXPORT ContactsFactory 00039 { 00040 public: 00041 virtual ~ContactsFactory(); 00042 00043 virtual Contact *addContact(const QString &id, const QVariantMap &data) = 0; 00044 virtual void serialize(Contact *contact, QVariantMap &data) = 0; 00045 }; 00046 00047 class LIBQUTIM_EXPORT RosterStorage : public QObject 00048 { 00049 Q_OBJECT 00050 Q_DECLARE_PRIVATE(RosterStorage) 00051 Q_CLASSINFO("Service", "RosterStorage") 00052 public: 00053 static RosterStorage *instance(); 00054 00055 virtual QString load(Account *account) = 0; 00056 virtual void addContact(Contact *contact, const QString &version = QString()) = 0; 00057 virtual void updateContact(Contact *contact, const QString &version = QString()) = 0; 00058 virtual void removeContact(Contact *contact, const QString &version = QString()) = 0; 00059 protected: 00060 RosterStorage(); 00061 virtual ~RosterStorage(); 00062 private: 00063 QScopedPointer<RosterStoragePrivate> d_ptr; 00064 }; 00065 } 00066 00067 Q_DECLARE_INTERFACE(qutim_sdk_0_3::ContactsFactory, "org.qutim.ContactsFactory") 00068 00069 #endif // ROSTERSTORAGE_H 00070