mirror of
https://github.com/mangosfour/server.git
synced 2025-12-26 16:37:06 +00:00
* [2008_10_21_01_mangos_mangos_string.sql,2008_10_21_02_mangos_command.sql] Merge CLI command proccessing to chat command proccessing.
Now console/RA uas same commads as used in chat if selected command marked as safe for console. Some commands accessable only at console and have security level 4. See sql update for new command names. Not all commands that safe (or can be modified to safe) for console allowed currently for use in console input, this will be fixed later.
This commit is contained in:
parent
c9026395fc
commit
26dc8c07ab
19 changed files with 1216 additions and 1549 deletions
|
|
@ -42,7 +42,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)
|
||||
|
|
@ -220,7 +220,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("mangos>");
|
||||
|
|
@ -232,20 +232,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);
|
||||
#ifdef RA_CRYPT
|
||||
Encrypt(megabuffer,sz);
|
||||
#endif
|
||||
if( !szText )
|
||||
return;
|
||||
|
||||
#ifdef RA_CRYPT
|
||||
|
||||
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
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue