TelegramSearch/src/message.h

27 lines
579 B
C
Raw Permalink Normal View History

2021-04-11 01:47:55 +02:00
#pragma once
#include <cstdint>
#include <string>
2021-04-11 15:25:34 +02:00
#include <nlohmann/json_fwd.hpp>
using json = nlohmann::json;
2021-04-11 01:47:55 +02:00
struct Message {
2021-04-11 15:25:34 +02:00
int64_t chatid = 0;
int64_t messageid = 0;
int64_t senderid = 0;
2021-06-06 22:44:54 +02:00
std::string fwdFrom;
2021-04-11 15:25:34 +02:00
std::string text = "";
2021-04-11 01:47:55 +02:00
std::string filename = ""; //empty filename = no file
2021-04-11 15:25:34 +02:00
time_t date = 0;
2021-04-11 01:47:55 +02:00
bool isreply = false;
2021-04-11 15:25:34 +02:00
Message() {}
Message(const json& j, int64_t chatid);
2021-04-11 01:47:55 +02:00
bool operator==(const Message& m) const;
bool operator!=(const Message& m) const;
bool operator<(const Message& m) const;
2021-04-11 15:25:34 +02:00
2021-04-11 01:47:55 +02:00
bool hasFile() const;
2021-04-11 15:25:34 +02:00
std::string getDate() const;
};