This is an automated email from the git hooks/post-receive script. apo pushed a commit to branch master in repository springlobby.
commit 835d11162fade35c02b15543896d57756cc71293 Author: Markus Koschany <[email protected]> Date: Wed Nov 1 12:00:55 2017 +0100 New upstream version 0.260+dfsg --- ChangeLog | 6 +++ VERSION | 2 +- springlobby_config.h | 2 +- src/CMakeLists.txt | 7 +++ src/battle.cpp | 21 ++++---- src/channel.cpp | 5 -- src/channel.h | 1 - .../lib/src/lsl/lslunitsync/unitsync.cpp | 2 +- src/gui/chatpanelmenu.cpp | 19 ------- src/gui/chatpanelmenu.h | 1 - src/gui/hosting/battleroomtab.cpp | 8 ++- src/iserver.h | 4 -- src/springlobbyapp.cpp | 2 +- src/tasserver.cpp | 63 +++++++++++++++------- src/tasserver.h | 6 +-- 15 files changed, 81 insertions(+), 68 deletions(-) diff --git a/ChangeLog b/ChangeLog index 899712d..6709ba6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ ChangeLog of Springlobby +## 0.260 + - reimplement channel history + - check if synced before game start / prompt for download + - don't send plain text PING when tls-handshaking + - increase default log verbosity + ## 0.259 - fix #791: cannot select last entry in engine list - use more robust TLS handshake on connect (should solve issues when registering new username) diff --git a/VERSION b/VERSION index 5d2af92..5f30be6 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.259 +0.260 diff --git a/springlobby_config.h b/springlobby_config.h index 7866f62..a6d46ae 100644 --- a/springlobby_config.h +++ b/springlobby_config.h @@ -6,6 +6,6 @@ #undef VERSION /* the git tag / commit we build from */ -#define VERSION "0.259" +#define VERSION "0.260" #endif /* SPRINGLOBBY_HEADERGUARD_CONFIG_H */ diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 8f540af..38b8f7a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -89,6 +89,13 @@ message(STATUS "Using WX_LD_FLAGS: ${WX_LD_FLAGS}") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WX_CXX_FLAGS}") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${WX_C_FLAGS}") + +include(CheckIncludeFileCXX) +CHECK_INCLUDE_FILE_CXX(wx/config.h HAS_WXGTKHEADERS) +if (NOT HAS_WXGTKHEADERS) + message(FATAL_ERROR "Couldn't find wx/config.h, is wxgtk-dev installed?") +endif() + #---------------------------------------------------------------------------------------------------- # openAL libs dependency check #---------------------------------------------------------------------------------------------------- diff --git a/src/battle.cpp b/src/battle.cpp index e758c06..8e1594f 100644 --- a/src/battle.cpp +++ b/src/battle.cpp @@ -611,15 +611,18 @@ void Battle::StartHostedBattle() void Battle::StartSpring() { - if (UserExists(GetMe().GetNick()) && !GetMe().Status().in_game) { - GetMe().BattleStatus().ready = false; - SendMyBattleStatus(); - // set m_generating_script, this will make the script.txt writer realize we're just clients even if using a relayhost - m_generating_script = true; - GetMe().Status().in_game = spring().Run(*this); - m_generating_script = false; - GetMe().SendMyUserStatus(); - } + User& me = GetMe(); + if (!UserExists(me.GetNick())) + return; + if (me.Status().in_game) + return; + me.BattleStatus().ready = false; + SendMyBattleStatus(); + // set m_generating_script, this will make the script.txt writer realize we're just clients even if using a relayhost + m_generating_script = true; + me.Status().in_game = spring().Run(*this); + m_generating_script = false; + me.SendMyUserStatus(); } void Battle::OnTimer(wxTimerEvent&) diff --git a/src/channel.cpp b/src/channel.cpp index 914a426..c47bc89 100644 --- a/src/channel.cpp +++ b/src/channel.cpp @@ -288,8 +288,3 @@ void Channel::SetPassword(const std::string& pw) m_password = pw; } -bool Channel::IsSubscribed() -{ - const LSL::StringSet subscriptions = m_serv.GetSubscriptions(); - return (subscriptions.find(m_name) != subscriptions.end()); -} diff --git a/src/channel.h b/src/channel.h index b7aaadb..feb7c4b 100644 --- a/src/channel.h +++ b/src/channel.h @@ -56,7 +56,6 @@ public: std::string GetPassword() const; void SetPassword(const std::string& pw); - bool IsSubscribed(); //subscribed to channel history? private: IServer& m_serv; diff --git a/src/downloader/lib/src/lsl/lslunitsync/unitsync.cpp b/src/downloader/lib/src/lsl/lslunitsync/unitsync.cpp index 2df9380..70b3919 100644 --- a/src/downloader/lib/src/lsl/lslunitsync/unitsync.cpp +++ b/src/downloader/lib/src/lsl/lslunitsync/unitsync.cpp @@ -575,9 +575,9 @@ StringVector Unitsync::GetUnitsList(const std::string& gamename) { assert(!gamename.empty()); StringVector cache; - GetGameHash(gamename); if (!GameExists(gamename)) return cache; + GetGameHash(gamename); const std::string cachefile = GetUnitsCacheFilePath(gamename); TRY_LOCK(cache) diff --git a/src/gui/chatpanelmenu.cpp b/src/gui/chatpanelmenu.cpp index fb2f2a3..c505471 100644 --- a/src/gui/chatpanelmenu.cpp +++ b/src/gui/chatpanelmenu.cpp @@ -52,11 +52,6 @@ wxMenu* ChatPanelMenu::GetMenu() if (m_chatpanel->m_type == CPT_Channel) { wxLogMessage(_T( "channel" )); - m_subscribe = new wxMenuItem(m_menu_all, CHAT_MENU_CH_SUBSCRIBE, _("Subscribe to this channel"), wxEmptyString, wxITEM_CHECK); - m_menu_all->Append(m_subscribe); - m_subscribe->Check(m_chatpanel->m_channel->IsSubscribed()); - - wxMenuItem* leaveitem = new wxMenuItem(m_menu_all, CHAT_MENU_CH_LEAVE, _("Leave"), wxEmptyString, wxITEM_NORMAL); m_menu_all->Append(leaveitem); } @@ -722,17 +717,6 @@ void ChatPanelMenu::OnUserMenuCreateGroup(wxCommandEvent& /*unused*/) } } -void ChatPanelMenu::OnChannelSubscribe(wxCommandEvent& /*unused*/) -{ - const std::string chan = m_chatpanel->m_channel->GetName(); - IServer& serv = m_chatpanel->m_channel->GetServer(); - if (!m_chatpanel->m_channel->IsSubscribed()) { - serv.SendCmd("SUBSCRIBE", "chanName=" + chan); - } else { - serv.SendCmd("UNSUBSCRIBE", "chanName=" + chan); - } -} - void ChatPanelMenu::OnMenuItem(wxCommandEvent& event) { if (event.GetId() == CHAT_MENU_SHOW_MUTELIST) @@ -839,9 +823,6 @@ void ChatPanelMenu::OnMenuItem(wxCommandEvent& event) OnUserMenuDeleteFromGroup(event); else if (event.GetId() == wxID_COPY) m_chatpanel->m_chatlog_text->OnCopy(event); - else if (event.GetId() == CHAT_MENU_CH_SUBSCRIBE) - OnChannelSubscribe(event); - else OnUserMenuAddToGroup(event); } diff --git a/src/gui/chatpanelmenu.h b/src/gui/chatpanelmenu.h index ef823ef..d9c3f33 100644 --- a/src/gui/chatpanelmenu.h +++ b/src/gui/chatpanelmenu.h @@ -103,7 +103,6 @@ static const long CHAT_MENU_DISABLE_APPEND = wxNewId(); static const long CHAT_MENU_CH_LEAVE = wxNewId(); static const long CHAT_MENU_CH_DISPLAYJOIN = wxNewId(); -static const long CHAT_MENU_CH_SUBSCRIBE = wxNewId(); static const long CHAT_MENU_CH_TOPIC = wxNewId(); static const long CHAT_MENU_CH_INFO = wxNewId(); diff --git a/src/gui/hosting/battleroomtab.cpp b/src/gui/hosting/battleroomtab.cpp index 7233ad1..fc2f802 100644 --- a/src/gui/hosting/battleroomtab.cpp +++ b/src/gui/hosting/battleroomtab.cpp @@ -614,7 +614,8 @@ void BattleRoomTab::OnPromote(wxCommandEvent& /*unused*/) void BattleRoomTab::OnStart(wxCommandEvent& /*unused*/) { - if (!m_battle) + slLogDebugFunc(""); + if (m_battle == nullptr) return; if (m_battle->IsFounderMe()) { m_battle->GetMe().BattleStatus().ready = true; @@ -628,6 +629,11 @@ void BattleRoomTab::OnStart(wxCommandEvent& /*unused*/) m_battle->StartHostedBattle(); } else { + if (ui().NeedsDownload(m_battle)) { + wxLogWarning("Cannot start, need to download first!"); + return; + } + if (m_battle->GetFounder().Status().in_game) { if (!ui().IsSpringRunning()) m_battle->StartSpring(); diff --git a/src/iserver.h b/src/iserver.h index 1e3ddcb..acabca4 100644 --- a/src/iserver.h +++ b/src/iserver.h @@ -230,10 +230,6 @@ public: { return LSL::StringVector(); } - virtual LSL::StringSet GetSubscriptions() - { - return LSL::StringSet(); - } void Reset(); virtual void SendCmd(const std::string& /*command*/, const std::string& /*param*/){}; diff --git a/src/springlobbyapp.cpp b/src/springlobbyapp.cpp index b6686af..831390e 100644 --- a/src/springlobbyapp.cpp +++ b/src/springlobbyapp.cpp @@ -76,7 +76,7 @@ END_EVENT_TABLE() SpringLobbyApp::SpringLobbyApp() : quit_called(false) , m_translationhelper(NULL) - , m_log_verbosity(4) + , m_log_verbosity(6) , m_log_console(true) , m_log_window_show(false) , m_crash_handle_disable(false) diff --git a/src/tasserver.cpp b/src/tasserver.cpp index 68b09f6..a6ebd59 100644 --- a/src/tasserver.cpp +++ b/src/tasserver.cpp @@ -33,6 +33,9 @@ lsl/networking/tasserver.cpp #include "utils/conversion.h" #include "utils/slconfig.h" #include "utils/version.h" + +//FIXME: unhard-code +#include "downloader/lib/src/lib/jsoncpp/include/json/reader.h" #include <lslutils/misc.h> SLCONFIG("/Server/ExitMessage", "Using http://springlobby.info/", "Message which is send when leaving server"); @@ -274,7 +277,6 @@ void TASServer::Connect(const ServerLoginInfo& server) m_serverinfo = server; m_buffer.clear(); - m_subscriptions.clear(); if (m_sock != NULL) { Disconnect(); } @@ -503,7 +505,7 @@ void TASServer::ExecuteCommand(const std::string& in) } } - +/* static LSL::StringMap parseKeyValue(const std::string& str) { const LSL::StringVector params = LSL::Util::StringTokenize(str, "\t"); @@ -518,7 +520,7 @@ static LSL::StringMap parseKeyValue(const std::string& str) } return result; } - +*/ void TASServer::ExecuteCommand(const std::string& cmd, const std::string& inparams, int replyid) { @@ -533,6 +535,7 @@ void TASServer::ExecuteCommand(const std::string& cmd, const std::string& inpara if (cmd == "TASSERVER") { #ifdef SSL_SUPPORT if (!m_sock->IsTLS() && sett().IsServerTLS(GetServerName()) ) { + Stop(); //don't send ping until TLS handshake is complete SendCmd("STLS", ""); } else { #endif @@ -552,6 +555,7 @@ void TASServer::ExecuteCommand(const std::string& cmd, const std::string& inpara } else if (cmd == "OK") { if (!m_sock->IsTLS() && sett().IsServerTLS(GetServerName()) ) { m_sock->StartTLS(sett().GetServerFingerprint(GetServerName())); + Start(); //restart ping as server + client have startet TLS } } else if (cmd == "ACCEPTED") { SetUsername(params); @@ -618,7 +622,6 @@ void TASServer::ExecuteCommand(const std::string& cmd, const std::string& inpara m_online = true; if (UserExists("RelayHostManagerList")) SayPrivate("RelayHostManagerList", "!lm"); - SendCmd("LISTSUBSCRIPTIONS", ""); m_se->OnLoginInfoComplete(); } else if (cmd == "REMOVEUSER") { nick = GetWordParam(params); @@ -643,15 +646,16 @@ void TASServer::ExecuteCommand(const std::string& cmd, const std::string& inpara HandlePong(replyid); } else if (cmd == "JOIN") { channel = GetWordParam(params); + int lastid = 0; + cfg().Read(wxString::Format("/Channels/%s/lastid", channel.c_str()), &lastid); m_se->OnJoinChannelResult(true, channel, ""); - } else if (cmd == "JOIN") { - channel = GetWordParam(params); - error = GetSentenceParam(params); - m_se->OnJoinChannelResult(false, channel, error); + SendCmd("GETCHANNELMESSAGES", stdprintf("%s %d", channel.c_str(), lastid)); } else if (cmd == "SAID") { channel = GetWordParam(params); nick = GetWordParam(params); m_se->OnChannelSaid(channel, nick, params); + } else if (cmd == "JSON") { + ParseJson(inparams); } else if (cmd == "JOINED") { channel = GetWordParam(params); nick = GetWordParam(params); @@ -954,22 +958,43 @@ void TASServer::ExecuteCommand(const std::string& cmd, const std::string& inpara m_se->OnConnected(m_serverinfo.description, "", true, m_supported_spring_version, m_server_lanmode); } else if (cmd == "REGISTRATIONDENIED") { m_se->RegistrationDenied(params); - } else if (cmd == "LISTSUBSCRIPTION") { - const LSL::StringMap keyvals = parseKeyValue(GetWordParam(params)); - const std::string keyname = "chanName"; - if (keyvals.find(keyname) != keyvals.end()) { - m_subscriptions.insert(keyvals.at(keyname)); - } - } else if (cmd == "STARTLISTSUBSCRIPTION") { - m_subscriptions.clear(); - } else if (cmd == "ENDLISTSUBSCRIPTION") { - //m_se->OnSubscriptons(); } else { - wxLogWarning(wxString::Format(_T("??? Cmd: %s params: %s"), TowxString(cmd).c_str(), params.c_str())); + wxLogWarning(wxString::Format("??? Cmd: %s params: %s" , cmd.c_str(), params.c_str())); m_se->OnUnknownCommand(cmd, params); } } +void TASServer::ParseJson(const std::string& jsonstr) +{ + wxLogMessage("JSON %s", jsonstr.c_str()); + + Json::Value js; // will contains the root value after parsing. + Json::Reader reader; + const bool parsingSuccessful = reader.parse(jsonstr, js); + if (!parsingSuccessful) { + wxLogWarning("Invalid json: %s", jsonstr.c_str()); + return; + } + + if (!js.isObject()) { + wxLogWarning("Invalid json, object excepted: %s", jsonstr.c_str()); + return; + } + + if (!js["SAID"].isObject()) { + wxLogWarning("Invalid json, object excepted: %s", jsonstr.c_str()); + return; + } + + Json::Value said = js["SAID"]; + cfg().Write(wxString::Format("/Channels/%s/lastid", said["chanName"].asString()), said["id"].asInt()); + m_se->OnChannelSaid(said["chanName"].asString(), said["userName"].asString(), said["msg"].asString()); + + //TODO: store last id for channel + //said["time"].asInt64(); + //said["id"].asUInt64(); +} + void TASServer::RelayCmd(const std::string& command, const std::string& param) { diff --git a/src/tasserver.h b/src/tasserver.h index fe8dd52..c5e31f1 100644 --- a/src/tasserver.h +++ b/src/tasserver.h @@ -128,10 +128,6 @@ private: { return m_se; } - LSL::StringSet GetSubscriptions() override - { - return m_subscriptions; - } // TASServer specific functions void ExecuteCommand(const std::string& cmd, const std::string& inparams, int replyid = -1); @@ -173,6 +169,7 @@ private: void RelayCmd(const std::string& command, const std::string& param = "") override; void Notify() override; bool IsCurrentBattle(int battle_id); + void ParseJson(const std::string& jsonstr); //! @brief Struct used internally by the TASServer class to calculate ping roundtimes. struct TASPingListItem @@ -188,7 +185,6 @@ private: double m_ser_ver; LSL::StringVector m_relay_host_manager_list; - LSL::StringSet m_subscriptions; std::string m_last_denied; bool m_connected; -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/springlobby.git _______________________________________________ Pkg-games-commits mailing list [email protected] http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-games-commits

