File indexing completed on 2023-10-03 04:18:00

0001 /*
0002  * Copyright (C) 2011 Collabora Ltd. <http://www.collabora.co.uk/>
0003  *   @author Andre Moreira Magalhaes <andre.magalhaes@collabora.co.uk>
0004  *
0005  * This library is free software; you can redistribute it and/or
0006  * modify it under the terms of the GNU Lesser General Public
0007  * License as published by the Free Software Foundation; either
0008  * version 2.1 of the License, or (at your option) any later version.
0009  *
0010  * This library is distributed in the hope that it will be useful,
0011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0013  * Lesser General Public License for more details.
0014  *
0015  * You should have received a copy of the GNU Lesser General Public
0016  * License along with this library; if not, write to the Free Software
0017  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
0018  */
0019 
0020 #ifndef TLSHANDLER_H
0021 #define TLSHANDLER_H
0022 
0023 #include <QObject>
0024 
0025 #include <TelepathyQt/AbstractClientHandler>
0026 
0027 namespace Tp
0028 {
0029     class PendingOperation;
0030 };
0031 
0032 class TlsCertVerifierOp;
0033 
0034 class TlsHandler : public QObject, public Tp::AbstractClientHandler
0035 {
0036     Q_OBJECT
0037 
0038 public:
0039     explicit TlsHandler();
0040     ~TlsHandler();
0041 
0042     bool bypassApproval() const;
0043 
0044     void handleChannels(const Tp::MethodInvocationContextPtr<> &context,
0045             const Tp::AccountPtr &account,
0046             const Tp::ConnectionPtr &connection,
0047             const QList<Tp::ChannelPtr> &channels,
0048             const QList<Tp::ChannelRequestPtr> &requestsSatisfied,
0049             const QDateTime &userActionTime,
0050             const Tp::AbstractClientHandler::HandlerInfo &handlerInfo);
0051 
0052 private Q_SLOTS:
0053     void onCertVerifierReady(Tp::PendingOperation *op);
0054     void onCertVerifierFinished(Tp::PendingOperation *op);
0055 
0056 private:
0057     QHash<Tp::PendingOperation *, Tp::MethodInvocationContextPtr<> > mVerifiers;
0058 };
0059 
0060 #endif