Jump to content

Small Messenger Fix


Ken

Recommended Posts

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

  • Love 17

Do not be sorry, be better.

Link to comment
Share on other sites

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

  • Love 5

Do not be sorry, be better.

Link to comment
Share on other sites

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

  • Love 3

Do not be sorry, be better.

Link to comment
Share on other sites

  • 1 year later...

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.