From 83246d23d9e1c1feeaee267b9a1b68c4766e7114 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 6 Jun 2012 20:38:53 +0000 Subject: array fixes git-svn-id: http://svn.miranda-ng.org/main/trunk@340 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/NewXstatusNotify/common.h | 9 ++++++--- plugins/NewXstatusNotify/main.cpp | 24 +++++++----------------- plugins/NewXstatusNotify/xstatus.cpp | 10 +++++----- 3 files changed, 18 insertions(+), 25 deletions(-) (limited to 'plugins/NewXstatusNotify') diff --git a/plugins/NewXstatusNotify/common.h b/plugins/NewXstatusNotify/common.h index 67892f1d72..0a939fe984 100644 --- a/plugins/NewXstatusNotify/common.h +++ b/plugins/NewXstatusNotify/common.h @@ -26,6 +26,7 @@ #define STRICT #define WIN32_LEAN_AND_MEAN +#define _CRT_SECURE_NO_WARNINGS #define _WIN32_WINNT 0x0500 #define WINVER 0x0600 @@ -42,9 +43,11 @@ #include #include -#include "newpluginapi.h" -#include "statusmodes.h" -#include "win2k.h" +#include +#include +#include +#include +#include #include "m_awaymsg.h" #include "m_button.h" diff --git a/plugins/NewXstatusNotify/main.cpp b/plugins/NewXstatusNotify/main.cpp index f1e34b53c7..033d89a45b 100644 --- a/plugins/NewXstatusNotify/main.cpp +++ b/plugins/NewXstatusNotify/main.cpp @@ -34,8 +34,8 @@ MM_INTERFACE mmi = {0}; UTF8_INTERFACE utfi = {0}; LIST_INTERFACE li = {0}; -SortedList *eventList; -SortedList *xstatusList; +LIST eventList( 10, 0 ); +LIST xstatusList( 10, 0 ); HANDLE hEnableDisableMenu, hOptionsInitialize, hModulesLoaded, hUserInfoInitialise; HANDLE hContactSettingChanged, hHookContactStatusChanged, hContactStatusChanged; @@ -117,22 +117,20 @@ HANDLE GetIconHandle(char *szIcon) __inline void AddXSC(XSTATUSCHANGE *xsc) { - li.List_Insert(xstatusList, xsc, xstatusList->realCount); + xstatusList.insert(xsc); } __inline void RemoveXSC(XSTATUSCHANGE *xsc) { - int id = li.List_IndexOf(xstatusList, xsc); + int id = xstatusList.getIndex(xsc); if (id != -1) - li.List_Remove(xstatusList, id); + xstatusList.remove(id); } XSTATUSCHANGE *FindXSC(HANDLE hContact) { - XSTATUSCHANGE *xsc; - for (int i = 0; i < xstatusList->realCount; i++) - { - xsc = (XSTATUSCHANGE *)xstatusList->items[i]; + for (int i = 0; i < xstatusList.getCount(); i++) { + XSTATUSCHANGE* xsc = xstatusList[i]; if (xsc->hContact == hContact) return xsc; } @@ -1383,9 +1381,6 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam) InitMainMenuItem(); InitTopToolbar(); - eventList = li.List_Create(0, 10); - xstatusList = li.List_Create(0, 10); - hUserInfoInitialise = HookEvent(ME_USERINFO_INITIALISE, UserInfoInitialise); hContactStatusChanged = HookEvent(ME_STATUSCHANGE_CONTACTSTATUSCHANGED, ContactStatusChanged); hMessageWindowOpen = HookEvent(ME_MSG_WINDOWEVENT, OnWindowEvent); @@ -1439,11 +1434,6 @@ extern "C" int __declspec(dllexport) Load(PLUGINLINK *link) extern "C" int __declspec(dllexport) Unload(void) { - li.List_Destroy(eventList); - li.List_Destroy(xstatusList); - mir_free(eventList); - mir_free(xstatusList); - UnhookEvent(hContactSettingChanged); UnhookEvent(hOptionsInitialize); UnhookEvent(hModulesLoaded); diff --git a/plugins/NewXstatusNotify/xstatus.cpp b/plugins/NewXstatusNotify/xstatus.cpp index ed875c7fe0..4692dd5682 100644 --- a/plugins/NewXstatusNotify/xstatus.cpp +++ b/plugins/NewXstatusNotify/xstatus.cpp @@ -23,7 +23,7 @@ #include "utils.h" #include "xstatus.h" -extern SortedList *eventList; +extern LIST eventList; extern OPTIONS opt; extern TEMPLATES templates; @@ -52,13 +52,13 @@ void FreeXSC(XSTATUSCHANGE *xsc) void RemoveLoggedEvents(HANDLE hContact) { - for (int i = eventList->realCount-1; i >= 0; i--) + for (int i = eventList.getCount()-1; i >= 0; i--) { - DBEVENT *dbevent = (DBEVENT *)eventList->items[i]; + DBEVENT *dbevent = eventList[i]; if (dbevent->hContact == hContact) { CallService(MS_DB_EVENT_DELETE, (WPARAM)dbevent->hContact, (LPARAM)dbevent->hDBEvent); - li.List_Remove(eventList, i); + eventList.remove(i); mir_free(dbevent); } } @@ -312,7 +312,7 @@ void LogToMessageWindow(XSTATUSCHANGE *xsc, BOOL opening) DBEVENT *dbevent = (DBEVENT *)mir_alloc(sizeof(DBEVENT)); dbevent->hContact = xsc->hContact; dbevent->hDBEvent = hDBEvent; - li.List_Insert(eventList, dbevent, eventList->realCount); + eventList.insert(dbevent); } } } -- cgit v1.2.3