Ken 904 Posted June 25, 2017 Share Posted June 25, 2017 Hi, I'd like to share a small fix about the messenger system. what exactly are we fixing? The main problem is when you remove any person from your list, the companion's messenger list is not refreshing until relog in. Webzen has fixed this situation with a small packet. That packet will provide to remove the name from the list. There is no part of Python because it's already done by Ymir. For serverside Spoiler Open messenger_manager.cpp and find this string if (d) ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<¸Ş½ÅÁ®> %s ´ÔÀ» ¸Ş½ÅÀú¿¡¼ »èÁ¦ÇÏ¿´½À´Ï´Ù."), companion.c_str()); then add those codes LPCHARACTER tch = CHARACTER_MANAGER::Instance().FindPC(companion.c_str()); if (tch && tch->GetDesc()) { TPacketGCMessenger p; p.header = HEADER_GC_MESSENGER; p.subheader = MESSENGER_SUBHEADER_GC_REMOVE_FRIEND; p.size = sizeof(TPacketGCMessenger) + sizeof(BYTE) + account.size(); BYTE bLen = account.size(); tch->GetDesc()->BufferedPacket(&p, sizeof(p)); tch->GetDesc()->BufferedPacket(&bLen, sizeof(BYTE)); tch->GetDesc()->Packet(account.c_str(), account.size()); } Open packet.h and find this string MESSENGER_SUBHEADER_GC_MOBILE, Then add this string MESSENGER_SUBHEADER_GC_REMOVE_FRIEND, That's all for server side 1 For client side Spoiler Open packet.h and find this string MESSENGER_SUBHEADER_GC_MOBILE, Then add this string MESSENGER_SUBHEADER_GC_REMOVE_FRIEND, Open PythonMessenger.cpp and find this function void CPythonMessenger::RemoveFriend(const char * c_szKey) { m_FriendNameMap.erase(c_szKey); } Replace with this void CPythonMessenger::RemoveFriend(const char * c_szKey) { m_FriendNameMap.erase(c_szKey); if (m_poMessengerHandler) PyCallClassMemberFunc(m_poMessengerHandler, "OnRemoveList", Py_BuildValue("(is)", MESSENGER_GRUOP_INDEX_FRIEND, c_szKey)); } Open PythonNetworkStreamPhaseGame.cpp and find this case MESSENGER_SUBHEADER_GC_MOBILE: { BYTE byState; // I do not have a mobile number that the flag BYTE byLength; if (!Recv(sizeof(byState), &byState)) return false; if (!Recv(sizeof(byLength), &byLength)) return false; if (!Recv(byLength, char_name)) return false; char_name[byLength] = 0; CPythonMessenger::Instance().SetMobile(char_name, byState); break; } Then add this case MESSENGER_SUBHEADER_GC_REMOVE_FRIEND: { BYTE bLength; if (!Recv(sizeof(bLength), &bLength)) return false; if (!Recv(bLength, char_name)) return false; char_name[bLength] = 0; CPythonMessenger::Instance().RemoveFriend(char_name); break; } Best Regards Ken 17 Do not be sorry, be better. Link to comment Share on other sites More sharing options...
Horinna 4 Posted June 25, 2017 Share Posted June 25, 2017 wow, a "small" fix, but a huge change. very nice @Ken. thank you! 1 Link to comment Share on other sites More sharing options...
alondark 59 Posted June 25, 2017 Share Posted June 25, 2017 you're welcome Ken Link to comment Share on other sites More sharing options...
emirhan 0 Posted June 26, 2017 Share Posted June 26, 2017 thanks Ken. Link to comment Share on other sites More sharing options...
Ken 904 Posted June 26, 2017 Author Share Posted June 26, 2017 I've updated the codes again. Good luck Do not be sorry, be better. Link to comment Share on other sites More sharing options...
Ken 904 Posted June 27, 2017 Author Share Posted June 27, 2017 A small fix about a query of messenger system. When you remove any person on your list, the companion will continue to see your name on his list (when the companion relog in the game again). This query will remove both of them's contact in the database. Spoiler Open messenger_manager.cpp and find this string DBManager::instance().Query("DELETE FROM messenger_list%s WHERE account='%s' AND companion = '%s'", get_table_postfix(), account.c_str(), companion.c_str()); Replace with this DBManager::instance().Query("DELETE FROM messenger_list%s WHERE (account='%s' AND companion = '%s') OR (account = '%s' AND companion = '%s')", get_table_postfix(), account.c_str(), companion.c_str(), companion.c_str(), account.c_str()); 1 Best Regards Ken 5 Do not be sorry, be better. Link to comment Share on other sites More sharing options...
Horinna 4 Posted June 28, 2017 Share Posted June 28, 2017 @Ken Bug: - User1 add User2 - User1 delete User2 - User2 cannot add User1 - User2 press friend-Button, but nothing happens on the messanger-list(ingame) - User1 have User2 on friend-list, but User2 doesnt have User1 on list Link to comment Share on other sites More sharing options...
Ken 904 Posted June 28, 2017 Author Share Posted June 28, 2017 Hey, @Horinna thanks for feeding back. About the last bug, the system is not doing the same things for the companion. To fix this; Find this line in messenger_manager.cpp m_Relation[account].erase(companion); m_InverseRelation[companion].erase(account); And add this code blog m_Relation[companion].erase(account); m_InverseRelation[account].erase(companion); Best Regards Ken 3 Do not be sorry, be better. Link to comment Share on other sites More sharing options...
Horinna 4 Posted June 28, 2017 Share Posted June 28, 2017 @Ken It works. Thanks! you should edit your thread. Link to comment Share on other sites More sharing options...
Woytman 89 Posted July 1, 2017 Share Posted July 1, 2017 Thanks @Ken Link to comment Share on other sites More sharing options...
Eqarus 1 Posted June 22, 2019 Share Posted June 22, 2019 "delete 3497578395834589 from list" fix? Link to comment Share on other sites More sharing options...
Recommended Posts