sources/network/rconsession.cpp

changeset 92
39947c46ed17
parent 88
08ccaf26cffd
child 96
5314ebdcb38d
equal deleted inserted replaced
91:ac02cf1c3576 92:39947c46ed17
33 #include "../interface.h" 33 #include "../interface.h"
34 BEGIN_ZFC_NAMESPACE 34 BEGIN_ZFC_NAMESPACE
35 35
36 // ------------------------------------------------------------------------------------------------- 36 // -------------------------------------------------------------------------------------------------
37 // 37 //
38 RCONSession::RCONSession (Interface* iface) : 38 RCONSession::RCONSession() :
39 m_state (RCON_DISCONNECTED), 39 m_state (RCON_DISCONNECTED),
40 m_lastPing (0), 40 m_lastPing (0),
41 m_numAdmins (0), 41 m_numAdmins (0),
42 m_interface (iface) 42 m_interface (NULL)
43 { 43 {
44 if (not m_socket.set_blocking (false)) 44 if (not m_socket.set_blocking (false))
45 { 45 {
46 fprintf (stderr, "unable to set socket as non-blocking: %s\n", 46 fprintf (stderr, "unable to set socket as non-blocking: %s\n",
47 m_socket.error_string().chars()); 47 m_socket.error_string().chars());
71 { 71 {
72 // Say goodbye to remote 72 // Say goodbye to remote
73 Bytestream packet; 73 Bytestream packet;
74 packet.write_byte (CLRC_DISCONNECT); 74 packet.write_byte (CLRC_DISCONNECT);
75 this->send (packet); 75 this->send (packet);
76
76 m_interface->print ("Disconnected from %s\n", 77 m_interface->print ("Disconnected from %s\n",
77 m_address.to_string (IPAddress::WITH_PORT).chars()); 78 m_address.to_string (IPAddress::WITH_PORT).chars());
78 m_interface->update_statusbar(); 79 m_interface->update_statusbar();
79 } 80 }
80 81
381 { 382 {
382 m_interface->print ("This server does not support tab-completion\n", m_serverProtocol); 383 m_interface->print ("This server does not support tab-completion\n", m_serverProtocol);
383 } 384 }
384 } 385 }
385 386
387 // -------------------------------------------------------------------------------------------------
388 //
389 void RCONSession::set_interface (Interface* iface)
390 {
391 m_interface = iface;
392 }
393
386 END_ZFC_NAMESPACE 394 END_ZFC_NAMESPACE

mercurial