| 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     virtual void observeChannels(const MethodInvocationContextPtr<> &context,
    00059             const AccountPtr &account,
    00060             const ConnectionPtr &connection,
    00061             const QList<ChannelPtr> &channels,
    00062             const ChannelDispatchOperationPtr &dispatchOperation,
    00063             const QList<ChannelRequestPtr> &requestsSatisfied,
    00064             const QVariantMap &observerInfo) = 0;
    00065
    00066 protected:
    00067     AbstractClientObserver(const ChannelClassList &channelFilter);
    00068
    00069 private:
    00070     struct Private;
    00071     friend struct Private;
    00072     Private *mPriv;
    00073 };
    00074
    00075 class TELEPATHY_QT4_EXPORT AbstractClientApprover : public virtual AbstractClient
    00076 {
    00077     Q_DISABLE_COPY(AbstractClientApprover)
    00078
    00079 public:
    00080     virtual ~AbstractClientApprover();
    00081
    00082     ChannelClassList approverChannelFilter() const;
    00083
    00084     virtual void addDispatchOperation(const MethodInvocationContextPtr<> &context,
    00085             const QList<ChannelPtr> &channels,
    00086             const ChannelDispatchOperationPtr &dispatchOperation) = 0;
    00087
    00088 protected:
    00089     AbstractClientApprover(const ChannelClassList &channelFilter);
    00090
    00091 private:
    00092     struct Private;
    00093     friend struct Private;
    00094     Private *mPriv;
    00095 };
    00096
    00097 class TELEPATHY_QT4_EXPORT AbstractClientHandler : public virtual AbstractClient
    00098 {
    00099     Q_DISABLE_COPY(AbstractClientHandler)
    00100
    00101 public:
    00102     virtual ~AbstractClientHandler();
    00103
    00104     ChannelClassList handlerChannelFilter() const;
    00105     virtual bool bypassApproval() const = 0;
    00106
    00107     virtual void handleChannels(const MethodInvocationContextPtr<> &context,
    00108             const AccountPtr &account,
    00109             const ConnectionPtr &connection,
    00110             const QList<ChannelPtr> &channels,
    00111             const QList<ChannelRequestPtr> &requestsSatisfied,
    00112             const QDateTime &userActionTime,
    00113             const QVariantMap &handlerInfo) = 0;
    00114
    00115     bool wantsRequestNotification() const;
    00116     virtual void addRequest(const ChannelRequestPtr &request);
    00117     virtual void removeRequest(const ChannelRequestPtr &request,
    00118             const QString &errorName, const QString &errorMessage);
    00119
    00120 protected:
    00121     AbstractClientHandler(const ChannelClassList &channelFilter,
    00122             bool wantsRequestNotification = false);
    00123
    00124 private:
    00125     struct Private;
    00126     friend struct Private;
    00127     Private *mPriv;
    00128 };
    00129
    00130 } // Tp
    00131
    00132 #endif