not sending two packets on self-pm
This commit is contained in:
parent
8bd3df1ae1
commit
809d40ab2e
@ -736,15 +736,20 @@ void *why2_communicate_thread(void *arg)
|
|||||||
|
|
||||||
if (valid_param) //IGNORE INVALID ARGS
|
if (valid_param) //IGNORE INVALID ARGS
|
||||||
{
|
{
|
||||||
|
connection_node_t pm_connection_node = *(connection_node_t*) pm_connection -> value;
|
||||||
|
|
||||||
//ALLOCATE MESSAGE TO SEND TO RECEIVER
|
//ALLOCATE MESSAGE TO SEND TO RECEIVER
|
||||||
char *private_msg = why2_malloc(strlen(WHY2_CHAT_CODE_PM_SERVER) + strlen(node.username) + strlen((*(connection_node_t*) pm_connection -> value).username) + strlen(msg) + 5);
|
char *private_msg = why2_malloc(strlen(WHY2_CHAT_CODE_PM_SERVER) + strlen(node.username) + strlen(pm_connection_node.username) + strlen(msg) + 5);
|
||||||
|
|
||||||
//CONSTRUCT DA MESSAGE
|
//CONSTRUCT DA MESSAGE
|
||||||
sprintf(private_msg, WHY2_CHAT_CODE_PM_SERVER ";%s;%s;%s;%c", node.username, (*(connection_node_t*) pm_connection -> value).username, msg, '\0');
|
sprintf(private_msg, WHY2_CHAT_CODE_PM_SERVER ";%s;%s;%s;%c", node.username, pm_connection_node.username, msg, '\0');
|
||||||
|
|
||||||
|
//USER IS SENDING THE MESSAGE TO HIMSELF
|
||||||
|
why2_bool self_pm = pm_connection_node.connection == connection;
|
||||||
|
|
||||||
//SEND YOU DUMB FUCK
|
//SEND YOU DUMB FUCK
|
||||||
send_socket_deallocate(private_msg, why2_chat_server_config("server_username"), (*(connection_node_t*) pm_connection -> value).connection); //RECIPIENT
|
send_socket_deallocate(private_msg, why2_chat_server_config("server_username"), pm_connection_node.connection); //RECIPIENT
|
||||||
send_socket_deallocate(private_msg, why2_chat_server_config("server_username"), connection); //AUTHOR
|
if (!self_pm) send_socket_deallocate(private_msg, why2_chat_server_config("server_username"), connection); //AUTHOR
|
||||||
|
|
||||||
why2_deallocate(private_msg);
|
why2_deallocate(private_msg);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user