summaryrefslogtreecommitdiff
path: root/src/core/stdmsg
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-03-30 17:32:39 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-03-30 17:32:39 +0000
commit109877a3c75cb290c55755dcfc88794d2453669d (patch)
tree3ede8b9170b2fc3f6f35dc2cea6742d44b19d631 /src/core/stdmsg
parentfee8d991bdf4a59b563d1b92165ea0ed2f7bacb8 (diff)
MS_DB_EVENT_* services remained, but their calls removed
git-svn-id: http://svn.miranda-ng.org/main/trunk@4255 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/core/stdmsg')
-rw-r--r--src/core/stdmsg/src/msgdialog.cpp138
-rw-r--r--src/core/stdmsg/src/msglog.cpp61
-rw-r--r--src/core/stdmsg/src/msgs.cpp63
-rw-r--r--src/core/stdmsg/src/msgtimedout.cpp15
4 files changed, 117 insertions, 160 deletions
diff --git a/src/core/stdmsg/src/msgdialog.cpp b/src/core/stdmsg/src/msgdialog.cpp
index b078aa10aa..74029cd726 100644
--- a/src/core/stdmsg/src/msgdialog.cpp
+++ b/src/core/stdmsg/src/msgdialog.cpp
@@ -132,21 +132,18 @@ HANDLE SendMessageDirect(const TCHAR *szMsg, HANDLE hContact, char *szProto)
}
if (sendBuffer) {
- HANDLE hNewEvent, hSendId;
- DBEVENTINFO dbei = { 0 };
- dbei.cbSize = sizeof(dbei);
+ DBEVENTINFO dbei = { sizeof(dbei) };
dbei.eventType = EVENTTYPE_MESSAGE;
dbei.flags = DBEF_SENT | (flags & PREF_UTF ? DBEF_UTF : 0) | (flags & PREF_RTL ? DBEF_RTL : 0);
dbei.szModule = szProto;
dbei.timestamp = (DWORD)time(NULL);
dbei.cbBlob = (DWORD)bufSize;
dbei.pBlob = (PBYTE)sendBuffer;
+ HANDLE hNewEvent = db_event_add(hContact, &dbei);
- hNewEvent = (HANDLE) CallService(MS_DB_EVENT_ADD, (WPARAM)hContact, (LPARAM)&dbei);
- hSendId = (HANDLE) CallContactService(hContact, MsgServiceName(hContact), flags, (LPARAM) sendBuffer);
+ HANDLE hSendId = (HANDLE) CallContactService(hContact, MsgServiceName(hContact), flags, (LPARAM) sendBuffer);
msgQueue_add(hContact, hSendId, szMsg, hNewEvent);
mir_free(sendBuffer);
-
return hNewEvent;
}
return NULL;
@@ -786,80 +783,67 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
if (dat->hContact) {
int historyMode = db_get_b(NULL, SRMMMOD, SRMSGSET_LOADHISTORY, SRMSGDEFSET_LOADHISTORY);
// This finds the first message to display, it works like shit
- dat->hDbEventFirst = (HANDLE) CallService(MS_DB_EVENT_FINDFIRSTUNREAD, (WPARAM) dat->hContact, 0);
+ dat->hDbEventFirst = db_event_firstUnread(dat->hContact);
switch (historyMode) {
case LOADHISTORY_COUNT:
{
HANDLE hPrevEvent;
- DBEVENTINFO dbei = { 0 };
- dbei.cbSize = sizeof(dbei);
+ DBEVENTINFO dbei = { sizeof(dbei) };
for (int i = DBGetContactSettingWord(NULL, SRMMMOD, SRMSGSET_LOADCOUNT, SRMSGDEFSET_LOADCOUNT); i--; ) {
if (dat->hDbEventFirst == NULL)
- hPrevEvent = (HANDLE) CallService(MS_DB_EVENT_FINDLAST, (WPARAM) dat->hContact, 0);
+ hPrevEvent = db_event_last(dat->hContact);
else
- hPrevEvent = (HANDLE) CallService(MS_DB_EVENT_FINDPREV, (WPARAM) dat->hDbEventFirst, 0);
+ hPrevEvent = db_event_prev(dat->hDbEventFirst);
if (hPrevEvent == NULL)
break;
dbei.cbBlob = 0;
dat->hDbEventFirst = hPrevEvent;
- CallService(MS_DB_EVENT_GET, (WPARAM) hPrevEvent, (LPARAM) &dbei);
+ db_event_get(hPrevEvent, &dbei);
if ( !DbEventIsShown(&dbei, dat))
i++;
}
break;
}
case LOADHISTORY_TIME:
- {
+ DBEVENTINFO dbei = { sizeof(dbei) };
+ if (dat->hDbEventFirst == NULL)
+ dbei.timestamp = (DWORD)time(NULL);
+ else
+ db_event_get( dat->hDbEventFirst, &dbei);
+
+ DWORD firstTime = dbei.timestamp - 60 * DBGetContactSettingWord(NULL, SRMMMOD, SRMSGSET_LOADTIME, SRMSGDEFSET_LOADTIME);
+ for (;;) {
HANDLE hPrevEvent;
- DBEVENTINFO dbei = { 0 };
- DWORD firstTime;
-
- dbei.cbSize = sizeof(dbei);
if (dat->hDbEventFirst == NULL)
- dbei.timestamp = (DWORD)time(NULL);
+ hPrevEvent = db_event_last(dat->hContact);
else
- CallService(MS_DB_EVENT_GET, (WPARAM) dat->hDbEventFirst, (LPARAM) & dbei);
- firstTime = dbei.timestamp - 60 * DBGetContactSettingWord(NULL, SRMMMOD, SRMSGSET_LOADTIME, SRMSGDEFSET_LOADTIME);
- for (;;)
- {
- if (dat->hDbEventFirst == NULL)
- hPrevEvent = (HANDLE) CallService(MS_DB_EVENT_FINDLAST, (WPARAM) dat->hContact, 0);
- else
- hPrevEvent = (HANDLE) CallService(MS_DB_EVENT_FINDPREV, (WPARAM) dat->hDbEventFirst, 0);
- if (hPrevEvent == NULL)
- break;
- dbei.cbBlob = 0;
- CallService(MS_DB_EVENT_GET, (WPARAM) hPrevEvent, (LPARAM) & dbei);
- if (dbei.timestamp < firstTime)
- break;
- dat->hDbEventFirst = hPrevEvent;
- }
- break;
+ hPrevEvent = db_event_prev(dat->hDbEventFirst);
+ if (hPrevEvent == NULL)
+ break;
+
+ dbei.cbBlob = 0;
+ db_event_get(hPrevEvent, &dbei);
+ if (dbei.timestamp < firstTime)
+ break;
+ dat->hDbEventFirst = hPrevEvent;
}
+ break;
}
}
- {
- DBEVENTINFO dbei = { 0 };
- HANDLE hdbEvent;
-
- dbei.cbSize = sizeof(dbei);
- hdbEvent = (HANDLE) CallService(MS_DB_EVENT_FINDLAST, (WPARAM) dat->hContact, 0);
- if (hdbEvent)
- {
- do {
- ZeroMemory(&dbei, sizeof(dbei));
- dbei.cbSize = sizeof(dbei);
- CallService(MS_DB_EVENT_GET, (WPARAM) hdbEvent, (LPARAM) & dbei);
- if (( dbei.eventType == EVENTTYPE_MESSAGE || DbEventIsForMsgWindow(&dbei)) && !(dbei.flags & DBEF_SENT)) {
- dat->lastMessage = dbei.timestamp;
- PostMessage(hwndDlg, DM_UPDATELASTMESSAGE, 0, 0);
- break;
- }
+ HANDLE hdbEvent = db_event_last(dat->hContact);
+ if (hdbEvent) {
+ do {
+ DBEVENTINFO dbei = { sizeof(dbei) };
+ db_event_get( hdbEvent, &dbei);
+ if (( dbei.eventType == EVENTTYPE_MESSAGE || DbEventIsForMsgWindow(&dbei)) && !(dbei.flags & DBEF_SENT)) {
+ dat->lastMessage = dbei.timestamp;
+ PostMessage(hwndDlg, DM_UPDATELASTMESSAGE, 0, 0);
+ break;
}
- while (hdbEvent = (HANDLE) CallService(MS_DB_EVENT_FINDPREV, (WPARAM) hdbEvent, 0));
}
+ while (hdbEvent = db_event_prev(hdbEvent));
}
SendMessage(hwndDlg, DM_OPTIONSAPPLIED, 1, 0);
@@ -1193,9 +1177,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
// log
if ((dat->wStatus != dat->wOldStatus || lParam != 0) &&
db_get_b(NULL, SRMMMOD, SRMSGSET_SHOWSTATUSCH, SRMSGDEFSET_SHOWSTATUSCH)) {
- DBEVENTINFO dbei;
TCHAR buffer[200];
- HANDLE hNewEvent;
int iLen;
TCHAR *szOldStatus = (TCHAR*)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, (WPARAM) dat->wOldStatus, GSMDF_TCHAR);
@@ -1210,22 +1192,20 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
else
iLen = mir_sntprintf(buffer, SIZEOF(buffer), TranslateT("is now %s (was %s)"), szNewStatus, szOldStatus);
- {
- char* blob = ( char* )alloca(1000);
- int ansiLen = WideCharToMultiByte(CP_ACP, 0, buffer, -1, blob, 1000, 0, 0);
- memcpy( blob+ansiLen, buffer, sizeof(TCHAR)*(iLen+1));
- dbei.cbBlob = ansiLen + sizeof(TCHAR)*(iLen+1);
- dbei.cbSize = sizeof(dbei);
- dbei.pBlob = (PBYTE) blob;
- dbei.eventType = EVENTTYPE_STATUSCHANGE;
- dbei.flags = 0;
- dbei.timestamp = (DWORD)time(NULL);
- dbei.szModule = dat->szProto;
- hNewEvent = (HANDLE) CallService(MS_DB_EVENT_ADD, (WPARAM) dat->hContact, (LPARAM) & dbei);
- if (dat->hDbEventFirst == NULL) {
- dat->hDbEventFirst = hNewEvent;
- SendMessage(hwndDlg, DM_REMAKELOG, 0, 0);
- }
+ char* blob = ( char* )alloca(1000);
+ int ansiLen = WideCharToMultiByte(CP_ACP, 0, buffer, -1, blob, 1000, 0, 0);
+ memcpy( blob+ansiLen, buffer, sizeof(TCHAR)*(iLen+1));
+
+ DBEVENTINFO dbei = { sizeof(dbei) };
+ dbei.cbBlob = ansiLen + sizeof(TCHAR)*(iLen+1);
+ dbei.pBlob = (PBYTE) blob;
+ dbei.eventType = EVENTTYPE_STATUSCHANGE;
+ dbei.timestamp = (DWORD)time(NULL);
+ dbei.szModule = dat->szProto;
+ HANDLE hNewEvent = db_event_add(dat->hContact, &dbei);
+ if (dat->hDbEventFirst == NULL) {
+ dat->hDbEventFirst = hNewEvent;
+ SendMessage(hwndDlg, DM_REMAKELOG, 0, 0);
}
}
dat->wOldStatus = dat->wStatus;
@@ -1396,15 +1376,13 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
break;
case HM_DBEVENTADDED:
- if ((HANDLE) wParam != dat->hContact)
- break;
- {
- DBEVENTINFO dbei = { 0 };
-
- dbei.cbSize = sizeof(dbei);
- CallService(MS_DB_EVENT_GET, lParam, (LPARAM) & dbei);
+ if ((HANDLE)wParam == dat->hContact) {
+ HANDLE hDbEvent = (HANDLE)lParam;
if (dat->hDbEventFirst == NULL)
- dat->hDbEventFirst = (HANDLE) lParam;
+ dat->hDbEventFirst = hDbEvent;
+
+ DBEVENTINFO dbei = { sizeof(dbei) };
+ db_event_get(hDbEvent, &dbei);
if (DbEventIsShown(&dbei, dat) && !(dbei.flags & DBEF_READ)) {
if ((dbei.eventType == EVENTTYPE_MESSAGE || DbEventIsForMsgWindow(&dbei)) && !(dbei.flags & DBEF_SENT)) {
if (GetForegroundWindow() == hwndDlg)
@@ -1416,7 +1394,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
dat->lastMessage = dbei.timestamp;
SendMessage(hwndDlg, DM_UPDATELASTMESSAGE, 0, 0);
}
- if ((HANDLE) lParam != dat->hDbEventFirst && (HANDLE) CallService(MS_DB_EVENT_FINDNEXT, lParam, 0) == NULL)
+ if (hDbEvent != dat->hDbEventFirst && db_event_next(hDbEvent) == NULL)
SendMessage(hwndDlg, DM_APPENDTOLOG, lParam, 0);
else
SendMessage(hwndDlg, DM_REMAKELOG, 0, 0);
diff --git a/src/core/stdmsg/src/msglog.cpp b/src/core/stdmsg/src/msglog.cpp
index a76bbeaac5..6dc9aad95e 100644
--- a/src/core/stdmsg/src/msglog.cpp
+++ b/src/core/stdmsg/src/msglog.cpp
@@ -268,26 +268,25 @@ static char *CreateRTFFromDbEvent(struct SrmmWindowData *dat, HANDLE hContact, H
{
char *buffer;
int bufferAlloced, bufferEnd;
- DBEVENTINFO dbei = { 0 };
int showColon = 0;
- dbei.cbSize = sizeof(dbei);
- dbei.cbBlob = CallService(MS_DB_EVENT_GETBLOBSIZE, (WPARAM) hDbEvent, 0);
+ DBEVENTINFO dbei = { sizeof(dbei) };
+ dbei.cbBlob = db_event_getBlobSize(hDbEvent);
if (dbei.cbBlob == -1)
return NULL;
+
dbei.pBlob = (PBYTE) mir_alloc(dbei.cbBlob);
- CallService(MS_DB_EVENT_GET, (WPARAM) hDbEvent, (LPARAM) & dbei);
+ db_event_get(hDbEvent, &dbei);
if (!DbEventIsShown(&dbei, dat)) {
mir_free(dbei.pBlob);
return NULL;
}
- if (!(dbei.flags & DBEF_SENT) && (dbei.eventType == EVENTTYPE_MESSAGE || DbEventIsForMsgWindow(&dbei)))
- {
- CallService(MS_DB_EVENT_MARKREAD, (WPARAM) hContact, (LPARAM) hDbEvent);
+ if (!(dbei.flags & DBEF_SENT) && (dbei.eventType == EVENTTYPE_MESSAGE || DbEventIsForMsgWindow(&dbei))) {
+ db_event_markRead(hContact, hDbEvent);
CallService(MS_CLIST_REMOVEEVENT, (WPARAM) hContact, (LPARAM) hDbEvent);
}
else if (dbei.eventType == EVENTTYPE_STATUSCHANGE || dbei.eventType == EVENTTYPE_JABBER_CHATSTATES || dbei.eventType == EVENTTYPE_JABBER_PRESENCE) {
- CallService(MS_DB_EVENT_MARKREAD, (WPARAM) hContact, (LPARAM) hDbEvent);
+ db_event_markRead(hContact, hDbEvent);
}
bufferEnd = 0;
bufferAlloced = 1024;
@@ -298,41 +297,38 @@ static char *CreateRTFFromDbEvent(struct SrmmWindowData *dat, HANDLE hContact, H
AppendToBuffer(&buffer, &bufferEnd, &bufferAlloced, "\\par");
if (dbei.flags & DBEF_RTL) {
- AppendToBuffer(&buffer, &bufferEnd, &bufferAlloced, "\\rtlpar");
+ AppendToBuffer(&buffer, &bufferEnd, &bufferAlloced, "\\rtlpar");
dat->bIsAutoRTL = TRUE;
}
- else
- AppendToBuffer(&buffer, &bufferEnd, &bufferAlloced, "\\ltrpar");
+ else AppendToBuffer(&buffer, &bufferEnd, &bufferAlloced, "\\ltrpar");
streamData->isEmpty = 0;
if (dat->bIsAutoRTL) {
- if(dbei.flags & DBEF_RTL) {
+ if(dbei.flags & DBEF_RTL)
AppendToBuffer(&buffer, &bufferEnd, &bufferAlloced, "\\ltrch\\rtlch");
- }else{
+ else
AppendToBuffer(&buffer, &bufferEnd, &bufferAlloced, "\\rtlch\\ltrch");
- }
}
if (g_dat.flags & SMF_SHOWICONS) {
int i;
switch (dbei.eventType) {
- case EVENTTYPE_MESSAGE:
- if (dbei.flags & DBEF_SENT) {
- i = LOGICON_MSG_OUT;
- }
- else {
- i = LOGICON_MSG_IN;
- }
- break;
- case EVENTTYPE_JABBER_CHATSTATES:
- case EVENTTYPE_JABBER_PRESENCE:
- case EVENTTYPE_STATUSCHANGE:
- case EVENTTYPE_FILE:
- default:
- i = LOGICON_MSG_NOTICE;
- break;
+ case EVENTTYPE_MESSAGE:
+ if (dbei.flags & DBEF_SENT)
+ i = LOGICON_MSG_OUT;
+ else
+ i = LOGICON_MSG_IN;
+ break;
+
+ case EVENTTYPE_JABBER_CHATSTATES:
+ case EVENTTYPE_JABBER_PRESENCE:
+ case EVENTTYPE_STATUSCHANGE:
+ case EVENTTYPE_FILE:
+ default:
+ i = LOGICON_MSG_NOTICE;
+ break;
}
AppendToBuffer(&buffer, &bufferEnd, &bufferAlloced, "\\f0\\fs14");
while (bufferAlloced - bufferEnd < logIconBmpSize[i])
@@ -341,8 +337,8 @@ static char *CreateRTFFromDbEvent(struct SrmmWindowData *dat, HANDLE hContact, H
CopyMemory(buffer + bufferEnd, pLogIconBmpBits[i], logIconBmpSize[i]);
bufferEnd += logIconBmpSize[i];
}
- if (g_dat.flags & SMF_SHOWTIME)
- {
+
+ if (g_dat.flags & SMF_SHOWTIME) {
const TCHAR* szFormat;
TCHAR str[64];
@@ -357,6 +353,7 @@ static char *CreateRTFFromDbEvent(struct SrmmWindowData *dat, HANDLE hContact, H
AppendToBufferWithRTF(&buffer, &bufferEnd, &bufferAlloced, str);
showColon = 1;
}
+
if (!(g_dat.flags&SMF_HIDENAMES) && dbei.eventType != EVENTTYPE_STATUSCHANGE && dbei.eventType != EVENTTYPE_JABBER_CHATSTATES && dbei.eventType != EVENTTYPE_JABBER_PRESENCE) {
TCHAR* szName;
CONTACTINFO ci = {0};
@@ -477,7 +474,7 @@ static DWORD CALLBACK LogStreamInEvents(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG
dat->buffer = CreateRTFFromDbEvent(dat->dlgDat, dat->hContact, dat->hDbEvent, dat);
if (dat->buffer)
dat->hDbEventLast = dat->hDbEvent;
- dat->hDbEvent = (HANDLE) CallService(MS_DB_EVENT_FINDNEXT, (WPARAM) dat->hDbEvent, 0);
+ dat->hDbEvent = db_event_next(dat->hDbEvent);
if (--dat->eventsToInsert == 0)
break;
} while (dat->buffer == NULL && dat->hDbEvent);
diff --git a/src/core/stdmsg/src/msgs.cpp b/src/core/stdmsg/src/msgs.cpp
index fe65236e7f..7079ff4b65 100644
--- a/src/core/stdmsg/src/msgs.cpp
+++ b/src/core/stdmsg/src/msgs.cpp
@@ -50,29 +50,23 @@ static int SRMMStatusToPf2(int status)
static int MessageEventAdded(WPARAM wParam, LPARAM lParam)
{
- DBEVENTINFO dbei = {0};
- HWND hwnd;
-
- dbei.cbSize = sizeof(dbei);
- CallService(MS_DB_EVENT_GET, lParam, (LPARAM) & dbei);
+ DBEVENTINFO dbei = { sizeof(dbei) };
+ db_event_get((HANDLE)lParam, &dbei);
if (dbei.flags & (DBEF_SENT | DBEF_READ) || !(dbei.eventType == EVENTTYPE_MESSAGE || DbEventIsForMsgWindow(&dbei)))
return 0;
CallServiceSync(MS_CLIST_REMOVEEVENT, wParam, (LPARAM) 1);
/* does a window for the contact exist? */
- hwnd = WindowList_Find(g_dat.hMessageWindowList, (HANDLE) wParam);
- if (hwnd)
- {
- if (!db_get_b(NULL, SRMMMOD, SRMSGSET_DONOTSTEALFOCUS, SRMSGDEFSET_DONOTSTEALFOCUS))
- {
+ HWND hwnd = WindowList_Find(g_dat.hMessageWindowList, (HANDLE) wParam);
+ if (hwnd) {
+ if (!db_get_b(NULL, SRMMMOD, SRMSGSET_DONOTSTEALFOCUS, SRMSGDEFSET_DONOTSTEALFOCUS)) {
ShowWindow(hwnd, SW_RESTORE);
SetWindowPos(hwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW);
SetForegroundWindow(hwnd);
SkinPlaySound("RecvMsgActive");
}
- else
- {
+ else {
if (GetForegroundWindow() == hwnd)
SkinPlaySound("RecvMsgActive");
else
@@ -244,57 +238,48 @@ static int ContactDeleted(WPARAM wParam, LPARAM lParam)
static void RestoreUnreadMessageAlerts(void)
{
- CLISTEVENT cle = {0};
- DBEVENTINFO dbei = {0};
TCHAR toolTip[256];
int windowAlreadyExists;
- HANDLE hDbEvent, hContact;
int autoPopup;
- dbei.cbSize = sizeof(dbei);
- cle.cbSize = sizeof(cle);
+ CLISTEVENT cle = { sizeof(cle) };
cle.hIcon = LoadSkinnedIcon(SKINICON_EVENT_MESSAGE);
cle.pszService = "SRMsg/ReadMessage";
cle.flags = CLEF_TCHAR;
cle.ptszTooltip = toolTip;
- hContact = db_find_first();
- while (hContact)
- {
- hDbEvent = (HANDLE) CallService(MS_DB_EVENT_FINDFIRSTUNREAD, (WPARAM) hContact, 0);
- while (hDbEvent)
- {
+ DBEVENTINFO dbei = { sizeof(dbei) };
+
+ HANDLE hContact = db_find_first();
+ while (hContact) {
+ HANDLE hDbEvent = db_event_firstUnread(hContact);
+ while (hDbEvent) {
autoPopup = 0;
dbei.cbBlob = 0;
- CallService(MS_DB_EVENT_GET, (WPARAM) hDbEvent, (LPARAM) & dbei);
- if (!(dbei.flags & (DBEF_SENT | DBEF_READ)) && ( dbei.eventType == EVENTTYPE_MESSAGE || DbEventIsForMsgWindow(&dbei)))
- {
+ db_event_get( hDbEvent, &dbei);
+ if (!(dbei.flags & (DBEF_SENT | DBEF_READ)) && ( dbei.eventType == EVENTTYPE_MESSAGE || DbEventIsForMsgWindow(&dbei))) {
windowAlreadyExists = WindowList_Find(g_dat.hMessageWindowList, hContact) != NULL;
if (windowAlreadyExists)
continue;
- {
- char *szProto = GetContactProto(hContact);
- if (szProto && (g_dat.openFlags & SRMMStatusToPf2(CallProtoService(szProto, PS_GETSTATUS, 0, 0))))
- {
- autoPopup = 1;
- }
- }
- if (autoPopup && !windowAlreadyExists)
- {
- struct NewMessageWindowLParam newData = {0};
+
+ char *szProto = GetContactProto(hContact);
+ if (szProto && (g_dat.openFlags & SRMMStatusToPf2(CallProtoService(szProto, PS_GETSTATUS, 0, 0))))
+ autoPopup = 1;
+
+ if (autoPopup && !windowAlreadyExists) {
+ NewMessageWindowLParam newData = {0};
newData.hContact = hContact;
newData.noActivate = db_get_b(NULL, SRMMMOD, SRMSGSET_DONOTSTEALFOCUS, SRMSGDEFSET_DONOTSTEALFOCUS);
CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_MSG), NULL, DlgProcMessage, (LPARAM) & newData);
}
- else
- {
+ else {
cle.hContact = hContact;
cle.hDbEvent = hDbEvent;
mir_sntprintf(toolTip, SIZEOF(toolTip), TranslateT("Message from %s"), (TCHAR *) CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM) hContact, GCDNF_TCHAR));
CallService(MS_CLIST_ADDEVENT, 0, (LPARAM) & cle);
}
}
- hDbEvent = (HANDLE) CallService(MS_DB_EVENT_FINDNEXT, (WPARAM) hDbEvent, 0);
+ hDbEvent = db_event_next(hDbEvent);
}
hContact = db_find_next(hContact);
}
diff --git a/src/core/stdmsg/src/msgtimedout.cpp b/src/core/stdmsg/src/msgtimedout.cpp
index 9e112adb72..3004671f7f 100644
--- a/src/core/stdmsg/src/msgtimedout.cpp
+++ b/src/core/stdmsg/src/msgtimedout.cpp
@@ -88,20 +88,17 @@ INT_PTR CALLBACK ErrorDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar
void MessageFailureProcess(TMsgQueue *item, const char* err)
{
- HWND hwnd;
- ErrorDlgParam param = { err, item };
-
- CallService(MS_DB_EVENT_DELETE, (WPARAM)item->hContact, (LPARAM)item->hDbEvent);
+ db_event_delete(item->hContact, item->hDbEvent);
- hwnd = WindowList_Find(g_dat.hMessageWindowList, (HANDLE)item->hContact);
- if (hwnd == NULL)
- {
+ HWND hwnd = WindowList_Find(g_dat.hMessageWindowList, (HANDLE)item->hContact);
+ if (hwnd == NULL) {
SendMessageCmd(item->hContact, NULL, 0);
hwnd = WindowList_Find(g_dat.hMessageWindowList, (HANDLE)item->hContact);
}
- else
- SendMessage(hwnd, DM_REMAKELOG, 0, 0);
+ else SendMessage(hwnd, DM_REMAKELOG, 0, 0);
SkinPlaySound("SendError");
+
+ ErrorDlgParam param = { err, item };
CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_MSGSENDERROR), hwnd, ErrorDlgProc, (LPARAM) &param);
}