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
+2 -2
View File
@@ -394,7 +394,7 @@ void renderscores(void *menu, bool init)
// for now we'll just cut it off, same as the serverbrowser
// but we might want to consider wrapping the bottom-line to accomodate longer descriptions - to a limit.
string text;
filtertext(text, s->sdesc);
filtertext(text, s->sdesc, FTXT__SERVDESC);
//for(char *p = text; (p = strchr(p, '\"')); *p++ = ' ');
//text[30] = '\0'; // serverbrowser has less room - +8 chars here - 2010AUG03 - seems it was too much, falling back to 30 (for now): TODO get real width of menu as reference-width. FIXME: cutoff
concatformatstring(serverline, "%s:%d %s", s->name, s->port, text);
@@ -450,7 +450,7 @@ const char *asciiscores(bool destjpg)
if(s)
{
string sdesc;
filtertext(sdesc, s->sdesc, 1);
filtertext(sdesc, s->sdesc, FTXT__SERVDESC);
formatstring(text)(", %s:%d %s", s->name, s->port, sdesc);
addstr(buf, text);
}