Made the appended string configurable

This commit is contained in:
tastytea 2018-05-11 01:17:53 +02:00
parent 580d0f23aa
commit e312f062a5
Signed by: tastytea
GPG Key ID: 59346E0EA35C67E5
5 changed files with 18 additions and 4 deletions

View File

@ -1,6 +1,6 @@
cmake_minimum_required (VERSION 3.7)
project (mastorss
VERSION 0.5.17
VERSION 0.6.0
LANGUAGES CXX
)

View File

@ -63,7 +63,8 @@ ${HOME}/.config/mastorss/config-example.json
[
"delete this",
"[Rr]ead more(\.{3}|…)"
]
],
"append": "#bot"
}
}

View File

@ -133,6 +133,14 @@ std::uint16_t read_config(string &instance, string &access_token, string &feedur
}
config_changed = true;
}
if (config[profile]["append"].isNull())
{
string append;
cout << "Append this string to each post []: ";
cin >> append;
config[profile]["append"] = append;
config_changed = true;
}
if (config_changed)
{
write_config();

View File

@ -17,7 +17,6 @@ std::uint16_t read_config(string &instance, string &access_token, string &feedur
const bool write_config();
std::vector<string> parse_website(const string &xml);
void unescape_html(const string &str);
void individual_fixes(string &str);
const std::uint16_t http_get(const string &feedurl,

View File

@ -158,7 +158,13 @@ std::vector<string> parse_website(const string &xml)
{
str.resize(str.length() - 1);
}
str += "\n\n" + link + "\n\n#bot";
str += "\n\n" + link;
if (!config[profile]["append"].empty())
{
str += "\n\n" + config[profile]["append"].asString();
}
ret.push_back(str);
}
}