diff options
author | Tobias Weimer <wishmaster51@googlemail.com> | 2015-10-04 16:04:25 +0000 |
---|---|---|
committer | Tobias Weimer <wishmaster51@googlemail.com> | 2015-10-04 16:04:25 +0000 |
commit | c7bb55b7586eeb85258759dd71c2a1012d772556 (patch) | |
tree | 729c53830fc725fbcd32aec08df65e0550063325 /plugins/MirandaG15/src/CAppletManager.cpp | |
parent | 7db5dec75a13047e90ab9acafc5c5acc06223b60 (diff) |
MirandaG15:
- fixed group chat messages (broken in r14971)
- minor cleanup, leaks fixed, etc...
git-svn-id: http://svn.miranda-ng.org/main/trunk@15508 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/MirandaG15/src/CAppletManager.cpp')
-rw-r--r-- | plugins/MirandaG15/src/CAppletManager.cpp | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/plugins/MirandaG15/src/CAppletManager.cpp b/plugins/MirandaG15/src/CAppletManager.cpp index 2ec2cb4f48..d7c9388caa 100644 --- a/plugins/MirandaG15/src/CAppletManager.cpp +++ b/plugins/MirandaG15/src/CAppletManager.cpp @@ -750,9 +750,6 @@ void CAppletManager::SendTypingNotification(MCONTACT hContact, bool bEnable) MEVENT CAppletManager::SendMessageToContact(MCONTACT hContact, tstring strMessage) { tstring strAscii = _A2T(toNarrowString(strMessage).c_str()); - SMessageJob *pJob = new SMessageJob(); - pJob->dwTimestamp = GetTickCount(); - pJob->hContact = hContact; char *szProto = GetContactProto(hContact); tstring strProto = toTstring(szProto); @@ -760,14 +757,13 @@ MEVENT CAppletManager::SendMessageToContact(MCONTACT hContact, tstring strMessag CIRCConnection *pIRCCon = CAppletManager::GetInstance()->GetIRCConnection(strProto); if (pIRCCon && db_get_b(hContact, szProto, "ChatRoom", 0) != 0) { - GCDEST gcd = { szProto, 0, GC_EVENT_SENDMESSAGE }; - DBVARIANT dbv; - if (!db_get_ts(hContact, szProto, "Nick", &dbv)) - gcd.ptszID = dbv.ptszVal; - else + if (db_get_ts(hContact, szProto, "Nick", &dbv)) return NULL; + GCDEST gcd = { szProto, 0, GC_EVENT_SENDMESSAGE }; + gcd.ptszID = dbv.ptszVal; + tstring strID = tstring(gcd.ptszID) + _T(" - ") + tstring(_A2T(toNarrowString(pIRCCon->strNetwork).c_str())); gcd.ptszID = (LPTSTR)strID.c_str(); @@ -778,9 +774,14 @@ MEVENT CAppletManager::SendMessageToContact(MCONTACT hContact, tstring strMessag gce.bIsMe = true; CallService(MS_GC_EVENT, NULL, (LPARAM)&gce); - pJob->hEvent = NULL; + db_free(&dbv); + return 0; } else { + SMessageJob *pJob = new SMessageJob(); + pJob->dwTimestamp = GetTickCount(); + pJob->hContact = hContact; + char* szMsgUtf = mir_utf8encodeW(strMessage.c_str()); pJob->iBufferSize = (int)mir_strlen(szMsgUtf) + 1; @@ -792,9 +793,8 @@ MEVENT CAppletManager::SendMessageToContact(MCONTACT hContact, tstring strMessag pJob->hEvent = (MEVENT)CallContactService(pJob->hContact, PSS_MESSAGE, 0, (LPARAM)pJob->pcBuffer); CAppletManager::GetInstance()->AddMessageJob(pJob); + return pJob->hEvent; } - - return pJob->hEvent; } //************************************************************************ @@ -1361,7 +1361,7 @@ int CAppletManager::HookChatInbound(WPARAM, LPARAM lParam) TRACE(_T("OK!\n")); return 0; } - if (gcd->ptszID != NULL) { + else if (gcd->ptszID != NULL) { TRACE(_T("OK!\n")); return 0; } @@ -1583,6 +1583,7 @@ int CAppletManager::HookProtoAck(WPARAM, LPARAM lParam) if (pProtoData == NULL) return 0; + // Skip connecting status if (iNewStatus == ID_STATUS_CONNECTING) return 0; @@ -1602,10 +1603,6 @@ int CAppletManager::HookProtoAck(WPARAM, LPARAM lParam) Event.eType = EVENT_PROTO_STATUS; } - // Skip connecting status - if (iNewStatus == ID_STATUS_CONNECTING) - return 0; - pProtoData->iStatus = iNewStatus; Event.iValue = iNewStatus; |