summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2016-02-02 08:48:56 +0000
committerGeorge Hazan <george.hazan@gmail.com>2016-02-02 08:48:56 +0000
commit2c8efde364e6dc3e3ad2da9e99b667c1b56c1585 (patch)
treefad3ba812c31d855126c1ec68389da890f41f8a8 /plugins
parent8b76921724a22eda440f9a8d1fb52b9fa8cc0df0 (diff)
another perversion (called EventList) died
git-svn-id: http://svn.miranda-ng.org/main/trunk@16210 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins')
-rw-r--r--plugins/Clist_modern/src/modern_clistevents.cpp29
-rw-r--r--plugins/Clist_nicer/src/clistevents.cpp31
-rw-r--r--plugins/helpers/gen_helpers.cpp2
3 files changed, 34 insertions, 28 deletions
diff --git a/plugins/Clist_modern/src/modern_clistevents.cpp b/plugins/Clist_modern/src/modern_clistevents.cpp
index 038f6449e7..78bd96b475 100644
--- a/plugins/Clist_modern/src/modern_clistevents.cpp
+++ b/plugins/Clist_modern/src/modern_clistevents.cpp
@@ -74,10 +74,10 @@ struct NotifyMenuItemExData {
static CLISTEVENT* MyGetEvent(int iSelection)
{
- for (int i = 0; i < pcli->events.count; i++) {
- CListEvent *p = pcli->events.items[i];
- if (p->menuId == iSelection)
- return p;
+ for (int i = 0; i < pcli->events->getCount(); i++) {
+ CListEvent &p = (*pcli->events)[i];
+ if (p.menuId == iSelection)
+ return &p;
}
return NULL;
}
@@ -141,7 +141,7 @@ CListEvent* cli_AddEvent(CLISTEVENT *cle)
g_CluiData.hUpdateContact = p->hContact;
}
- if (pcli->events.count > 0) {
+ if (pcli->events->getCount() > 0) {
g_CluiData.bEventAreaEnabled = TRUE;
if (g_CluiData.bNotifyActive == FALSE) {
g_CluiData.bNotifyActive = TRUE;
@@ -158,31 +158,34 @@ int cli_RemoveEvent(MCONTACT hContact, MEVENT hDbEvent)
{
// Find the event that should be removed
int i;
- for (i = 0; i < pcli->events.count; i++)
- if ((pcli->events.items[i]->hContact == hContact) && (pcli->events.items[i]->hDbEvent == hDbEvent))
+ for (i = 0; i < pcli->events->getCount(); i++) {
+ CListEvent &e = (*pcli->events)[i];
+ if (e.hContact == hContact && e.hDbEvent == hDbEvent)
break;
+ }
// Event was not found
- if (i == pcli->events.count)
+ if (i == pcli->events->getCount())
return 1;
// remove event from the notify menu
- if (pcli->events.items[i]->menuId > 0) {
+ int iMenuId = (*pcli->events)[i].menuId;
+ if (iMenuId > 0) {
MENUITEMINFO mii = { 0 };
mii.cbSize = sizeof(mii);
mii.fMask = MIIM_DATA;
- if (GetMenuItemInfo(g_CluiData.hMenuNotify, pcli->events.items[i]->menuId, FALSE, &mii) != 0) {
+ if (GetMenuItemInfo(g_CluiData.hMenuNotify, iMenuId, FALSE, &mii) != 0) {
struct NotifyMenuItemExData *nmi = (struct NotifyMenuItemExData *) mii.dwItemData;
if (nmi && nmi->hContact == hContact && nmi->hDbEvent == hDbEvent) {
free(nmi);
- DeleteMenu(g_CluiData.hMenuNotify, pcli->events.items[i]->menuId, MF_BYCOMMAND);
+ DeleteMenu(g_CluiData.hMenuNotify, iMenuId, MF_BYCOMMAND);
}
}
}
int res = corecli.pfnRemoveEvent(hContact, hDbEvent);
- if (pcli->events.count == 0) {
+ if (pcli->events->getCount() == 0) {
g_CluiData.bNotifyActive = FALSE;
EventArea_HideShowNotifyFrame();
}
@@ -263,7 +266,7 @@ static int ehhEventAreaBackgroundSettingsChanged(WPARAM, LPARAM)
void EventArea_ConfigureEventArea()
{
- int iCount = pcli->events.count;
+ int iCount = pcli->events->getCount();
g_CluiData.dwFlags &= ~(CLUI_FRAME_AUTOHIDENOTIFY | CLUI_FRAME_SHOWALWAYS);
if (db_get_b(NULL, "CLUI", "EventArea", SETTING_EVENTAREAMODE_DEFAULT) == 1) g_CluiData.dwFlags |= CLUI_FRAME_AUTOHIDENOTIFY;
diff --git a/plugins/Clist_nicer/src/clistevents.cpp b/plugins/Clist_nicer/src/clistevents.cpp
index 5db5463e11..39afbc541a 100644
--- a/plugins/Clist_nicer/src/clistevents.cpp
+++ b/plugins/Clist_nicer/src/clistevents.cpp
@@ -67,10 +67,10 @@ void HideShowNotifyFrame()
static CLISTEVENT* MyGetEvent(int iSelection)
{
- for (int i = 0; i < pcli->events.count; i++) {
- CListEvent* p = pcli->events.items[i];
- if (p->menuId == iSelection)
- return p;
+ for (int i = 0; i < pcli->events->getCount(); i++) {
+ CListEvent &p = (*pcli->events)[i];
+ if (p.menuId == iSelection)
+ return &p;
}
return NULL;
}
@@ -298,7 +298,7 @@ CListEvent* AddEvent(CLISTEVENT *cle)
}
}
- if (pcli->events.count > 0) {
+ if (pcli->events->getCount() > 0) {
cfg::dat.bEventAreaEnabled = TRUE;
if (cfg::dat.notifyActive == 0) {
cfg::dat.notifyActive = 1;
@@ -318,31 +318,34 @@ int RemoveEvent(MCONTACT hContact, MEVENT hDbEvent)
{
// Find the event that should be removed
int i;
- for (i = 0; i < pcli->events.count; i++)
- if ((pcli->events.items[i]->hContact == hContact) && (pcli->events.items[i]->hDbEvent == hDbEvent))
+ for (i = 0; i < pcli->events->getCount(); i++) {
+ CListEvent &e = (*pcli->events)[i];
+ if (e.hContact == hContact && e.hDbEvent == hDbEvent)
break;
+ }
// Event was not found
- if (i == pcli->events.count)
+ if (i == pcli->events->getCount())
return 1;
// remove event from the notify menu
- if (pcli->events.items[i]->menuId > 0) {
+ int iMenuId = (*pcli->events)[i].menuId;
+ if (iMenuId > 0) {
MENUITEMINFO mii = { 0 };
mii.cbSize = sizeof(mii);
mii.fMask = MIIM_DATA;
- if (GetMenuItemInfo(cfg::dat.hMenuNotify, pcli->events.items[i]->menuId, FALSE, &mii) != 0) {
+ if (GetMenuItemInfo(cfg::dat.hMenuNotify, iMenuId, FALSE, &mii) != 0) {
struct NotifyMenuItemExData *nmi = (struct NotifyMenuItemExData *) mii.dwItemData;
if (nmi && nmi->hContact == hContact && nmi->hDbEvent == hDbEvent) {
free(nmi);
- DeleteMenu(cfg::dat.hMenuNotify, pcli->events.items[i]->menuId, MF_BYCOMMAND);
+ DeleteMenu(cfg::dat.hMenuNotify, iMenuId, MF_BYCOMMAND);
}
}
}
- coreCli.pfnRemoveEvent(hContact, hDbEvent);
+ int res = coreCli.pfnRemoveEvent(hContact, hDbEvent);
- if (pcli->events.count == 0) {
+ if (pcli->events->getCount() == 0) {
cfg::dat.bEventAreaEnabled = FALSE;
if (cfg::dat.dwFlags & CLUI_FRAME_AUTOHIDENOTIFY) {
cfg::dat.notifyActive = 0;
@@ -363,5 +366,5 @@ int RemoveEvent(MCONTACT hContact, MEVENT hDbEvent)
if (cfg::dat.notifyActive)
InvalidateRect(hwndEventFrame, NULL, FALSE);
- return 0;
+ return res;
}
diff --git a/plugins/helpers/gen_helpers.cpp b/plugins/helpers/gen_helpers.cpp
index e79c66a7c4..aba815a2fd 100644
--- a/plugins/helpers/gen_helpers.cpp
+++ b/plugins/helpers/gen_helpers.cpp
@@ -15,7 +15,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
+*/
#include "commonheaders.h"
#include "gen_helpers.h"