* new class for IP utils

* method to check telegram support out of config
* getters in Config.cpp
* lots of reformatings and cdoc
This commit is contained in:
2020-05-07 14:54:40 +02:00
parent b133ab6961
commit ba4af36df0
16 changed files with 175 additions and 58 deletions

View File

@ -4,7 +4,7 @@
#include "api/DynuAPI.h"
int DynuAPI::refreshIp(std:: string ip) {
bool DynuAPI::refreshIp(std::string ip) {
Hashmap<std::string, std::string> args;
args.add("name", domainname);
args.add("ipv4Address", ip);
@ -16,15 +16,11 @@ int DynuAPI::refreshIp(std:: string ip) {
const std::string dynurepl = request("https://api.dynu.com/v2/dns/" + domainid, true, args, headers);
if (dynurepl != "{\"statusCode\":200}") {
return -1;
} else {
return 1;
}
return (dynurepl == "{\"statusCode\":200}");
}
void DynuAPI::init(const std::string& dynuApiKey, const std::string& domainId, const std::string& domainName) {
this->dynuapikey=dynuApiKey;
this->domainid=domainId;
this->domainname=domainName;
void DynuAPI::init(const std::string &dynuApiKey, const std::string &domainId, const std::string &domainName) {
this->dynuapikey = dynuApiKey;
this->domainid = domainId;
this->domainname = domainName;
}

View File

@ -6,4 +6,4 @@
std::string IPAPI::getGlobalIp() {
return request("https://api.ipify.org");
}
}

View File

@ -7,7 +7,7 @@
#include <climits>
int TelegramAPI::sendMessage(const std::string& text) {
int TelegramAPI::sendMessage(const std::string &text) {
Hashmap<std::string, std::string> args;
args.add("chat_id", chatid);
args.add("text", text);