mirror of
https://github.com/xorgy/mediafire-fuse
synced 2026-01-13 13:14:29 -08:00
use gnu indent to enforce coding style and adapt source
- indent options are listed in ./.indent.pro - use test case to run indent
This commit is contained in:
@@ -17,69 +17,69 @@
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include <jansson.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "../../utils/http.h"
|
||||
#include "../../utils/json.h"
|
||||
#include "../mfconn.h"
|
||||
#include "../apicalls.h" // IWYU pragma: keep
|
||||
#include "../apicalls.h" // IWYU pragma: keep
|
||||
|
||||
static int
|
||||
_decode_user_get_info(mfhttp *conn, void *data);
|
||||
static int _decode_user_get_info(mfhttp * conn, void *data);
|
||||
|
||||
int
|
||||
mfconn_api_user_get_info(mfconn *conn)
|
||||
int mfconn_api_user_get_info(mfconn * conn)
|
||||
{
|
||||
char *api_call;
|
||||
int retval;
|
||||
char *api_call;
|
||||
int retval;
|
||||
mfhttp *http;
|
||||
|
||||
// char *rx_buffer;
|
||||
|
||||
if(conn == NULL) return -1;
|
||||
if (conn == NULL)
|
||||
return -1;
|
||||
|
||||
api_call = mfconn_create_signed_get(conn,0,"user/get_info.php",
|
||||
"&response_format=json");
|
||||
api_call = mfconn_create_signed_get(conn, 0, "user/get_info.php",
|
||||
"&response_format=json");
|
||||
|
||||
mfhttp* http = http_create();
|
||||
http = http_create();
|
||||
retval = http_get_buf(http, api_call, _decode_user_get_info, NULL);
|
||||
http_destroy(http);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
static int
|
||||
_decode_user_get_info(mfhttp *conn, void *data)
|
||||
static int _decode_user_get_info(mfhttp * conn, void *data)
|
||||
{
|
||||
json_error_t error;
|
||||
json_t *root;
|
||||
json_t *node;
|
||||
json_t *email;
|
||||
json_t *first_name;
|
||||
json_t *last_name;
|
||||
json_t *root;
|
||||
json_t *node;
|
||||
json_t *email;
|
||||
json_t *first_name;
|
||||
json_t *last_name;
|
||||
|
||||
if (data != NULL)
|
||||
return -1;
|
||||
|
||||
root = http_parse_buf_json(conn, 0, &error);
|
||||
|
||||
node = json_object_by_path(root,"response/user_info");
|
||||
node = json_object_by_path(root, "response/user_info");
|
||||
|
||||
email = json_object_get(node,"email");
|
||||
if(email != NULL)
|
||||
printf("Email: %s\n\r",(char*)json_string_value(email));
|
||||
email = json_object_get(node, "email");
|
||||
if (email != NULL)
|
||||
printf("Email: %s\n\r", (char *)json_string_value(email));
|
||||
|
||||
first_name = json_object_get(node,"first_name");
|
||||
if(first_name != NULL)
|
||||
printf("Name: %s ",(char*)json_string_value(first_name));
|
||||
first_name = json_object_get(node, "first_name");
|
||||
if (first_name != NULL)
|
||||
printf("Name: %s ", (char *)json_string_value(first_name));
|
||||
|
||||
last_name = json_object_get(node,"last_name");
|
||||
if(node != NULL)
|
||||
printf("%s",(char*)json_string_value(last_name));
|
||||
last_name = json_object_get(node, "last_name");
|
||||
if (node != NULL)
|
||||
printf("%s", (char *)json_string_value(last_name));
|
||||
|
||||
printf("\n\r");
|
||||
|
||||
if(root != NULL) json_decref(root);
|
||||
if (root != NULL)
|
||||
json_decref(root);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user