From 10bc9e42dfba6ed8be41199243d688c2e367dc0d Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 30 Jun 2015 18:59:38 +0000 Subject: MS_CLIST_GETSTATUSMODEDESCRIPTION & MS_CLIST_GETCONTACTDISPLAYNAME replaced with pcli->* members git-svn-id: http://svn.miranda-ng.org/main/trunk@14459 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/ShellExt/src/main.cpp | 2 ++ plugins/ShellExt/src/shlcom.cpp | 29 +++++++++++------------------ 2 files changed, 13 insertions(+), 18 deletions(-) (limited to 'plugins/ShellExt') diff --git a/plugins/ShellExt/src/main.cpp b/plugins/ShellExt/src/main.cpp index c71028a40d..b4d4b09ef1 100644 --- a/plugins/ShellExt/src/main.cpp +++ b/plugins/ShellExt/src/main.cpp @@ -1,6 +1,7 @@ #include "stdafx.h" #include "shlcom.h" +CLIST_INTERFACE *pcli; HINSTANCE hInst; int hLangpack; bool bIsVistaPlus; @@ -161,6 +162,7 @@ STDAPI DllUnregisterServer() extern "C" __declspec(dllexport) int Load(void) { mir_getLP(&pluginInfoEx); + mir_getCLI(); InvokeThreadServer(); HookEvent(ME_OPT_INITIALISE, OnOptionsInit); diff --git a/plugins/ShellExt/src/shlcom.cpp b/plugins/ShellExt/src/shlcom.cpp index 0ace778b30..a1ecc1c505 100644 --- a/plugins/ShellExt/src/shlcom.cpp +++ b/plugins/ShellExt/src/shlcom.cpp @@ -299,25 +299,19 @@ bool ipcGetSortedContacts(THeaderIPC *ipch, int *pSlot, bool bGroupMode) dwContacts = i; qsort(pContacts, dwContacts, sizeof(TSlotInfo), SortContact); - DBVARIANT dbv; - int n, rc; // create an IPC slot for each contact and store display name, etc for (i=0; i < dwContacts; i++) { - char *szContact = (char*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)pContacts[i].hContact, 0); + ptrA szContact(mir_t2a(pcli->pfnGetContactDisplayName(pContacts[i].hContact, 0))); if (szContact != NULL) { - n = 0; - rc = 1; - if (bGroupMode) { - rc = db_get_s(pContacts[i].hContact, "CList", "Group", &dbv); - if (!rc) - n = lstrlenA(dbv.pszVal) + 1; - } + ptrA szGroup; + if (bGroupMode) + szGroup = db_get_sa(pContacts[i].hContact, "CList", "Group"); + int cch = lstrlenA(szContact) + 1; - TSlotIPC *pct = ipcAlloc(ipch, cch + 1 + n); - if (pct == NULL) { - db_free(&dbv); + TSlotIPC *pct = ipcAlloc(ipch, cch + 1 + lstrlenA(szGroup) + 1); + if (pct == NULL) break; - } + // lie about the actual size of the TSlotIPC pct->cbStrSection = cch; LPSTR szSlot = LPSTR(pct) + sizeof(TSlotIPC); @@ -330,10 +324,9 @@ bool ipcGetSortedContacts(THeaderIPC *ipch, int *pSlot, bool bGroupMode) if (ipch->ContactsBegin == NULL) ipch->ContactsBegin = pct; szSlot += cch + 1; - if (rc == 0) { - pct->hGroup = murmur_hash(dbv.pszVal); - lstrcpyA(szSlot, dbv.pszVal); - db_free(&dbv); + if (szGroup != 0) { + pct->hGroup = murmur_hash(szGroup); + lstrcpyA(szSlot, szGroup); } else { pct->hGroup = 0; -- cgit v1.2.3