GUI2/Chatbox: attempt to send roomless messages to the active room first

Fixes #2775. Server messages in particular are roomless, so now they should appear in
whatever tab (PMs included) you have open.
This commit is contained in:
Charles Dang 2018-05-06 17:05:48 +11:00
parent 2769345f55
commit be580a1973

View file

@ -736,6 +736,14 @@ void chatbox::process_message(const ::config& data, bool whisper /*= false*/)
add_whisper_received(sender, message);
} else {
std::string room = data["room"];
// Attempt to send to the currently active room first.
if(room.empty()) {
LOG_LB << "Message without a room from " << sender << ", falling back to active window\n";
room = open_windows_[active_window_].name;
}
// If we still don't have a name, fall back to lobby.
if(room.empty()) {
LOG_LB << "Message without a room from " << sender << ", assuming lobby\n";
room = "lobby";