added const variables in class headers
This commit is contained in:
parent
07ce161155
commit
c5b5029cb1
@ -6,11 +6,6 @@
|
||||
|
||||
int DynuAPI::refreshIp(std:: string ip) {
|
||||
|
||||
static std::string dynuapikey = "88vNpMfDhMM2YYDNfWR1DNYfRX9W6fYg";
|
||||
|
||||
static std::string domainid = "8506047"; //id of the dynu domain
|
||||
static std::string domainname = "luki.dynu.net";
|
||||
|
||||
Hashmap<std::string, std::string> args;
|
||||
args.add("name", domainname);
|
||||
args.add("ipv4Address", ip);
|
||||
@ -22,7 +17,7 @@ int DynuAPI::refreshIp(std:: string ip) {
|
||||
|
||||
std::string dynurepl = request("https://api.dynu.com/v2/dns/" + domainid, true, args, headers);
|
||||
|
||||
std::cout << "[DEBUG] api reply:: " << dynurepl << std::endl;
|
||||
// std::cout << "[DEBUG] api reply:: " << dynurepl << std::endl;
|
||||
|
||||
if (dynurepl != "{\"statusCode\":200}") {
|
||||
return -1;
|
||||
|
@ -12,8 +12,10 @@ class DynuAPI : API{
|
||||
public:
|
||||
int refreshIp(std::string ip);
|
||||
private:
|
||||
const std::string dynuapikey = "88vNpMfDhMM2YYDNfWR1DNYfRX9W6fYg";
|
||||
|
||||
|
||||
const std::string domainid = "8506047"; //id of the dynu domain
|
||||
const std::string domainname = "luki.dynu.net";
|
||||
};
|
||||
|
||||
|
||||
|
@ -12,7 +12,6 @@
|
||||
class IPAPI : API{
|
||||
public:
|
||||
std::string getGlobalIp();
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
@ -12,5 +12,5 @@ void TelegramAPI::sendMessage(std::string text) {
|
||||
std::vector<std::string> headers;
|
||||
|
||||
std::string reply = request("https://api.telegram.org/bot" + apikey + "/sendmessage", false, args, headers);
|
||||
std::cout << "[DEBUG] " << reply << std::endl;
|
||||
// std::cout << "[DEBUG] " << reply << std::endl;
|
||||
}
|
||||
|
@ -14,8 +14,8 @@ public:
|
||||
void sendMessage(std::string text);
|
||||
|
||||
private:
|
||||
std::string apikey = "717213769:AAHan1nSXhUsxLJAN1Dv8Oc0z8wqwDdYPn4";
|
||||
std::string chatid = "618154204";
|
||||
const std::string apikey = "717213769:AAHan1nSXhUsxLJAN1Dv8Oc0z8wqwDdYPn4";
|
||||
const std::string chatid = "618154204";
|
||||
};
|
||||
|
||||
|
||||
|
@ -42,9 +42,9 @@ int main(int argc, char *argv[]) {
|
||||
std::cout << "[INFO] ip changed! -- from :" << oldip << "to: " << ip << std::endl;
|
||||
|
||||
DynuAPI dynu;
|
||||
TelegramAPI tele;
|
||||
|
||||
if(dynu.refreshIp(ip)){
|
||||
TelegramAPI tele;
|
||||
tele.sendMessage(oldip + " moved to " + ip);
|
||||
} else{
|
||||
//error
|
||||
|
Loading…
Reference in New Issue
Block a user