Central Moderation (client side)
git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@4801 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
@@ -1,10 +1,9 @@
|
||||
#include "cube.h"
|
||||
#include "cmodserver.h"
|
||||
|
||||
// moderator = client + operator, admin = server + operator, developer = client + server + operator
|
||||
string ut[] = { "null", "client", "server", "both", "operator", "moderator", "admin", "developer" };
|
||||
string ut[] = { "null", "client", "server" };
|
||||
|
||||
string mt[] = {"register", "getlist", "insert_bl", "remove_bl", "insert_wl", "remove_wl", "report", "can_trust", "show_us", "show_bl", "show_wl"};
|
||||
string mt[] = {"register", "getlist"};
|
||||
|
||||
string rt[] = {"speedhack", "aimbot", "weaponhack", "wallhack", "maphack", "opk", "teleport", "serverhack", "bug_exploit", "other"};
|
||||
|
||||
@@ -54,27 +53,6 @@ int msg_size (int v)
|
||||
case MT_GETLIST: // mt n t
|
||||
return 7;
|
||||
break;
|
||||
case MT_CANTRUST: // mt n t ct
|
||||
return 10;
|
||||
break;
|
||||
case MT_INSERTBL: // mt n ip name reason exp t
|
||||
return 14+NAMELEN;
|
||||
break;
|
||||
case MT_REPORT: // mt n ip name reason t
|
||||
return 13+NAMELEN;
|
||||
break;
|
||||
case MT_REMOVEWL:
|
||||
case MT_REMOVEBL: // mt n k
|
||||
return 8;
|
||||
break;
|
||||
case MT_INSERTWL: // mt n ip name t
|
||||
return 13+NAMELEN; // it is sending a null 8 bits (reason)
|
||||
break;
|
||||
case MT_SHOWUS:
|
||||
case MT_SHOWBL:
|
||||
case MT_SHOWWL:
|
||||
return 7;
|
||||
break;
|
||||
default:
|
||||
return MAXMSGSIZE;
|
||||
}
|
||||
@@ -103,25 +81,12 @@ void fix_end (int mt, s_vmsg *vmsg)
|
||||
case MT_REGISTER:
|
||||
invert_end16((uint8_t *)vmsg->version);
|
||||
break;
|
||||
case MT_CANTRUST:
|
||||
invert_end16((uint8_t *)vmsg->ct);
|
||||
break;
|
||||
case MT_REMOVEBL:
|
||||
case MT_REMOVEWL:
|
||||
invert_end16((uint8_t *)vmsg->k);
|
||||
break;
|
||||
case MT_INSERTBL:
|
||||
case MT_REPORT:
|
||||
invert_end16((uint8_t *)vmsg->reason);
|
||||
case MT_INSERTWL:
|
||||
invert_end32((uint8_t *)vmsg->f);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
int convert_ip ( char *string, uint8_t *f )
|
||||
int convert_ip ( char *string, uint8_t *f ) // little endian
|
||||
{
|
||||
f[0] = f[1] = f[2] = f[3] = 0;
|
||||
f[4] = 32;
|
||||
@@ -150,19 +115,6 @@ int find_reason (char *reason)
|
||||
return -1;
|
||||
}
|
||||
|
||||
int get_ct (char *type)
|
||||
{
|
||||
if ( !strncmp(type,"client",6) ) {
|
||||
return UT_CLIENT;
|
||||
} else if ( !strncmp(type,"server",6) ) {
|
||||
return UT_SERVER;
|
||||
} else if ( !strncmp(type,"both",4) ) {
|
||||
return UT_BOTH;
|
||||
} else if ( !strncmp(type,"op",2) ) {
|
||||
return UT_OP;
|
||||
} else return UT_NULL;
|
||||
}
|
||||
|
||||
int include_endian(s_vmsg *vmsg){
|
||||
if ( *vmsg->mt == *vmsg->le ) {
|
||||
*vmsg->be = 128;
|
||||
@@ -277,7 +229,7 @@ int cmodregistered = RM_DONE;
|
||||
|
||||
int updatecmod(int millis, int type)
|
||||
{
|
||||
if ( !lastcmodreg || lastcmodreg + 1000 * 60 * 20 + 3333 < millis ) {
|
||||
if ( !lastcmodreg || lastcmodreg + 1000 * 60 * 20 + 3333 < millis ) { // about 20 minutes (with some error)
|
||||
cmodregistered = cmodregister(type);
|
||||
if ( cmodregistered != RM_DONE ) {
|
||||
//treat_failure(can_retrieve);
|
||||
|
||||
@@ -21,10 +21,10 @@
|
||||
#define AC_CMOD_PORT 28763 // this is a test
|
||||
|
||||
enum
|
||||
{UT_NULL, UT_CLIENT, UT_SERVER, UT_BOTH, UT_OP, UT_LAST};
|
||||
{UT_NULL, UT_CLIENT, UT_SERVER, UT_LAST};
|
||||
|
||||
enum
|
||||
{MT_REGISTER, MT_GETLIST, MT_INSERTBL, MT_REMOVEBL, MT_INSERTWL, MT_REMOVEWL, MT_REPORT, MT_CANTRUST, MT_SHOWUS, MT_SHOWBL, MT_SHOWWL, MT_LAST};
|
||||
{MT_REGISTER, MT_GETLIST, MT_LAST};
|
||||
|
||||
enum
|
||||
{RT_SPEED, RT_AIMBOT, RT_WEAPON, RT_WALL, RT_MAP, RT_OPK, RT_TELEPORT, RT_SERVER, RT_BUGEXP, RT_OTHER, RT_LAST};
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
// serverbrowser.cpp: eihrul's concurrent resolver, and server browser window management
|
||||
|
||||
#include "cube.h"
|
||||
#include "cmodserver.h"
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include <pthread.h>
|
||||
#endif
|
||||
@@ -1270,12 +1272,17 @@ void clearservers()
|
||||
|
||||
VARP(masterupdatefrequency, 1, 60*60, 24*60*60);
|
||||
|
||||
extern int updatecmod(int millis, int type);
|
||||
|
||||
void updatefrommaster(int force)
|
||||
{
|
||||
static int lastupdate = 0;
|
||||
if(!force && lastupdate && totalmillis-lastupdate<masterupdatefrequency*1000) return;
|
||||
|
||||
uchar buf[32000];
|
||||
|
||||
if ( !updatecmod(totalmillis, UT_CLIENT) ) return;
|
||||
|
||||
uchar *reply = retrieveservers(buf, sizeof(buf));
|
||||
if(!*reply || strstr((char *)reply, "<html>") || strstr((char *)reply, "<HTML>")) conoutf("master server not replying");
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user