Fixed: Completely remove Yubo Chat since it's not used anymore (patch by Kaetemi)
This commit is contained in:
parent
d3625364c6
commit
3c6e3c4eaa
12 changed files with 4 additions and 508 deletions
|
@ -1078,7 +1078,7 @@
|
|||
tooltip_parent="win" />
|
||||
<!-- Yes order is strange, but don't want to modify all the ugly hardcoded code -->
|
||||
<ctrl style="tab_button_new"
|
||||
id="tab7"
|
||||
id="tab6"
|
||||
posparent="tab3"
|
||||
group="content:cb:universe"
|
||||
hardtext="uitabChatUniverse"
|
||||
|
@ -1090,7 +1090,7 @@
|
|||
tooltip_parent="win" />
|
||||
<ctrl style="tab_button_new"
|
||||
id="tab4"
|
||||
posparent="tab7"
|
||||
posparent="tab6"
|
||||
group="content:cb:sysinfo"
|
||||
hardtext="uitabChatSysInfo"
|
||||
onclick_r="set"
|
||||
|
|
|
@ -1300,7 +1300,6 @@ void CClientChatManager::updateChatModeAndButton(uint mode, uint32 dynamicChanne
|
|||
pUserBut->setHardText(title.toUtf8());
|
||||
}
|
||||
break;
|
||||
// NB: user chat cannot have yubo_chat target
|
||||
}
|
||||
|
||||
pUserBut->setActive(true);
|
||||
|
|
|
@ -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", "")
|
||||
{
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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<CGroupList *>(_Chat->getGroup("content:cb:region:text_list"));
|
||||
tab = dynamic_cast<CCtrlTabButton*>(_Chat->getCtrl("header_opened:channel_select:tab1"));
|
||||
break;
|
||||
case CChatGroup::yubo_chat:
|
||||
gl = dynamic_cast<CGroupList *>(_Chat->getGroup("content:cb:yubo_chat:text_list"));
|
||||
tab = dynamic_cast<CCtrlTabButton*>(_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<CGroupList *>(_Chat->getGroup("content:cb:universe:text_list"));
|
||||
tab = dynamic_cast<CCtrlTabButton*>(_Chat->getCtrl("header_opened:channel_select:tab7"));
|
||||
tab = dynamic_cast<CCtrlTabButton*>(_Chat->getCtrl("header_opened:channel_select:tab6"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<ucstring> 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<std::string> CInterfaceManager::getInGameXMLInterfaceFiles()
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;i<CChatGroup::MaxDynChanPerPlayer;i++)
|
||||
|
@ -329,7 +317,6 @@ void CPeopleInterraction::release()
|
|||
if (SystemInfo) cwm.removeChatWindow(SystemInfo);
|
||||
TheUserChat.release();
|
||||
if (DebugInfo) cwm.removeChatWindow(DebugInfo);
|
||||
if (YuboChat) cwm.removeChatWindow(YuboChat);
|
||||
// if (TellWindow) cwm.removeChatWindow(TellWindow);
|
||||
TeamList.reset();
|
||||
FriendList.reset();
|
||||
|
@ -342,7 +329,6 @@ void CPeopleInterraction::release()
|
|||
SystemInfo = NULL;
|
||||
TellWindow = NULL;
|
||||
DebugInfo = NULL;
|
||||
YuboChat = NULL;
|
||||
// TellWindow = NULL;
|
||||
|
||||
for(uint i=0;i<CChatGroup::MaxDynChanPerPlayer;i++)
|
||||
|
@ -421,7 +407,6 @@ void CPeopleInterraction::init()
|
|||
createGuildChat();
|
||||
createSystemInfo();
|
||||
createTheUserChat();
|
||||
createYuboChat();
|
||||
createDynamicChats();
|
||||
|
||||
createDebugInfo();
|
||||
|
@ -463,7 +448,6 @@ void CPeopleInterraction::initStdInputs()
|
|||
ChatInput.Guild.addListeningWindow (ChatGroup.Window);
|
||||
ChatInput.Tell.addListeningWindow (ChatGroup.Window);
|
||||
ChatInput.SystemInfo.addListeningWindow (ChatGroup.Window);
|
||||
ChatInput.YuboChat.addListeningWindow (ChatGroup.Window);
|
||||
ChatInput.Universe.addListeningWindow (ChatGroup.Window);
|
||||
|
||||
if (AroundMe.Window)
|
||||
|
@ -487,9 +471,6 @@ void CPeopleInterraction::initStdInputs()
|
|||
if (DebugInfo)
|
||||
ChatInput.DebugInfo.addListeningWindow(DebugInfo);
|
||||
|
||||
if (YuboChat)
|
||||
ChatInput.YuboChat.addListeningWindow(YuboChat);
|
||||
|
||||
if (TheUserChat.Window)
|
||||
{
|
||||
ChatInput.AroundMe.addListeningWindow(TheUserChat.Window);
|
||||
|
@ -774,26 +755,6 @@ void CPeopleInterraction::createGuildChat()
|
|||
GuildChat->setMenu(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);
|
||||
|
|
|
@ -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<CChatGroup::MaxDynChanPerPlayer;i++)
|
||||
{
|
||||
|
@ -142,8 +139,6 @@ public:
|
|||
CChatWindow *SystemInfo;
|
||||
CChatWindow *TellWindow;
|
||||
CChatWindow *DebugInfo;
|
||||
// (special telnet chat for Game Masters, same channel as the Yubo Klient)
|
||||
CChatWindow *YuboChat;
|
||||
// Special dynamic chat
|
||||
CChatWindow *DynamicChat[CChatGroup::MaxDynChanPerPlayer];
|
||||
|
||||
|
@ -279,7 +274,6 @@ private:
|
|||
void createDebugInfo();
|
||||
void createChatGroup(); // Create chat group containing all other chat
|
||||
void createTheUserChat();
|
||||
void createYuboChat(); // (special telnet chat for Game Masters, same channel as the Yubo Klient)
|
||||
void createDynamicChats();
|
||||
//
|
||||
void initStdInputs();
|
||||
|
|
|
@ -1,273 +0,0 @@
|
|||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||
// 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
#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<ucstring> &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)=="<sor> 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)=="<sor> 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<toSend.size();i++)
|
||||
{
|
||||
if((uint8)toSend[i]==255)
|
||||
toSend[i]= '?';
|
||||
}
|
||||
// append linefield
|
||||
toSend+= "\r\n";
|
||||
uint32 size= (uint32)toSend.size();
|
||||
uint32 off= 0;
|
||||
// until the whole message is sent
|
||||
while(size!=0)
|
||||
{
|
||||
if (_Sock.send((uint8 *)toSend.c_str()+off, size, false) != CSock::Ok)
|
||||
{
|
||||
addStringReceived(toString("ERROR: Can't send data to the server %s", _URL.c_str()));
|
||||
return;
|
||||
}
|
||||
// maybe send the rest of the message (very rare....)
|
||||
off+=size;
|
||||
size= (uint32)toSend.size()-off;
|
||||
}
|
||||
}
|
||||
catch(const Exception &e)
|
||||
{
|
||||
addStringReceived(toString("ERROR: exception with server %s: %s", _URL.c_str(), e.what()));
|
||||
}
|
||||
}
|
||||
|
|
@ -1,80 +0,0 @@
|
|||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||
// 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
#ifndef NL_YUBO_CHAT_H
|
||||
#define NL_YUBO_CHAT_H
|
||||
|
||||
#include "nel/misc/types_nl.h"
|
||||
#include <vector>
|
||||
#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<ucstring> &msgList);
|
||||
|
||||
|
||||
private:
|
||||
bool _Connected;
|
||||
std::string _URL;
|
||||
std::string _Login;
|
||||
std::string _Password; // problem if clearly sotred in ram?
|
||||
NLNET::CTcpSock _Sock;
|
||||
std::list<ucstring> _ReceivedStrings;
|
||||
std::list<ucstring> _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 */
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue