replace textfilter functions with one-fits-all version

* replaces filtertext() with a version with a dozen of single filters
  that can be used in any combination
* defines classes of allowed characters for strings for various uses
  (see protocol.h line 153ff)
* now the allowed charset of, for example, player names is defined
  in one location only
* fixes issue #58
This commit is contained in:
ac-stef
2014-05-24 12:59:19 +02:00
parent e313a99beb
commit a0286d2b3f
13 changed files with 157 additions and 144 deletions
+30
View File
@@ -135,3 +135,33 @@ enum
#define m_coop (gamemode==1)
#define m_flags (m_ctf || m_htf || m_ktf)
// single filter modes
#define FTXT_NOWHITE (1<<8)
#define FTXT_ALLOWBLANKS (1<<9)
#define FTXT_ALLOWNL (1<<10)
#define FTXT_ALLOWTAB (1<<11)
#define FTXT_NOCOLOR (1<<12)
#define FTXT_TABTOBLANK (1<<13)
#define FTXT_FILLBLANKS (1<<14)
#define FTXT_SAFECS (1<<15)
#define FTXT_LEET (1<<16)
#define FTXT_TOUPPER (1<<17)
#define FTXT_TOLOWER (1<<18)
#define FTXT_FILENAME (1<<19)
#define FTXT_MAPNAME (1<<20)
// character classes
#define FTXT__SERVDESC (FTXT_NOWHITE | FTXT_ALLOWBLANKS | FTXT_TABTOBLANK)
#define FTXT__MAPMSG (FTXT_NOWHITE | FTXT_ALLOWBLANKS | FTXT_TABTOBLANK)
#define FTXT__MAPNAME (FTXT_NOCOLOR | FTXT_MAPNAME | FTXT_TOLOWER) // FTXT_FILENAME and FTXT_NOCOLOR not needed, since FTXT_MAPNAME is very strict; can not be used with paths
#define FTXT__PLAYERNAME (FTXT_NOWHITE | FTXT_NOCOLOR)
#define FTXT__SERVERINFO (FTXT_ALLOWTAB)
#define FTXT__MOTD (FTXT_TABTOBLANK)
#define FTXT__CHAT (FTXT_NOWHITE | FTXT_ALLOWBLANKS | FTXT_NOCOLOR | FTXT_TABTOBLANK)
#define FTXT__LOG (FTXT_NOCOLOR | FTXT_TABTOBLANK)
#define FTXT__LOGIDENT (FTXT_NOCOLOR | FTXT_NOWHITE | FTXT_FILENAME)
#define FTXT__PREFERENCES (FTXT_NOCOLOR | FTXT_NOWHITE | FTXT_FILENAME)
#define FTXT__AUTH (FTXT_NOCOLOR | FTXT_NOWHITE)
#define FTXT__KICKBANREASON (FTXT_NOWHITE | FTXT_ALLOWBLANKS | FTXT_NOCOLOR | FTXT_TABTOBLANK)
#define FTXT__FAVCATEGORY (FTXT_NOWHITE | FTXT_ALLOWBLANKS | FTXT_NOCOLOR)
#define FTXT__GLOBALNAME (FTXT_NOWHITE | FTXT_NOCOLOR | FTXT_FILLBLANKS)