Prevent spoofing moderator packets (#86)
This commit is contained in:
parent
780249ab21
commit
f552e98cd4
|
@ -52,7 +52,7 @@ void packet_process(struct Packet* p) {
|
|||
case PACKET_CHAT: network_receive_chat(p); break;
|
||||
case PACKET_KICK: network_receive_kick(p); break;
|
||||
case PACKET_COMMAND: network_recieve_chat_command(p); break;
|
||||
case PACKET_MODERATOR: network_recieve_moderator(); break;
|
||||
case PACKET_MODERATOR: network_recieve_moderator(p); break;
|
||||
case PACKET_KEEP_ALIVE: network_receive_keep_alive(p); break;
|
||||
case PACKET_LEAVING: network_receive_leaving(p); break;
|
||||
case PACKET_SAVE_FILE: network_receive_save_file(p); break;
|
||||
|
|
|
@ -247,7 +247,7 @@ void network_recieve_chat_command(struct Packet* p);
|
|||
|
||||
// packet_moderator.c
|
||||
void network_send_moderator(u8 localIndex);
|
||||
void network_recieve_moderator(void);
|
||||
void network_recieve_moderator(struct Packet* p);
|
||||
|
||||
// packet_keep_alive.c
|
||||
void network_send_keep_alive(u8 localIndex);
|
||||
|
|
|
@ -52,10 +52,15 @@ void network_send_moderator(u8 localIndex) {
|
|||
network_send_to(localIndex, &p);
|
||||
}
|
||||
|
||||
void network_recieve_moderator(void) {
|
||||
void network_recieve_moderator(struct Packet* p) {
|
||||
if (gIsModerator == 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (network_player_any_connected() && gNetworkPlayers[p->localIndex].type != NPT_SERVER) {
|
||||
return;
|
||||
}
|
||||
|
||||
gIsModerator = 1;
|
||||
djui_chat_message_create("\\#fff982\\You are now a Moderator.");
|
||||
}
|
Loading…
Reference in New Issue