QXmpp  Version: 1.4.0
QXmppAttentionManager.h
1 /*
2  * Copyright (C) 2008-2021 The QXmpp developers
3  *
4  * Author:
5  * Linus Jahn
6  *
7  * Source:
8  * https://github.com/qxmpp-project/qxmpp
9  *
10  * This file is a part of QXmpp library.
11  *
12  * This library is free software; you can redistribute it and/or
13  * modify it under the terms of the GNU Lesser General Public
14  * License as published by the Free Software Foundation; either
15  * version 2.1 of the License, or (at your option) any later version.
16  *
17  * This library is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20  * Lesser General Public License for more details.
21  *
22  */
23 
24 #ifndef QXMPPATTENTIONMANAGER_H
25 #define QXMPPATTENTIONMANAGER_H
26 
27 #include "QXmppClientExtension.h"
28 
29 #include <QTime>
30 
31 class QXmppAttentionManagerPrivate;
32 class QXmppMessage;
33 
34 class QXMPP_EXPORT QXmppAttentionManager : public QXmppClientExtension
35 {
36  Q_OBJECT
37 
38 public:
39  QXmppAttentionManager(quint8 allowedAttempts = 3, QTime timeFrame = QTime(0, 15, 0));
41 
42  QStringList discoveryFeatures() const override;
43 
44  quint8 allowedAttempts() const;
45  void setAllowedAttempts(quint8 allowedAttempts);
46 
47  QTime allowedAttemptsTimeInterval() const;
48  void setAllowedAttemptsTimeInterval(QTime interval);
49 
50 public Q_SLOTS:
51  QString requestAttention(const QString &jid, const QString &message = {});
52 
53 Q_SIGNALS:
54  void attentionRequested(const QXmppMessage &message, bool isTrusted);
56 
57 protected:
58  void setClient(QXmppClient *client) override;
59  bool handleStanza(const QDomElement &stanza) override;
60 
61 private Q_SLOTS:
62  void handleMessageReceived(const QXmppMessage &message);
63 
64 private:
65  QXmppAttentionManagerPrivate *const d;
66 };
67 
68 #endif // QXMPPATTENTIONMANAGER_H
The QXmppAttentionManager class manages attention requests as defined by XEP-0224: Attention.
Definition: QXmppAttentionManager.h:35
void attentionRequested(const QXmppMessage &message, bool isTrusted)
void attentionRequestRateLimited(const QXmppMessage &message)
The QXmppClientExtension class is the base class for QXmppClient extensions.
Definition: QXmppClientExtension.h:47
virtual void setClient(QXmppClient *client)
Definition: QXmppClientExtension.cpp:79
virtual QStringList discoveryFeatures() const
Definition: QXmppClientExtension.cpp:54
virtual bool handleStanza(const QDomElement &stanza)=0
You need to implement this method to process incoming XMPP stanzas.
The QXmppClient class is the main class for using QXmpp.
Definition: QXmppClient.h:94
The QXmppMessage class represents an XMPP message.
Definition: QXmppMessage.h:46