mastobotmon/src/mastobotmon.hpp

58 lines
1.8 KiB
C++
Raw Normal View History

2018-02-27 23:38:05 +01:00
/* This file is part of mastobotmon.
* Copyright © 2018 tastytea <tastytea@tastytea.de>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef mastobotmon_HPP
#define mastobotmon_HPP
2018-02-28 06:23:42 +01:00
#include <string>
#include <cstdint>
2018-04-11 16:52:48 +02:00
#include <vector>
#include <memory>
2018-03-07 09:21:13 +01:00
#include <jsoncpp/json/json.h>
#include <mastodon-cpp/mastodon-cpp.hpp>
2018-04-11 16:52:48 +02:00
#include <mastodon-cpp/easy/easy.hpp>
#include <mastodon-cpp/easy/entities/notification.hpp>
2018-02-28 06:23:42 +01:00
using std::uint16_t;
using std::string;
2018-02-27 23:38:05 +01:00
2018-03-07 18:33:13 +01:00
extern Json::Value config;
2018-04-11 16:52:48 +02:00
class Account : public Mastodon::Easy
2018-02-28 06:23:42 +01:00
{
public:
explicit Account(const string &instance, const string &access_token);
2018-03-02 06:11:18 +01:00
const void set_minutes(uint16_t minutes);
const uint64_t get_minutes() const;
2018-03-07 11:41:16 +01:00
const uint16_t get_mentions(string &answer);
const void set_last_mention_id(const std::uint64_t &id);
2018-02-28 06:23:42 +01:00
private:
uint16_t _minutes;
2018-03-07 11:41:16 +01:00
std::uint64_t _last_mention_id;
2018-02-28 06:23:42 +01:00
};
2018-02-27 23:38:05 +01:00
2018-03-07 18:33:13 +01:00
const bool read_config();
2018-03-07 11:41:16 +01:00
const string get_access_token(const string &account);
2018-03-07 18:33:13 +01:00
const bool add_account();
const bool write_config();
2018-03-07 11:41:16 +01:00
2018-04-11 16:52:48 +02:00
const bool write_mentions(const string &straccount,
std::vector<std::shared_ptr<Mastodon::Easy::Notification>> &mentions);
2018-03-15 14:35:58 +01:00
const bool write_statistics(const string &straccount, Json::Value &account_json);
2018-03-07 11:41:16 +01:00
2018-02-27 23:38:05 +01:00
#endif // mastobotmon_HPP