unfuck reverts
This reverts commit 577c84c997c3b970ea9407d6727af5adc613487e.
This commit is contained in:
parent
577c84c997
commit
3355d6ceea
@ -163,29 +163,6 @@ void *read_socket_raw_thread(void *socket)
|
|||||||
return read_socket_raw(*(int*) socket);
|
return read_socket_raw(*(int*) socket);
|
||||||
}
|
}
|
||||||
|
|
||||||
char *read_socket_from_raw(char *raw)
|
|
||||||
{
|
|
||||||
char *final_message;
|
|
||||||
struct json_object *json_obj = json_tokener_parse(raw);
|
|
||||||
|
|
||||||
if (json_obj == NULL) return "ERR"; //RETURN IF INVALID SYNTAX WAS SENT BY SOME FUCKING SCRIPT KIDDIE
|
|
||||||
|
|
||||||
//GET STRINGS
|
|
||||||
char *message = get_string_from_json(json_obj, "message");
|
|
||||||
char *username = get_string_from_json(json_obj, "username");
|
|
||||||
|
|
||||||
//ALLOCATE final_message
|
|
||||||
final_message = why2_calloc(strlen(message) + strlen(username) + 3, sizeof(char));
|
|
||||||
|
|
||||||
//BUILD final_message
|
|
||||||
sprintf(final_message, "%s: %s", username, message);
|
|
||||||
|
|
||||||
//DEALLOCATION
|
|
||||||
json_object_put(json_obj);
|
|
||||||
|
|
||||||
return final_message;
|
|
||||||
}
|
|
||||||
|
|
||||||
void remove_json_syntax_characters(char *text)
|
void remove_json_syntax_characters(char *text)
|
||||||
{
|
{
|
||||||
for (int i = 0; text[i] != '\0'; i++) //TODO: DO SOMETHING MORE
|
for (int i = 0; text[i] != '\0'; i++) //TODO: DO SOMETHING MORE
|
||||||
|
Loading…
x
Reference in New Issue
Block a user