aboutsummaryrefslogtreecommitdiff
path: root/src/client/QXmppEntityTimeManager.h
blob: 87219122a7f7038f47553906051aaf1a527d5ddb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// SPDX-FileCopyrightText: 2010 Manjeet Dahiya <manjeetdahiya@gmail.com>
// SPDX-FileCopyrightText: 2022 Linus Jahn <lnj@kaidan.im>
//
// SPDX-License-Identifier: LGPL-2.1-or-later

#ifndef QXMPPENTITYTIMEMANAGER_H
#define QXMPPENTITYTIMEMANAGER_H

#include "QXmppClientExtension.h"

#include <variant>

template<class T>
class QXmppTask;
class QXmppEntityTimeIq;
struct QXmppError;

///
/// \brief The QXmppEntityTimeManager class provided the functionality to get
/// the local time of an entity as defined by \xep{0202}: Entity Time.
///
/// \ingroup Managers
///
class QXMPP_EXPORT QXmppEntityTimeManager : public QXmppClientExtension
{
    Q_OBJECT

public:
    QString requestTime(const QString &jid);

    using EntityTimeResult = std::variant<QXmppEntityTimeIq, QXmppError>;
    QXmppTask<EntityTimeResult> requestEntityTime(const QString &jid);

    /// \cond
    QStringList discoveryFeatures() const override;
    bool handleStanza(const QDomElement &element) override;
    std::variant<QXmppEntityTimeIq, QXmppStanza::Error> handleIq(QXmppEntityTimeIq iq);
    /// \endcond

Q_SIGNALS:
    /// \brief This signal is emitted when a time response is received. It's not
    /// emitted when the QFuture-based request is used.
    void timeReceived(const QXmppEntityTimeIq &);
};

#endif  // QXMPPENTITYTIMEMANAGER_H