29 */ |
29 */ |
30 |
30 |
31 #include <time.h> |
31 #include <time.h> |
32 #include "rconsession.h" |
32 #include "rconsession.h" |
33 #include "../interface.h" |
33 #include "../interface.h" |
|
34 BEGIN_ZFC_NAMESPACE |
34 |
35 |
35 // ------------------------------------------------------------------------------------------------- |
36 // ------------------------------------------------------------------------------------------------- |
36 // |
37 // |
37 RCONSession::RCONSession (Interface* iface) : |
38 RCONSession::RCONSession (Interface* iface) : |
38 m_state (RCON_DISCONNECTED), |
39 m_state (RCON_DISCONNECTED), |
70 { |
71 { |
71 // Say goodbye to remote |
72 // Say goodbye to remote |
72 Bytestream packet; |
73 Bytestream packet; |
73 packet.write_byte (CLRC_DISCONNECT); |
74 packet.write_byte (CLRC_DISCONNECT); |
74 this->send (packet); |
75 this->send (packet); |
75 m_interface->print ("Disconnected from %s\n", m_address.to_string (IP_WITH_PORT).chars()); |
76 m_interface->print ("Disconnected from %s\n", |
|
77 m_address.to_string (IPAddress::WITH_PORT).chars()); |
76 m_interface->update_statusbar(); |
78 m_interface->update_statusbar(); |
77 } |
79 } |
78 |
80 |
79 m_state = RCON_DISCONNECTED; |
81 m_state = RCON_DISCONNECTED; |
80 } |
82 } |
272 |
274 |
273 // ------------------------------------------------------------------------------------------------- |
275 // ------------------------------------------------------------------------------------------------- |
274 // |
276 // |
275 void RCONSession::send_hello() |
277 void RCONSession::send_hello() |
276 { |
278 { |
277 m_interface->print ("Connecting to %s...\n", m_address.to_string (IP_WITH_PORT).chars()); |
279 m_interface->print ("Connecting to %s...\n", |
|
280 m_address.to_string (IPAddress::WITH_PORT).chars()); |
278 Bytestream packet; |
281 Bytestream packet; |
279 packet.write_byte (CLRC_BEGINCONNECTION); |
282 packet.write_byte (CLRC_BEGINCONNECTION); |
280 packet.write_byte (RCON_PROTOCOL_VERSION); |
283 packet.write_byte (RCON_PROTOCOL_VERSION); |
281 send (packet); |
284 send (packet); |
282 bump_last_ping(); |
285 bump_last_ping(); |