From d5ab74fb069fe2e95879c8d9cf21602727f4cacd Mon Sep 17 00:00:00 2001 From: Tobias Weimer Date: Thu, 10 Jan 2013 21:24:23 +0000 Subject: Fixed "Sort alphabetically" git-svn-id: http://svn.miranda-ng.org/main/trunk@3042 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/MetaContacts/src/addto.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'plugins/MetaContacts/src') diff --git a/plugins/MetaContacts/src/addto.cpp b/plugins/MetaContacts/src/addto.cpp index 058be6394c..3828d04d85 100644 --- a/plugins/MetaContacts/src/addto.cpp +++ b/plugins/MetaContacts/src/addto.cpp @@ -67,19 +67,20 @@ int FillList(HWND list, BOOL sort) if (_tcslen(swzContactDisplayName) > 1023) swzContactDisplayName[1024] = 0; - int index; + int pos = -1; if (sort) { + pos = 0; for (int j = 0; j < i; j++) { TCHAR buff[1024]; SendMessage(list, LB_GETTEXT, j, (LPARAM)buff); if ( _tcscmp(buff, swzContactDisplayName) > 0) { - index = SendMessage(list, LB_INSERTSTRING, j, (LPARAM)swzContactDisplayName); + pos = j; break; } } } - else index = SendMessage(list, LB_INSERTSTRING, (WPARAM)-1, (LPARAM)swzContactDisplayName); + int index = SendMessage(list, LB_INSERTSTRING, (WPARAM)pos, (LPARAM)swzContactDisplayName); SendMessage(list, LB_SETITEMDATA, index, (LPARAM)hMetaUser); i++; -- cgit v1.2.3