From 6941b13721285765d6b8df94c1c87d4f78b8be68 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 8 Jan 2014 15:51:52 +0000 Subject: chat structures slightly cleaned (no changes so far) git-svn-id: http://svn.miranda-ng.org/main/trunk@7547 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/MirandaG15/src/CAppletManager.cpp | 30 +++++++++++------------------- 1 file changed, 11 insertions(+), 19 deletions(-) (limited to 'plugins/MirandaG15/src') diff --git a/plugins/MirandaG15/src/CAppletManager.cpp b/plugins/MirandaG15/src/CAppletManager.cpp index ea1739bb24..d586923033 100644 --- a/plugins/MirandaG15/src/CAppletManager.cpp +++ b/plugins/MirandaG15/src/CAppletManager.cpp @@ -843,8 +843,8 @@ void CAppletManager::SendTypingNotification(HANDLE hContact,bool bEnable) //************************************************************************ HANDLE CAppletManager::SendMessageToContact(HANDLE hContact,tstring strMessage) { - string strAscii = toNarrowString(strMessage); - int bufSize = lstrlenA(strAscii.c_str())+1; + tstring strAscii = _A2T(toNarrowString(strMessage).c_str()); + int bufSize = lstrlen(strAscii.c_str())+1; SMessageJob *pJob = new SMessageJob(); pJob->dwTimestamp = GetTickCount(); pJob->hContact = hContact; @@ -857,31 +857,24 @@ HANDLE CAppletManager::SendMessageToContact(HANDLE hContact,tstring strMessage) if(pIRCCon && db_get_b(hContact, szProto, "ChatRoom", 0) != 0) { GCDEST gcd = {0}; - GCEVENT gce = {0}; DBVARIANT dbv; - if (!db_get((HANDLE)hContact, szProto, "Nick", &dbv) && dbv.type == DBVT_ASCIIZ ) - gcd.pszID = dbv.pszVal; + if (!db_get_ts((HANDLE)hContact, szProto, "Nick", &dbv)) + gcd.ptszID = dbv.ptszVal; else return NULL; - string strID = string(gcd.pszID) + " - " + toNarrowString(pIRCCon->strNetwork).c_str(); - gcd.pszID = (char*)strID.c_str(); + tstring strID = tstring(gcd.ptszID) + _T(" - ") + tstring(_A2T(toNarrowString(pIRCCon->strNetwork).c_str())); + gcd.ptszID = (LPTSTR)strID.c_str(); gcd.pszModule = szProto; gcd.iType = GC_EVENT_SENDMESSAGE; - gce.cbSize = sizeof(GCEVENT); - gce.pDest = &gcd; - gce.pszStatus = ""; - // gce.bAddToLog = true; - gce.pszUserInfo = NULL; - - gce.pszText = (char *)strAscii.c_str(); - - gce.dwItemData = NULL; + GCEVENT gce = { sizeof(gce), &gcd }; + gce.dwFlags = GC_TCHAR; + gce.ptszStatus = _T(""); + gce.ptszText = (LPTSTR)strAscii.c_str(); gce.time = time(NULL); gce.bIsMe = true; - CallService(MS_GC_EVENT, NULL, (LPARAM) &gce); pJob->hEvent = NULL; @@ -928,7 +921,6 @@ HANDLE CAppletManager::SendMessageToContact(HANDLE hContact,tstring strMessage) CAppletManager::GetInstance()->AddMessageJob(pJob); } - return pJob->hEvent; } @@ -1279,7 +1271,7 @@ int CAppletManager::HookChatInbound(WPARAM wParam,LPARAM lParam) if(gce == NULL || gcd == NULL) TRACE(_T("<< [%s] skipping invalid IRC event\n")); - TRACE(_T("<< [%s:%s] IRC event %04X\n"),toTstring(gcd->pszModule).c_str(),toTstring(gcd->pszID).c_str(),gcd->iType); + TRACE(_T("<< [%s:%s] IRC event %04X\n"),toTstring(gcd->pszModule).c_str(), gcd->ptszID, gcd->iType); // get the matching irc connection entry CIRCConnection *pIRCCon = CAppletManager::GetInstance()->GetIRCConnection(toTstring(gcd->pszModule)); -- cgit v1.2.3