# HG changeset patch
# User Teemu Piippo <crimsondusk64@gmail.com>
# Date 1418601788 -7200
# Node ID e534f2f781967a90e8cc24ee164262010a7d48bf
# Parent  3cc042af3090437fdcb2c205ec79f950c0f0c5e8
- handle the 'from' argument in RCONSession::handle_packet to filter out packets from foreign hosts
- some code simplification in the interface code

diff -r 3cc042af3090 -r e534f2f78196 sources/interface.cpp
--- a/sources/interface.cpp	Mon Dec 15 01:47:40 2014 +0200
+++ b/sources/interface.cpp	Mon Dec 15 02:03:08 2014 +0200
@@ -306,13 +306,8 @@
 
 		case RCON_CONNECTED:
 			{
-				String adminText;
-
-				if (session->num_admins() == 0)
-					adminText = "No other admins";
-				else
-					adminText = format ("%1 other admin%s1", session->num_admins());
-
+				String adminText = (session->num_admins() == 0) ? "No other admins"
+					: format ("%1 other admin%s1", session->num_admins());
 				text = format ("%1 | %2 | %3", session->address().to_string (IP_WITH_PORT),
 					session->level(), adminText);
 			}
diff -r 3cc042af3090 -r e534f2f78196 sources/network/rconsession.cpp
--- a/sources/network/rconsession.cpp	Mon Dec 15 01:47:40 2014 +0200
+++ b/sources/network/rconsession.cpp	Mon Dec 15 02:03:08 2014 +0200
@@ -119,6 +119,9 @@
 METHOD
 RCONSession::handle_packet (Bytestream& packet, const IPAddress& from) -> void
 {
+	if (from != m_address)
+		return;
+
 	try
 	{
 		while (packet.bytes_left() > 0)