This commit is contained in:
parent
929cb540d4
commit
cf3f13fff1
|
@ -1,6 +1,6 @@
|
||||||
cmake_minimum_required (VERSION 3.7)
|
cmake_minimum_required (VERSION 3.7)
|
||||||
project (mastorss
|
project (mastorss
|
||||||
VERSION 0.6.3
|
VERSION 0.7.0
|
||||||
LANGUAGES CXX
|
LANGUAGES CXX
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -10,11 +10,11 @@ The documentation is far from complete, sorry.
|
||||||
## Dependencies
|
## Dependencies
|
||||||
|
|
||||||
* Tested OS: Linux
|
* Tested OS: Linux
|
||||||
* C++ compiler (tested: gcc 6.3, 7.3)
|
* C++ compiler (tested: gcc 6 / 7 / 8)
|
||||||
* [cmake](https://cmake.org/) (tested: 3.9 / 3.11)
|
* [cmake](https://cmake.org/) (tested: 3.9 / 3.11)
|
||||||
* [boost](http://www.boost.org/) (tested: 1.65 / 1.62)
|
* [boost](http://www.boost.org/) (tested: 1.65 / 1.62)
|
||||||
* [curlpp](http://www.curlpp.org/) (tested: 0.8 / 0.7)
|
* [curlpp](http://www.curlpp.org/) (tested: 0.8 / 0.7)
|
||||||
* [mastodon-cpp](https://schlomp.space/tastytea/mastodon-cpp) (at least: 0.12.0)
|
* [mastodon-cpp](https://schlomp.space/tastytea/mastodon-cpp) (at least: 0.18.4)
|
||||||
* [jsoncpp](https://github.com/open-source-parsers/jsoncpp) (tested: 1.8 / 1.7)
|
* [jsoncpp](https://github.com/open-source-parsers/jsoncpp) (tested: 1.8 / 1.7)
|
||||||
|
|
||||||
## Get sourcecode
|
## Get sourcecode
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <jsoncpp/json/json.h>
|
#include <jsoncpp/json/json.h>
|
||||||
#include <mastodon-cpp/mastodon-cpp.hpp>
|
#include <mastodon-cpp/mastodon-cpp.hpp>
|
||||||
|
#include <mastodon-cpp/easy/all.hpp>
|
||||||
#include "version.hpp"
|
#include "version.hpp"
|
||||||
#include "mastorss.hpp"
|
#include "mastorss.hpp"
|
||||||
|
|
||||||
|
@ -57,7 +58,7 @@ int main(int argc, char *argv[])
|
||||||
profile = argv[1];
|
profile = argv[1];
|
||||||
std::uint16_t ret;
|
std::uint16_t ret;
|
||||||
string answer;
|
string answer;
|
||||||
std::vector<string> entries;
|
std::vector<Mastodon::Easy::Status> entries;
|
||||||
|
|
||||||
read_config(instance, access_token, feedurl);
|
read_config(instance, access_token, feedurl);
|
||||||
curlpp_init();
|
curlpp_init();
|
||||||
|
@ -76,14 +77,14 @@ int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
// If no last_entry is stored in the config file,
|
// If no last_entry is stored in the config file,
|
||||||
// make last_entry the second-newest entry.
|
// make last_entry the second-newest entry.
|
||||||
last_entry = entries.at(1);
|
last_entry = entries.at(1).content();
|
||||||
}
|
}
|
||||||
config[profile]["last_entry"] = entries.front();
|
config[profile]["last_entry"] = entries.front().content();
|
||||||
|
|
||||||
bool new_content = false;
|
bool new_content = false;
|
||||||
for (auto rit = entries.rbegin(); rit != entries.rend(); ++rit)
|
for (auto rit = entries.rbegin(); rit != entries.rend(); ++rit)
|
||||||
{
|
{
|
||||||
if (!new_content && (*rit).compare(last_entry) == 0)
|
if (!new_content && (*rit).content().compare(last_entry) == 0)
|
||||||
{
|
{
|
||||||
// If the last entry is found in entries,
|
// If the last entry is found in entries,
|
||||||
// start tooting in the next loop.
|
// start tooting in the next loop.
|
||||||
|
@ -96,13 +97,9 @@ int main(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
|
|
||||||
string answer;
|
string answer;
|
||||||
Mastodon::API masto(instance, access_token);
|
Mastodon::Easy masto(instance, access_token);
|
||||||
|
|
||||||
API::parametermap parameters =
|
masto.send_post(*rit);
|
||||||
{
|
|
||||||
{ "status", { *rit } }
|
|
||||||
};
|
|
||||||
ret = masto.post(API::v1::statuses, parameters, answer);
|
|
||||||
|
|
||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue
Block a user