mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 23:32:09 +00:00
make nick matching case insensitive and 1 == i
This commit is contained in:
parent
fb7918d4f8
commit
a7b402031f
1 changed files with 18 additions and 3 deletions
|
@ -37,6 +37,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
|
||||||
#include "QF/cmd.h"
|
#include "QF/cmd.h"
|
||||||
#include "QF/cvar.h"
|
#include "QF/cvar.h"
|
||||||
|
@ -59,6 +60,16 @@ char fp_msg[255] = { 0 };
|
||||||
extern cvar_t *cl_warncmd;
|
extern cvar_t *cl_warncmd;
|
||||||
extern redirect_t sv_redirected;
|
extern redirect_t sv_redirected;
|
||||||
|
|
||||||
|
static qboolean
|
||||||
|
match_char (char a, char b)
|
||||||
|
{
|
||||||
|
a = tolower (sys_char_map[(byte)a]);
|
||||||
|
b = tolower (sys_char_map[(byte)b]);
|
||||||
|
|
||||||
|
if (a == b || (a == '1' && b == 'i') || (a == 'i' || b == '1'))
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
qboolean
|
qboolean
|
||||||
SV_Match_User (const char *substr, int *uidp)
|
SV_Match_User (const char *substr, int *uidp)
|
||||||
|
@ -76,10 +87,11 @@ SV_Match_User (const char *substr, int *uidp)
|
||||||
for (i = 0, cl = svs.clients; i < MAX_CLIENTS; i++, cl++) {
|
for (i = 0, cl = svs.clients; i < MAX_CLIENTS; i++, cl++) {
|
||||||
if (!cl->state)
|
if (!cl->state)
|
||||||
continue;
|
continue;
|
||||||
str = strchr (cl->name, substr[0]);
|
for (str = cl->name; *str && !match_char (*str, substr[0]); str++)
|
||||||
while (str) {
|
;
|
||||||
|
while (*str) {
|
||||||
for (j = 0; substr[j] && str[j]; j++)
|
for (j = 0; substr[j] && str[j]; j++)
|
||||||
if (sys_char_map[(byte)substr[j]] != sys_char_map[(byte)str[j]])
|
if (!match_char (substr[j], str[j]))
|
||||||
break;
|
break;
|
||||||
if (!substr[j]) { // found a match;
|
if (!substr[j]) { // found a match;
|
||||||
*uidp = cl->userid;
|
*uidp = cl->userid;
|
||||||
|
@ -89,6 +101,9 @@ SV_Match_User (const char *substr, int *uidp)
|
||||||
str = 0;
|
str = 0;
|
||||||
} else {
|
} else {
|
||||||
str = strchr (str + 1, substr[0]);
|
str = strchr (str + 1, substr[0]);
|
||||||
|
for (str = str + 1;
|
||||||
|
*str && !match_char (*str, substr[0]); str++)
|
||||||
|
;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue