|
|
@ -764,37 +764,39 @@ void CInterfaceChatDisplayer::displayChat(TDataSetIndex compressedSenderIndex, c
|
|
|
|
sint32 dbIndex= ChatMngr.getDynamicChannelDbIndexFromId(dynChatId);
|
|
|
|
sint32 dbIndex= ChatMngr.getDynamicChannelDbIndexFromId(dynChatId);
|
|
|
|
// if found, display, else discarded
|
|
|
|
// if found, display, else discarded
|
|
|
|
if(dbIndex >= 0 && dbIndex < CChatGroup::MaxDynChanPerPlayer)
|
|
|
|
if(dbIndex >= 0 && dbIndex < CChatGroup::MaxDynChanPerPlayer)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
PeopleInterraction.ChatInput.DynamicChat[dbIndex].displayMessage(finalString, col, 2, &windowVisible);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Add dynchannel info before text so that the chat log will show the correct string.
|
|
|
|
|
|
|
|
CCDBNodeLeaf* node = pIM->getDbProp("UI:SAVE:CHAT:SHOW_DYN_CHANNEL_NAME_IN_CHAT_CB", false);
|
|
|
|
|
|
|
|
if (pIM->getLogState())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Add dyn chan number before string
|
|
|
|
// Add dyn chan number before string
|
|
|
|
ucstring prefix = "[" + NLMISC::toString(dbIndex) + "]";
|
|
|
|
ucstring prefix("[" + NLMISC::toString(dbIndex) + "]");
|
|
|
|
// Find position to put the new string
|
|
|
|
// Find position to put the new string
|
|
|
|
// After timestamp?
|
|
|
|
// After timestamp?
|
|
|
|
size_t pos = finalString.find(ucstring("]"));
|
|
|
|
size_t pos = finalString.find(ucstring("]"));
|
|
|
|
if (pos == ucstring::npos)
|
|
|
|
size_t colonpos = finalString.find(ucstring(": @{"));
|
|
|
|
|
|
|
|
// If no ] found or if found but after the colon (so part of the user chat)
|
|
|
|
|
|
|
|
if (pos == ucstring::npos || (colonpos < pos))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// No timestamp, so put it right after the color and add a space
|
|
|
|
// No timestamp, so put it right after the color and add a space
|
|
|
|
pos = finalString.find(ucstring("}"));
|
|
|
|
pos = finalString.find(ucstring("}"));;
|
|
|
|
prefix += " ";
|
|
|
|
prefix += " ";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
finalString = finalString.substr(0, pos + 1) + prefix + finalString.substr(pos + 1);
|
|
|
|
finalString = finalString.substr(0, pos + 1) + prefix + finalString.substr(pos + 1);
|
|
|
|
PeopleInterraction.ChatInput.DynamicChat[dbIndex].displayMessage(finalString, col, 2, &windowVisible);
|
|
|
|
|
|
|
|
// Add optionally dynchannel name before text so that the chat log
|
|
|
|
if (node && node->getValueBool())
|
|
|
|
// will show the correct string if enabled.
|
|
|
|
|
|
|
|
CCDBNodeLeaf* node = pIM->getDbProp("UI:SAVE:CHAT:SHOW_DYN_CHANNEL_NAME_IN_CHAT_CB", false);
|
|
|
|
|
|
|
|
if (node && pIM->getLogState() && node->getValueBool())
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
uint32 textId = ChatMngr.getDynamicChannelNameFromDbIndex(dbIndex);
|
|
|
|
uint32 textId = ChatMngr.getDynamicChannelNameFromDbIndex(dbIndex);
|
|
|
|
ucstring title;
|
|
|
|
ucstring title;
|
|
|
|
STRING_MANAGER::CStringManagerClient::instance()->getDynString(textId, title);
|
|
|
|
STRING_MANAGER::CStringManagerClient::instance()->getDynString(textId, title);
|
|
|
|
if ( ! title.empty())
|
|
|
|
prefix = title.empty() ? ucstring("") : ucstring(" ") + title;
|
|
|
|
{
|
|
|
|
pos = finalString.find(ucstring("] "));
|
|
|
|
prefix = " " + title;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// Put the new prefix in the correct position
|
|
|
|
|
|
|
|
size_t pos = finalString.find(ucstring("] "));
|
|
|
|
|
|
|
|
finalString = finalString.substr(0, pos) + prefix + finalString.substr(pos);
|
|
|
|
finalString = finalString.substr(0, pos) + prefix + finalString.substr(pos);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
nlwarning("Dynamic chat %s not found for message: %s", dynChatId.toString().c_str(), finalString.toString().c_str());
|
|
|
|
nlwarning("Dynamic chat %s not found for message: %s", dynChatId.toString().c_str(), finalString.toString().c_str());
|
|
|
|