qTox  Version: nightly | Commit: bc751c8e1cac455f9690654fcfe0f560d2d7dfdd
imessagedispatcher.h
Go to the documentation of this file.
1 /*
2  Copyright © 2019 by The qTox Project Contributors
3 
4  This file is part of qTox, a Qt-based graphical interface for Tox.
5 
6  qTox is libre software: you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  qTox is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with qTox. If not, see <http://www.gnu.org/licenses/>.
18 */
19 
20 #pragma once
21 
22 #include "src/model/friend.h"
23 #include "src/model/message.h"
25 
26 #include <QObject>
27 #include <QString>
28 
29 #include <cstdint>
30 
31 using DispatchedMessageId = NamedType<size_t, struct SentMessageIdTag, Orderable, Incrementable>;
33 
34 class IMessageDispatcher : public QObject
35 {
36  Q_OBJECT
37 public:
38  virtual ~IMessageDispatcher() = default;
39 
46  virtual std::pair<DispatchedMessageId, DispatchedMessageId>
47  sendMessage(bool isAction, const QString& content) = 0;
48 
57  virtual std::pair<DispatchedMessageId, DispatchedMessageId>
58  sendExtendedMessage(const QString& content, ExtensionSet extensions) = 0;
59 
60 signals:
64  void messageReceived(const ToxPk& sender, const Message& message);
65 
71  void messageSent(DispatchedMessageId id, const Message& message);
72 
77  void messageComplete(DispatchedMessageId id);
78 
79  void messageBroken(DispatchedMessageId id, BrokenMessageReason reason);
80 };
friend.h
Q_DECLARE_METATYPE
Q_DECLARE_METATYPE(ExtendedReceiptNum)
brokenmessagereason.h
IMessageDispatcher
Definition: imessagedispatcher.h:34
message.h
HistMessageContentType::message
@ message
ToxPk
This class represents a Tox Public Key, which is a part of Tox ID.
Definition: toxpk.h:26
DispatchedMessageId
NamedType< size_t, struct SentMessageIdTag, Orderable, Incrementable > DispatchedMessageId
Definition: imessagedispatcher.h:31
BrokenMessageReason
BrokenMessageReason
Definition: brokenmessagereason.h:23
ExtensionSet
std::bitset< ExtensionType::max > ExtensionSet
Definition: extension.h:32
Message
Definition: message.h:52