aboutsummaryrefslogtreecommitdiff
path: root/src/trinitycore/RASocket.cpp
diff options
context:
space:
mode:
authorKingPin <none@none>2008-10-26 13:32:42 -0500
committerKingPin <none@none>2008-10-26 13:32:42 -0500
commita0f843a3ebe505dabe138294dd7c6dbc0dcfe094 (patch)
treee6d8c282355f1affbe5bce524a7d3df23e7e4661 /src/trinitycore/RASocket.cpp
parent6f2e0ee48a24dff1ac7acf441b1559e9d7c26657 (diff)
[svn] * Merge CLI Commands with regular commands and give them level4 access. sec_console. Source mangos - thanks to ogeraisi for the amalgamated patch.
* Redid/Fixed/Added some lang strings. * As usual remember this is a trunk rev so stability only guaranteed on northern countries of Mars and western parts of Pluto. No warranties outside the solar system, sorry :( . Check with your local government or dictator on regulations regarding export. --HG-- branch : trunk
Diffstat (limited to 'src/trinitycore/RASocket.cpp')
-rw-r--r--src/trinitycore/RASocket.cpp31
1 files changed, 17 insertions, 14 deletions
diff --git a/src/trinitycore/RASocket.cpp b/src/trinitycore/RASocket.cpp
index 36d6b497d3f..69295917d7c 100644
--- a/src/trinitycore/RASocket.cpp
+++ b/src/trinitycore/RASocket.cpp
@@ -44,7 +44,7 @@ unsigned int iUsers=0; ///< Number of activ
typedef int(* pPrintf)(const char*,...);
-void ParseCommand(pPrintf zprintf, char*command);
+void ParseCommand(CliCommandHolder::Print*, char*command);
/// RASocket constructor
RASocket::RASocket(ISocketHandler &h): TcpSocket(h)
@@ -222,7 +222,7 @@ void RASocket::OnRead()
if(strlen(buff))
{
sLog.outRALog("Got '%s' cmd.\n",buff);
- ParseCommand(&RASocket::zprintf , buff);
+ sWorld.QueueCliCommand(&RASocket::zprint , buff);
}
else
Sendf("TC>");
@@ -234,20 +234,23 @@ void RASocket::OnRead()
}
/// Output function
-int RASocket::zprintf( const char * szText, ... )
+void RASocket::zprint( const char * szText )
{
- if( !szText ) return 0;
- va_list ap;
- va_start(ap, szText);
- /// \todo Remove buffer length here. Can be >1024 (e.g. list of users)
- char *megabuffer=new char[1024];
- unsigned int sz=vsnprintf(megabuffer,1024,szText,ap);
+ if( !szText )
+ return;
+
#ifdef RA_CRYPT
- Encrypt(megabuffer,sz);
- #endif
- send(r,megabuffer,sz,0);
+ char *megabuffer=strdup(szText);
+ unsigned int sz=strlen(megabuffer);
+ Encrypt(megabuffer,sz);
+ send(r,megabuffer,sz,0);
delete [] megabuffer;
- va_end(ap);
- return 0;
+
+ #else
+
+ unsigned int sz=strlen(szText);
+ send(r,szText,sz,0);
+
+ #endif
}