This commit is contained in:
Jonathan Santis 2024-09-12 12:15:43 +02:00
parent 1b991bfbf4
commit 7bdc8c9080

35
main.c
View File

@ -130,8 +130,7 @@ int DBusOptions(DBusConnection *connection,DBusError **error) //not tested check
{
fprintf(stderr,"%s",(**error).message);
return -1;
}
else
}else
{
printf("name requested from dbus: %d\n",ret);
}
@ -144,16 +143,14 @@ int DBusOptions(DBusConnection *connection,DBusError **error) //not tested check
{
printf("\nobject dbus: %s",objects[i]);
}
}
else{
}else{
printf("dbus_connection_list_registered error\n");
}
if((ret=dbus_connection_get_unix_user(connection,&uid))==1)
{
printf("found USERID:%ld",uid);
}
else
}else
{
printf("NO userID set in dbus session, servers normali do not authenthicate against users/slaves: %d\n",ret);
}
@ -167,8 +164,7 @@ int GetSendStatus(DBusConnection *connection,char *objectpath)
if(ret == 0)
{
checkState(objectpath,result);
}
else
} else
{
fprintf(stderr,"could not call systemdunit\n");
}
@ -201,7 +197,7 @@ int gotify_message(char *url,char *title,char *message)
{
int ret;
CURL *curl;
CURLcode res;
CURLcode res,res2;
char post_buffer[128];
char url_buffer[128];
long response_code;
@ -215,6 +211,7 @@ int gotify_message(char *url,char *title,char *message)
}
else
{
printf("Got token from env\n");
ret = snprintf(url_buffer,sizeof(url_buffer),"%s/message?token=%s",url,token);
if(ret < sizeof(url_buffer))
{
@ -243,12 +240,22 @@ int gotify_message(char *url,char *title,char *message)
{
fprintf(stderr,"curl_easy_perform failed: %s\n",curl_easy_strerror(res));
}
curl_easy_getinfo(curl,CURLINFO_RESPONSE_CODE,&response_code);
printf("Server returned:%ld\n",response_code);
res2 = curl_easy_getinfo(curl,CURLINFO_RESPONSE_CODE,&response_code);
if((res2 == CURLE_OK) && response_code)
{
printf("Server returned:%ld\n",response_code);
}else
{
fprintf(stderr,"Error getting info; %ld\n",(long int)res2);
}
curl_easy_cleanup(curl);
}
}
else{
}else
{
fprintf(stderr,"Error initializing curl context\n");
}
}else
{
printf("Error on string concelblalbla: %d\n",ret);
}