From 53f6adb04145a5a8a6a08f672ce0193c3138f4a1 Mon Sep 17 00:00:00 2001 From: Nimetu Date: Thu, 15 Jan 2015 20:08:28 +0200 Subject: [PATCH] Include chat message channel/type to chatlog file --HG-- branch : issue-221 --- code/ryzom/client/src/client_chat_manager.cpp | 2 +- .../client/src/interface_v3/chat_window.cpp | 2 +- .../src/interface_v3/interface_manager.cpp | 4 +-- .../src/interface_v3/interface_manager.h | 2 +- .../client/src/interface_v3/people_list.cpp | 4 +-- code/ryzom/client/src/net_manager.cpp | 25 +++++++++++++++++-- 6 files changed, 30 insertions(+), 9 deletions(-) diff --git a/code/ryzom/client/src/client_chat_manager.cpp b/code/ryzom/client/src/client_chat_manager.cpp index bac2abf1e..141edea27 100644 --- a/code/ryzom/client/src/client_chat_manager.cpp +++ b/code/ryzom/client/src/client_chat_manager.cpp @@ -1204,7 +1204,7 @@ class CHandlerTell : public IActionHandler ucstring s = CI18N::get("youTellPlayer"); strFindReplace(s, "%name", receiver); strFindReplace(finalMsg, CI18N::get("youTell"), s); - CInterfaceManager::getInstance()->log(finalMsg); + CInterfaceManager::getInstance()->log(finalMsg, CChatGroup::groupTypeToString(CChatGroup::tell)); } }; REGISTER_ACTION_HANDLER( CHandlerTell, "tell"); diff --git a/code/ryzom/client/src/interface_v3/chat_window.cpp b/code/ryzom/client/src/interface_v3/chat_window.cpp index 7dcf13eeb..dd483030b 100644 --- a/code/ryzom/client/src/interface_v3/chat_window.cpp +++ b/code/ryzom/client/src/interface_v3/chat_window.cpp @@ -483,7 +483,7 @@ void CChatWindow::displayLocalPlayerTell(const ucstring &receiver, const ucstrin strFindReplace(s, "%name", receiver); strFindReplace(finalMsg, CI18N::get("youTell"), s); displayMessage(finalMsg, prop.getRGBA(), CChatGroup::tell, 0, numBlinks); - CInterfaceManager::getInstance()->log(finalMsg); + CInterfaceManager::getInstance()->log(finalMsg, CChatGroup::groupTypeToString(CChatGroup::tell)); } void CChatWindow::encodeColorTag(const NLMISC::CRGBA &color, ucstring &text, bool append) diff --git a/code/ryzom/client/src/interface_v3/interface_manager.cpp b/code/ryzom/client/src/interface_v3/interface_manager.cpp index 541cb853a..75678f7e6 100644 --- a/code/ryzom/client/src/interface_v3/interface_manager.cpp +++ b/code/ryzom/client/src/interface_v3/interface_manager.cpp @@ -2684,7 +2684,7 @@ bool CInterfaceManager::deletePlayerKeys (const std::string &playerFileIdent) } // *************************************************************************** -void CInterfaceManager::log(const ucstring &str) +void CInterfaceManager::log(const ucstring &str, const std::string &cat) { if (_LogState) { @@ -2693,7 +2693,7 @@ void CInterfaceManager::log(const ucstring &str) FILE *f = fopen(fileName.c_str(), "at"); if (f != NULL) { - const string finalString = string(NLMISC::IDisplayer::dateToHumanString()) + " * " + str.toUtf8(); + const string finalString = string(NLMISC::IDisplayer::dateToHumanString()) + " (" + NLMISC::toUpper(cat) + ") * " + str.toUtf8(); fprintf(f, "%s\n", finalString.c_str()); } fclose(f); diff --git a/code/ryzom/client/src/interface_v3/interface_manager.h b/code/ryzom/client/src/interface_v3/interface_manager.h index 36bd909e3..d947f4912 100644 --- a/code/ryzom/client/src/interface_v3/interface_manager.h +++ b/code/ryzom/client/src/interface_v3/interface_manager.h @@ -218,7 +218,7 @@ public: // Log system (all chat/tell void setLogState(bool state) { _LogState = state; } bool getLogState() const { return _LogState; } - void log(const ucstring &str); + void log(const ucstring &str, const std::string &cat = ""); /// Text from here and from server diff --git a/code/ryzom/client/src/interface_v3/people_list.cpp b/code/ryzom/client/src/interface_v3/people_list.cpp index 4dc451ea3..c2167358f 100644 --- a/code/ryzom/client/src/interface_v3/people_list.cpp +++ b/code/ryzom/client/src/interface_v3/people_list.cpp @@ -478,7 +478,7 @@ void CPeopleList::displayLocalPlayerTell(const ucstring &receiver, uint index, c strFindReplace(s, "%name", receiver); strFindReplace(finalMsg, CI18N::get("youTell"), s); gl->addChild(getChatTextMngr().createMsgText(finalMsg, prop.getRGBA())); - CInterfaceManager::getInstance()->log(finalMsg); + CInterfaceManager::getInstance()->log(finalMsg, CChatGroup::groupTypeToString(CChatGroup::tell)); // if the group is closed, make it blink if (!gc->isOpen()) @@ -946,7 +946,7 @@ class CHandlerContactEntry : public IActionHandler ucstring s = CI18N::get("youTellPlayer"); strFindReplace(s, "%name", pWin->getFreeTellerName(str)); strFindReplace(final, CI18N::get("youTell"), s); - CInterfaceManager::getInstance()->log(final); + CInterfaceManager::getInstance()->log(final, CChatGroup::groupTypeToString(CChatGroup::tell)); } } } diff --git a/code/ryzom/client/src/net_manager.cpp b/code/ryzom/client/src/net_manager.cpp index 4b37b698a..66c4b83fc 100644 --- a/code/ryzom/client/src/net_manager.cpp +++ b/code/ryzom/client/src/net_manager.cpp @@ -879,7 +879,28 @@ void CInterfaceChatDisplayer::displayChat(TDataSetIndex compressedSenderIndex, c } // Log - pIM->log (finalString); + + string channel; + if (mode == CChatGroup::dyn_chat) + { + sint32 dbIndex = ChatMngr.getDynamicChannelDbIndexFromId(dynChatId); + clamp(dbIndex, (sint32)0 , (sint32)CChatGroup::MaxDynChanPerPlayer); + + channel = "dyn" + toString(dbIndex); + } + else + { + channel = CChatGroup::groupTypeToString(mode); + if (channel.empty()) + { + channel = "#" + toString((uint32)mode); + } + } + if (!stringCategory.empty() && NLMISC::toUpper(stringCategory) != "SYS") + { + channel = channel + "/" + stringCategory; + } + pIM->log (finalString, channel); } @@ -911,7 +932,7 @@ void CInterfaceChatDisplayer::displayTell(/*TDataSetIndex senderIndex, */const u colorizeSender(finalString, senderPart, prop.getRGBA()); PeopleInterraction.ChatInput.Tell.displayTellMessage(/*senderIndex, */finalString, goodSenderName, prop.getRGBA(), 2, &windowVisible); - CInterfaceManager::getInstance()->log(finalString); + CInterfaceManager::getInstance()->log(finalString, CChatGroup::groupTypeToString(CChatGroup::tell)); // Open the free teller window CChatGroupWindow *pCGW = PeopleInterraction.getChatGroupWindow();