widelands-dev team mailing list archive
-
widelands-dev team
-
Mailing list archive
-
Message #16804
[Merge] lp:~widelands-dev/widelands/bug-1827182-sort-client-list into lp:widelands
Toni Förster has proposed merging lp:~widelands-dev/widelands/bug-1827182-sort-client-list into lp:widelands.
Commit message:
sort the lobby client list by client type admin->irc
The admin users will be on top of the list, followed by registered and
unregistered. IRC user are at the bottom as they are already.
Requested reviews:
Widelands Developers (widelands-dev)
Related bugs:
Bug #1827182 in widelands: "Prefix chat username with symbol showing whether they are superuser/regstered/unregistered"
https://bugs.launchpad.net/widelands/+bug/1827182
For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/bug-1827182-sort-client-list/+merge/366843
--
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/bug-1827182-sort-client-list into lp:widelands.
=== modified file 'src/network/internet_gaming.cc'
--- src/network/internet_gaming.cc 2019-05-01 20:17:37 +0000
+++ src/network/internet_gaming.cc 2019-05-02 15:04:35 +0000
@@ -527,8 +527,8 @@
// Client received the new list of clients
uint8_t number = boost::lexical_cast<int>(packet.string()) & 0xff;
std::vector<InternetClient> old = clientlist_;
- // Push IRC users to a second list and add them to the back
- std::vector<InternetClient> irc;
+ // Push admins/registred/IRC users to a temporary list and add them back later
+ std::vector<InternetClient> irc, registered, superuser ;
clientlist_.clear();
log("InternetGaming: Received a client list update with %u items.\n", number);
InternetClient inc;
@@ -537,13 +537,18 @@
inc.build_id = packet.string();
inc.game = packet.string();
inc.type = packet.string();
+
if (inc.type == INTERNET_CLIENT_IRC) {
irc.push_back(inc);
// No "join" or "left" messages for IRC users
continue;
+ } else if (inc.type == INTERNET_CLIENT_SUPERUSER) {
+ superuser.push_back(inc);
+ } else if (inc.type == INTERNET_CLIENT_REGISTERED){
+ registered.push_back(inc);
+ } else {
+ clientlist_.push_back(inc);
}
- // No IRC client
- clientlist_.push_back(inc);
bool found =
old.empty(); // do not show all clients, if this instance is the actual change
@@ -558,7 +563,15 @@
format_and_add_chat(
"", "", true, (boost::format(_("%s joined the lobby")) % inc.name).str());
}
+
+ // The final list looks like this:
+ // SUPERUSER
+ // REGISTERED
+ // UNREGISTERED
+ // IRC
clientlist_.insert(clientlist_.end(), irc.begin(), irc.end());
+ clientlist_.insert(clientlist_.begin(), registered.begin(), registered.end());
+ clientlist_.insert(clientlist_.begin(), superuser.begin(), superuser.end());
for (InternetClient& client : old) {
if (client.name.size() && client.type != INTERNET_CLIENT_IRC) {
=== modified file 'src/ui_fsmenu/internet_lobby.cc'
--- src/ui_fsmenu/internet_lobby.cc 2019-04-24 06:01:37 +0000
+++ src/ui_fsmenu/internet_lobby.cc 2019-05-02 15:04:35 +0000
@@ -39,9 +39,9 @@
namespace {
// Constants for convert_clienttype() / compare_clienttype()
-const uint8_t kClientUnregistered = 0;
+const uint8_t kClientSuperuser = 0;
const uint8_t kClientRegistered = 1;
-const uint8_t kClientSuperuser = 2;
+const uint8_t kClientUnregistered = 2;
// 3 was INTERNET_CLIENT_BOT which is not used
const uint8_t kClientIRC = 4;
} // namespace
Follow ups
-
[Merge] lp:~widelands-dev/widelands/bug-1827182-sort-client-list into lp:widelands
From: noreply, 2019-05-05
-
Re: [Merge] lp:~widelands-dev/widelands/bug-1827182-sort-client-list into lp:widelands
From: Toni Förster, 2019-05-05
-
[Merge] lp:~widelands-dev/widelands/bug-1827182-sort-client-list into lp:widelands
From: bunnybot, 2019-05-05
-
Re: [Merge] lp:~widelands-dev/widelands/bug-1827182-sort-client-list into lp:widelands
From: GunChleoc, 2019-05-05
-
Re: [Merge] lp:~widelands-dev/widelands/bug-1827182-sort-client-list into lp:widelands
From: Klaus Halfmann, 2019-05-05
-
Re: [Merge] lp:~widelands-dev/widelands/bug-1827182-sort-client-list into lp:widelands
From: Klaus Halfmann, 2019-05-05
-
Re: [Merge] lp:~widelands-dev/widelands/bug-1827182-sort-client-list into lp:widelands
From: Toni Förster, 2019-05-05
-
Re: [Merge] lp:~widelands-dev/widelands/bug-1827182-sort-client-list into lp:widelands
From: Klaus Halfmann, 2019-05-05
-
Re: [Merge] lp:~widelands-dev/widelands/bug-1827182-sort-client-list into lp:widelands
From: Toni Förster, 2019-05-05
-
Re: [Merge] lp:~widelands-dev/widelands/bug-1827182-sort-client-list into lp:widelands
From: Klaus Halfmann, 2019-05-05
-
Re: [Merge] lp:~widelands-dev/widelands/bug-1827182-sort-client-list into lp:widelands
From: Toni Förster, 2019-05-05
-
Re: [Merge] lp:~widelands-dev/widelands/bug-1827182-sort-client-list into lp:widelands
From: Toni Förster, 2019-05-05
-
Re: [Merge] lp:~widelands-dev/widelands/bug-1827182-sort-client-list into lp:widelands
From: Klaus Halfmann, 2019-05-05
-
Re: [Merge] lp:~widelands-dev/widelands/bug-1827182-sort-client-list into lp:widelands
From: Toni Förster, 2019-05-05
-
Re: [Merge] lp:~widelands-dev/widelands/bug-1827182-sort-client-list into lp:widelands
From: Toni Förster, 2019-05-05
-
Re: [Merge] lp:~widelands-dev/widelands/bug-1827182-sort-client-list into lp:widelands
From: GunChleoc, 2019-05-05
-
[Merge] lp:~widelands-dev/widelands/bug-1827182-sort-client-list into lp:widelands
From: Toni Förster, 2019-05-05
-
Re: [Merge] lp:~widelands-dev/widelands/bug-1827182-sort-client-list into lp:widelands
From: Toni Förster, 2019-05-04
-
[Merge] lp:~widelands-dev/widelands/bug-1827182-sort-client-list into lp:widelands
From: Toni Förster, 2019-05-04
-
[Merge] lp:~widelands-dev/widelands/bug-1827182-sort-client-list into lp:widelands
From: bunnybot, 2019-05-04
-
[Merge] lp:~widelands-dev/widelands/bug-1827182-sort-client-list into lp:widelands
From: bunnybot, 2019-05-04
-
Re: [Merge] lp:~widelands-dev/widelands/bug-1827182-sort-client-list into lp:widelands
From: GunChleoc, 2019-05-03
-
Re: [Merge] lp:~widelands-dev/widelands/bug-1827182-sort-client-list into lp:widelands
From: Toni Förster, 2019-05-03
-
Re: [Merge] lp:~widelands-dev/widelands/bug-1827182-sort-client-list into lp:widelands
From: GunChleoc, 2019-05-03
-
Re: [Merge] lp:~widelands-dev/widelands/bug-1827182-sort-client-list into lp:widelands
From: Toni Förster, 2019-05-03
-
Re: [Merge] lp:~widelands-dev/widelands/bug-1827182-sort-client-list into lp:widelands
From: GunChleoc, 2019-05-03
-
Re: [Merge] lp:~widelands-dev/widelands/bug-1827182-sort-client-list into lp:widelands
From: Toni Förster, 2019-05-03
-
Re: [Merge] lp:~widelands-dev/widelands/bug-1827182-sort-client-list into lp:widelands
From: Toni Förster, 2019-05-02
-
[Merge] lp:~widelands-dev/widelands/bug-1827182-sort-client-list into lp:widelands
From: bunnybot, 2019-05-02
-
Re: [Merge] lp:~widelands-dev/widelands/bug-1827182-sort-client-list into lp:widelands
From: GunChleoc, 2019-05-02
-
Re: [Merge] lp:~widelands-dev/widelands/bug-1827182-sort-client-list into lp:widelands
From: Toni Förster, 2019-05-02