From 6bb9843450cc285c7acc870c79bcc3beae8933b2 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 24 Sep 2013 11:20:49 +0000 Subject: major Asshole design flaw removed from Jabber, there's no need to invent monstrous maps to store message-related information git-svn-id: http://svn.miranda-ng.org/main/trunk@6207 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/JabberG/src/jabber_proto.cpp | 27 ++++++--------------------- 1 file changed, 6 insertions(+), 21 deletions(-) (limited to 'protocols/JabberG/src/jabber_proto.cpp') diff --git a/protocols/JabberG/src/jabber_proto.cpp b/protocols/JabberG/src/jabber_proto.cpp index 14aaaae002..08bbb6cba5 100644 --- a/protocols/JabberG/src/jabber_proto.cpp +++ b/protocols/JabberG/src/jabber_proto.cpp @@ -67,13 +67,11 @@ CJabberProto::CJabberProto(const char *aProtoName, const TCHAR *aUserName) : m_priorityMenuValSet(false), m_hPrivacyMenuRoot(0), m_hPrivacyMenuItems(10), - m_pLastResourceList(NULL), m_lstJabberFeatCapPairsDynamic(2), m_uEnabledFeatCapsDynamic(0) { InitializeCriticalSection(&m_csModeMsgMutex); InitializeCriticalSection(&m_csLists); - InitializeCriticalSection(&m_csLastResourceMap); m_szXmlStreamToBeInitialized = NULL; @@ -179,8 +177,6 @@ CJabberProto::CJabberProto(const char *aProtoName, const TCHAR *aUserName) : db_free(&dbv); delSetting("Password"); } - - CleanLastResourceMap(); } CJabberProto::~CJabberProto() @@ -199,8 +195,6 @@ CJabberProto::~CJabberProto() DestroyHookableEvent(m_hEventXStatusIconChanged); DestroyHookableEvent(m_hEventXStatusChanged); - CleanLastResourceMap(); - ListWipe(); DeleteCriticalSection(&m_csLists); @@ -209,7 +203,6 @@ CJabberProto::~CJabberProto() DeleteCriticalSection(&m_filterInfo.csPatternLock); DeleteCriticalSection(&m_csModeMsgMutex); - DeleteCriticalSection(&m_csLastResourceMap); mir_free(m_modeMsgs.szOnline); mir_free(m_modeMsgs.szAway); @@ -311,7 +304,6 @@ int CJabberProto::OnModulesLoadedEx(WPARAM, LPARAM) } } - CleanLastResourceMap(); return 0; } @@ -914,7 +906,7 @@ int __cdecl CJabberProto::RecvContacts(HANDLE /*hContact*/, PROTORECVEVENT*) //////////////////////////////////////////////////////////////////////////////////////// // RecvFile -int __cdecl CJabberProto::RecvFile(HANDLE hContact, PROTORECVFILET* evt) +int __cdecl CJabberProto::RecvFile(HANDLE hContact, PROTORECVFILET *evt) { return Proto_RecvFile(hContact, evt); } @@ -922,19 +914,12 @@ int __cdecl CJabberProto::RecvFile(HANDLE hContact, PROTORECVFILET* evt) //////////////////////////////////////////////////////////////////////////////////////// // RecvMsg -int __cdecl CJabberProto::RecvMsg(HANDLE hContact, PROTORECVEVENT* evt) +int __cdecl CJabberProto::RecvMsg(HANDLE hContact, PROTORECVEVENT *evt) { - INT_PTR nDbEvent = Proto_RecvMessage(hContact, evt); - - EnterCriticalSection(&m_csLastResourceMap); - if (IsLastResourceExists((void*)evt->lParam)) { - m_ulpResourceToDbEventMap[ m_dwResourceMapPointer++ ] = nDbEvent; - m_ulpResourceToDbEventMap[ m_dwResourceMapPointer++ ] = evt->lParam; - if (m_dwResourceMapPointer >= SIZEOF(m_ulpResourceToDbEventMap)) - m_dwResourceMapPointer = 0; - } - LeaveCriticalSection(&m_csLastResourceMap); - + ptrA szResUtf( mir_utf8encodeT((LPCTSTR)evt->lParam)); + evt->pCustomData = szResUtf; + evt->cbCustomDataSize = lstrlenA(szResUtf); + Proto_RecvMessage(hContact, evt); return 0; } -- cgit v1.2.3