Merge branch 'deepl'

feature/prepare-cross-merge
Ulukyn 4 years ago committed by kaetemi
parent 0d57aad8b9
commit 3c178cb506
No known key found for this signature in database
GPG Key ID: 9873C4D40BB479BC

@ -4577,17 +4577,20 @@ NLMISC_COMMAND (connectLangChannel, "Connect to lang channel", "<user id> <lang>
CPVPManager2 *inst = CPVPManager2::getInstance(); CPVPManager2 *inst = CPVPManager2::getInstance();
string action;
string lang = args[1]; string lang = args[1];
if (lang != "en" && lang != "fr" && lang != "de" && lang != "ru" && lang != "es" && lang != "rf" if (lang != "en" && lang != "fr" && lang != "de" && lang != "ru" && lang != "es" && lang != "rf" && !c->havePriv(":DEV:"))
&& lang != "rf-en" && lang != "rf-fr" && lang != "rf-de" && lang != "rf-ru" && lang != "rf-es")
return false; return false;
bool leave = !c->havePriv(":DEV:"); // Since June 2020, no any lang channels, players only can leave it bool leave = false;
if (args.size() > 2) if (args.size() > 2)
leave = args[2] == "1"; leave = args[2] == "1";
TChanID channel = inst->getFactionDynChannel(lang);
string channelName = lang;
// Convert langs to usr lang channels
if (lang == "en" || lang == "fr" || lang == "de" || lang == "ru" || lang == "es")
channelName = "usr_"+lang;
TChanID channel = inst->getFactionDynChannel(channelName);
if (channel != DYN_CHAT_INVALID_CHAN) if (channel != DYN_CHAT_INVALID_CHAN)
{ {

@ -436,7 +436,7 @@ static void prepareCharacterPositionForStore ( COfflineEntityState & state, cons
PROP(uint32,_GuildPoints)\ PROP(uint32,_GuildPoints)\
PROP(uint8,_TodayGuildPoints)\ PROP(uint8,_TodayGuildPoints)\
PROP_GAME_CYCLE_COMP(_NextTodayGuildPointsReset)\ PROP_GAME_CYCLE_COMP(_NextTodayGuildPointsReset)\
PROP2(_LangChannel,string,_LangChannel,_LangChannel="rf")\ PROP2(_LangChannel,string,_LangChannel,_LangChannel=val)\
PROP(uint32,_Organization)\ PROP(uint32,_Organization)\
PROP(uint32,_OrganizationStatus)\ PROP(uint32,_OrganizationStatus)\
PROP(uint32,_OrganizationPoints)\ PROP(uint32,_OrganizationPoints)\

@ -221,20 +221,21 @@ std::vector<TChanID> CPVPManager2::getCharacterChannels(CCharacter * user)
NLMISC::splitString(user->getLangChannel(), " ", langChannels); NLMISC::splitString(user->getLangChannel(), " ", langChannels);
for ( uint i = 0; i < langChannels.size(); i++ ) for ( uint i = 0; i < langChannels.size(); i++ )
{ {
TMAPExtraFactionChannel::iterator it = _ExtraFactionChannel.find(langChannels[i]); if (langChannels[i] != "rf")
if (it != _ExtraFactionChannel.end())
{ {
result.push_back((*it).second); TMAPExtraFactionChannel::iterator it = _ExtraFactionChannel.find("usr_"+langChannels[i]);
if (it != _ExtraFactionChannel.end())
{
result.push_back((*it).second);
}
} }
} }
} }
else
TMAPExtraFactionChannel::iterator it = _ExtraFactionChannel.find("rf");
if (it != _ExtraFactionChannel.end())
{ {
TMAPExtraFactionChannel::iterator it = _ExtraFactionChannel.find("en"); result.push_back((*it).second);
if (it != _ExtraFactionChannel.end())
{
result.push_back((*it).second);
}
} }
PVP_CLAN::TPVPClan faction = user->getAllegiance().first; PVP_CLAN::TPVPClan faction = user->getAllegiance().first;
@ -1184,11 +1185,18 @@ void CPVPManager2::onIOSMirrorUp()
createExtraFactionChannel("de", true); createExtraFactionChannel("de", true);
createExtraFactionChannel("ru", true); createExtraFactionChannel("ru", true);
createExtraFactionChannel("es", true); createExtraFactionChannel("es", true);
createExtraFactionChannel("usr_en", true);
createExtraFactionChannel("usr_fr", true);
createExtraFactionChannel("usr_de", true);
createExtraFactionChannel("usr_ru", true);
createExtraFactionChannel("usr_es", true);
createExtraFactionChannel("rf", true); createExtraFactionChannel("rf", true);
createExtraFactionChannel("rf-fr", true); createExtraFactionChannel("rf-fr", true);
createExtraFactionChannel("rf-en", true); createExtraFactionChannel("rf-en", true);
createExtraFactionChannel("rf-es", true); createExtraFactionChannel("rf-es", true);
createExtraFactionChannel("rf-ed", true); createExtraFactionChannel("rf-de", true);
createExtraFactionChannel("rf-ru", true); createExtraFactionChannel("rf-ru", true);
#ifdef HAVE_MONGO #ifdef HAVE_MONGO

@ -46,7 +46,7 @@ CChatClient::CChatClient( const TDataSetRow& index )
cm.addGroup(_SayAudienceId, CChatGroup::say, ""); cm.addGroup(_SayAudienceId, CChatGroup::say, "");
cm.addGroup(_ShoutAudienceId, CChatGroup::shout, ""); cm.addGroup(_ShoutAudienceId, CChatGroup::shout, "");
_Muted = false; _Muted = false;
_ChatMode = CChatGroup::say; _ChatMode = CChatGroup::say;
_SayLastAudienceUpdateTime = CTime::getLocalTime(); _SayLastAudienceUpdateTime = CTime::getLocalTime();
_ShoutLastAudienceUpdateTime = _SayLastAudienceUpdateTime; _ShoutLastAudienceUpdateTime = _SayLastAudienceUpdateTime;
@ -64,9 +64,9 @@ CChatClient::~CChatClient()
} }
void CChatClient::setChatMode( CChatGroup::TGroupType mode, TChanID dynChatChan) void CChatClient::setChatMode( CChatGroup::TGroupType mode, TChanID dynChatChan)
{ {
_ChatMode = mode; _ChatMode = mode;
_DynChatChan = dynChatChan; _DynChatChan = dynChatChan;
} }
@ -126,7 +126,7 @@ bool CChatClient::isMuted()
return false; return false;
} }
} }
return true; return true;
} }
} // isMuted // } // isMuted //
@ -143,10 +143,10 @@ void CChatClient::setIgnoreStatus( const NLMISC::CEntityId &id, bool ignored)
if (ignored) if (ignored)
{ {
if( itIgnore == _IgnoreList.end() ) if( itIgnore == _IgnoreList.end() )
{ {
_IgnoreList.insert( id ); _IgnoreList.insert( id );
} }
} }
else else
{ {
@ -223,11 +223,11 @@ void CChatClient::filter( TFilter filterId )
// //
//----------------------------------------------- //-----------------------------------------------
CChatGroup& CChatClient::getAudience() CChatGroup& CChatClient::getAudience()
{ {
CChatManager &cm = IOS->getChatManager(); CChatManager &cm = IOS->getChatManager();
if(_ChatMode == CChatGroup::shout) if(_ChatMode == CChatGroup::shout)
return cm.getGroup(_ShoutAudienceId); return cm.getGroup(_ShoutAudienceId);
else else
return cm.getGroup(_SayAudienceId); return cm.getGroup(_SayAudienceId);
} // getAudience // } // getAudience //
@ -239,7 +239,7 @@ CChatGroup& CChatClient::getAudience()
// //
//----------------------------------------------- //-----------------------------------------------
CChatGroup& CChatClient::getSayAudience( bool update ) CChatGroup& CChatClient::getSayAudience( bool update )
{ {
CChatManager &cm = IOS->getChatManager(); CChatManager &cm = IOS->getChatManager();
if( update ) if( update )
{ {
@ -256,7 +256,7 @@ CChatGroup& CChatClient::getSayAudience( bool update )
// //
//----------------------------------------------- //-----------------------------------------------
CChatGroup& CChatClient::getShoutAudience( bool update ) CChatGroup& CChatClient::getShoutAudience( bool update )
{ {
CChatManager &cm = IOS->getChatManager(); CChatManager &cm = IOS->getChatManager();
if( update ) if( update )
{ {
@ -339,8 +339,8 @@ void CChatClient::updateAudience( CEntityId &audienceId, sint maxDist, TTime& la
// first of all, check the instance id // first of all, check the instance id
if (instanceId == charInstanceId) if (instanceId == charInstanceId)
{ {
CMirrorPropValueRO<sint32> charCell( TheDataset, entityIndex, DSPropertyCELL ); CMirrorPropValueRO<sint32> charCell( TheDataset, entityIndex, DSPropertyCELL );
// if the player is NOT in an appartment // if the player is NOT in an appartment
if( cellS > 0 ) if( cellS > 0 )
{ {
@ -349,7 +349,7 @@ void CChatClient::updateAudience( CEntityId &audienceId, sint maxDist, TTime& la
uint16 charCellX = (uint16)(charCell>>16); uint16 charCellX = (uint16)(charCell>>16);
uint16 charCellY = (uint16)(charCell&0xffff); uint16 charCellY = (uint16)(charCell&0xffff);
sint32 distX = (sint32)(charCellX) - (sint32)(senderCellX); sint32 distX = (sint32)(charCellX) - (sint32)(senderCellX);
sint32 distY = (sint32)(charCellY) - (sint32)(senderCellY); sint32 distY = (sint32)(charCellY) - (sint32)(senderCellY);
@ -409,7 +409,7 @@ void CChatClient::updateAudience( CEntityId &audienceId, sint maxDist, TTime& la
} }
lastAudienceUpdateTime = currentTime; lastAudienceUpdateTime = currentTime;
} }
} // updateAudience // } // updateAudience //
@ -512,13 +512,24 @@ void CChatClient::unsubscribeAllChatGroup()
//----------------------------------------------- //-----------------------------------------------
// disableTranslation // disableSendTranslation
//----------------------------------------------- //-----------------------------------------------
void CChatClient::disableTranslation( const string &lang ) void CChatClient::disableSendTranslation( const string &lang )
{ {
if (find(_DontTranslate.begin(), _DontTranslate.end(), lang) == _DontTranslate.end()) if (find(_DontSendTranslation.begin(), _DontSendTranslation.end(), lang) == _DontSendTranslation.end())
{ {
_DontTranslate.push_back(lang); _DontSendTranslation.push_back(lang);
}
}
//-----------------------------------------------
// disableReceiveTranslation
//-----------------------------------------------
void CChatClient::disableReceiveTranslation( const string &lang )
{
if (find(_DontReceiveTranslation.begin(), _DontReceiveTranslation.end(), lang) == _DontReceiveTranslation.end())
{
_DontReceiveTranslation.push_back(lang);
} }
} }
@ -527,16 +538,25 @@ void CChatClient::disableTranslation( const string &lang )
//----------------------------------------------- //-----------------------------------------------
void CChatClient::resetDisabledTranslations() void CChatClient::resetDisabledTranslations()
{ {
_DontTranslate.clear(); _DontReceiveTranslation.clear();
_DontSendTranslation.clear();
} }
//----------------------------------------------- //-----------------------------------------------
// haveDisabledTranslation // dontReceiveTranslation
//----------------------------------------------- //-----------------------------------------------
bool CChatClient::haveDisabledTranslation( const string &lang ) bool CChatClient::dontReceiveTranslation( const string &lang )
{ {
return find(_DontTranslate.begin(), _DontTranslate.end(), lang) != _DontTranslate.end(); return find(_DontReceiveTranslation.begin(), _DontReceiveTranslation.end(), lang) != _DontReceiveTranslation.end();
} }
//-----------------------------------------------
// dontSendTranslation
//-----------------------------------------------
bool CChatClient::dontSendTranslation( const string &lang )
{
return find(_DontSendTranslation.begin(), _DontSendTranslation.end(), lang) != _DontSendTranslation.end();
}

@ -33,21 +33,21 @@
typedef uint8 TFilter; typedef uint8 TFilter;
/** /**
* CChatClient * CChatClient
* \author Stephane Coutelas * \author Stephane Coutelas
* \author Nevrax France * \author Nevrax France
* \date 2002 * \date 2002
*/ */
class CChatClient class CChatClient
{ {
public : public :
/** /**
* Constructor * Constructor
*/ */
CChatClient( const TDataSetRow& id ); CChatClient( const TDataSetRow& id );
/************************************************************************/ /************************************************************************/
/* Destructor */ /* Destructor */
/************************************************************************/ /************************************************************************/
@ -62,7 +62,7 @@ public :
*/ */
const TDataSetRow &getDataSetIndex() const { return _DataSetIndex; } const TDataSetRow &getDataSetIndex() const { return _DataSetIndex; }
/** /**
* Mute or unmute this client, nobody will received chat from him * Mute or unmute this client, nobody will received chat from him
* the player can be muted for a fixed period of time * the player can be muted for a fixed period of time
* If the player is unmuted, the delay is not taken into account * If the player is unmuted, the delay is not taken into account
@ -73,7 +73,7 @@ public :
/** /**
* Get the mute state of this client * Get the mute state of this client
* *
* \return true if this client is muted * \return true if this client is muted
*/ */
bool isMuted(); bool isMuted();
@ -101,7 +101,7 @@ public :
* \param filterId the filter * \param filterId the filter
*/ */
void filter( TFilter filterId ); void filter( TFilter filterId );
/** /**
* Return true if the filter is on * Return true if the filter is on
* \param filterId the filter * \param filterId the filter
@ -109,7 +109,7 @@ public :
bool isFilterOn( TFilter filterId ) const; bool isFilterOn( TFilter filterId ) const;
/** /**
* Set the chat mode * Set the chat mode
* \param mode the chat mode * \param mode the chat mode
* \param dynChatChan If mode is dyn chat, then gives the channel * \param dynChatChan If mode is dyn chat, then gives the channel
*/ */
@ -132,32 +132,32 @@ public :
*/ */
// void setChatGroup( TGroupId gId) { _ChatGroup = gId; } // void setChatGroup( TGroupId gId) { _ChatGroup = gId; }
void setTeamChatGroup( TGroupId gId) void setTeamChatGroup( TGroupId gId)
{ {
_TeamChat = gId; _TeamChat = gId;
} }
void setGuildChatGroup( TGroupId gId) void setGuildChatGroup( TGroupId gId)
{ {
_GuildChat = gId; _GuildChat = gId;
} }
void setRegionChatGroup( TGroupId gId) void setRegionChatGroup( TGroupId gId)
{ {
_RegionChat = gId; _RegionChat = gId;
} }
TGroupId getTeamChatGroup() TGroupId getTeamChatGroup()
{ {
return _TeamChat; return _TeamChat;
} }
TGroupId getGuildChatGroup() TGroupId getGuildChatGroup()
{ {
return _GuildChat; return _GuildChat;
} }
TGroupId getRegionChatGroup() TGroupId getRegionChatGroup()
{ {
return _RegionChat; return _RegionChat;
} }
/** /**
* Get the chat group * Get the chat group
* \return the group's id * \return the group's id
@ -206,12 +206,14 @@ public :
// unsubscribe to all chat group // unsubscribe to all chat group
void unsubscribeAllChatGroup(); void unsubscribeAllChatGroup();
void disableTranslation( const std::string &lang ); void disableSendTranslation( const std::string &lang );
void disableReceiveTranslation( const std::string &lang );
void resetDisabledTranslations(); void resetDisabledTranslations();
bool haveDisabledTranslation( const std::string &lang ); bool dontReceiveTranslation( const std::string &lang );
bool dontSendTranslation( const std::string &lang );
private : private :
/// CLient datasetrow /// CLient datasetrow
TDataSetRow _DataSetIndex; TDataSetRow _DataSetIndex;
/// client character id /// client character id
@ -275,7 +277,8 @@ private :
/// keep infos about which string has been received by the client /// keep infos about which string has been received by the client
std::vector<bool> _KnownStrings; std::vector<bool> _KnownStrings;
std::vector<std::string> _DontTranslate; std::vector<std::string> _DontReceiveTranslation;
std::vector<std::string> _DontSendTranslation;
/** /**
* Update the audience of this client * Update the audience of this client

@ -552,6 +552,9 @@ void CChatManager::chat( const TDataSetRow& sender, const ucstring& ucstr )
TClientInfoCont::iterator itCl = _Clients.find( sender ); TClientInfoCont::iterator itCl = _Clients.find( sender );
if( itCl != _Clients.end() ) if( itCl != _Clients.end() )
{ {
CChatManager &cm = IOS->getChatManager();
CChatClient &senderClient = cm.getClient(sender);
// if( itCl->second->isMuted() ) // if( itCl->second->isMuted() )
CEntityId eid = TheDataset.getEntityId(sender); CEntityId eid = TheDataset.getEntityId(sender);
if(_MutedUsers.find( eid ) != _MutedUsers.end()) if(_MutedUsers.find( eid ) != _MutedUsers.end())
@ -603,6 +606,8 @@ void CChatManager::chat( const TDataSetRow& sender, const ucstring& ucstr )
// clean up container // clean up container
_DestUsers.clear(); _DestUsers.clear();
string senderLang = SM->getLanguageCodeString(ci->Language);
switch( itCl->second->getChatMode() ) switch( itCl->second->getChatMode() )
{ {
// dynamic group // dynamic group
@ -617,8 +622,6 @@ void CChatManager::chat( const TDataSetRow& sender, const ucstring& ucstr )
bool have_es = false; bool have_es = false;
CChatGroup::TMemberCont::iterator itA; CChatGroup::TMemberCont::iterator itA;
string sender_lang = SM->getLanguageCodeString(ci->Language);
for( itA = itCl->second->getAudience().Members.begin(); for( itA = itCl->second->getAudience().Members.begin();
itA != itCl->second->getAudience().Members.end(); itA != itCl->second->getAudience().Members.end();
++itA ) ++itA )
@ -639,16 +642,12 @@ void CChatManager::chat( const TDataSetRow& sender, const ucstring& ucstr )
receiver_lang = SM->getLanguageCodeString(co->Language); receiver_lang = SM->getLanguageCodeString(co->Language);
} }
if (EnableDeepL) if (EnableDeepL && !senderClient.dontSendTranslation(senderLang))
{ {
CChatClient &client = getClient(*itA); CChatClient &client = getClient(*itA);
if (sender_lang == "wk") if (senderLang == "wk")
receiver_lang = sender_lang; receiver_lang = senderLang;
if (ucstr[0] != '>' && client.haveDisabledTranslation(sender_lang))
receiver_lang = sender_lang;
if (ucstr[0] == '>') // Sent directly when prefixed by '>', it's the anti-translation code if (ucstr[0] == '>') // Sent directly when prefixed by '>', it's the anti-translation code
{ {
@ -656,7 +655,7 @@ void CChatManager::chat( const TDataSetRow& sender, const ucstring& ucstr )
{ {
string usedlang = ucstr.toString().substr(2, 2); string usedlang = ucstr.toString().substr(2, 2);
//nlinfo("used: %s, user: %s", usedlang.c_str(), receiver_lang.c_str()); //nlinfo("used: %s, user: %s", usedlang.c_str(), receiver_lang.c_str());
if (usedlang == receiver_lang && !client.haveDisabledTranslation(sender_lang)) if (usedlang == receiver_lang && !client.dontReceiveTranslation(usedlang))
sendChat( itCl->second->getChatMode(), *itA, ucstr.substr(5), sender ); sendChat( itCl->second->getChatMode(), *itA, ucstr.substr(5), sender );
} }
else else
@ -664,7 +663,7 @@ void CChatManager::chat( const TDataSetRow& sender, const ucstring& ucstr )
sendChat( itCl->second->getChatMode(), *itA, ucstr.substr(1), sender ); sendChat( itCl->second->getChatMode(), *itA, ucstr.substr(1), sender );
} }
} }
else if (sender_lang == receiver_lang) // Sent directly if sender and receiver uses same lang else if (senderLang == receiver_lang || client.dontReceiveTranslation(senderLang)) // Sent directly if sender and receiver uses same lang
{ {
sendChat( itCl->second->getChatMode(), *itA, ucstr, sender ); sendChat( itCl->second->getChatMode(), *itA, ucstr, sender );
} }
@ -687,7 +686,7 @@ void CChatManager::chat( const TDataSetRow& sender, const ucstring& ucstr )
sendChat( itCl->second->getChatMode(), *itA, ucstr, sender ); sendChat( itCl->second->getChatMode(), *itA, ucstr, sender );
} }
string langs = sender_lang; string langs = senderLang;
if (have_fr) if (have_fr)
langs += "-fr"; langs += "-fr";
if (have_de) if (have_de)
@ -716,11 +715,12 @@ void CChatManager::chat( const TDataSetRow& sender, const ucstring& ucstr )
if (EnableDeepL) if (EnableDeepL)
{ {
string sender_lang = SM->getLanguageCodeString(ci->Language);
if (ucstr[0] == '>') // Sent directly when prefixed by '>', it's the anti-translation code if (ucstr[0] == '>') // Sent directly when prefixed by '>', it's the anti-translation code
chatInGroup( grpId, ucstr.substr(1), sender ); chatInGroup( grpId, ucstr.substr(1), sender );
else if (senderClient.dontSendTranslation(senderLang))
chatInGroup( grpId, ucstr, sender );
else else
_Log.displayNL("region:%s|%s|*|%s-*|%s", grpId.toString().c_str(), fullName.c_str(), sender_lang.c_str(), ucstr.toString().c_str() ); _Log.displayNL("region:%s|%s|*|%s-*|%s", grpId.toString().c_str(), fullName.c_str(), senderLang.c_str(), ucstr.toUtf8().c_str() );
} }
else else
chatInGroup( grpId, ucstr, sender ); chatInGroup( grpId, ucstr, sender );
@ -761,14 +761,16 @@ void CChatManager::chat( const TDataSetRow& sender, const ucstring& ucstr )
bool sendToMongo = true; bool sendToMongo = true;
bool sendToAllUni = false; bool sendToAllUni = false;
string autosub = "1"; string autoSub = "1";
uint8 startPos = 0; uint8 startPos = 0;
string mongoText = ucstr.toUtf8(); string mongoText = ucstr.toUtf8();
string chatId = "all"; string chatId = "all";
string chatType = "univers"; string chatType = "univers";
string usedlang = SM->getLanguageCodeString(ci->Language);
if (EnableDeepL)
string usedlang = senderLang;
if (EnableDeepL && !senderClient.dontSendTranslation(senderLang))
{ {
chatType = "dynamic"; chatType = "dynamic";
if (ucstr[0] == '>') // Sent directly when prefixed by '>', it's the anti-translation code if (ucstr[0] == '>') // Sent directly when prefixed by '>', it's the anti-translation code
@ -788,7 +790,7 @@ void CChatManager::chat( const TDataSetRow& sender, const ucstring& ucstr )
source_lang = mongoText.substr(6, 2); source_lang = mongoText.substr(6, 2);
string sourceText = mongoText.substr(9, endOfOriginal-9); string sourceText = mongoText.substr(9, endOfOriginal-9);
strFindReplace(sourceText, ")", "}"); strFindReplace(sourceText, ")", "}");
mongoText = "["+source_lang+"](http://chatdev.ryzom.com/channel/pub-universe-"+source_lang+"? "+sourceText+") "+mongoText.substr(endOfOriginal+4, mongoText.size()-endOfOriginal-4); mongoText = "["+source_lang+"](http://chat.ryzom.com/channel/pub-universe-"+source_lang+"? "+sourceText+") "+mongoText.substr(endOfOriginal+4, mongoText.size()-endOfOriginal-4);
} }
else else
{ {
@ -796,14 +798,14 @@ void CChatManager::chat( const TDataSetRow& sender, const ucstring& ucstr )
mongoText = mongoText.substr(4, mongoText.size()-4); mongoText = mongoText.substr(4, mongoText.size()-4);
} }
if (source_lang == "en") // in RC the icon are :us: if (source_lang == "en") // in RC the icon are :gb:
mongoText = ":us:"+mongoText; mongoText = ":gb:"+mongoText;
else else
mongoText = ":"+source_lang+":"+mongoText; mongoText = ":"+source_lang+":"+mongoText;
chatId = "FACTION_"+toUpper(usedlang); chatId = "FACTION_"+toUpper(usedlang);
if (usedlang != SM->getLanguageCodeString(ci->Language)) if (usedlang != SM->getLanguageCodeString(ci->Language))
autosub = "0"; autoSub = "0";
} }
else else
@ -813,8 +815,7 @@ void CChatManager::chat( const TDataSetRow& sender, const ucstring& ucstr )
} }
else else
{ {
string sender_lang = SM->getLanguageCodeString(ci->Language); _Log.displayNL("%s|%s|*|%s-*|%s", "universe", fullName.c_str(), senderLang.c_str(), ucstr.toUtf8().c_str());
_Log.displayNL("%s|%s|*|%s-*|%s", "universe", fullName.c_str(), sender_lang.c_str(), ucstr.toUtf8().c_str());
sendToMongo = false; sendToMongo = false;
} }
} }
@ -826,15 +827,14 @@ void CChatManager::chat( const TDataSetRow& sender, const ucstring& ucstr )
{ {
if (sendToAllUni) if (sendToAllUni)
{ {
string userlang = SM->getLanguageCodeString(ci->Language); CMongo::insert("ryzom_chats", toString("{ 'username': '%s', 'chat': '%s', 'chatType': '%s', 'chatId': 'FACTION_EN', 'date': %f, 'ig': true, 'autoSub': %s }", CMongo::quote(fullName).c_str(), CMongo::quote(mongoText).c_str(), chatType.c_str(), date, senderLang == "en"?"1":"0"));
CMongo::insert("ryzom_chats", toString("{ 'username': '%s', 'chat': '%s', 'chatType': '%s', 'chatId': 'FACTION_EN', 'date': %f, 'ig': true, 'autosub': %s }", CMongo::quote(fullName).c_str(), CMongo::quote(mongoText).c_str(), chatType.c_str(), date, userlang == "en"?"1":"0")); CMongo::insert("ryzom_chats", toString("{ 'username': '%s', 'chat': '%s', 'chatType': '%s', 'chatId': 'FACTION_DE', 'date': %f, 'ig': true, 'autoSub': %s }", CMongo::quote(fullName).c_str(), CMongo::quote(mongoText).c_str(), chatType.c_str(), date, senderLang == "de"?"1":"0"));
CMongo::insert("ryzom_chats", toString("{ 'username': '%s', 'chat': '%s', 'chatType': '%s', 'chatId': 'FACTION_DE', 'date': %f, 'ig': true, 'autosub': %s }", CMongo::quote(fullName).c_str(), CMongo::quote(mongoText).c_str(), chatType.c_str(), date, userlang == "de"?"1":"0")); CMongo::insert("ryzom_chats", toString("{ 'username': '%s', 'chat': '%s', 'chatType': '%s', 'chatId': 'FACTION_ES', 'date': %f, 'ig': true, 'autoSub': %s }", CMongo::quote(fullName).c_str(), CMongo::quote(mongoText).c_str(), chatType.c_str(), date, senderLang == "es"?"1":"0"));
CMongo::insert("ryzom_chats", toString("{ 'username': '%s', 'chat': '%s', 'chatType': '%s', 'chatId': 'FACTION_ES', 'date': %f, 'ig': true, 'autosub': %s }", CMongo::quote(fullName).c_str(), CMongo::quote(mongoText).c_str(), chatType.c_str(), date, userlang == "es"?"1":"0")); CMongo::insert("ryzom_chats", toString("{ 'username': '%s', 'chat': '%s', 'chatType': '%s', 'chatId': 'FACTION_FR', 'date': %f, 'ig': true, 'autoSub': %s }", CMongo::quote(fullName).c_str(), CMongo::quote(mongoText).c_str(), chatType.c_str(), date, senderLang == "fr"?"1":"0"));
CMongo::insert("ryzom_chats", toString("{ 'username': '%s', 'chat': '%s', 'chatType': '%s', 'chatId': 'FACTION_FR', 'date': %f, 'ig': true, 'autosub': %s }", CMongo::quote(fullName).c_str(), CMongo::quote(mongoText).c_str(), chatType.c_str(), date, userlang == "fr"?"1":"0")); CMongo::insert("ryzom_chats", toString("{ 'username': '%s', 'chat': '%s', 'chatType': '%s', 'chatId': 'FACTION_RU', 'date': %f, 'ig': true, 'autoSub': %s }", CMongo::quote(fullName).c_str(), CMongo::quote(mongoText).c_str(), chatType.c_str(), date, senderLang == "ru"?"1":"0"));
CMongo::insert("ryzom_chats", toString("{ 'username': '%s', 'chat': '%s', 'chatType': '%s', 'chatId': 'FACTION_RU', 'date': %f, 'ig': true, 'autosub': %s }", CMongo::quote(fullName).c_str(), CMongo::quote(mongoText).c_str(), chatType.c_str(), date, userlang == "ru"?"1":"0"));
} }
else else
CMongo::insert("ryzom_chats", toString("{ 'username': '%s', 'chat': '%s', 'chatType': '%s', 'chatId': '%s', 'date': %f, 'ig': true, 'autosub': %s }", CMongo::quote(fullName).c_str(), CMongo::quote(mongoText).c_str(), chatType.c_str(), chatId.c_str(), date, autosub.c_str())); CMongo::insert("ryzom_chats", toString("{ 'username': '%s', 'chat': '%s', 'chatType': '%s', 'chatId': '%s', 'date': %f, 'ig': true, 'autoSub': %s }", CMongo::quote(fullName).c_str(), CMongo::quote(mongoText).c_str(), chatType.c_str(), chatId.c_str(), date, autoSub.c_str()));
} }
#endif #endif
@ -866,7 +866,7 @@ void CChatManager::chat( const TDataSetRow& sender, const ucstring& ucstr )
double date = 1000.0*(double)CTime::getSecondsSince1970(); double date = 1000.0*(double)CTime::getSecondsSince1970();
#ifdef HAVE_MONGO #ifdef HAVE_MONGO
CMongo::insert("ryzom_chats", toString("{ 'username': '%s', 'chat': '%s', 'chatType': 'guildId', 'chatId': '%s', 'date': %f, 'ig': true, 'autosub': 1 }", CMongo::quote(fullName).c_str(), CMongo::quote(ucstr.toUtf8()).c_str(), sGuildId.str().c_str(), date)); CMongo::insert("ryzom_chats", toString("{ 'username': '%s', 'chat': '%s', 'chatType': 'guildId', 'chatId': '%s', 'date': %f, 'ig': true, 'autoSub': 1 }", CMongo::quote(fullName).c_str(), CMongo::quote(ucstr.toUtf8()).c_str(), sGuildId.str().c_str(), date));
#endif #endif
chatInGroup( grpId, ucstr, sender ); chatInGroup( grpId, ucstr, sender );
} }
@ -892,158 +892,186 @@ void CChatManager::chat( const TDataSetRow& sender, const ucstring& ucstr )
} }
} }
const std::string *tmpChatId = _ChanNames.getB(chanId); const std::string *tmpChatId = _ChanNames.getB(chanId);
string chatId; string chatId;
if (tmpChatId) if (tmpChatId)
chatId = *tmpChatId; chatId = *tmpChatId;
double date = 1000.0*(double)CTime::getSecondsSince1970(); double date = 1000.0*(double)CTime::getSecondsSince1970();
bool sendToMongo = true;
bool sendToAllForge = false;
uint8 startPos = 0;
string mongoText = ucstr.toUtf8(); string mongoText = ucstr.toUtf8();
string usedlang = "";
string autosub = "0";
if (EnableDeepL) bool sendMessages = true;
{ bool sendToAllForge = false;
if (ucstr[0] == '>') // Sent directly when prefixed by '>', it's the anti-translation code bool haveOriginMessage = false;
uint8 startPos = 0;
string originLang = senderLang;
string translatedLang = "";
string autoSub = "0";
if (EnableDeepL)
{ {
startPos = 1; if (senderClient.dontSendTranslation(senderLang))
mongoText = mongoText.substr(1);
string::size_type endOfOriginal = mongoText.find("}@{");
if (mongoText.size() > 4 && mongoText[0] == ':' && mongoText[3] == ':')
{ {
startPos = 5; sendToAllForge = true;
usedlang = mongoText.substr(1, 2); }
string source_lang = usedlang; else if (ucstr[0] == '>') // Sent directly when prefixed by '>', it's the anti-translation code
{
if (endOfOriginal != string::npos) startPos = 1;
{ mongoText = mongoText.substr(1);
if (mongoText.size() > 9) string::size_type endOfOriginal = mongoText.find("}@{");
source_lang = mongoText.substr(6, 2); if (mongoText.size() > 4 && mongoText[0] == ':' && mongoText[3] == ':')
string sourceText = mongoText.substr(9, endOfOriginal-9);
strFindReplace(sourceText, ")", "}");
mongoText = "["+source_lang+"](http://chatdev.ryzom.com/channel/pub-forge-"+source_lang+"? "+sourceText+") "+mongoText.substr(endOfOriginal+4, mongoText.size()-endOfOriginal-4);
}
else
{ {
usedlang = mongoText.substr(1, 2); startPos = 5;
mongoText = mongoText.substr(4, mongoText.size()-4); translatedLang = mongoText.substr(1, 2);
if (endOfOriginal != string::npos)
{
haveOriginMessage = true;
if (mongoText.size() > 9)
originLang = mongoText.substr(6, 2);
string originText = mongoText.substr(9, endOfOriginal-9);
strFindReplace(originText, ")", "}");
mongoText = "["+originLang+"](http://chat.ryzom.com/channel/pub-forge-"+originLang+"? "+originText+") "+mongoText.substr(endOfOriginal+4, mongoText.size()-endOfOriginal-4);
}
else
{
originLang = translatedLang;
mongoText = mongoText.substr(4, mongoText.size()-4);
}
if (originLang == "en") // in RC the icon are :gb:
mongoText = ":gb:"+mongoText;
else
mongoText = ":"+originLang+":"+mongoText;
} }
else if (chatId == "FACTION_RF") // Only when it's a not translated text
sendToAllForge = true;
if (source_lang == "en") // in RC the icon are :us:
mongoText = ":us:"+mongoText;
else
mongoText = ":"+source_lang+":"+mongoText;
} }
else if (chatId == "FACTION_RF") // Send for translation
sendToAllForge = true; else if (chatId == "FACTION_RF" || chatId == "FACTION_EN" || chatId == "FACTION_DE" || chatId == "FACTION_FR" || chatId == "FACTION_ES" || chatId == "FACTION_RU")
{
} _Log.displayNL("%s|%s|*|%s-*|%s", string("#"+chatId).c_str(), fullName.c_str(), senderLang.c_str(), ucstr.toUtf8().c_str());
else if (chatId == "FACTION_RF" || chatId == "FACTION_EN" || chatId == "FACTION_DE" || chatId == "FACTION_FR" || chatId == "FACTION_ES" || chatId == "FACTION_RU") sendMessages = false; // We need translated it before
{ }
usedlang = SM->getLanguageCodeString(ci->Language);
_Log.displayNL("%s|%s|*|%s-*|%s", string("#"+chatId).c_str(), fullName.c_str(), usedlang.c_str(), ucstr.toUtf8().c_str());
sendToMongo = false;
} }
}
#ifdef HAVE_MONGO if (sendMessages) // only send to mongo if it's not a message to translate
if (sendToMongo) // only send to mongo if it's not a translated message
{ {
string userlang = SM->getLanguageCodeString(ci->Language); #ifdef HAVE_MONGO
if (sendToAllForge) if (sendToAllForge)
{ {
CMongo::insert("ryzom_chats", toString("{ 'username': '%s', 'chat': '%s', 'chatType': 'dynamic', 'chatId': 'FACTION_RF-EN', 'date': %f, 'ig': true, 'autosub': %s }", CMongo::quote(fullName).c_str(), CMongo::quote(mongoText).c_str(), date, userlang == "en"?"1":"0")); CMongo::insert("ryzom_chats", toString("{ 'username': '%s', 'chat': '%s', 'chatType': 'dynamic', 'chatId': 'FACTION_RF-EN', 'date': %f, 'ig': true, 'autoSub': %s }", CMongo::quote(fullName).c_str(), CMongo::quote(mongoText).c_str(), date, senderLang == "en"?"1":"0"));
CMongo::insert("ryzom_chats", toString("{ 'username': '%s', 'chat': '%s', 'chatType': 'dynamic', 'chatId': 'FACTION_RF-DE', 'date': %f, 'ig': true, 'autosub': %s }", CMongo::quote(fullName).c_str(), CMongo::quote(mongoText).c_str(), date, userlang == "de"?"1":"0")); CMongo::insert("ryzom_chats", toString("{ 'username': '%s', 'chat': '%s', 'chatType': 'dynamic', 'chatId': 'FACTION_RF-DE', 'date': %f, 'ig': true, 'autoSub': %s }", CMongo::quote(fullName).c_str(), CMongo::quote(mongoText).c_str(), date, senderLang == "de"?"1":"0"));
CMongo::insert("ryzom_chats", toString("{ 'username': '%s', 'chat': '%s', 'chatType': 'dynamic', 'chatId': 'FACTION_RF-ES', 'date': %f, 'ig': true, 'autosub': %s }", CMongo::quote(fullName).c_str(), CMongo::quote(mongoText).c_str(), date, userlang == "es"?"1":"0")); CMongo::insert("ryzom_chats", toString("{ 'username': '%s', 'chat': '%s', 'chatType': 'dynamic', 'chatId': 'FACTION_RF-ES', 'date': %f, 'ig': true, 'autoSub': %s }", CMongo::quote(fullName).c_str(), CMongo::quote(mongoText).c_str(), date, senderLang == "es"?"1":"0"));
CMongo::insert("ryzom_chats", toString("{ 'username': '%s', 'chat': '%s', 'chatType': 'dynamic', 'chatId': 'FACTION_RF-FR', 'date': %f, 'ig': true, 'autosub': %s }", CMongo::quote(fullName).c_str(), CMongo::quote(mongoText).c_str(), date, userlang == "fr"?"1":"0")); CMongo::insert("ryzom_chats", toString("{ 'username': '%s', 'chat': '%s', 'chatType': 'dynamic', 'chatId': 'FACTION_RF-FR', 'date': %f, 'ig': true, 'autoSub': %s }", CMongo::quote(fullName).c_str(), CMongo::quote(mongoText).c_str(), date, senderLang == "fr"?"1":"0"));
CMongo::insert("ryzom_chats", toString("{ 'username': '%s', 'chat': '%s', 'chatType': 'dynamic', 'chatId': 'FACTION_RF-RU', 'date': %f, 'ig': true, 'autosub': %s }", CMongo::quote(fullName).c_str(), CMongo::quote(mongoText).c_str(), date, userlang == "ru"?"1":"0")); CMongo::insert("ryzom_chats", toString("{ 'username': '%s', 'chat': '%s', 'chatType': 'dynamic', 'chatId': 'FACTION_RF-RU', 'date': %f, 'ig': true, 'autoSub': %s }", CMongo::quote(fullName).c_str(), CMongo::quote(mongoText).c_str(), date, senderLang == "ru"?"1":"0"));
} }
else else
{ {
if (chatId == "FACTION_RF") if (chatId == "FACTION_RF")
chatId = "FACTION_RF-"+toUpper(usedlang); {
CMongo::insert("ryzom_chats", toString("{ 'username': '%s', 'chat': '%s', 'chatType': 'dynamic', 'chatId': '%s', 'date': %f, 'ig': true, 'autosub': %s }", CMongo::quote(fullName).c_str(), CMongo::quote(mongoText).c_str(), chatId.c_str(), date, userlang == usedlang?"1":"0")); if (translatedLang.empty())
chatId = "FACTION_RF-"+toUpper(senderLang);
else
chatId = "FACTION_RF-"+toUpper(translatedLang);
}
CMongo::insert("ryzom_chats", toString("{ 'username': '%s', 'chat': '%s', 'chatType': 'dynamic', 'chatId': '%s', 'date': %f, 'ig': true, 'autoSub': %s }", CMongo::quote(fullName).c_str(), CMongo::quote(mongoText).c_str(), chatId.c_str(), date, (translatedLang.empty() || translatedLang == senderLang)?"1":"0"));
} }
}
#endif #endif
if (!session->getChan()->getDontBroadcastPlayerInputs() && startPos != 0) if (!session->getChan()->getDontBroadcastPlayerInputs())
{ {
// add msg to the historic // add msg to the historic
CDynChatChan::CHistoricEntry entry; CDynChatChan::CHistoricEntry entry;
entry.String = ucstr; entry.String = ucstr;
if (ci != NULL) if (ci != NULL)
entry.SenderString = ci->Name; entry.SenderString = ci->Name;
else else
entry.SenderString = ""; entry.SenderString = "";
session->getChan()->Historic.push(entry); session->getChan()->Historic.push(entry);
ucstring content; ucstring content;
if (!session->getChan()->HideBubble) if (!session->getChan()->HideBubble)
{ //normal case { //normal case
content = ucstr; content = ucstr;
}
else
{
// true for control channel (Ring)
ucstring tmp("{no_bubble}");
if (ucstr.find(tmp) == ucstring::npos)
{
tmp += ucstr;
content.swap(tmp);
} }
else else
{ {
content = ucstr; // true for control channel (Ring)
ucstring tmp("{no_bubble}");
if (ucstr.find(tmp) == ucstring::npos)
{
tmp += ucstr;
content.swap(tmp);
}
else
{
content = ucstr;
}
} }
}
// broadcast to other client in the channel // broadcast to other client in the channel
CDynChatSession *dcc = session->getChan()->getFirstSession(); CDynChatSession *dcc = session->getChan()->getFirstSession();
while (dcc) while (dcc)
{
NLMISC::CEntityId receiverId = TheDataset.getEntityId(dcc->getClient()->getID());
CCharacterInfos* co = IOS->getCharInfos(receiverId);
CChatClient &receiverClient = getClient(dcc->getClient()->getID());
bool canSendChat = true;
if (EnableDeepL)
{
if (receiverClient.dontReceiveTranslation(originLang))
{
if (haveOriginMessage) // Only send untranslated message
canSendChat = false;
}
else if (!translatedLang.empty() && translatedLang != SM->getLanguageCodeString(co->Language))
canSendChat = false;
}
if (canSendChat)
sendChat(itCl->second->getChatMode(), dcc->getClient()->getID(), content.substr(startPos), sender, chanId);
dcc = dcc->getNextChannelSession(); // next session in this channel
}
}
else
{ {
NLMISC::CEntityId receiverId = TheDataset.getEntityId(dcc->getClient()->getID()); // only send an echo to the sender
CCharacterInfos* co = IOS->getCharInfos(receiverId); if (!EnableDeepL) // only send an echo to the sender
if (!EnableDeepL || usedlang.empty() || usedlang == SM->getLanguageCodeString(co->Language)) sendChat(itCl->second->getChatMode(), itCl->first, ucstr, sender, chanId);
sendChat(itCl->second->getChatMode(), dcc->getClient()->getID(), content.substr(startPos), sender, chanId);
dcc = dcc->getNextChannelSession(); // next session in this channel
} }
}
else
{
// only send an echo to the sender
if (!EnableDeepL || usedlang.empty()) // only send an echo to the sender
sendChat(itCl->second->getChatMode(), itCl->first, ucstr, sender, chanId);
}
if (session->getChan()->getForwardPlayerIntputToOwnerService()) if (session->getChan()->getForwardPlayerIntputToOwnerService())
{ {
// send player input to service owner // send player input to service owner
NLNET::TServiceId serviceId(chanId.getCreatorId()); NLNET::TServiceId serviceId(chanId.getCreatorId());
TPlayerInputForward pif; TPlayerInputForward pif;
pif.ChanID = chanId; pif.ChanID = chanId;
pif.Sender = sender; pif.Sender = sender;
pif.Content = ucstr; pif.Content = ucstr;
CMessage msgout( "DYN_CHAT:FORWARD"); CMessage msgout( "DYN_CHAT:FORWARD");
msgout.serial(pif); msgout.serial(pif);
CUnifiedNetwork::getInstance()->send(serviceId, msgout); CUnifiedNetwork::getInstance()->send(serviceId, msgout);
} }
if (session->getChan()->getUnifiedChannel())
{ if (session->getChan()->getUnifiedChannel())
// send the text to other shards {
if (IChatUnifierClient::getInstance()) // send the text to other shards
IChatUnifierClient::getInstance()->sendUnifiedDynChat(session->getChan()->getID(), senderName, ucstr); if (IChatUnifierClient::getInstance())
IChatUnifierClient::getInstance()->sendUnifiedDynChat(session->getChan()->getID(), senderName, ucstr);
}
} }
} }
} }
@ -1098,13 +1126,22 @@ void CChatManager::chatInGroup( TGroupId& grpId, const ucstring& ucstr, const TD
list<CEntityId> logDest; list<CEntityId> logDest;
uint8 startPos = 0; uint8 startPos = 0;
string usedlang; string usedlang = "";
if (EnableDeepL && ucstr.length() > 4 && ucstr[0] == ':' && ucstr[3] == ':') // check lang prefix string str = ucstr.toString();
if (EnableDeepL && str.length() > 4 && str[0] == ':' && str[3] == ':') // check lang prefix
{ {
usedlang = ucstr.toString().substr(1, 2); usedlang = str.substr(1, 2);
startPos = 4; startPos = 4;
} }
bool areOriginal = true;
string originLang = usedlang;
if (EnableDeepL && str.length() > 8 && str[4] == '{' && str[5] == ':' && str[8] == ':') // check lang origin
{
areOriginal = false;
originLang = str.substr(6, 2);
}
for( itM = chatGrp.Members.begin(); itM != chatGrp.Members.end(); ++itM ) for( itM = chatGrp.Members.begin(); itM != chatGrp.Members.end(); ++itM )
{ {
CMirrorPropValueRO<uint32> instanceId( TheDataset, *itM, DSPropertyAI_INSTANCE ); CMirrorPropValueRO<uint32> instanceId( TheDataset, *itM, DSPropertyAI_INSTANCE );
@ -1113,7 +1150,14 @@ void CChatManager::chatInGroup( TGroupId& grpId, const ucstring& ucstr, const TD
{ {
NLMISC::CEntityId receiverId = TheDataset.getEntityId(*itM); NLMISC::CEntityId receiverId = TheDataset.getEntityId(*itM);
CCharacterInfos* co = IOS->getCharInfos(receiverId); CCharacterInfos* co = IOS->getCharInfos(receiverId);
if (usedlang != SM->getLanguageCodeString(co->Language)) CChatClient &client = getClient(*itM);
if (client.dontReceiveTranslation(originLang))
{
if (!areOriginal)
continue;
}
else if (usedlang != SM->getLanguageCodeString(co->Language))
continue; continue;
} }
@ -1907,7 +1951,7 @@ void CChatManager::sendFarChat(const string &name, const ucstring& ucstr, const
source_lang = mongoText.substr(6, 2); source_lang = mongoText.substr(6, 2);
string sourceText = mongoText.substr(9, endOfOriginal-9); string sourceText = mongoText.substr(9, endOfOriginal-9);
strFindReplace(sourceText, ")", "}"); strFindReplace(sourceText, ")", "}");
mongoText = "["+source_lang+"](http://chatdev.ryzom.com/channel/"+rc_channel+source_lang+"? "+sourceText+") "+mongoText.substr(endOfOriginal+4, mongoText.size()-endOfOriginal-4); mongoText = "["+source_lang+"](http://chat.ryzom.com/channel/"+rc_channel+source_lang+"? "+sourceText+") "+mongoText.substr(endOfOriginal+4, mongoText.size()-endOfOriginal-4);
} }
else else
{ {
@ -1916,8 +1960,8 @@ void CChatManager::sendFarChat(const string &name, const ucstring& ucstr, const
} }
if (source_lang == "en") // in RC the icon are :us: if (source_lang == "en") // in RC the icon are :gb:
mongoText = ":us:"+mongoText; mongoText = ":gb:"+mongoText;
else else
mongoText = ":"+source_lang+":"+mongoText; mongoText = ":"+source_lang+":"+mongoText;

@ -65,7 +65,7 @@ void cbImpulsionReadyString( CMessage& msgin, const string &serviceName, TServic
msgin.serial(sender); msgin.serial(sender);
msgin.serial(nbBitsToSkip); msgin.serial(nbBitsToSkip);
msgin.serialMemStream(bms); msgin.serialMemStream(bms);
// Unpack bitmemstream // Unpack bitmemstream
uint32 xmlcode; uint32 xmlcode;
bms.serial(xmlcode, nbBitsToSkip); // the XML code was already read by tbe sender service bms.serial(xmlcode, nbBitsToSkip); // the XML code was already read by tbe sender service
@ -179,7 +179,7 @@ void cbImpulsionChatTeam( CMessage& msgin, const string &serviceName, TServiceId
} }
try try
{ {
TDataSetRow senderRow = TheDataset.getDataSetRow(sender); TDataSetRow senderRow = TheDataset.getDataSetRow(sender);
// get current chat mode // get current chat mode
const CChatGroup::TGroupType chatModeBck = IOS->getChatManager().getClient(senderRow).getChatMode(); const CChatGroup::TGroupType chatModeBck = IOS->getChatManager().getClient(senderRow).getChatMode();
@ -189,7 +189,7 @@ void cbImpulsionChatTeam( CMessage& msgin, const string &serviceName, TServiceId
// send the message // send the message
IOS->getChatManager().chat( senderRow, ucstr ); IOS->getChatManager().chat( senderRow, ucstr );
// reset chat mode to old value // reset chat mode to old value
IOS->getChatManager().getClient(senderRow).setChatMode( chatModeBck ); IOS->getChatManager().getClient(senderRow).setChatMode( chatModeBck );
} }
catch(const Exception &e) catch(const Exception &e)
{ {
@ -240,19 +240,19 @@ void cbImpulsionTell( CMessage& msgin, const string &serviceName, TServiceId ser
static void updateIgnoreStatus(CMessage& msgin, const string &serviceName, TServiceId serviceId, bool ignored) static void updateIgnoreStatus(CMessage& msgin, const string &serviceName, TServiceId serviceId, bool ignored)
{ {
CEntityId senderId; CEntityId senderId;
CEntityId ignoredId; CEntityId ignoredId;
try try
{ {
msgin.serial(senderId); msgin.serial(senderId);
msgin.serial(ignoredId); msgin.serial(ignoredId);
IOS->getChatManager().getClient(TheDataset.getDataSetRow(senderId)).setIgnoreStatus(ignoredId, ignored); IOS->getChatManager().getClient(TheDataset.getDataSetRow(senderId)).setIgnoreStatus(ignoredId, ignored);
} }
catch(const Exception &e) catch(const Exception &e)
{ {
nlwarning("<impulsionIgnore> %s",e.what()); nlwarning("<impulsionIgnore> %s",e.what());
return; return;
} }
} }
//----------------------------------------------- //-----------------------------------------------
@ -261,7 +261,7 @@ static void updateIgnoreStatus(CMessage& msgin, const string &serviceName, TServ
//----------------------------------------------- //-----------------------------------------------
void cbImpulsionIgnore( CMessage& msgin, const string &serviceName, TServiceId serviceId ) void cbImpulsionIgnore( CMessage& msgin, const string &serviceName, TServiceId serviceId )
{ {
updateIgnoreStatus(msgin, serviceName, serviceId, true); updateIgnoreStatus(msgin, serviceName, serviceId, true);
} // impulsionIgnore // } // impulsionIgnore //
//----------------------------------------------- //-----------------------------------------------
@ -281,7 +281,7 @@ void cbImpulsionUnignoreAll( CMessage& msgin, const string &serviceName, TServic
{ {
CEntityId senderId; CEntityId senderId;
vector<CEntityId> ignoredIds; vector<CEntityId> ignoredIds;
try try
{ {
msgin.serial(senderId); msgin.serial(senderId);
@ -366,7 +366,7 @@ void cbImpulsionChatMode( CMessage& msgin, const string &serviceName, TServiceId
msgin.serial(sender); msgin.serial(sender);
uint8 chatMode; uint8 chatMode;
TChanID chanID; TChanID chanID;
try try
{ {
msgin.serial( chatMode ); msgin.serial( chatMode );
@ -393,8 +393,8 @@ void cbImpulsionChatMode( CMessage& msgin, const string &serviceName, TServiceId
IOS->getChatManager().getClient(TheDataset.getDataSetRow(sender)).setChatMode( static_cast<CChatGroup::TGroupType>(chatMode)); IOS->getChatManager().getClient(TheDataset.getDataSetRow(sender)).setChatMode( static_cast<CChatGroup::TGroupType>(chatMode));
nldebug("IOS: Chat mode --> %s", DebugChatModeName[chatMode]); nldebug("IOS: Chat mode --> %s", DebugChatModeName[chatMode]);
break; break;
case CChatGroup::dyn_chat: case CChatGroup::dyn_chat:
IOS->getChatManager().getClient(TheDataset.getDataSetRow(sender)).setChatMode( static_cast<CChatGroup::TGroupType>(chatMode), chanID); IOS->getChatManager().getClient(TheDataset.getDataSetRow(sender)).setChatMode( static_cast<CChatGroup::TGroupType>(chatMode), chanID);
break; break;
default: default:
if (chatMode < CChatGroup::nbChatMode) if (chatMode < CChatGroup::nbChatMode)
@ -542,7 +542,7 @@ static void cbChatMessage(CMessage& msgin, const string &serviceName, TServiceId
CChatGroup::TGroupType oldMode = IOS->getChatManager().getClient(entityId).getChatMode(); CChatGroup::TGroupType oldMode = IOS->getChatManager().getClient(entityId).getChatMode();
if ( oldMode != CChatGroup::say ) if ( oldMode != CChatGroup::say )
IOS->getChatManager().getClient(entityId).setChatMode(CChatGroup::say); IOS->getChatManager().getClient(entityId).setChatMode(CChatGroup::say);
IOS->getChatManager().getClient(entityId).updateAudience(); IOS->getChatManager().getClient(entityId).updateAudience();
IOS->getChatManager().chat( entityId, str ); IOS->getChatManager().chat( entityId, str );
@ -620,7 +620,7 @@ static void cbCharacterNameId(CMessage& msgin, const string &serviceName, TServi
{ {
// read character id // read character id
msgin.serial( chId ); msgin.serial( chId );
// character's string Id // character's string Id
msgin.serial( stringId ); msgin.serial( stringId );
} }
@ -630,7 +630,7 @@ static void cbCharacterNameId(CMessage& msgin, const string &serviceName, TServi
return; return;
} }
IOS->addCharacterName( chId, SM->getString( stringId ), TSessionId(0) ); IOS->addCharacterName( chId, SM->getString( stringId ), TSessionId(0) );
} // cbCharacterNameId // } // cbCharacterNameId //
//----------------------------------------------- //-----------------------------------------------
@ -777,7 +777,7 @@ static void cbAddNamedGroup( CMessage& msgin, const string &serviceName, TServic
IOS->getChatManager().addGroup( gId, (CChatGroup::TGroupType)gType, name ); IOS->getChatManager().addGroup( gId, (CChatGroup::TGroupType)gType, name );
if (VerboseChatManagement) if (VerboseChatManagement)
nldebug("IOS: cbAddGroup Adding named group %s with type '%s' as '%s'", nldebug("IOS: cbAddGroup Adding named group %s with type '%s' as '%s'",
gId.toString().c_str(), gId.toString().c_str(),
CChatGroup::groupTypeToString((CChatGroup::TGroupType)gType).c_str(), CChatGroup::groupTypeToString((CChatGroup::TGroupType)gType).c_str(),
name.c_str()); name.c_str());
@ -913,7 +913,7 @@ static void cbRemoveFromGroup( CMessage& msgin, const string &serviceName, TServ
// { // {
// try // try
// { // {
// if( IOS->getChatManager().getClient(clientInfos->DataSetIndex).knowString(entityInfos->OldNameIndex) == false ) // if( IOS->getChatManager().getClient(clientInfos->DataSetIndex).knowString(entityInfos->OldNameIndex) == false )
// { // {
// IOS->getChatManager().addDynStr( clientId, entityInfos->OldNameIndex, serviceId ); // IOS->getChatManager().addDynStr( clientId, entityInfos->OldNameIndex, serviceId );
// } // }
@ -1022,13 +1022,13 @@ void cbNpcTellEx( CMessage& msgin, const string &serviceName, TServiceId service
TDataSetRow sender; TDataSetRow sender;
TDataSetRow receiver; TDataSetRow receiver;
uint32 phraseId; uint32 phraseId;
msgin.serial(sender); msgin.serial(sender);
msgin.serial(receiver); msgin.serial(receiver);
msgin.serial(phraseId); msgin.serial(phraseId);
CChatManager &cm = IOS->getChatManager(); CChatManager &cm = IOS->getChatManager();
try try
{ {
// TDataSetRow dsr = TheDataset.getDataSetRow(sender); // TDataSetRow dsr = TheDataset.getDataSetRow(sender);
@ -1056,19 +1056,19 @@ void cbNpcChatEx( CMessage& msgin, const string &serviceName, TServiceId service
TDataSetRow sender; TDataSetRow sender;
CChatGroup::TGroupType type = CChatGroup::nbChatMode; CChatGroup::TGroupType type = CChatGroup::nbChatMode;
uint32 phraseId; uint32 phraseId;
msgin.serial(sender); msgin.serial(sender);
msgin.serialEnum(type); msgin.serialEnum(type);
msgin.serial(phraseId); msgin.serial(phraseId);
CChatManager &cm = IOS->getChatManager(); CChatManager &cm = IOS->getChatManager();
try try
{ {
// TDataSetRow dsr = TheDataset.getDataSetRow(sender); // TDataSetRow dsr = TheDataset.getDataSetRow(sender);
if (sender == INVALID_DATASET_ROW) if (sender == INVALID_DATASET_ROW)
{ {
nlwarning("cbNpcChatEx : ignoring chat because NPC %s:%x Invalid", nlwarning("cbNpcChatEx : ignoring chat because NPC %s:%x Invalid",
TheDataset.getEntityId(sender).toString().c_str(), TheDataset.getEntityId(sender).toString().c_str(),
sender.getIndex()); sender.getIndex());
return; return;
@ -1106,7 +1106,7 @@ void cbNpcChat( CMessage& msgin, const string &serviceName, TServiceId serviceId
// TDataSetRow dsr = TheDataset.getDataSetRow(sender); // TDataSetRow dsr = TheDataset.getDataSetRow(sender);
if ( !sender.isValid() || !TheDataset.isDataSetRowStillValid(sender) ) if ( !sender.isValid() || !TheDataset.isDataSetRowStillValid(sender) )
{ {
nlwarning("cbNpcChat : ignoring chat because NPC %x not yet/not anymore in mirror", nlwarning("cbNpcChat : ignoring chat because NPC %x not yet/not anymore in mirror",
sender.getIndex()); sender.getIndex());
return; return;
} }
@ -1153,7 +1153,7 @@ void cbNpcChatParam( CMessage& msgin, const string &serviceName, NLNET::TService
// TDataSetRow dsr = TheDataset.getDataSetRow(sender); // TDataSetRow dsr = TheDataset.getDataSetRow(sender);
if ( !sender.isValid() || !TheDataset.isDataSetRowStillValid(sender) ) if ( !sender.isValid() || !TheDataset.isDataSetRowStillValid(sender) )
{ {
nlwarning("cbNpcChat : ignoring chat because NPC %x not yet/not anymore in mirror", nlwarning("cbNpcChat : ignoring chat because NPC %x not yet/not anymore in mirror",
sender.getIndex()); sender.getIndex());
return; return;
} }
@ -1190,7 +1190,7 @@ void cbNpcChatSentence( CMessage& msgin, const string &serviceName, TServiceId s
// TDataSetRow dsr = TheDataset.getDataSetRow(sender); // TDataSetRow dsr = TheDataset.getDataSetRow(sender);
if ( !sender.isValid() || !TheDataset.isDataSetRowStillValid(sender) ) if ( !sender.isValid() || !TheDataset.isDataSetRowStillValid(sender) )
{ {
nlwarning("cbNpcChatSentence : ignoring chat because NPC %x not yet/not anymore in mirror", nlwarning("cbNpcChatSentence : ignoring chat because NPC %x not yet/not anymore in mirror",
sender.getIndex()); sender.getIndex());
return; return;
} }
@ -1247,7 +1247,7 @@ void cbNpcChatSentenceChannel( CMessage& msgin, const string &serviceName, TServ
msgin.serial(id); msgin.serial(id);
msgin.serial(sender); msgin.serial(sender);
msgin.serial(sentence); msgin.serial(sentence);
if(sender.isValid()) if(sender.isValid())
{ {
CChatManager &cm = IOS->getChatManager(); CChatManager &cm = IOS->getChatManager();
@ -1287,7 +1287,7 @@ void cbGroupDynString( CMessage& msgin, const string &serviceName, TServiceId se
nlwarning("cbGroupDynString : ignoring group message because entity %x not yet in mirror", sender.getIndex()); nlwarning("cbGroupDynString : ignoring group message because entity %x not yet in mirror", sender.getIndex());
return; return;
} }
list<CReceiver> receiverList; list<CReceiver> receiverList;
CChatClient &client = cm.getClient(sender); CChatClient &client = cm.getClient(sender);
@ -1297,7 +1297,7 @@ void cbGroupDynString( CMessage& msgin, const string &serviceName, TServiceId se
CChatGroup::TMemberCont::iterator itM; CChatGroup::TMemberCont::iterator itM;
for( itM = group.Members.begin(); itM != group.Members.end(); ++itM ) for( itM = group.Members.begin(); itM != group.Members.end(); ++itM )
{ {
const CEntityId &id = TheDataset.getEntityId(*itM); const CEntityId &id = TheDataset.getEntityId(*itM);
// skip it if excluded // skip it if excluded
if ( std::find(excluded.begin(), excluded.end(), id) != excluded.end() ) if ( std::find(excluded.begin(), excluded.end(), id) != excluded.end() )
@ -1317,7 +1317,7 @@ void cbGroupDynString( CMessage& msgin, const string &serviceName, TServiceId se
msgout.serialBufferWithSize((uint8*)bms.buffer(), bms.length()); msgout.serialBufferWithSize((uint8*)bms.buffer(), bms.length());
CUnifiedNetwork::getInstance()->send( TServiceId(id.getDynamicId()), msgout ); CUnifiedNetwork::getInstance()->send( TServiceId(id.getDynamicId()), msgout );
} }
} }
} }
catch(const CChatManager::EChatClient &) catch(const CChatManager::EChatClient &)
{ {
@ -1476,9 +1476,9 @@ void cbEmoteCrowd( CMessage& msgin, const string &serviceName, TServiceId servic
string phraseTextId; string phraseTextId;
TVectorParamCheck params; TVectorParamCheck params;
vector<TDataSetRow> ignored; vector<TDataSetRow> ignored;
CChatManager &cm = IOS->getChatManager(); CChatManager &cm = IOS->getChatManager();
try try
{ {
msgin.serial(sender); msgin.serial(sender);
@ -1534,9 +1534,9 @@ void cbCustomEmote( CMessage& msgin, const string &serviceName, TServiceId servi
{ {
TDataSetRow sender; TDataSetRow sender;
ucstring emoteCustomText; ucstring emoteCustomText;
CChatManager &cm = IOS->getChatManager(); CChatManager &cm = IOS->getChatManager();
try try
{ {
msgin.serial(sender); msgin.serial(sender);
@ -1544,7 +1544,7 @@ void cbCustomEmote( CMessage& msgin, const string &serviceName, TServiceId servi
// filter emote text // filter emote text
emoteCustomText = IOS->getChatManager().filterClientInputColorCode(emoteCustomText); emoteCustomText = IOS->getChatManager().filterClientInputColorCode(emoteCustomText);
// get the player // get the player
if ( sender == TDataSetRow::createFromRawIndex(INVALID_DATASET_ROW) ) if ( sender == TDataSetRow::createFromRawIndex(INVALID_DATASET_ROW) )
{ {
@ -1638,7 +1638,7 @@ void addSession(TDataSetRow client,TChanID chan,bool writeRight)
IOS->getChatManager().addClient( client ); IOS->getChatManager().addClient( client );
} }
CDynChatSession *session = IOS->getChatManager().getDynChat().addSession(chan, client); CDynChatSession *session = IOS->getChatManager().getDynChat().addSession(chan, client);
if (!session) if (!session)
{ {
nlwarning("Couldn't create session"); nlwarning("Couldn't create session");
return; return;
@ -1665,7 +1665,7 @@ void cbDynChatAddSession(CMessage& msgin, const string &serviceName, TServiceId
IOS->getChatManager().addClient( client ); IOS->getChatManager().addClient( client );
} }
CDynChatSession *session = IOS->getChatManager().getDynChat().addSession(chan, client); CDynChatSession *session = IOS->getChatManager().getDynChat().addSession(chan, client);
if (!session) if (!session)
{ {
nlwarning("Couldn't create session"); nlwarning("Couldn't create session");
return; return;
@ -1691,7 +1691,7 @@ void cbDynChatAddSessionWithName(CMessage& msgin, const string &serviceName, TSe
msgin.serial(chan); msgin.serial(chan);
msgin.serial(clientName); msgin.serial(clientName);
msgin.serial(writeRight); msgin.serial(writeRight);
if(chan.isUnknownId()) if(chan.isUnknownId())
{ {
nlwarning("unknown channel id! unable to add session!"); nlwarning("unknown channel id! unable to add session!");
@ -1707,7 +1707,7 @@ void cbDynChatAddSessionWithName(CMessage& msgin, const string &serviceName, TSe
IOS->getChatManager().addClient( client ); IOS->getChatManager().addClient( client );
CDynChatSession *session = IOS->getChatManager().getDynChat().addSession(chan, client); CDynChatSession *session = IOS->getChatManager().getDynChat().addSession(chan, client);
if (!session) if (!session)
{ {
nlwarning("Couldn't create session"); nlwarning("Couldn't create session");
return; return;
@ -1730,9 +1730,9 @@ void cbDynChatAddSessionWithName(CMessage& msgin, const string &serviceName, TSe
void cbDynChatRemoveSession(CMessage& msgin, const string &serviceName, TServiceId serviceId) void cbDynChatRemoveSession(CMessage& msgin, const string &serviceName, TServiceId serviceId)
{ {
TChanID chan; TChanID chan;
TDataSetRow client; TDataSetRow client;
msgin.serial(chan); msgin.serial(chan);
msgin.serial(client); msgin.serial(client);
bool res = IOS->getChatManager().getDynChat().removeSession(chan, client); bool res = IOS->getChatManager().getDynChat().removeSession(chan, client);
if (!res) nlwarning("Couldn't remove session"); if (!res) nlwarning("Couldn't remove session");
} }
@ -1745,7 +1745,7 @@ void cbDynChatRemoveSessionWithName(CMessage& msgin, const string &serviceName,
{ {
TChanID chan; TChanID chan;
ucstring clientName; ucstring clientName;
TDataSetRow client; TDataSetRow client;
msgin.serial(chan); msgin.serial(chan);
msgin.serial(clientName); msgin.serial(clientName);
CCharacterInfos* cInfo = IOS->getCharInfos(clientName); CCharacterInfos* cInfo = IOS->getCharInfos(clientName);
@ -1760,9 +1760,9 @@ void cbDynChatRemoveSessionWithName(CMessage& msgin, const string &serviceName,
return; return;
}*/ }*/
bool res = IOS->getChatManager().getDynChat().removeSession(chan, client); bool res = IOS->getChatManager().getDynChat().removeSession(chan, client);
if (!res) nlwarning("Couldn't remove session"); if (!res) nlwarning("Couldn't remove session");
} }
} }
//----------------------------------------------- //-----------------------------------------------
@ -1772,10 +1772,10 @@ void cbDynChatRemoveSessionWithName(CMessage& msgin, const string &serviceName,
void cbDynChatSetWriteRight(CMessage& msgin, const string &serviceName, TServiceId serviceId) void cbDynChatSetWriteRight(CMessage& msgin, const string &serviceName, TServiceId serviceId)
{ {
TChanID chan; TChanID chan;
TDataSetRow client; TDataSetRow client;
bool writeRight; bool writeRight;
msgin.serial(chan); msgin.serial(chan);
msgin.serial(client); msgin.serial(client);
msgin.serial(writeRight); msgin.serial(writeRight);
CDynChatSession *session = IOS->getChatManager().getDynChat().getSession(chan, client); CDynChatSession *session = IOS->getChatManager().getDynChat().getSession(chan, client);
if (!session) if (!session)
@ -1794,7 +1794,7 @@ void cbDynChatSetHistoricSize(CMessage& msgin, const string &serviceName, TServi
TChanID chanID; TChanID chanID;
uint32 historicSize; uint32 historicSize;
msgin.serial(chanID); msgin.serial(chanID);
msgin.serial(historicSize); msgin.serial(historicSize);
CDynChatChan *chan = IOS->getChatManager().getDynChat().getChan(chanID); CDynChatChan *chan = IOS->getChatManager().getDynChat().getChan(chanID);
if (!chan) if (!chan)
{ {
@ -1807,10 +1807,10 @@ void cbDynChatSetHideBubble(CMessage& msgin, const string &serviceName, TService
{ {
TChanID chanID; TChanID chanID;
bool hideBubble; bool hideBubble;
msgin.serial(chanID); msgin.serial(chanID);
msgin.serial(hideBubble); msgin.serial(hideBubble);
CChatManager &cm = IOS->getChatManager(); CChatManager &cm = IOS->getChatManager();
CDynChatChan *chan = cm.getDynChat().getChan(chanID); CDynChatChan *chan = cm.getDynChat().getChan(chanID);
if (!chan) if (!chan)
@ -1825,10 +1825,10 @@ void cbDynChatSetUniversalChannel(CMessage& msgin, const string &serviceName, TS
{ {
TChanID chanID; TChanID chanID;
bool universalChannel; bool universalChannel;
msgin.serial(chanID); msgin.serial(chanID);
msgin.serial(universalChannel); msgin.serial(universalChannel);
CChatManager &cm = IOS->getChatManager(); CChatManager &cm = IOS->getChatManager();
CDynChatChan *chan = cm.getDynChat().getChan(chanID); CDynChatChan *chan = cm.getDynChat().getChan(chanID);
if (!chan) if (!chan)
@ -1868,10 +1868,10 @@ void cbDynChatServiceChat(CMessage& msgin, const string &serviceName, TServiceId
if(!dcc) nlwarning(("nobody hears on channel "+chanID.toString()).c_str()); if(!dcc) nlwarning(("nobody hears on channel "+chanID.toString()).c_str());
while (dcc) while (dcc)
{ {
cm.sendChat(CChatGroup::dyn_chat, dcc->getClient()->getID(), text, TDataSetRow(), chanID, senderName); cm.sendChat(CChatGroup::dyn_chat, dcc->getClient()->getID(), text, TDataSetRow(), chanID, senderName);
dcc = dcc->getNextChannelSession(); // next session in this channel dcc = dcc->getNextChannelSession(); // next session in this channel
} }
} }
void cbDynChatServiceTell(CMessage& msgin, const string &serviceName, TServiceId serviceId) void cbDynChatServiceTell(CMessage& msgin, const string &serviceName, TServiceId serviceId)
@ -1908,7 +1908,7 @@ void cbDynChatServiceTell(CMessage& msgin, const string &serviceName, TServiceId
break; break;
} }
dcc = dcc->getNextChannelSession(); // next session in this channel dcc = dcc->getNextChannelSession(); // next session in this channel
} }
} }
//----------------------------------------------- //-----------------------------------------------
@ -1921,7 +1921,7 @@ void cbDynChatReset(CMessage& msgin, const string &serviceName, TServiceId servi
} }
//----------------------------------------------- //-----------------------------------------------
// update the alias list // update the alias list
// //
//----------------------------------------------- //-----------------------------------------------
void cbUpdateAIAlias(CMessage& msgin, const string &serviceName, TServiceId serviceId) void cbUpdateAIAlias(CMessage& msgin, const string &serviceName, TServiceId serviceId)
@ -1932,22 +1932,22 @@ void cbUpdateAIAlias(CMessage& msgin, const string &serviceName, TServiceId serv
uint32 subcommand; uint32 subcommand;
msgin.serial(subcommand); msgin.serial(subcommand);
switch(subcommand) switch(subcommand)
{ {
case Set: case Set:
IOS->getAIAliasManager().clear(); IOS->getAIAliasManager().clear();
case Add: case Add:
{ {
uint32 size; uint32 size;
msgin.serial(size); msgin.serial(size);
uint first = 0; uint first = 0;
uint last = size; uint last = size;
for ( ;first != last; ++first) for ( ;first != last; ++first)
{ {
uint32 alias; uint32 alias;
std::string name; std::string name;
msgin.serial(alias); msgin.serial(alias);
@ -1956,7 +1956,7 @@ void cbUpdateAIAlias(CMessage& msgin, const string &serviceName, TServiceId serv
} }
} }
break; break;
/* /*
case Add: break; case Add: break;
case Delete: break; case Delete: break;
@ -2006,7 +2006,7 @@ void cbUserDontTranslateLanguages( CMessage& msgin, const string &serviceName, T
if (player == INVALID_DATASET_ROW) if (player == INVALID_DATASET_ROW)
{ {
nlwarning("cbUserTranslateLanguage : ignoring chat because Player %s:%x Invalid", nlwarning("cbUserTranslateLanguage : ignoring chat because Player %s:%x Invalid",
TheDataset.getEntityId(player).toString().c_str(), TheDataset.getEntityId(player).toString().c_str(),
player.getIndex()); player.getIndex());
return; return;
@ -2019,12 +2019,19 @@ void cbUserDontTranslateLanguages( CMessage& msgin, const string &serviceName, T
CChatClient &client = cm.getClient(player); CChatClient &client = cm.getClient(player);
nlinfo("USER DISBALED TRANSLATIONS: %s", langs.c_str());
vector<string> vlangs; vector<string> vlangs;
NLMISC::splitString(langs, "|", vlangs); NLMISC::splitString(langs, "|", vlangs);
client.resetDisabledTranslations(); client.resetDisabledTranslations();
for (uint i=0; i<vlangs.size(); i++) for (uint i=0; i<vlangs.size(); i++)
{ {
client.disableTranslation(vlangs[i]); if (vlangs[i].size() == 3)
{
if (vlangs[i][0] == '>')
client.disableSendTranslation(vlangs[i].substr(1));
else if (vlangs[i][0] == '<')
client.disableReceiveTranslation(vlangs[i].substr(1));
}
} }
} }
@ -2071,7 +2078,7 @@ TUnifiedCallbackItem CbIOSArray[]=
// { "READY_STRING", cbImpulsionReadyString }, // { "READY_STRING", cbImpulsionReadyString },
{ "CLIENT:STRING:CHAT", cbImpulsionChat }, { "CLIENT:STRING:CHAT", cbImpulsionChat },
{ "CLIENT:STRING:CHAT_TEAM", cbImpulsionChatTeam }, { "CLIENT:STRING:CHAT_TEAM", cbImpulsionChatTeam },
{ "CLIENT:STRING:TELL", cbImpulsionTell }, { "CLIENT:STRING:TELL", cbImpulsionTell },
{ "CLIENT:STRING:FILTER", cbImpulsionFilter }, { "CLIENT:STRING:FILTER", cbImpulsionFilter },
{ "CLIENT:STRING:CHAT_MODE", cbImpulsionChatMode }, { "CLIENT:STRING:CHAT_MODE", cbImpulsionChatMode },
{ "CLIENT:STRING:AFK_TXT", cbImpulsionAfkTxt }, { "CLIENT:STRING:AFK_TXT", cbImpulsionAfkTxt },
@ -2092,8 +2099,8 @@ TUnifiedCallbackItem CbIOSArray[]=
{ "REMOVE_FROM_GROUP", cbRemoveFromGroup }, { "REMOVE_FROM_GROUP", cbRemoveFromGroup },
// { "SEND_DYNAMIC_ID", cbSendDynamicId }, // { "SEND_DYNAMIC_ID", cbSendDynamicId },
{ "CHAT", cbSysChat }, // talk to a user or a whole group { "CHAT", cbSysChat }, // talk to a user or a whole group
{ "NPC_CHAT", cbNpcChat }, // Npc talk to a chat group { "NPC_CHAT", cbNpcChat }, // Npc talk to a chat group
{ "NPC_CHAT_PARAM", cbNpcChatParam }, // Npc talk to a chat group (with parameter) { "NPC_CHAT_PARAM", cbNpcChatParam }, // Npc talk to a chat group (with parameter)
{ "NPC_TELL", cbNpcTell }, // Npc tell to a player { "NPC_TELL", cbNpcTell }, // Npc tell to a player
@ -2104,7 +2111,7 @@ TUnifiedCallbackItem CbIOSArray[]=
{ "NPC_CHAT_SENTENCE", cbNpcChatSentence}, //Npc chat. receive the sentence to chat { "NPC_CHAT_SENTENCE", cbNpcChatSentence}, //Npc chat. receive the sentence to chat
{ "NPC_CHAT_SENTENCE_CHANNEL",cbNpcChatSentenceChannel}, { "NPC_CHAT_SENTENCE_CHANNEL",cbNpcChatSentenceChannel},
{ "NPC_CHAT_SENTENCE_EX",cbNpcChatSentenceEx},//Npc chat. receive the name of the npc which talks, and the sentence { "NPC_CHAT_SENTENCE_EX",cbNpcChatSentenceEx},//Npc chat. receive the name of the npc which talks, and the sentence
{ "GROUP_DYN_STRING", cbGroupDynString }, // send a system dynamic string to a group { "GROUP_DYN_STRING", cbGroupDynString }, // send a system dynamic string to a group
{ "PHRASE", cbPhrasePrepare }, { "PHRASE", cbPhrasePrepare },
{ "PHRASE_DEBUG", cbPhrasePrepareDebug }, { "PHRASE_DEBUG", cbPhrasePrepareDebug },
@ -2130,7 +2137,7 @@ TUnifiedCallbackItem CbIOSArray[]=
{ "EMOTE_CROWD", cbEmoteCrowd }, // EGS wants IOS to dispatch an emote texte to all users around the "emoting" player { "EMOTE_CROWD", cbEmoteCrowd }, // EGS wants IOS to dispatch an emote texte to all users around the "emoting" player
{ "EMOTE_PLAYER", cbEmoteSolePlayer }, // EGS wants IOS to dispatch an emote texte to a unique player { "EMOTE_PLAYER", cbEmoteSolePlayer }, // EGS wants IOS to dispatch an emote texte to a unique player
{ "CUSTOM_EMOTE", cbCustomEmote }, // EGS wants IOS to dispatch an emote custom text to all users around { "CUSTOM_EMOTE", cbCustomEmote }, // EGS wants IOS to dispatch an emote custom text to all users around
{ "SET_PHRASE", cbSetPhrase }, // AIS wants IOS to change a phrase content { "SET_PHRASE", cbSetPhrase }, // AIS wants IOS to change a phrase content
{ "SET_PHRASE_LANG", cbSetPhraseLang }, // AIS or EGS wants IOS to change a phrase content for a language { "SET_PHRASE_LANG", cbSetPhraseLang }, // AIS or EGS wants IOS to change a phrase content for a language

Loading…
Cancel
Save