From 3c6e3c4eaacdc14e49e519eb5c8129ade98e859f Mon Sep 17 00:00:00 2001 From: kervala Date: Thu, 3 Dec 2015 12:49:51 +0100 Subject: [PATCH] Fixed: Completely remove Yubo Chat since it's not used anymore (patch by Kaetemi) --- .../gamedev/interfaces_v3/interaction.xml | 4 +- code/ryzom/client/src/client_chat_manager.cpp | 1 - code/ryzom/client/src/commands.cpp | 8 - .../client/src/interface_v3/chat_filter.cpp | 8 - .../client/src/interface_v3/chat_window.cpp | 9 +- .../src/interface_v3/interface_manager.cpp | 64 ---- .../src/interface_v3/interface_manager.h | 15 - .../src/interface_v3/people_interraction.cpp | 41 --- .../src/interface_v3/people_interraction.h | 6 - .../client/src/interface_v3/yubo_chat.cpp | 273 ------------------ .../ryzom/client/src/interface_v3/yubo_chat.h | 80 ----- code/ryzom/common/src/game_share/chat_group.h | 3 +- 12 files changed, 4 insertions(+), 508 deletions(-) delete mode 100644 code/ryzom/client/src/interface_v3/yubo_chat.cpp delete mode 100644 code/ryzom/client/src/interface_v3/yubo_chat.h diff --git a/code/ryzom/client/data/gamedev/interfaces_v3/interaction.xml b/code/ryzom/client/data/gamedev/interfaces_v3/interaction.xml index 3a3b1948b..e81173dfa 100644 --- a/code/ryzom/client/data/gamedev/interfaces_v3/interaction.xml +++ b/code/ryzom/client/data/gamedev/interfaces_v3/interaction.xml @@ -1078,7 +1078,7 @@ tooltip_parent="win" /> setHardText(title.toUtf8()); } break; - // NB: user chat cannot have yubo_chat target } pUserBut->setActive(true); diff --git a/code/ryzom/client/src/commands.cpp b/code/ryzom/client/src/commands.cpp index ebcd14399..c80d0701d 100644 --- a/code/ryzom/client/src/commands.cpp +++ b/code/ryzom/client/src/commands.cpp @@ -159,14 +159,6 @@ void releaseCommands() // COMMANDS // ////////////// -// connect to the support chat -NLMISC_COMMAND(supportChat, "connect to the external support chat", "") -{ - CInterfaceManager *pIM= CInterfaceManager::getInstance(); - pIM->connectYuboChat(); - return true; -} - // 'follow' : To Follow the target. NLMISC_COMMAND(follow, "Follow the target", "") { diff --git a/code/ryzom/client/src/interface_v3/chat_filter.cpp b/code/ryzom/client/src/interface_v3/chat_filter.cpp index 76d7acede..b5741adfc 100644 --- a/code/ryzom/client/src/interface_v3/chat_filter.cpp +++ b/code/ryzom/client/src/interface_v3/chat_filter.cpp @@ -288,14 +288,6 @@ void CChatTargetFilter::setChat(CChatWindow *w) //============================================================================================================= void CChatTargetFilter::msgEntered(const ucstring &msg, CChatWindow *chatWindow) { - // Special case for yubo chat - if(_TargetGroup==CChatGroup::yubo_chat) - { - CInterfaceManager *pIM= CInterfaceManager::getInstance(); - pIM->sendStringToYuboChat(msg); - return; - } - // Common Target case if (ClientCfg.Local) { diff --git a/code/ryzom/client/src/interface_v3/chat_window.cpp b/code/ryzom/client/src/interface_v3/chat_window.cpp index 0bb192fc5..af0942bc9 100644 --- a/code/ryzom/client/src/interface_v3/chat_window.cpp +++ b/code/ryzom/client/src/interface_v3/chat_window.cpp @@ -627,9 +627,6 @@ void CChatGroupWindow::displayMessage(const ucstring &msg, NLMISC::CRGBA col, CC } } break; - - // NB: the yubo chat cannot be in a user chat - case CChatGroup::yubo_chat: gl = NULL; break; } if (gl != NULL) @@ -1039,10 +1036,6 @@ void CChatGroupWindow::getAssociatedSubWindow(CChatGroup::TGroupType gt, uint32 gl = dynamic_cast(_Chat->getGroup("content:cb:region:text_list")); tab = dynamic_cast(_Chat->getCtrl("header_opened:channel_select:tab1")); break; - case CChatGroup::yubo_chat: - gl = dynamic_cast(_Chat->getGroup("content:cb:yubo_chat:text_list")); - tab = dynamic_cast(_Chat->getCtrl("header_opened:channel_select:tab6")); - break; case CChatGroup::dyn_chat: { // use dynamicChatDbIndex to get the wanted tab button/group @@ -1052,7 +1045,7 @@ void CChatGroupWindow::getAssociatedSubWindow(CChatGroup::TGroupType gt, uint32 break; case CChatGroup::universe: gl = dynamic_cast(_Chat->getGroup("content:cb:universe:text_list")); - tab = dynamic_cast(_Chat->getCtrl("header_opened:channel_select:tab7")); + tab = dynamic_cast(_Chat->getCtrl("header_opened:channel_select:tab6")); break; } } diff --git a/code/ryzom/client/src/interface_v3/interface_manager.cpp b/code/ryzom/client/src/interface_v3/interface_manager.cpp index a104dd01d..b662468ce 100644 --- a/code/ryzom/client/src/interface_v3/interface_manager.cpp +++ b/code/ryzom/client/src/interface_v3/interface_manager.cpp @@ -1447,9 +1447,6 @@ void CInterfaceManager::updateFrameEvents() // Update contact list with incoming server string ids PeopleInterraction.updateWaitingContacts(); - // Connect and receive/send to the yubo chat - checkYuboChat(); - // Update string if some waiting CEncyclopediaManager::getInstance()->updateAllFrame(); @@ -3205,67 +3202,6 @@ CInterfaceElement *getInterfaceResource(const std::string &key) return CWidgetManager::getInstance()->getElementFromId (key); } - -// *************************************************************************** -void CInterfaceManager::sendStringToYuboChat(const ucstring &str) -{ - // If the yubo chat really connected - if(_YuboChat.connected()) - { - _YuboChat.send(str); - } -} - -// *************************************************************************** -void CInterfaceManager::checkYuboChat() -{ - // flush the receive queue - if(_YuboChat.connected()) - { - std::list toReceive; - _YuboChat.receive(toReceive); - while(!toReceive.empty()) - { - PeopleInterraction.ChatInput.YuboChat.displayMessage(toReceive.front(), CRGBA::White, 2, NULL); - toReceive.pop_front(); - } - } -} - -// *************************************************************************** -void CInterfaceManager::connectYuboChat() -{ - // force disconnection if was connected - _YuboChat.disconnect(); - - uint32 KlientChatPort = 0; - - extern TSessionId HighestMainlandSessionId; - switch(HighestMainlandSessionId.asInt()) - { - case 101: KlientChatPort = 6002; break; // fr - case 102: KlientChatPort = 6003; break; // de - case 103: KlientChatPort = 6001; break; // en - case 301: KlientChatPort = 4000; break; // yubo - default: - if(!ClientCfg.KlientChatPort.empty()) - fromString(ClientCfg.KlientChatPort, KlientChatPort); - break; - } - - // check if must reconnect - if(KlientChatPort != 0 && !_YuboChat.connected()) - { - // NB: hard code url, to avoid "client.cfg trojan" - // (a client.cfg with an url pointing to a hacker site, to grab login/password) - extern std::string LoginLogin, LoginPassword; - _YuboChat.connect(string("chat.ryzom.com:")+toString(KlientChatPort), LoginLogin, LoginPassword); - - // Inform the interface that the chat is present - NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:YUBO_CHAT_PRESENT")->setValue32(1); - } -} - // *************************************************************************** std::vector CInterfaceManager::getInGameXMLInterfaceFiles() { diff --git a/code/ryzom/client/src/interface_v3/interface_manager.h b/code/ryzom/client/src/interface_v3/interface_manager.h index d947f4912..d0dccecc5 100644 --- a/code/ryzom/client/src/interface_v3/interface_manager.h +++ b/code/ryzom/client/src/interface_v3/interface_manager.h @@ -47,7 +47,6 @@ // CLIENT #include "../string_manager_client.h" -#include "yubo_chat.h" #include "../ingame_database_manager.h" @@ -349,13 +348,6 @@ public: // test if the config has been loaded in initInGame() bool isConfigLoaded() const {return _ConfigLoaded;} - /** connect or reconnect to the yubo chat (if was kicked for instance). - * The YuboChat is a special telnet chat for Game Masters, same channel as the Yubo Klient - */ - void connectYuboChat(); - /// send a string to the yubo chat - void sendStringToYuboChat(const ucstring &str); - /// Manager for flying text. use it to add CFlyingTextManager FlyingTextManager; @@ -556,13 +548,6 @@ private: // @} - /// \name Check Yubo Chat (special telnet chat for Game Masters, same channel as the Yubo Klient) - // @{ - CYuboChat _YuboChat; - void checkYuboChat(); - // @} - - /** This is the GLOBAL Action counter used to synchronize some systems (including INVENTORY) with the server. */ uint8 _LocalSyncActionCounter; diff --git a/code/ryzom/client/src/interface_v3/people_interraction.cpp b/code/ryzom/client/src/interface_v3/people_interraction.cpp index c2eb972dd..62e6c0990 100644 --- a/code/ryzom/client/src/interface_v3/people_interraction.cpp +++ b/code/ryzom/client/src/interface_v3/people_interraction.cpp @@ -228,16 +228,6 @@ struct CDebugConsoleEntryHandler : public IChatWindowListener } }; -// handler to manager user entry in a Yubo Chat -struct CYuboChatEntryHandler : public IChatWindowListener -{ - virtual void msgEntered(const ucstring &msg, CChatWindow * /* chatWindow */) - { - CInterfaceManager *pIM= CInterfaceManager::getInstance(); - pIM->sendStringToYuboChat(msg); - } -}; - // handler to manager user entry in a Dynamic Chat struct CDynamicChatEntryHandler : public IChatWindowListener { @@ -272,7 +262,6 @@ static CGuildChatEntryHandler GuildChatEntryHandler; static CTeamChatEntryHandler TeamChatEntryHandler; static CFriendTalkEntryHandler FriendTalkEntryHandler; static CDebugConsoleEntryHandler DebugConsoleEntryHandler; -static CYuboChatEntryHandler YuboChatEntryHandler; static CDynamicChatEntryHandler DynamicChatEntryHandler[CChatGroup::MaxDynChanPerPlayer]; @@ -302,7 +291,6 @@ CPeopleInterraction::CPeopleInterraction() : Region(NULL), SystemInfo(NULL), TellWindow(NULL), DebugInfo(NULL), - YuboChat(NULL), CurrPartyChatID(0) { for(uint i=0;isetMenu(STD_CHAT_SOURCE_MENU); } -//=========================================================================================================== -void CPeopleInterraction::createYuboChat() -{ - CChatWindowDesc chatDesc; - chatDesc.FatherContainer = "ui:interface"; - chatDesc.Title = "uiYuboChat"; - chatDesc.Listener = &YuboChatEntryHandler; - chatDesc.Localize = true; - chatDesc.Savable = true; - chatDesc.Id = "yubo_chat"; - chatDesc.AHOnCloseButton = "proc"; - chatDesc.AHOnCloseButtonParams = "yubo_chat_proc_close"; - chatDesc.HeaderColor = "UI:SAVE:WIN:COLORS:MEM"; - - YuboChat = getChatWndMgr().createChatWindow(chatDesc); - if (!YuboChat) return; - YuboChat->setMenu(STD_CHAT_SOURCE_MENU); -} - - //================================================================================================================= void CPeopleInterraction::createDynamicChats() { @@ -926,7 +887,6 @@ class CHandlerChatGroupFilter : public IActionHandler rCTF.setTargetGroup(CChatGroup::system); writeRight= false; } - else if (sParams == "yubo_chat") rCTF.setTargetGroup(CChatGroup::yubo_chat); else if (sParams.compare(0, dynChatId.size(), dynChatId)==0) { // get the number of this tab @@ -985,7 +945,6 @@ class CHandlerChatGroupFilter : public IActionHandler pUserBut->setHardText(title.toUtf8()); } break; - // NB: user chat cannot have yubo_chat target } pUserBut->setActive(true); diff --git a/code/ryzom/client/src/interface_v3/people_interraction.h b/code/ryzom/client/src/interface_v3/people_interraction.h index cfaa0bfb6..591a005e2 100644 --- a/code/ryzom/client/src/interface_v3/people_interraction.h +++ b/code/ryzom/client/src/interface_v3/people_interraction.h @@ -94,8 +94,6 @@ public: CChatInputFilter Tell; CChatInputFilter DebugInfo; - // YuboChat (special telnet chat for Game Masters, same channel as the Yubo Klient) - CChatInputFilter YuboChat; // Dynamic Chat. A fixed number of chat that can be assign CChatInputFilter DynamicChat[CChatGroup::MaxDynChanPerPlayer]; @@ -111,7 +109,6 @@ public: Guild.FilterType = CChatGroup::guild; SystemInfo.FilterType = CChatGroup::system; Tell.FilterType = CChatGroup::tell; - YuboChat.FilterType = CChatGroup::yubo_chat; Universe.FilterType = CChatGroup::universe; for(uint i=0;i -// Copyright (C) 2010 Winch Gate Property Limited -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -#include "stdpch.h" - -#include "yubo_chat.h" - - -using namespace std; -using namespace NLMISC; -using namespace NLNET; - - -// *************************************************************************** -CYuboChat::CYuboChat() -{ - _Connected= false; - _CommandState= None; - _AutoLoginState= UserUnknown; -} - -// *************************************************************************** -void CYuboChat::connect(const string &url, const std::string &login, const std::string &pwd) -{ - if(_Connected) - return; - - _URL= url; - _Login= login; - _Password= pwd; - // mark as connected even if the connection failed (to allow display of error message) - _Connected= true; - - - // Connect the socket - try - { - // connect in non blocking mode - _Sock.connect(CInetAddress(_URL)); - _Sock.setNonBlockingMode(true); - - if (!_Sock.connected()) - { - // Add an error string - addStringReceived(toString("ERROR: Cannot connect to the url: %s", _URL.c_str())); - return; - } - } - catch(const Exception &e) - { - addStringReceived(toString("ERROR: exception with server %s: %s", _URL.c_str(), e.what())); - } -} - -// *************************************************************************** -void CYuboChat::disconnect() -{ - if(!_Connected) - return; - - // verify if the actual connection was not broken first - if(_Sock.connected()) - { - try - { - _Sock.disconnect(); - } - catch(const Exception &e) - { - addStringReceived(toString("ERROR: exception with server %s: %s", _URL.c_str(), e.what())); - } - } - - // must reset the sock, else block at next connect (due to nonblocking stuff i think) - contReset(_Sock); - - // flush - _CurrentReceivedString.clear(); - _CommandState= None; - _AutoLoginState= UserUnknown; - _Connected= false; -} - -// *************************************************************************** -void CYuboChat::send(const ucstring &msg) -{ - if(!_Connected) - return; - - // verify also that the socket was not disconnected by peer - if(_Sock.connected()) - { - // append to the queue of user string to send - _StringsToSend.push_back(msg); - - // flush string only when the user is logued - // Allow also the user to enter his login if autologin has failed - if(_AutoLoginState!=UserUnknown) - { - while(!_StringsToSend.empty()) - { - sendInternal(_StringsToSend.front()); - _StringsToSend.pop_front(); - } - } - } - -} - -// *************************************************************************** -void CYuboChat::receive(std::list &msgList) -{ - // verify also that the socket was not disconnected by peer - if(_Connected && _Sock.connected()) - { - // **** Receive chars from chat - bool receiving= true; - while(receiving) - { - uint32 size = 1; - char c; - - if (_Sock.receive((uint8*)&c, size, false) == CSock::Ok && size==1) - { - // the char is a command id? - if(_CommandState==WaitCommandId) - { - // if the command is an option negociation - if((uint8)c>=251 && (uint8)c<=254) - // next char is the option id - _CommandState= WaitOptionId; - else - // back to normal state - _CommandState= None; - } - // the char is an option id? - else if(_CommandState==WaitOptionId) - { - // just ignore and back to normal mode - _CommandState= None; - } - // end of line? - else if(c==0 || c=='\n') - { - if(!_CurrentReceivedString.empty()) - { - addStringReceived(_CurrentReceivedString); - // clear the received string - _CurrentReceivedString.clear(); - } - } - // special telnet code? - else if((uint8)c==255) - { - // next char is the command id - _CommandState=WaitCommandId; - } - // normal char - else - { - if(c=='\r') - { - if(_CurrentReceivedString.empty()) - _CurrentReceivedString=" "; - } - else - _CurrentReceivedString += c; - } - - // test if must send login/pwd - if(toLower(_CurrentReceivedString)==" login: ") - { - // flush display - addStringReceived(_CurrentReceivedString); - _CurrentReceivedString.clear(); - - // autolog - if(_AutoLoginState==UserUnknown) - { - _AutoLoginState=LoginEntered; - // if autologin valid - if(!_Login.empty()) - sendInternal(_Login); - } - } - else if(toLower(_CurrentReceivedString)==" password: ") - { - // flush display - addStringReceived(_CurrentReceivedString); - _CurrentReceivedString.clear(); - - // autolog - if(_AutoLoginState==LoginEntered) - { - _AutoLoginState=Logged; - // if autologin valid - if(!_Password.empty()) - { - sendInternal(_Password); - // cool stuff - sendInternal(string(".emote is in game")); - sendInternal(string(".set client Ryzom")); - } - } - } - - } - else - { - receiving= false; - } - } - } - - // return the list of received string (NB: even if not connected, can contains conection errors) - msgList= _ReceivedStrings; - _ReceivedStrings.clear(); -} - -// *************************************************************************** -void CYuboChat::addStringReceived(const std::string &str) -{ - _ReceivedStrings.push_back(str); -} - -// *************************************************************************** -void CYuboChat::sendInternal(const ucstring &msg) -{ - try - { - string toSend= msg.toString(); - // replace any 255 char (eg: y trema) with '?' - for(uint i=0;i -// Copyright (C) 2010 Winch Gate Property Limited -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -#ifndef NL_YUBO_CHAT_H -#define NL_YUBO_CHAT_H - -#include "nel/misc/types_nl.h" -#include -#include "nel/net/tcp_sock.h" - - -// *************************************************************************** -/** - * Yubo Chat (special telnet chat for Game Masters, same channel as the Yubo Klient) - * This is the NET part of the yubo chat only (no interface here) - * \author Lionel Berenguier - * \author Nevrax France - * \date 2004 - */ -class CYuboChat -{ -public: - - CYuboChat(); - - void connect(const std::string &url, const std::string &login, const std::string &pwd); - void disconnect(); - - // NB: return true even if was disconnected by peer, or if the connect() failed. - bool connected() const {return _Connected;} - - void send(const ucstring &msg); - void receive(std::list &msgList); - - -private: - bool _Connected; - std::string _URL; - std::string _Login; - std::string _Password; // problem if clearly sotred in ram? - NLNET::CTcpSock _Sock; - std::list _ReceivedStrings; - std::list _StringsToSend; - std::string _CurrentReceivedString; - enum TLoginState - { - UserUnknown, - LoginEntered, - Logged - }; - TLoginState _AutoLoginState; - enum TCommandState - { - None, - WaitCommandId, - WaitOptionId - }; - TCommandState _CommandState; - - void addStringReceived(const std::string &str); - void sendInternal(const ucstring &msg); -}; - - -#endif // NL_YUBO_CHAT_H - -/* End of yubo_chat.h */ diff --git a/code/ryzom/common/src/game_share/chat_group.h b/code/ryzom/common/src/game_share/chat_group.h index fd9173afd..afa958d3d 100644 --- a/code/ryzom/common/src/game_share/chat_group.h +++ b/code/ryzom/common/src/game_share/chat_group.h @@ -65,9 +65,8 @@ struct CChatGroup system, region, dyn_chat, - nbChatMode, + nbChatMode // Following mode are client side only. Thus, after 'nbChatMode' - yubo_chat // (special telnet chat for Game Masters, same channel as the Yubo Klient) }; /// group type