forked from palindromiq/YATE
-
Notifications
You must be signed in to change notification settings - Fork 0
/
discordmanager.h
111 lines (93 loc) · 2.56 KB
/
discordmanager.h
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#ifndef DISCORDMANAGER_H
#define DISCORDMANAGER_H
#include "globals.h"
#ifdef DISCORD_ENABLED
#include <QObject>
#include <QMutex>
namespace discord {
class Core;
class User;
}
class QTimer;
class QSettings;
namespace Yate {
class DiscordManager : public QObject
{
Q_OBJECT
public:
explicit DiscordManager(QObject *parent = nullptr);
~DiscordManager();
const QString &activityDetails() const;
const QString &activityState() const;
bool connectTo(QString lobbySecret);
bool running() const;
long long getLobbyId() const;
bool isHost() const;
void setIsHost(bool newIsHost);
public slots:
void start();
void stop();
void update();
void updateActivity();
void clearActivity();
void setActivityState(const QString &newActivityState);
void setActivityDetails(const QString &newActivityDetails);
void sendMessageOnChannel1(QString msg);
void sendMessageOnChannel2(QString msg);
void sendMessageOnChannel3(QString msg);
void disconnectFromLobby();
void checkMessageBuffers();
void setSquadString(QString msg);
signals:
void ready();
void failed(QString err);
void onLobbyIdChange(QString id);
void onPeerIdChange(QString id);
void onUserConnected(QString name);
void onMessageFromChannel1(QString msg);
void onMessageFromChannel2(QString msg);
void onMessageFromChannel3(QString msg);
void connectionSucceeded();
void connectionFailed();
void onLobbyDisconnect();
void onInviteAccepted(QString secret);
private:
void setup(bool emitErrors = true);
void sendMessageToLobby(QString msg);
discord::Core* core_;
discord::User* currentUser_;
QTimer *updateTimer_;
QTimer *messageBufferTimer_;
QString currentActivityDetails_;
QString currentActivityState_;
QString currentActivityImageText_;
QString activityDetails_;
QString activityState_;
QString activityImageText_;
QSettings *settings_;
QString ch1Buffer;
QString ch2Buffer;
QString ch3Buffer;
QMutex bufferMutex_;
QAtomicInt ready_;
QAtomicInt failed_;
QAtomicInt running_;
QAtomicInt activityInit_;
long long lobbyId_;
long long peerLobbyId_;
long long peerUserId_;
int currentPartySize_;
int activityPartySize_;
long long activityLobbyId_;
char lobbySecret_[512];
char lobbyIdStr_[512];
char peerLobbyIdStr_[512];
char peerLobbySecret_[512];
char appCommand[2048];
bool isHost_;
bool activityIsHost_;
bool commandRegistered_;
};
}
#endif
#endif // DISCORDMANAGER_H