Revert "Implement comma in search and exclude queries to separate search terms"

This reverts commit 3341e18d13.
This commit is contained in:
def 2016-08-07 00:52:00 +02:00
parent 5b19be992d
commit 28f50e4440
4 changed files with 43 additions and 74 deletions

View file

@ -2168,24 +2168,6 @@ int mem_comp(const void *a, const void *b, int size)
return memcmp(a,b,size);
}
const char *str_next_word(char *str, char delim, char *buf, int *cursor)
{
int i;
if(str[*cursor] == '\0')
return NULL;
for(i = *cursor; ; ++i)
{
if(str[i] == delim || str[i] == '\0')
{
str_copy(buf, str + *cursor, i - *cursor);
*cursor = i + 1;
return buf;
}
}
}
const MEMSTATS *mem_stats()
{
return &memory_stats;

View file

@ -1030,8 +1030,6 @@ void str_hex(char *dst, int dst_size, const void *data, int data_size);
void str_timestamp(char *buffer, int buffer_size);
void str_timestamp_ex(time_t time, char *buffer, int buffer_size, const char *format);
const char *str_next_word(char *str, char delim, char *buf, int *cursor);
/* Group: Filesystem */
/*

View file

@ -205,17 +205,13 @@ void CServerBrowser::Filter()
}
if(!Filtered && g_Config.m_BrFilterString[0] != 0)
{
int Cursor = 0;
char aBuf[sizeof(g_Config.m_BrFilterString)];
m_ppServerlist[i]->m_Info.m_QuickSearchHit = 0;
while(const char *pWord = str_next_word(g_Config.m_BrFilterString, ',', aBuf, &Cursor))
{
int MatchFound = 0;
m_ppServerlist[i]->m_Info.m_QuickSearchHit = 0;
// match against server name
if(str_find_nocase(m_ppServerlist[i]->m_Info.m_aName, pWord))
if(str_find_nocase(m_ppServerlist[i]->m_Info.m_aName, g_Config.m_BrFilterString))
{
MatchFound = 1;
m_ppServerlist[i]->m_Info.m_QuickSearchHit |= IServerBrowser::QUICK_SERVERNAME;
@ -224,8 +220,8 @@ void CServerBrowser::Filter()
// match against players
for(p = 0; p < m_ppServerlist[i]->m_Info.m_NumClients; p++)
{
if(str_find_nocase(m_ppServerlist[i]->m_Info.m_aClients[p].m_aName, pWord) ||
str_find_nocase(m_ppServerlist[i]->m_Info.m_aClients[p].m_aClan, pWord))
if(str_find_nocase(m_ppServerlist[i]->m_Info.m_aClients[p].m_aName, g_Config.m_BrFilterString) ||
str_find_nocase(m_ppServerlist[i]->m_Info.m_aClients[p].m_aClan, g_Config.m_BrFilterString))
{
MatchFound = 1;
m_ppServerlist[i]->m_Info.m_QuickSearchHit |= IServerBrowser::QUICK_PLAYER;
@ -234,7 +230,7 @@ void CServerBrowser::Filter()
}
// match against map
if(str_find_nocase(m_ppServerlist[i]->m_Info.m_aMap, pWord))
if(str_find_nocase(m_ppServerlist[i]->m_Info.m_aMap, g_Config.m_BrFilterString))
{
MatchFound = 1;
m_ppServerlist[i]->m_Info.m_QuickSearchHit |= IServerBrowser::QUICK_MAPNAME;
@ -243,25 +239,19 @@ void CServerBrowser::Filter()
if(!MatchFound)
Filtered = 1;
}
}
if(!Filtered && g_Config.m_BrExcludeString[0] != 0)
{
int Cursor = 0;
char aBuf[sizeof(g_Config.m_BrExcludeString)];
while(const char *pWord = str_next_word(g_Config.m_BrExcludeString, ',', aBuf, &Cursor))
{
int MatchFound = 0;
// match against server name
if(str_find_nocase(m_ppServerlist[i]->m_Info.m_aName, pWord))
if(str_find_nocase(m_ppServerlist[i]->m_Info.m_aName, g_Config.m_BrExcludeString))
{
MatchFound = 1;
}
// match against map
if(str_find_nocase(m_ppServerlist[i]->m_Info.m_aMap, pWord))
if(str_find_nocase(m_ppServerlist[i]->m_Info.m_aMap, g_Config.m_BrExcludeString))
{
MatchFound = 1;
}
@ -270,7 +260,6 @@ void CServerBrowser::Filter()
Filtered = 1;
}
}
}
if(Filtered == 0)
{

View file

@ -39,8 +39,8 @@ MACRO_CONFIG_INT(InpGrab, inp_grab, 0, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Use f
MACRO_CONFIG_INT(InpGrab, inp_grab, 1, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Use forceful input grabbing method")
#endif
MACRO_CONFIG_STR(BrFilterString, br_filter_string, 80, "", CFGFLAG_SAVE|CFGFLAG_CLIENT, "Server browser filtering string")
MACRO_CONFIG_STR(BrExcludeString, br_exclude_string, 80, "", CFGFLAG_SAVE|CFGFLAG_CLIENT, "Server browser exclusion string")
MACRO_CONFIG_STR(BrFilterString, br_filter_string, 25, "", CFGFLAG_SAVE|CFGFLAG_CLIENT, "Server browser filtering string")
MACRO_CONFIG_STR(BrExcludeString, br_exclude_string, 25, "", CFGFLAG_SAVE|CFGFLAG_CLIENT, "Server browser exclusion string")
MACRO_CONFIG_INT(BrFilterFull, br_filter_full, 0, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Filter out full server in browser")
MACRO_CONFIG_INT(BrFilterEmpty, br_filter_empty, 0, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Filter out empty server in browser")
MACRO_CONFIG_INT(BrFilterSpectators, br_filter_spectators, 0, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Filter out spectators from player numbers")