| Home · All Classes · All Namespaces · Modules · Functions · Files

# abstract-client.h

    00001 /*
    00002  * This file is part of TelepathyQt4
    00003  *
    00004  * Copyright (C) 2009 Collabora Ltd. <http://www.collabora.co.uk/>
    00005  * Copyright (C) 2009 Nokia Corporation
    00006  *
    00007  * This library is free software; you can redistribute it and/or
    00008  * modify it under the terms of the GNU Lesser General Public
    00009  * License as published by the Free Software Foundation; either
    00010  * version 2.1 of the License, or (at your option) any later version.
    00011  *
    00012  * This library is distributed in the hope that it will be useful,
    00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00015  * Lesser General Public License for more details.
    00016  *
    00017  * You should have received a copy of the GNU Lesser General Public
    00018  * License along with this library; if not, write to the Free Software
    00019  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    00020  */
    00021
    00022 #ifndef _TelepathyQt4_abstract_client_h_HEADER_GUARD_
    00023 #define _TelepathyQt4_abstract_client_h_HEADER_GUARD_
    00024
    00025 #ifndef IN_TELEPATHY_QT4_HEADER
    00026 #error IN_TELEPATHY_QT4_HEADER
    00027 #endif
    00028
    00029 #include <TelepathyQt4/SharedPtr>
    00030 #include <TelepathyQt4/Types>
    00031
    00032 #include <QList>
    00033 #include <QObject>
    00034 #include <QString>
    00035 #include <QVariantMap>
    00036
    00037 namespace Tp
    00038 {
    00039
    00040 class TELEPATHY_QT4_EXPORT AbstractClient : public RefCounted
    00041 {
    00042     Q_DISABLE_COPY(AbstractClient)
    00043
    00044 public:
    00045     AbstractClient();
    00046     virtual ~AbstractClient();
    00047 };
    00048
    00049 class TELEPATHY_QT4_EXPORT AbstractClientObserver : public virtual AbstractClient
    00050 {
    00051     Q_DISABLE_COPY(AbstractClientObserver)
    00052
    00053 public:
    00054     virtual ~AbstractClientObserver();
    00055
    00056     ChannelClassList observerChannelFilter() const;
    00057
    00058     bool shouldRecover() const;
    00059
    00060     virtual void observeChannels(const MethodInvocationContextPtr<> &context,
    00061             const AccountPtr &account,
    00062             const ConnectionPtr &connection,
    00063             const QList<ChannelPtr> &channels,
    00064             const ChannelDispatchOperationPtr &dispatchOperation,
    00065             const QList<ChannelRequestPtr> &requestsSatisfied,
    00066             const QVariantMap &observerInfo) = 0;
    00067
    00068 protected:
    00069     AbstractClientObserver(const ChannelClassList &channelFilter);
    00070     AbstractClientObserver(const ChannelClassList &channelFilter,
    00071             bool shouldRecover);
    00072
    00073 private:
    00074     struct Private;
    00075     friend struct Private;
    00076     Private *mPriv;
    00077 };
    00078
    00079 class TELEPATHY_QT4_EXPORT AbstractClientApprover : public virtual AbstractClient
    00080 {
    00081     Q_DISABLE_COPY(AbstractClientApprover)
    00082
    00083 public:
    00084     virtual ~AbstractClientApprover();
    00085
    00086     ChannelClassList approverChannelFilter() const;
    00087
    00088     virtual void addDispatchOperation(const MethodInvocationContextPtr<> &context,
    00089             const QList<ChannelPtr> &channels,
    00090             const ChannelDispatchOperationPtr &dispatchOperation) = 0;
    00091
    00092 protected:
    00093     AbstractClientApprover(const ChannelClassList &channelFilter);
    00094
    00095 private:
    00096     struct Private;
    00097     friend struct Private;
    00098     Private *mPriv;
    00099 };
    00100
    00101 class TELEPATHY_QT4_EXPORT AbstractClientHandler : public virtual AbstractClient
    00102 {
    00103     Q_DISABLE_COPY(AbstractClientHandler)
    00104
    00105 public:
    00106     virtual ~AbstractClientHandler();
    00107
    00108     ChannelClassList handlerChannelFilter() const;
    00109
    00110     QStringList capabilities() const;
    00111
    00112     virtual bool bypassApproval() const = 0;
    00113
    00114     virtual void handleChannels(const MethodInvocationContextPtr<> &context,
    00115             const AccountPtr &account,
    00116             const ConnectionPtr &connection,
    00117             const QList<ChannelPtr> &channels,
    00118             const QList<ChannelRequestPtr> &requestsSatisfied,
    00119             const QDateTime &userActionTime,
    00120             const QVariantMap &handlerInfo) = 0;
    00121
    00122     bool wantsRequestNotification() const;
    00123     virtual void addRequest(const ChannelRequestPtr &request);
    00124     virtual void removeRequest(const ChannelRequestPtr &request,
    00125             const QString &errorName, const QString &errorMessage);
    00126
    00127 protected:
    00128     AbstractClientHandler(const ChannelClassList &channelFilter,
    00129             bool wantsRequestNotification = false);
    00130     AbstractClientHandler(const ChannelClassList &channelFilter,
    00131             const QStringList &capabilities,
    00132             bool wantsRequestNotification = false);
    00133
    00134 private:
    00135     struct Private;
    00136     friend struct Private;
    00137     Private *mPriv;
    00138 };
    00139
    00140 } // Tp
    00141
    00142 #endif