Made the appended string configurable
This commit is contained in:
parent
580d0f23aa
commit
e312f062a5
|
@ -1,6 +1,6 @@
|
||||||
cmake_minimum_required (VERSION 3.7)
|
cmake_minimum_required (VERSION 3.7)
|
||||||
project (mastorss
|
project (mastorss
|
||||||
VERSION 0.5.17
|
VERSION 0.6.0
|
||||||
LANGUAGES CXX
|
LANGUAGES CXX
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -63,7 +63,8 @@ ${HOME}/.config/mastorss/config-example.json
|
||||||
[
|
[
|
||||||
"delete this",
|
"delete this",
|
||||||
"[Rr]ead more(\.{3}|…)"
|
"[Rr]ead more(\.{3}|…)"
|
||||||
]
|
],
|
||||||
|
"append": "#bot"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -133,6 +133,14 @@ std::uint16_t read_config(string &instance, string &access_token, string &feedur
|
||||||
}
|
}
|
||||||
config_changed = true;
|
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)
|
if (config_changed)
|
||||||
{
|
{
|
||||||
write_config();
|
write_config();
|
||||||
|
|
|
@ -17,7 +17,6 @@ std::uint16_t read_config(string &instance, string &access_token, string &feedur
|
||||||
const bool write_config();
|
const bool write_config();
|
||||||
|
|
||||||
std::vector<string> parse_website(const string &xml);
|
std::vector<string> parse_website(const string &xml);
|
||||||
void unescape_html(const string &str);
|
|
||||||
void individual_fixes(string &str);
|
void individual_fixes(string &str);
|
||||||
|
|
||||||
const std::uint16_t http_get(const string &feedurl,
|
const std::uint16_t http_get(const string &feedurl,
|
||||||
|
|
|
@ -158,7 +158,13 @@ std::vector<string> parse_website(const string &xml)
|
||||||
{
|
{
|
||||||
str.resize(str.length() - 1);
|
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);
|
ret.push_back(str);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user