sources/network/rconsession.cpp

branch
protocol5
changeset 106
7b156b764d11
parent 104
a76af67a3a4b
parent 105
b4466472aecd
child 130
9f54db6f9922
--- a/sources/network/rconsession.cpp	Sat Jan 09 02:35:00 2016 +0200
+++ b/sources/network/rconsession.cpp	Sat Jan 09 17:41:21 2016 +0200
@@ -31,14 +31,15 @@
 #include <time.h>
 #include "rconsession.h"
 #include "../interface.h"
+BEGIN_ZFC_NAMESPACE
 
 // -------------------------------------------------------------------------------------------------
 //
-RCONSession::RCONSession (Interface* iface) :
+RCONSession::RCONSession() :
 	m_state (RCON_DISCONNECTED),
 	m_lastPing (0),
 	m_numAdmins (0),
-	m_interface (iface)
+	m_interface (nullptr)
 {
 	if (not m_socket.set_blocking (false))
 	{
@@ -72,7 +73,7 @@
 		Bytestream packet;
 		packet.write_byte (CLRC_DISCONNECT);
 		this->send (packet);
-		m_interface->print ("Disconnected from %s\n", m_address.to_string (IP_WITH_PORT).chars());
+		m_interface->print ("Disconnected from %s\n", m_address.to_string (IPAddress::WITH_PORT).chars());
 		m_interface->update_statusbar();
 	}
 
@@ -311,7 +312,8 @@
 //
 void RCONSession::send_hello()
 {
-	m_interface->print ("Connecting to %s...\n", m_address.to_string (IP_WITH_PORT).chars());
+	m_interface->print ("Connecting to %s...\n",
+		m_address.to_string (IPAddress::WITH_PORT).chars());
 	Bytestream packet;
 	packet.write_byte (CLRC_BEGINCONNECTION);
 	packet.write_byte (RCON_PROTOCOL_VERSION);
@@ -429,6 +431,13 @@
 
 // -------------------------------------------------------------------------------------------------
 //
+void RCONSession::set_interface (Interface* iface)
+{
+	m_interface = iface;
+}
+
+// -------------------------------------------------------------------------------------------------
+//
 void RCONSession::request_watch (const String& cvar)
 {
 	StringList cvars;
@@ -449,3 +458,5 @@
 	packet.write_string("");
 	send(packet);
 }
+
+END_ZFC_NAMESPACE

mercurial