forked from Pizzabelly/EasyRP
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
45 lines (38 loc) · 1.27 KB
/
main.cpp
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
#include <iostream>
#include <chrono>
#include <thread>
#include <csignal>
#include "config.hpp"
#include "discord.hpp"
#define CONFIG_PATH "config.ini"
//Loop to keep the program running as well as checking the config file for updates
int main(void)
{
//Define When to Shutdown
signal(SIGINT, Shutdown);
signal(SIGTERM, Shutdown);
#ifdef SIGBREAK
signal(SIGBREAK, Shutdown);
#endif
config_t prevConfig = config;
setPresenceVariables(CONFIG_PATH);
//Start discord-rpc
InitDiscord(config.clientId.c_str());
//Loop to keep program running also to check for updated config
do
{
if (!config.compare(&prevConfig))
{
//Print and set variables for the presence
printVariables(config);
updatePresence(config.state.c_str(), config.details.c_str(), config.startTimestamp, config.endTimestamp,
config.smallImage.first.c_str(), config.smallImage.second.c_str(),
config.largeImage.first.c_str(), config.largeImage.second.c_str());
}
prevConfig = config;
setPresenceVariables(CONFIG_PATH);
std::this_thread::sleep_for(std::chrono::milliseconds(5000));
}
while(true);
return 0;
}