* added optional password to the ContolSocket * fixed possible exception/crash in the DefScript variable handler (occurred when typing "getvar" into the console or telnet). maybe a very slight code speedup, too. * minor chat script updates (more telnet-friendly) * note: if you use PHP or anything that is NOT telnet/netcat to send commands to the ControlSocket, you have to terminate each line with '\n' !
30 lines
510 B
C++
30 lines
510 B
C++
#ifndef CONTROLSOCKET_H
|
|
#define CONTROLSOCKET_H
|
|
|
|
#include "Network/TcpSocket.h"
|
|
#include "RemoteController.h"
|
|
|
|
class ControlSocket : public TcpSocket
|
|
{
|
|
public:
|
|
ControlSocket(SocketHandler& h);
|
|
|
|
void SetInstance(PseuInstance *in) { _instance = in; }
|
|
|
|
void OnAccept();
|
|
void OnRead();
|
|
|
|
void HandleString(std::string);
|
|
void SendTelnetText(std::string);
|
|
|
|
private:
|
|
void _Execute(std::string);
|
|
PseuInstance *_instance;
|
|
bool _ok;
|
|
std::string _str;
|
|
bool _authed;
|
|
};
|
|
|
|
|
|
#endif
|