(suggestion) Filter Search in server list
(suggestion) Filter Search in server list
Maybe you've thought of this and it's difficult or (currently) impossible to implement, and therefore haven't done it. That seems likely.
Maybe you just haven't thought of it and it turns out it's super easy to implement. Wouldn't that be neat.
The suggestion: with the server list open, you'd be able to type in "Crazy" into some text field, and filter out any servers without that letter combination in its name. Or "sumo" if you're looking for a server containing that word. Or fortress, or dogfight, or ladle. You get the gist.
I think that would be useful and wildly popular among users. However, I can't dream of doing it myself and I understand if nobody else can or wants to either. Just thought I'd bring it up.
Thanks for reading!
Maybe you just haven't thought of it and it turns out it's super easy to implement. Wouldn't that be neat.
The suggestion: with the server list open, you'd be able to type in "Crazy" into some text field, and filter out any servers without that letter combination in its name. Or "sumo" if you're looking for a server containing that word. Or fortress, or dogfight, or ladle. You get the gist.
I think that would be useful and wildly popular among users. However, I can't dream of doing it myself and I understand if nobody else can or wants to either. Just thought I'd bring it up.
Thanks for reading!
Re: (suggestion) Filter Search in server list
I got some time today and tried to implement it. The only thing I didn't get to work is the correct filtering. I tried it like this:
filter_string is already the search term to lower case.
But somehow it doesn't work correctly (see screenshot). Any ideas?
Code: Select all
if(filter_string.Len() > 1)
{
tString name;
name << tColoredString::RemoveColors( run->GetName(), false );
run->show = false;
oneFound = true;
if(name.ToLower().StrPos(filter_string) >= 0)
{
run->show = true;
}
}
But somehow it doesn't work correctly (see screenshot). Any ideas?
Re: (suggestion) Filter Search in server list
This worked for me, Jip. I don't know how to make your filter input though, so maybe it'll help?
Of course, we have to include the boost algorithm to that file for the to_lower() function I used.
When I don't use to_lower() on the server name I get HFT as my only result, which seems weird, but whatever ... Using to_lower() gives expected results.
Code: Select all
tString filter_string;
filter_string = "light";
if (filter_string.Len() > 0)
{
run = gServerInfo::GetFirstServer();
{
while (run)
{
tString name;
name << tColoredString::RemoveColors(run -> GetName(), false);
boost::algorithm::to_lower(name);
run -> show = false;
oneFound = true;
if (name.find(filter_string) != std::string::npos)
{
run -> show = true;
}
run = run -> Next();
}
}
}
Code: Select all
#include <boost/algorithm/string.hpp>
Re: (suggestion) Filter Search in server list
Thanks, the line
made it work.
I got it working but I have the feeling, that it is quite a hack. Could someone have a look over it and tell me what can be done better? I will make a pull request (doh! no github) bug report with attached patch.
Patch to look over is attached.
Code: Select all
if (name.find(filter_string) != std::string::npos)
I got it working but I have the feeling, that it is quite a hack. Could someone have a look over it and tell me what can be done better? I will make a pull request (doh! no github) bug report with attached patch.
Patch to look over is attached.
- Attachments
-
- browser_filter.patch.not.zip
- (6.03 KiB) Downloaded 144 times
Re: (suggestion) Filter Search in server list
It works.
I did get this ..
Not sure what may have gone wrong, but it was written.
Maybe this wasn't for the 0.4 client? The other file was written with all success though, so the more important part is fine. Should I send a patch to launchpad? I feel like we're going to have a much better chance of seeing this come up in 0.4 than 0.2.
I did get this ..
Code: Select all
tom@debian:~/armagetronad/src$ patch language/english_base.txt < browser_filter.patch
patching file language/english_base.txt
patching file language/english_base.txt
Hunk #1 FAILED at 114.
Hunk #2 FAILED at 128.
Hunk #3 FAILED at 154.
Hunk #4 FAILED at 315.
Hunk #5 FAILED at 332.
Hunk #6 FAILED at 342.
Hunk #7 FAILED at 432.
Hunk #8 FAILED at 446.
Hunk #9 FAILED at 521.
Hunk #10 FAILED at 564.
Hunk #11 FAILED at 799.
Hunk #12 FAILED at 996.
Hunk #13 succeeded at 967 with fuzz 2 (offset -43 lines).
Hunk #14 FAILED at 1076.
13 out of 14 hunks FAILED -- saving rejects to file language/english_base.txt.rej
Code: Select all
network_master_filter Filter:
Re: (suggestion) Filter Search in server list
Are you patching against current trunk?
I will post the patch on launchpad when we have some feedback from the devs.
I will post the patch on launchpad when we have some feedback from the devs.
Re: (suggestion) Filter Search in server list
Oh yeah .. The copy I have built atm is from the weekly builds and not the latest launchpad. That could be it.Jip wrote:Are you patching against current trunk?
I will post the patch on launchpad when we have some feedback from the devs.
Re: (suggestion) Filter Search in server list
Would just like to bump this and maybe get a comment from a dev? It would be nice to see this added, and the patch is there ready to go, unless you wanted to clean it up some. I think this is a very good feature to add to the client.
Re: (suggestion) Filter Search in server list
Comment: Wonderful! I especially like the escape handling bit. Action: Merged.
To Jip: Any special wishes on how you want to be credited in AUTHORS?
(This was open in my yet-to-properly-read tab collection, but thanks for the bump anyway; that collection all too often turns into the pit of oblivion.)
To Jip: Any special wishes on how you want to be credited in AUTHORS?
(This was open in my yet-to-properly-read tab collection, but thanks for the bump anyway; that collection all too often turns into the pit of oblivion.)
Re: (suggestion) Filter Search in server list
Nice to see it mergedZ-Man wrote:Comment: Wonderful! I especially like the escape handling bit. Action: Merged.
To Jip: Any special wishes on how you want to be credited in AUTHORS?
(This was open in my yet-to-properly-read tab collection, but thanks for the bump anyway; that collection all too often turns into the pit of oblivion.)
Would be wonderful to be mentioned as brandesign. That correspond with my github account