summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/SMS/src/SMS_svc.cpp24
-rw-r--r--plugins/SMS/src/stdafx.h1
-rw-r--r--plugins/Scriver/src/msgs.cpp3
-rw-r--r--plugins/TabSRMM/src/globals.cpp4
-rw-r--r--src/core/stdmsg/src/msgs.cpp4
5 files changed, 8 insertions, 28 deletions
diff --git a/plugins/SMS/src/SMS_svc.cpp b/plugins/SMS/src/SMS_svc.cpp
index ee3b8dc53c..1f62781b2f 100644
--- a/plugins/SMS/src/SMS_svc.cpp
+++ b/plugins/SMS/src/SMS_svc.cpp
@@ -49,8 +49,6 @@ int LoadModules(void)
Skin_AddSound("RecvSMSConfirmation", PROTOCOL_NAMEW, LPGENW("Incoming SMS Confirmation"));
RefreshAccountList(NULL, NULL);
-
- RestoreUnreadMessageAlerts();
return 0;
}
@@ -130,25 +128,3 @@ int ReadAckSMS(WPARAM, LPARAM lParam)
}
return 1;
}
-
-void RestoreUnreadMessageAlerts(void)
-{
- DBEVENTINFO dbei = {};
-
- for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact))
- for (MEVENT hDbEvent = db_event_firstUnread(hContact); hDbEvent; hDbEvent = db_event_next(hContact, hDbEvent)) {
- dbei.cbBlob = 0;
- if (db_event_get(hDbEvent, &dbei) == 0)
- if ((dbei.flags & (DBEF_SENT | DBEF_READ)) == 0 && ((dbei.eventType == ICQEVENTTYPE_SMS) || (dbei.eventType == ICQEVENTTYPE_SMSCONFIRMATION)))
- if (dbei.cbBlob > MIN_SMS_DBEVENT_LEN)
- handleNewMessage(hContact, (LPARAM)hDbEvent);
- }
-
- for (MEVENT hDbEvent = db_event_firstUnread(NULL); hDbEvent; hDbEvent = db_event_next(NULL, hDbEvent)) {
- dbei.cbBlob = 0;
- if (db_event_get(hDbEvent, &dbei) == 0)
- if ((dbei.flags & (DBEF_SENT | DBEF_READ)) == 0 && ((dbei.eventType == ICQEVENTTYPE_SMS) || (dbei.eventType == ICQEVENTTYPE_SMSCONFIRMATION)))
- if (dbei.cbBlob > MIN_SMS_DBEVENT_LEN)
- handleNewMessage(NULL, (LPARAM)hDbEvent);
- }
-}
diff --git a/plugins/SMS/src/stdafx.h b/plugins/SMS/src/stdafx.h
index a13314daaf..a908077d6c 100644
--- a/plugins/SMS/src/stdafx.h
+++ b/plugins/SMS/src/stdafx.h
@@ -122,7 +122,6 @@ int LoadModules();
int handleAckSMS(WPARAM wParam,LPARAM lParam);
int handleNewMessage(WPARAM wParam,LPARAM lParam);
-void RestoreUnreadMessageAlerts();
// Declaration of Menu SMS send click function
int SmsRebuildContactMenu(WPARAM wParam,LPARAM lParam);
diff --git a/plugins/Scriver/src/msgs.cpp b/plugins/Scriver/src/msgs.cpp
index d7c0f1ac32..e713c569cc 100644
--- a/plugins/Scriver/src/msgs.cpp
+++ b/plugins/Scriver/src/msgs.cpp
@@ -252,7 +252,8 @@ static void RestoreUnreadMessageAlerts(void)
for (MEVENT hDbEvent = db_event_firstUnread(hContact); hDbEvent; hDbEvent = db_event_next(hContact, hDbEvent)) {
DBEVENTINFO dbei = {};
dbei.cbBlob = 0;
- db_event_get(hDbEvent, &dbei);
+ if (db_event_get(hDbEvent, &dbei))
+ continue;
if ((dbei.flags & (DBEF_SENT | DBEF_READ)) || !DbEventIsMessageOrCustom(&dbei))
continue;
diff --git a/plugins/TabSRMM/src/globals.cpp b/plugins/TabSRMM/src/globals.cpp
index e52eb2a63e..69e3799fd9 100644
--- a/plugins/TabSRMM/src/globals.cpp
+++ b/plugins/TabSRMM/src/globals.cpp
@@ -507,7 +507,9 @@ void CGlobals::RestoreUnreadMessageAlerts(void)
for (MEVENT hDbEvent = db_event_firstUnread(hContact); hDbEvent; hDbEvent = db_event_next(hContact, hDbEvent)) {
DBEVENTINFO dbei = {};
- db_event_get(hDbEvent, &dbei);
+ if (db_event_get(hDbEvent, &dbei))
+ continue;
+
if (!dbei.markedRead() && dbei.eventType == EVENTTYPE_MESSAGE) {
if (Srmm_FindWindow(hContact) != nullptr)
continue;
diff --git a/src/core/stdmsg/src/msgs.cpp b/src/core/stdmsg/src/msgs.cpp
index 31e95c3db4..2933bbf669 100644
--- a/src/core/stdmsg/src/msgs.cpp
+++ b/src/core/stdmsg/src/msgs.cpp
@@ -246,7 +246,9 @@ static void RestoreUnreadMessageAlerts(void)
DBEVENTINFO dbei = {};
dbei.cbBlob = 0;
- db_event_get(hDbEvent, &dbei);
+ if (db_event_get(hDbEvent, &dbei))
+ continue;
+
if (!(dbei.flags & (DBEF_SENT | DBEF_READ)) && (dbei.eventType == EVENTTYPE_MESSAGE || DbEventIsForMsgWindow(&dbei))) {
int windowAlreadyExists = Srmm_FindWindow(hContact) != nullptr;
if (windowAlreadyExists)