From 7bdc8c9080ed66533fa39c0911081aa3fdf92afc Mon Sep 17 00:00:00 2001 From: Jonathan Santis Date: Thu, 12 Sep 2024 12:15:43 +0200 Subject: [PATCH] dunno --- main.c | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/main.c b/main.c index 0f8fc4e..1164e7e 100644 --- a/main.c +++ b/main.c @@ -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); }