diff --git a/bin/conf/PseuWoW.conf.default b/bin/conf/PseuWoW.conf.default
index 3d5d326..730a2bc 100644
--- a/bin/conf/PseuWoW.conf.default
+++ b/bin/conf/PseuWoW.conf.default
@@ -102,3 +102,9 @@ defaultlang=0
// the GUI is enabled and activated. (if its in background - way less CPU load.)
enablegui=0
+// options for remote control:
+// port beeing listened on. set to 0 do disable.
+rmcontrolport=8101
+// IP or hostname that is allowed to connect. leave blank to allow connections from everywhere (dangerous!)
+rmcontrolhost=localhost
+
diff --git a/src/Client/DefScriptInterface.cpp b/src/Client/DefScriptInterface.cpp
index cab9bf9..d08f8d3 100644
--- a/src/Client/DefScriptInterface.cpp
+++ b/src/Client/DefScriptInterface.cpp
@@ -812,3 +812,5 @@ void DefScriptPackage::My_Run(std::string line, std::string username)
Interpret(curSet);
}
+
+
diff --git a/src/Client/PseuWoW.cpp b/src/Client/PseuWoW.cpp
index 87e64cf..d5cb96c 100644
--- a/src/Client/PseuWoW.cpp
+++ b/src/Client/PseuWoW.cpp
@@ -12,7 +12,7 @@
#include "WorldSession.h"
#include "CacheHandler.h"
#include "GUI/PseuGUI.h"
-
+#include "RemoteController.h"
#include "Cli.h"
@@ -53,6 +53,7 @@ PseuInstance::PseuInstance(PseuInstanceRunnable *run)
_scp=NULL;
_conf=NULL;
_cli=NULL;
+ _rmcontrol=NULL;
_stop=false;
_fastquit=false;
_startrealm=true;
@@ -70,6 +71,8 @@ PseuInstance::~PseuInstance()
_cli->stop();
}
+ if(_rmcontrol)
+ delete _rmcontrol;
if(_rsession)
delete _rsession;
if(_wsession)
@@ -166,6 +169,11 @@ bool PseuInstance::Init(void) {
logerror("GUI: incorrect settings!");
}
+ if(GetConf()->rmcontrolport)
+ {
+ _rmcontrol = new RemoteController(this,GetConf()->rmcontrolport);
+ }
+
if(GetConf()->enablecli)
{
log("Starting CLI...");
@@ -286,6 +294,16 @@ void PseuInstance::Update()
}
+ if(_rmcontrol)
+ {
+ _rmcontrol->Update();
+ if(_rmcontrol->MustDie())
+ {
+ delete _rmcontrol;
+ _rmcontrol = NULL;
+ }
+ }
+
GetScripts()->GetEventMgr()->Update();
this->Sleep(GetConf()->networksleeptime);
@@ -338,6 +356,8 @@ void PseuInstanceConf::ApplyFromVarSet(VarSet &v)
showmyopcodes=(bool)atoi(v.Get("SHOWMYOPCODES").c_str());
disablespellcheck=(bool)atoi(v.Get("DISABLESPELLCHECK").c_str());
enablegui=(bool)atoi(v.Get("ENABLEGUI").c_str());
+ rmcontrolport=atoi(v.Get("RMCONTROLPORT").c_str());
+ rmcontrolhost=v.Get("RMCONTROLHOST");
// clientversion is a bit more complicated to add
{
diff --git a/src/Client/PseuWoW.h b/src/Client/PseuWoW.h
index bcb3ae8..135775f 100644
--- a/src/Client/PseuWoW.h
+++ b/src/Client/PseuWoW.h
@@ -15,6 +15,7 @@ class WorldSession;
class Sockethandler;
class PseuInstanceRunnable;
class CliRunnable;
+class RemoteController;
class PseuInstanceConf
{
@@ -49,6 +50,8 @@ class PseuInstanceConf
bool notifyping;
bool showmyopcodes;
bool disablespellcheck;
+ uint32 rmcontrolport;
+ std::string rmcontrolhost;
// gui related
bool enablegui;
@@ -109,6 +112,7 @@ class PseuInstance
SocketHandler _sh;
CliRunnable *_cli;
ZThread::Thread _clithread;
+ RemoteController *_rmcontrol;
};
diff --git a/src/Client/Realm/RealmSession.cpp b/src/Client/Realm/RealmSession.cpp
index 834ee6b..073661f 100644
--- a/src/Client/Realm/RealmSession.cpp
+++ b/src/Client/Realm/RealmSession.cpp
@@ -243,6 +243,11 @@ void RealmSession::_HandleRealmList(ByteBuffer& pkt)
void RealmSession::SendLogonChallenge(void)
{
+ if(!_socket)
+ {
+ logerror("Can't send logon challenge, socket doesn't exist");
+ return;
+ }
if( GetInstance()->GetConf()->accname.empty() || GetInstance()->GetConf()->clientversion_string.empty()
|| GetInstance()->GetConf()->clientbuild==0 || GetInstance()->GetConf()->clientlang.empty() )
{
@@ -264,7 +269,7 @@ void RealmSession::SendLogonChallenge(void)
for(uint8 i=0;i<4;i++)
packet << (uint8)(GetInstance()->GetConf()->clientlang[3-i]); // "enUS" -> "SUne" : reversed and NOT zero terminated
packet << (uint32)0x3c; // timezone
- packet << (uint32)_socket->GetClientRemoteAddr(); // my IP address
+ packet << (uint32)_socket->GetMyIP(); // my IP address
packet << (uint8)acc.length(); // length of acc name without \0
packet.append(acc.c_str(),acc.length()); // append accname, skip \0
diff --git a/src/Client/Realm/RealmSocket.cpp b/src/Client/Realm/RealmSocket.cpp
index 057957d..ef72134 100644
--- a/src/Client/Realm/RealmSocket.cpp
+++ b/src/Client/Realm/RealmSocket.cpp
@@ -3,6 +3,7 @@
#include "ByteBuffer.h"
#include "RealmSession.h"
#include "RealmSocket.h"
+#include "Network/Utility.h"
@@ -10,7 +11,7 @@
RealmSocket::RealmSocket(SocketHandler& h) : TcpSocket(h)
{
_session = NULL;
- _ok = false;
+ _ok = false;
}
RealmSocket::~RealmSocket()
@@ -88,4 +89,8 @@ void RealmSocket::OnDelete(void)
_session->SetMustDie();
}
+uint32 RealmSocket::GetMyIP(void)
+{
+ return GetRemoteIP4();
+}
diff --git a/src/Client/Realm/RealmSocket.h b/src/Client/Realm/RealmSocket.h
index 71bf98a..0576c4b 100644
--- a/src/Client/Realm/RealmSocket.h
+++ b/src/Client/Realm/RealmSocket.h
@@ -14,6 +14,7 @@ public:
RealmSession *GetSession(void);
bool IsOk(void);
void SetSession(RealmSession*);
+ uint32 GetMyIP(void);
void Update(void);
void SendLogonChallenge(void);
@@ -27,6 +28,7 @@ public:
int Close(void);
+
private:
bool _ok;
RealmSession *_session;
diff --git a/src/PseuWoW.vcproj b/src/PseuWoW.vcproj
index 45cb2f1..d016692 100644
--- a/src/PseuWoW.vcproj
+++ b/src/PseuWoW.vcproj
@@ -162,6 +162,12 @@
+
+
+
+
@@ -189,6 +195,12 @@
+
+
+
+
diff --git a/src/shared.vcproj b/src/shared.vcproj
index de64118..bf2f67a 100644
--- a/src/shared.vcproj
+++ b/src/shared.vcproj
@@ -28,6 +28,7 @@
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
+ RuntimeTypeInfo="FALSE"
PrecompiledHeaderFile=".\Debug/PseuWoW_Controller.pch"
AssemblerListingLocation="$(SolutionDir)temp/$(ProjectName)/$(ConfigurationName)/"
ObjectFile="$(SolutionDir)temp/$(ProjectName)/$(ConfigurationName)/"
@@ -84,6 +85,7 @@
BufferSecurityCheck="FALSE"
EnableFunctionLevelLinking="FALSE"
EnableEnhancedInstructionSet="0"
+ RuntimeTypeInfo="FALSE"
PrecompiledHeaderFile=".\Release/PseuWoW_Controller.pch"
AssemblerListingLocation="$(SolutionDir)temp/$(ProjectName)/$(ConfigurationName)/"
ObjectFile="$(SolutionDir)temp/$(ProjectName)/$(ConfigurationName)/"
@@ -160,18 +162,6 @@
-
-
-
-
-
-