summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-02-18 18:37:18 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-02-18 18:37:18 +0000
commit3791ce0c509d1d7a64cbba67015db38f4db5404c (patch)
tree360f57c9d567cb9a83f3c7bd09349324673ae184 /src
parenta154027918d0a5f2f270615e606d463e35a80d1e (diff)
- introducing ME_DB_EVENT_MARKED_READ - an event being called upon the call of db_event_markRead;
- various m_database.h related code cleaning git-svn-id: http://svn.miranda-ng.org/main/trunk@8165 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src')
-rw-r--r--src/core/stdmsg/src/msglog.cpp4
-rw-r--r--src/core/stduihist/history.cpp37
-rw-r--r--src/modules/database/dbutils.cpp64
3 files changed, 51 insertions, 54 deletions
diff --git a/src/core/stdmsg/src/msglog.cpp b/src/core/stdmsg/src/msglog.cpp
index 1aedcf4640..be5e960c5f 100644
--- a/src/core/stdmsg/src/msglog.cpp
+++ b/src/core/stdmsg/src/msglog.cpp
@@ -245,8 +245,8 @@ static char *SetToStyle(int style)
int DbEventIsForMsgWindow(DBEVENTINFO *dbei)
{
- DBEVENTTYPEDESCR* et = ( DBEVENTTYPEDESCR* )CallService(MS_DB_EVENT_GETTYPE, ( WPARAM )dbei->szModule, ( LPARAM )dbei->eventType );
- return et && ( et->flags & DETF_MSGWINDOW );
+ DBEVENTTYPEDESCR *et = ( DBEVENTTYPEDESCR* )CallService(MS_DB_EVENT_GETTYPE, ( WPARAM )dbei->szModule, ( LPARAM )dbei->eventType );
+ return et && (et->flags & DETF_MSGWINDOW);
}
int DbEventIsShown(DBEVENTINFO * dbei, SrmmWindowData *dat)
diff --git a/src/core/stduihist/history.cpp b/src/core/stduihist/history.cpp
index 13c08b692a..af51a6e95d 100644
--- a/src/core/stduihist/history.cpp
+++ b/src/core/stduihist/history.cpp
@@ -86,14 +86,12 @@ static void GetObjectDescription(DBEVENTINFO *dbei, TCHAR* str, int cbStr)
break;
default:
- {
- DBEVENTTYPEDESCR* et = (DBEVENTTYPEDESCR*)CallService(MS_DB_EVENT_GETTYPE, (WPARAM)dbei->szModule, (LPARAM)dbei->eventType);
- if (et && (et->flags & DETF_HISTORY)) {
- GetMessageDescription(dbei, str, cbStr);
- }
- else
- str[ 0 ] = 0;
-} } }
+ DBEVENTTYPEDESCR *et = (DBEVENTTYPEDESCR*)CallService(MS_DB_EVENT_GETTYPE, (WPARAM)dbei->szModule, (LPARAM)dbei->eventType);
+ if (et && (et->flags & DETF_HISTORY))
+ GetMessageDescription(dbei, str, cbStr);
+ else
+ *str = 0;
+} }
static void GetObjectSummary(DBEVENTINFO *dbei, TCHAR* str, int cbStr)
{
@@ -116,21 +114,18 @@ static void GetObjectSummary(DBEVENTINFO *dbei, TCHAR* str, int cbStr)
break;
default:
- {
- DBEVENTTYPEDESCR* et = (DBEVENTTYPEDESCR*)CallService(MS_DB_EVENT_GETTYPE, (WPARAM)dbei->szModule, (LPARAM)dbei->eventType);
- if (et && (et->flags & DETF_HISTORY)) {
- pszTmp = mir_a2t(et->descr);
- pszSrc = TranslateTS(pszTmp);
- break;
- }
- else {
- str[ 0 ] = 0;
- return;
- } } }
+ DBEVENTTYPEDESCR* et = (DBEVENTTYPEDESCR*)CallService(MS_DB_EVENT_GETTYPE, (WPARAM)dbei->szModule, (LPARAM)dbei->eventType);
+ if (et && (et->flags & DETF_HISTORY)) {
+ pszTmp = mir_a2t(et->descr);
+ pszSrc = TranslateTS(pszTmp);
+ break;
+ }
+ *str = 0;
+ return;
+ }
_tcsncpy(str, (const TCHAR*)pszSrc, cbStr);
- str[ cbStr-1 ] = 0;
-
+ str[cbStr-1] = 0;
mir_free(pszTmp);
}
diff --git a/src/modules/database/dbutils.cpp b/src/modules/database/dbutils.cpp
index 6f9bb2a9c8..d560fd7be8 100644
--- a/src/modules/database/dbutils.cpp
+++ b/src/modules/database/dbutils.cpp
@@ -25,7 +25,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "..\..\core\commonheaders.h"
#include "profilemanager.h"
-static int CompareEventTypes(const DBEVENTTYPEDESCR* p1, const DBEVENTTYPEDESCR* p2)
+static int CompareEventTypes(const DBEVENTTYPEDESCR *p1, const DBEVENTTYPEDESCR *p2)
{
int result = strcmp(p1->module, p2->module);
if (result)
@@ -40,44 +40,46 @@ static BOOL bModuleInitialized = FALSE;
static INT_PTR DbEventTypeRegister(WPARAM, LPARAM lParam)
{
- DBEVENTTYPEDESCR* et = (DBEVENTTYPEDESCR*)lParam;
- if (eventTypes.getIndex(et) == -1) {
- DBEVENTTYPEDESCR* p = (DBEVENTTYPEDESCR*)mir_calloc(sizeof(DBEVENTTYPEDESCR));
- p->cbSize = DBEVENTTYPEDESCR_SIZE;
- p->module = mir_strdup(et->module);
- p->eventType = et->eventType;
- p->descr = mir_strdup(et->descr);
- if (et->cbSize == DBEVENTTYPEDESCR_SIZE) {
- if (et->textService)
- p->textService = mir_strdup(et->textService);
- if (et->iconService)
- p->iconService = mir_strdup(et->iconService);
- p->eventIcon = et->eventIcon;
- p->flags = et->flags;
- }
- if (!p->textService) {
- char szServiceName[100];
- mir_snprintf(szServiceName, sizeof(szServiceName), "%s/GetEventText%d", p->module, p->eventType);
- p->textService = mir_strdup(szServiceName);
- }
- if (!p->iconService) {
- char szServiceName[100];
- mir_snprintf(szServiceName, sizeof(szServiceName), "%s/GetEventIcon%d", p->module, p->eventType);
- p->iconService = mir_strdup(szServiceName);
- }
- eventTypes.insert(p);
- }
+ DBEVENTTYPEDESCR *et = (DBEVENTTYPEDESCR*)lParam;
+ if (et == NULL || et->cbSize != sizeof(DBEVENTTYPEDESCR))
+ return 0;
+
+ if (eventTypes.getIndex(et) != -1)
+ return 0;
+ DBEVENTTYPEDESCR *p = (DBEVENTTYPEDESCR*)mir_calloc(sizeof(DBEVENTTYPEDESCR));
+ p->cbSize = sizeof(DBEVENTTYPEDESCR);
+ p->module = mir_strdup(et->module);
+ p->eventType = et->eventType;
+ p->descr = mir_strdup(et->descr);
+ if (et->textService)
+ p->textService = mir_strdup(et->textService);
+ if (et->iconService)
+ p->iconService = mir_strdup(et->iconService);
+ p->eventIcon = et->eventIcon;
+ p->flags = et->flags;
+
+ if (!p->textService) {
+ char szServiceName[100];
+ mir_snprintf(szServiceName, sizeof(szServiceName), "%s/GetEventText%d", p->module, p->eventType);
+ p->textService = mir_strdup(szServiceName);
+ }
+ if (!p->iconService) {
+ char szServiceName[100];
+ mir_snprintf(szServiceName, sizeof(szServiceName), "%s/GetEventIcon%d", p->module, p->eventType);
+ p->iconService = mir_strdup(szServiceName);
+ }
+ eventTypes.insert(p);
return 0;
}
static INT_PTR DbEventTypeGet(WPARAM wParam, LPARAM lParam)
{
DBEVENTTYPEDESCR tmp;
- int idx;
-
tmp.module = (char*)wParam;
tmp.eventType = lParam;
+
+ int idx;
if (!List_GetIndex((SortedList*)&eventTypes, &tmp, &idx))
return 0;
@@ -358,7 +360,7 @@ void UnloadEventsModule()
return;
for (int i=0; i < eventTypes.getCount(); i++) {
- DBEVENTTYPEDESCR* p = eventTypes[i];
+ DBEVENTTYPEDESCR *p = eventTypes[i];
mir_free(p->module);
mir_free(p->descr);
mir_free(p->textService);