qTox  Version: nightly | Commit: bc751c8e1cac455f9690654fcfe0f560d2d7dfdd
groupmessagedispatcher.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 
24 #include "src/model/group.h"
26 #include "src/model/message.h"
27 
28 #include <QObject>
29 #include <QString>
30 
31 #include <cstdint>
32 
33 class IGroupSettings;
34 
36 {
37  Q_OBJECT
38 public:
42 
43  std::pair<DispatchedMessageId, DispatchedMessageId> sendMessage(bool isAction,
44  QString const& content) override;
45 
46  std::pair<DispatchedMessageId, DispatchedMessageId> sendExtendedMessage(const QString& content,
47  ExtensionSet extensions) override;
48  void onMessageReceived(ToxPk const& sender, bool isAction, QString const& content);
49 
50 private:
57 };
GroupMessageDispatcher::nextMessageId
DispatchedMessageId nextMessageId
Definition: groupmessagedispatcher.h:56
IGroupSettings
Definition: igroupsettings.h:26
group.h
GroupMessageDispatcher::groupSettings
const IGroupSettings & groupSettings
Definition: groupmessagedispatcher.h:55
GroupMessageDispatcher::onMessageReceived
void onMessageReceived(ToxPk const &sender, bool isAction, QString const &content)
Processes and dispatches received message from toxcore.
Definition: groupmessagedispatcher.cpp:85
GroupMessageDispatcher::GroupMessageDispatcher
GroupMessageDispatcher(Group &group, MessageProcessor processor, ICoreIdHandler &idHandler, ICoreGroupMessageSender &messageSender, const IGroupSettings &groupSettings)
Definition: groupmessagedispatcher.cpp:25
icoregroupmessagesender.h
IMessageDispatcher
Definition: imessagedispatcher.h:34
GroupMessageDispatcher::idHandler
ICoreIdHandler & idHandler
Definition: groupmessagedispatcher.h:53
GroupMessageDispatcher
Definition: groupmessagedispatcher.h:35
GroupMessageDispatcher::sendExtendedMessage
std::pair< DispatchedMessageId, DispatchedMessageId > sendExtendedMessage(const QString &content, ExtensionSet extensions) override
Sends message to associated chat ensuring that extensions are available.
Definition: groupmessagedispatcher.cpp:69
GroupMessageDispatcher::sendMessage
std::pair< DispatchedMessageId, DispatchedMessageId > sendMessage(bool isAction, QString const &content) override
Sends message to associated chat.
Definition: groupmessagedispatcher.cpp:39
message.h
ICoreGroupMessageSender
Definition: icoregroupmessagesender.h:24
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
GroupMessageDispatcher::processor
MessageProcessor processor
Definition: groupmessagedispatcher.h:52
Group
Definition: group.h:34
ExtensionSet
std::bitset< ExtensionType::max > ExtensionSet
Definition: extension.h:32
GroupMessageDispatcher::messageSender
ICoreGroupMessageSender & messageSender
Definition: groupmessagedispatcher.h:54
GroupMessageDispatcher::group
Group & group
Definition: groupmessagedispatcher.h:51
ICoreIdHandler
Definition: icoreidhandler.h:25
MessageProcessor
Definition: message.h:62
imessagedispatcher.h
icoreidhandler.h