2016-08-27 00:51:00 -04:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#ifndef DISABLE_BITMESSAGE
|
|
|
|
|
2016-08-28 13:38:16 -04:00
|
|
|
#define BITMESSAGE_KEYS_FILENAME std::string("players/bmkeys.dat")
|
2016-08-27 15:20:08 -04:00
|
|
|
#define BITMESSAGE_OBJECT_STORAGE_FILENAME std::string("players/bmstore.dat")
|
2016-08-27 00:51:00 -04:00
|
|
|
|
|
|
|
namespace Components
|
|
|
|
{
|
|
|
|
class BitMessage : public Component
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
BitMessage();
|
2016-08-28 13:38:16 -04:00
|
|
|
~BitMessage();
|
2016-08-27 00:51:00 -04:00
|
|
|
|
|
|
|
#ifdef DEBUG
|
|
|
|
const char* GetName() { return "BitMessage"; };
|
|
|
|
#endif
|
|
|
|
|
2016-08-30 06:23:53 -04:00
|
|
|
static void SetDefaultTTL(time_t ttl);
|
|
|
|
static bool RequestPublicKey(std::string targetAddress);
|
|
|
|
static bool WaitForPublicKey(std::string targetAddress);
|
|
|
|
static bool Subscribe(std::string targetAddress);
|
|
|
|
static bool SendMsg(std::string targetAddress, std::string message, time_t ttl = 0);
|
|
|
|
static bool SendBroadcast(std::string message, time_t ttl = 0);
|
|
|
|
static void Save();
|
2016-08-28 13:38:16 -04:00
|
|
|
|
2016-08-30 06:23:53 -04:00
|
|
|
static BitMRC* BMClient;
|
2016-08-27 00:51:00 -04:00
|
|
|
|
|
|
|
private:
|
2016-08-30 06:23:53 -04:00
|
|
|
static PubAddr* FindPublicKey(PubAddr addr);
|
|
|
|
static bool InitAddr();
|
2016-08-27 00:51:00 -04:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|