|
|
@@ -154,7 +154,7 @@ bool flip_social_get_message_users()
|
|
|
|
|
|
fhttp.save_received_data = true;
|
|
|
auth_headers_alloc();
|
|
|
- snprintf(command, 128, "https://www.flipsocial.net/api/messages/%s/get/list/", app_instance->login_username_logged_out);
|
|
|
+ snprintf(command, 128, "https://www.flipsocial.net/api/messages/%s/get/list/%d/", app_instance->login_username_logged_out, MAX_MESSAGE_USERS);
|
|
|
if (!flipper_http_get_request_with_headers(command, auth_headers))
|
|
|
{
|
|
|
FURI_LOG_E(TAG, "Failed to send HTTP request for messages");
|
|
|
@@ -183,7 +183,7 @@ bool flip_social_get_messages_with_user()
|
|
|
FURI_LOG_E(TAG, "Username is NULL");
|
|
|
return false;
|
|
|
}
|
|
|
- char command[128];
|
|
|
+ char command[256];
|
|
|
snprintf(
|
|
|
fhttp.file_path,
|
|
|
sizeof(fhttp.file_path),
|
|
|
@@ -192,7 +192,7 @@ bool flip_social_get_messages_with_user()
|
|
|
|
|
|
fhttp.save_received_data = true;
|
|
|
auth_headers_alloc();
|
|
|
- snprintf(command, 128, "https://www.flipsocial.net/api/messages/%s/get/%s/", app_instance->login_username_logged_out, flip_social_message_users->usernames[flip_social_message_users->index]);
|
|
|
+ snprintf(command, sizeof(command), "https://www.flipsocial.net/api/messages/%s/get/%s/%d/", app_instance->login_username_logged_out, flip_social_message_users->usernames[flip_social_message_users->index], MAX_MESSAGES);
|
|
|
if (!flipper_http_get_request_with_headers(command, auth_headers))
|
|
|
{
|
|
|
FURI_LOG_E(TAG, "Failed to send HTTP request for messages");
|
|
|
@@ -231,18 +231,11 @@ bool flip_social_parse_json_message_users()
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
- // Remove newlines
|
|
|
- char *pos = data_cstr;
|
|
|
- while ((pos = strchr(pos, '\n')) != NULL)
|
|
|
- {
|
|
|
- *pos = ' ';
|
|
|
- }
|
|
|
-
|
|
|
// Initialize message users count
|
|
|
flip_social_message_users->count = 0;
|
|
|
|
|
|
// Extract the users array from the JSON
|
|
|
- char *json_users = get_json_value("users", data_cstr, MAX_TOKENS);
|
|
|
+ char *json_users = get_json_value("users", data_cstr, 64);
|
|
|
if (json_users == NULL)
|
|
|
{
|
|
|
FURI_LOG_E(TAG, "Failed to parse users array.");
|
|
|
@@ -324,18 +317,11 @@ bool flip_social_parse_json_message_user_choices()
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
- // Remove newlines
|
|
|
- char *pos = data_cstr;
|
|
|
- while ((pos = strchr(pos, '\n')) != NULL)
|
|
|
- {
|
|
|
- *pos = ' ';
|
|
|
- }
|
|
|
-
|
|
|
// Initialize explore count
|
|
|
flip_social_explore->count = 0;
|
|
|
|
|
|
// Extract the users array from the JSON
|
|
|
- char *json_users = get_json_value("users", data_cstr, MAX_TOKENS);
|
|
|
+ char *json_users = get_json_value("users", data_cstr, 64);
|
|
|
if (json_users == NULL)
|
|
|
{
|
|
|
FURI_LOG_E(TAG, "Failed to parse users array.");
|
|
|
@@ -417,13 +403,6 @@ bool flip_social_parse_json_messages()
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
- // Remove newlines
|
|
|
- char *pos = data_cstr;
|
|
|
- while ((pos = strchr(pos, '\n')) != NULL)
|
|
|
- {
|
|
|
- *pos = ' ';
|
|
|
- }
|
|
|
-
|
|
|
// Initialize messages count
|
|
|
flip_social_messages->count = 0;
|
|
|
|
|
|
@@ -431,15 +410,15 @@ bool flip_social_parse_json_messages()
|
|
|
for (int i = 0; i < MAX_MESSAGES; i++)
|
|
|
{
|
|
|
// Parse each item in the array
|
|
|
- char *item = get_json_array_value("conversations", i, data_cstr, MAX_TOKENS);
|
|
|
+ char *item = get_json_array_value("conversations", i, data_cstr, 128);
|
|
|
if (item == NULL)
|
|
|
{
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
// Extract individual fields from the JSON object
|
|
|
- char *sender = get_json_value("sender", item, 64);
|
|
|
- char *content = get_json_value("content", item, 64);
|
|
|
+ char *sender = get_json_value("sender", item, 32);
|
|
|
+ char *content = get_json_value("content", item, 32);
|
|
|
|
|
|
if (sender == NULL || content == NULL)
|
|
|
{
|