diff options
author | George Hazan <george.hazan@gmail.com> | 2013-03-30 17:32:39 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-03-30 17:32:39 +0000 |
commit | 109877a3c75cb290c55755dcfc88794d2453669d (patch) | |
tree | 3ede8b9170b2fc3f6f35dc2cea6742d44b19d631 /src/core | |
parent | fee8d991bdf4a59b563d1b92165ea0ed2f7bacb8 (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')
-rw-r--r-- | src/core/stdauth/auth.cpp | 9 | ||||
-rw-r--r-- | src/core/stdauth/authdialogs.cpp | 27 | ||||
-rw-r--r-- | src/core/stdchat/src/clist.cpp | 2 | ||||
-rw-r--r-- | src/core/stdfile/file.cpp | 25 | ||||
-rw-r--r-- | src/core/stdfile/filerecvdlg.cpp | 9 | ||||
-rw-r--r-- | src/core/stdfile/filexferdlg.cpp | 2 | ||||
-rw-r--r-- | src/core/stdmsg/src/msgdialog.cpp | 138 | ||||
-rw-r--r-- | src/core/stdmsg/src/msglog.cpp | 61 | ||||
-rw-r--r-- | src/core/stdmsg/src/msgs.cpp | 63 | ||||
-rw-r--r-- | src/core/stdmsg/src/msgtimedout.cpp | 15 | ||||
-rw-r--r-- | src/core/stduihist/history.cpp | 78 | ||||
-rw-r--r-- | src/core/stdurl/url.cpp | 45 | ||||
-rw-r--r-- | src/core/stdurl/urldialogs.cpp | 164 |
13 files changed, 282 insertions, 356 deletions
diff --git a/src/core/stdauth/auth.cpp b/src/core/stdauth/auth.cpp index 2edd847743..270bbb1436 100644 --- a/src/core/stdauth/auth.cpp +++ b/src/core/stdauth/auth.cpp @@ -47,15 +47,14 @@ static int AuthEventAdded(WPARAM, LPARAM lParam) TCHAR szTooltip[256];
const HANDLE hDbEvent = (HANDLE)lParam;
- DBEVENTINFO dbei = {0};
- dbei.cbSize = sizeof(dbei);
- CallService(MS_DB_EVENT_GET, (WPARAM)lParam, (LPARAM)&dbei);
+ DBEVENTINFO dbei = { sizeof(dbei) };
+ db_event_get((HANDLE)lParam, &dbei);
if (dbei.flags & (DBEF_SENT | DBEF_READ) || (dbei.eventType != EVENTTYPE_AUTHREQUEST && dbei.eventType != EVENTTYPE_ADDED))
return 0;
- dbei.cbBlob = CallService(MS_DB_EVENT_GETBLOBSIZE, lParam, 0);
+ dbei.cbBlob = db_event_getBlobSize(hDbEvent);
dbei.pBlob = (PBYTE)alloca(dbei.cbBlob);
- CallService(MS_DB_EVENT_GET, lParam, (LPARAM)&dbei);
+ db_event_get(hDbEvent, &dbei);
HANDLE hContact = DbGetAuthEventContact(&dbei);
diff --git a/src/core/stdauth/authdialogs.cpp b/src/core/stdauth/authdialogs.cpp index 3f498cce22..0fd7b44cce 100644 --- a/src/core/stdauth/authdialogs.cpp +++ b/src/core/stdauth/authdialogs.cpp @@ -38,11 +38,10 @@ INT_PTR CALLBACK DlgProcAdded(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
//blob is: uin(DWORD), hcontact(HANDLE), nick(ASCIIZ), first(ASCIIZ), last(ASCIIZ), email(ASCIIZ)
- DBEVENTINFO dbei = {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);
dbei.pBlob = (PBYTE)alloca(dbei.cbBlob);
- CallService(MS_DB_EVENT_GET, (WPARAM)hDbEvent, (LPARAM)&dbei);
+ db_event_get(hDbEvent, &dbei);
DWORD uin = *(PDWORD)dbei.pBlob;
HANDLE hContact = DbGetAuthEventContact(&dbei);
@@ -162,11 +161,10 @@ INT_PTR CALLBACK DlgProcAuthReq(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
//blob is: uin(DWORD), hcontact(HANDLE), nick(ASCIIZ), first(ASCIIZ), last(ASCIIZ), email(ASCIIZ), reason(ASCIIZ)
- DBEVENTINFO dbei = {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);
dbei.pBlob = (PBYTE)alloca(dbei.cbBlob);
- CallService(MS_DB_EVENT_GET, (WPARAM)hDbEvent, (LPARAM)&dbei);
+ db_event_get(hDbEvent, &dbei);
DWORD uin = *(PDWORD)dbei.pBlob;
HANDLE hContact = DbGetAuthEventContact(&dbei);
@@ -245,13 +243,11 @@ INT_PTR CALLBACK DlgProcAuthReq(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP case IDOK:
{
- DBEVENTINFO dbei = {0};
- dbei.cbSize = sizeof(dbei);
- CallService(MS_DB_EVENT_GET, (WPARAM)hDbEvent, (LPARAM)&dbei);
+ DBEVENTINFO dbei = { sizeof(dbei) };
+ db_event_get(hDbEvent, &dbei);
CallProtoService(dbei.szModule, PS_AUTHALLOW, (WPARAM)hDbEvent, 0);
- if (IsDlgButtonChecked(hwndDlg, IDC_ADDCHECK))
- {
+ if (IsDlgButtonChecked(hwndDlg, IDC_ADDCHECK)) {
ADDCONTACTSTRUCT acs = {0};
acs.handle = hDbEvent;
acs.handleType = HANDLE_EVENT;
@@ -264,9 +260,8 @@ INT_PTR CALLBACK DlgProcAuthReq(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP case IDCANCEL:
{
- DBEVENTINFO dbei = {0};
- dbei.cbSize = sizeof(dbei);
- CallService(MS_DB_EVENT_GET, (WPARAM)hDbEvent, (LPARAM)&dbei);
+ DBEVENTINFO dbei = { sizeof(dbei) };
+ db_event_get(hDbEvent, &dbei);
if (IsWindowEnabled(GetDlgItem(hwndDlg, IDC_DENYREASON)))
{
diff --git a/src/core/stdchat/src/clist.cpp b/src/core/stdchat/src/clist.cpp index 83c2e04196..7761fdab1c 100644 --- a/src/core/stdchat/src/clist.cpp +++ b/src/core/stdchat/src/clist.cpp @@ -295,7 +295,7 @@ HANDLE CList_FindRoom ( const char* pszModule, const TCHAR* pszRoom) {
HANDLE hContact = db_find_first();
while (hContact) {
- char* szProto = ( char* )CallService( MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hContact, 0 );
+ char *szProto = GetContactProto(hContact);
if ( szProto && !lstrcmpiA( szProto, pszModule )) {
if ( DBGetContactSettingByte( hContact, szProto, "ChatRoom", 0) != 0 ) {
DBVARIANT dbv;
diff --git a/src/core/stdfile/file.cpp b/src/core/stdfile/file.cpp index a29b71bc33..048125abac 100644 --- a/src/core/stdfile/file.cpp +++ b/src/core/stdfile/file.cpp @@ -140,12 +140,11 @@ static int FileEventAdded(WPARAM wParam, LPARAM lParam) {
DWORD dwSignature;
- DBEVENTINFO dbei = {0};
- dbei.cbSize = sizeof(dbei);
+ DBEVENTINFO dbei = { sizeof(dbei) };
dbei.cbBlob = sizeof(DWORD);
dbei.pBlob = (PBYTE)&dwSignature;
- CallService(MS_DB_EVENT_GET, lParam, (LPARAM)&dbei);
- if (dbei.flags&(DBEF_SENT|DBEF_READ) || dbei.eventType != EVENTTYPE_FILE || dwSignature == 0)
+ db_event_get((HANDLE)lParam, &dbei);
+ if (dbei.flags & (DBEF_SENT|DBEF_READ) || dbei.eventType != EVENTTYPE_FILE || dwSignature == 0)
return 0;
PushFileEvent((HANDLE)wParam, (HANDLE)lParam, 0);
@@ -288,19 +287,15 @@ void UpdateProtoFileTransferStatus(PROTOFILETRANSFERSTATUS *dest, PROTOFILETRANS static void RemoveUnreadFileEvents(void)
{
- DBEVENTINFO dbei = {0};
- HANDLE hDbEvent, hContact;
-
- dbei.cbSize = sizeof(dbei);
- hContact = db_find_first();
+ HANDLE hContact = db_find_first();
while (hContact) {
- hDbEvent = (HANDLE)CallService(MS_DB_EVENT_FINDFIRSTUNREAD, (WPARAM)hContact, 0);
+ HANDLE hDbEvent = db_event_firstUnread(hContact);
while (hDbEvent) {
- dbei.cbBlob = 0;
- CallService(MS_DB_EVENT_GET, (WPARAM)hDbEvent, (LPARAM)&dbei);
+ DBEVENTINFO dbei = { sizeof(dbei) };
+ db_event_get(hDbEvent, &dbei);
if ( !(dbei.flags&(DBEF_SENT|DBEF_READ)) && dbei.eventType == EVENTTYPE_FILE)
- CallService(MS_DB_EVENT_MARKREAD, (WPARAM)hContact, (LPARAM)hDbEvent);
- hDbEvent = (HANDLE)CallService(MS_DB_EVENT_FINDNEXT, (WPARAM)hDbEvent, 0);
+ db_event_markRead(hContact, hDbEvent);
+ hDbEvent = db_event_next(hDbEvent);
}
hContact = db_find_next(hContact);
}
@@ -413,7 +408,7 @@ static INT_PTR Proto_RecvFileT(WPARAM, LPARAM lParam) }
mir_free(szDescr);
- HANDLE hdbe = (HANDLE)CallService(MS_DB_EVENT_ADD, (WPARAM)ccs->hContact, (LPARAM)&dbei);
+ HANDLE hdbe = db_event_add(ccs->hContact, &dbei);
PushFileEvent(ccs->hContact, hdbe, pre->lParam);
mir_free(dbei.pBlob);
diff --git a/src/core/stdfile/filerecvdlg.cpp b/src/core/stdfile/filerecvdlg.cpp index ac082ac140..f9e2c3ddce 100644 --- a/src/core/stdfile/filerecvdlg.cpp +++ b/src/core/stdfile/filerecvdlg.cpp @@ -247,14 +247,13 @@ INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l DBFreeVariant(&dbv);
}
- CallService(MS_DB_EVENT_MARKREAD, (WPARAM)dat->hContact, (LPARAM)dat->hDbEvent);
+ db_event_markRead(dat->hContact, dat->hDbEvent);
- DBEVENTINFO dbei = {0};
- dbei.cbSize = sizeof(dbei);
- dbei.cbBlob = CallService(MS_DB_EVENT_GETBLOBSIZE, (WPARAM)dat->hDbEvent, 0);
+ DBEVENTINFO dbei = { sizeof(dbei) };
+ dbei.cbBlob = db_event_getBlobSize(dat->hDbEvent);
if (dbei.cbBlob > 4 && dbei.cbBlob <= 8196) {
dbei.pBlob = (PBYTE)alloca(dbei.cbBlob + 1);
- CallService(MS_DB_EVENT_GET, (WPARAM)dat->hDbEvent, (LPARAM)&dbei);
+ db_event_get(dat->hDbEvent, &dbei);
dbei.pBlob[dbei.cbBlob] = 0;
dat->fs = cle->lParam ? (HANDLE)cle->lParam : (HANDLE)*(PDWORD)dbei.pBlob;
diff --git a/src/core/stdfile/filexferdlg.cpp b/src/core/stdfile/filexferdlg.cpp index bcb51e6a62..93354d07d4 100644 --- a/src/core/stdfile/filexferdlg.cpp +++ b/src/core/stdfile/filexferdlg.cpp @@ -654,7 +654,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR DBEVENTINFO dbei = {0};
FillSendData(dat, dbei);
- CallService(MS_DB_EVENT_ADD, (WPARAM)dat->hContact, (LPARAM)&dbei);
+ db_event_add(dat->hContact, &dbei);
if (dbei.pBlob)
mir_free(dbei.pBlob);
dat->files = NULL; //protocol library frees this
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) ¶m);
}
diff --git a/src/core/stduihist/history.cpp b/src/core/stduihist/history.cpp index dcb8e6e401..da39ccaee2 100644 --- a/src/core/stduihist/history.cpp +++ b/src/core/stduihist/history.cpp @@ -142,32 +142,29 @@ static void FillHistoryThread(void* param) {
Thread_SetName("HistoryWindow::FillHistoryThread");
- TCHAR str[200], eventText[256], strdatetime[64];
- HANDLE hDbEvent;
- DBEVENTINFO dbei;
- int newBlobSize, oldBlobSize, i;
- HWND hwndList;
THistoryThread *hInfo = (THistoryThread*)param;
+ HWND hwndList = GetDlgItem(hInfo->hwnd, IDC_LIST);
SendDlgItemMessage(hInfo->hwnd, IDC_LIST, LB_RESETCONTENT, 0, 0);
- i = CallService(MS_DB_EVENT_GETCOUNT, (WPARAM)hInfo->hContact, 0);
+ int i = db_event_count(hInfo->hContact);
SendDlgItemMessage(hInfo->hwnd, IDC_LIST, LB_INITSTORAGE, i, i*40);
- ZeroMemory(&dbei, sizeof(dbei));
- dbei.cbSize = sizeof(dbei);
- oldBlobSize = 0;
- hDbEvent = (HANDLE)CallService(MS_DB_EVENT_FINDLAST, (WPARAM)hInfo->hContact, 0);
- hwndList = GetDlgItem(hInfo->hwnd, IDC_LIST);
+ DBEVENTINFO dbei = { sizeof(dbei) };
+ int oldBlobSize = 0;
+ HANDLE hDbEvent = db_event_last(hInfo->hContact);
+
while (hDbEvent != NULL) {
if ( !IsWindow(hInfo->hwnd))
break;
- newBlobSize = CallService(MS_DB_EVENT_GETBLOBSIZE, (WPARAM)hDbEvent, 0);
- if (newBlobSize>oldBlobSize) {
+ int newBlobSize = db_event_getBlobSize(hDbEvent);
+ if (newBlobSize > oldBlobSize) {
dbei.pBlob = (PBYTE)mir_realloc(dbei.pBlob, newBlobSize);
oldBlobSize = newBlobSize;
}
dbei.cbBlob = oldBlobSize;
- CallService(MS_DB_EVENT_GET, (WPARAM)hDbEvent, (LPARAM)&dbei);
+ db_event_get(hDbEvent, &dbei);
+
+ TCHAR str[200], eventText[256], strdatetime[64];
GetObjectSummary(&dbei, str, SIZEOF(str));
if (str[0]) {
tmi.printTimeStamp(NULL, dbei.timestamp, _T("d t"), strdatetime, SIZEOF(strdatetime), 0);
@@ -175,7 +172,7 @@ static void FillHistoryThread(void* param) i = SendMessage(hwndList, LB_ADDSTRING, 0, (LPARAM)eventText);
SendMessage(hwndList, LB_SETITEMDATA, i, (LPARAM)hDbEvent);
}
- hDbEvent = (HANDLE)CallService(MS_DB_EVENT_FINDPREV, (WPARAM)hDbEvent, 0);
+ hDbEvent = db_event_prev(hDbEvent);
}
mir_free(dbei.pBlob);
@@ -275,30 +272,25 @@ static INT_PTR CALLBACK DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wParam, LP if (MessageBox(hwndDlg, TranslateT("Are you sure you want to delete this history item?"), TranslateT("Delete History"), MB_YESNO|MB_ICONQUESTION) == IDYES) {
hDbevent = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_LIST, LB_GETITEMDATA, index, 0);
- CallService(MS_DB_EVENT_DELETE, (WPARAM)hContact, (LPARAM)hDbevent);
+ db_event_delete(hContact, hDbevent);
SendMessage(hwndDlg, DM_HREBUILD, 0, 0);
}
return TRUE;
}
case IDC_LIST:
if (HIWORD(wParam) == LBN_SELCHANGE) {
- TCHAR str[8192], *contactName;
- HANDLE hDbEvent;
- DBEVENTINFO dbei;
- int sel;
- sel = SendDlgItemMessage(hwndDlg, IDC_LIST, LB_GETCURSEL, 0, 0);
+ int sel = SendDlgItemMessage(hwndDlg, IDC_LIST, LB_GETCURSEL, 0, 0);
if (sel == LB_ERR) { EnableWindow(GetDlgItem(hwndDlg, IDC_DELETEHISTORY), FALSE); break; }
EnableWindow(GetDlgItem(hwndDlg, IDC_DELETEHISTORY), TRUE);
- contactName = pcli->pfnGetContactDisplayName(hContact, 0);
- hDbEvent = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_LIST, LB_GETITEMDATA, sel, 0);
- ZeroMemory(&dbei, sizeof(dbei));
- dbei.cbSize = sizeof(dbei);
- dbei.cbBlob = CallService(MS_DB_EVENT_GETBLOBSIZE, (WPARAM)hDbEvent, 0);
- if ((int)dbei.cbBlob != -1)
- {
+ TCHAR *contactName = pcli->pfnGetContactDisplayName(hContact, 0);
+ HANDLE hDbEvent = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_LIST, LB_GETITEMDATA, sel, 0);
+
+ DBEVENTINFO dbei = { sizeof(dbei) };
+ dbei.cbBlob = db_event_getBlobSize(hDbEvent);
+ if ((int)dbei.cbBlob != -1) {
dbei.pBlob = (PBYTE)mir_alloc(dbei.cbBlob);
- if (CallService(MS_DB_EVENT_GET, (WPARAM)hDbEvent, (LPARAM)&dbei) == 0)
- {
+ if (db_event_get(hDbEvent, &dbei) == 0) {
+ TCHAR str[8192];
GetObjectDescription(&dbei, str, SIZEOF(str));
if (str[0])
SetDlgItemText(hwndDlg, IDC_EDIT, str);
@@ -311,34 +303,32 @@ static INT_PTR CALLBACK DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wParam, LP break;
case DM_FINDNEXT:
{
- TCHAR str[1024];
- HANDLE hDbEvent, hDbEventStart;
- DBEVENTINFO dbei;
- int newBlobSize, oldBlobSize;
-
int index = SendDlgItemMessage(hwndDlg, IDC_LIST, LB_GETCURSEL, 0, 0);
if (index == LB_ERR)
break;
- hDbEventStart = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_LIST, LB_GETITEMDATA, index, 0);
- ZeroMemory(&dbei, sizeof(dbei));
- dbei.cbSize = sizeof(dbei);
- dbei.pBlob = NULL;
- oldBlobSize = 0;
+ DBEVENTINFO dbei = { sizeof(dbei) };
+ int oldBlobSize = 0;
+ HANDLE hDbEventStart = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_LIST, LB_GETITEMDATA, index, 0);
+
for (;;) {
- hDbEvent = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_LIST, LB_GETITEMDATA, ++index, 0);
+ HANDLE hDbEvent = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_LIST, LB_GETITEMDATA, ++index, 0);
if (hDbEvent == (HANDLE)LB_ERR) {
index = -1;
continue;
}
- if (hDbEvent == hDbEventStart) break;
- newBlobSize = CallService(MS_DB_EVENT_GETBLOBSIZE, (WPARAM)hDbEvent, 0);
+ if (hDbEvent == hDbEventStart)
+ break;
+
+ int newBlobSize = db_event_getBlobSize(hDbEvent);
if (newBlobSize>oldBlobSize) {
dbei.pBlob = (PBYTE)mir_realloc(dbei.pBlob, newBlobSize);
oldBlobSize = newBlobSize;
}
dbei.cbBlob = oldBlobSize;
- CallService(MS_DB_EVENT_GET, (WPARAM)hDbEvent, (LPARAM)&dbei);
+ db_event_get(hDbEvent, &dbei);
+
+ TCHAR str[1024];
GetObjectDescription(&dbei, str, SIZEOF(str));
if (str[0]) {
CharUpperBuff(str, lstrlen(str));
diff --git a/src/core/stdurl/url.cpp b/src/core/stdurl/url.cpp index 9f97c4288e..68818744b4 100644 --- a/src/core/stdurl/url.cpp +++ b/src/core/stdurl/url.cpp @@ -40,25 +40,22 @@ static INT_PTR ReadUrlCommand(WPARAM, LPARAM lParam) static int UrlEventAdded(WPARAM wParam, LPARAM lParam)
{
- CLISTEVENT cle;
- DBEVENTINFO dbei;
- TCHAR szTooltip[256];
-
- ZeroMemory(&dbei, sizeof(dbei));
- dbei.cbSize = sizeof(dbei);
- dbei.cbBlob = 0;
- CallService(MS_DB_EVENT_GET, lParam, (LPARAM)&dbei);
- if (dbei.flags&(DBEF_SENT|DBEF_READ) || dbei.eventType != EVENTTYPE_URL) return 0;
+ DBEVENTINFO dbei = { sizeof(dbei) };
+ db_event_get((HANDLE)lParam, &dbei);
+ if (dbei.flags&(DBEF_SENT|DBEF_READ) || dbei.eventType != EVENTTYPE_URL)
+ return 0;
SkinPlaySound("RecvUrl");
- ZeroMemory(&cle, sizeof(cle));
- cle.cbSize = sizeof(cle);
+
+ TCHAR szTooltip[256];
+ mir_sntprintf(szTooltip, SIZEOF(szTooltip), TranslateT("URL from %s"), pcli->pfnGetContactDisplayName((HANDLE)wParam, 0));
+
+ CLISTEVENT cle = { sizeof(cle) };
cle.flags = CLEF_TCHAR;
cle.hContact = (HANDLE)wParam;
cle.hDbEvent = (HANDLE)lParam;
cle.hIcon = LoadSkinIcon(SKINICON_EVENT_URL);
cle.pszService = "SRUrl/ReadUrl";
- mir_sntprintf(szTooltip, SIZEOF(szTooltip), TranslateT("URL from %s"), pcli->pfnGetContactDisplayName((HANDLE)wParam, 0));
cle.ptszTooltip = szTooltip;
CallService(MS_CLIST_ADDEVENT, 0, (LPARAM)&cle);
return 0;
@@ -72,31 +69,27 @@ static INT_PTR SendUrlCommand(WPARAM wParam, LPARAM) static void RestoreUnreadUrlAlerts(void)
{
- CLISTEVENT cle = {0};
- DBEVENTINFO dbei = {0};
- TCHAR toolTip[256];
- HANDLE hDbEvent, hContact;
-
- dbei.cbSize = sizeof(dbei);
- cle.cbSize = sizeof(cle);
+ CLISTEVENT cle = { sizeof(cle) };
cle.hIcon = LoadSkinIcon(SKINICON_EVENT_URL);
cle.pszService = "SRUrl/ReadUrl";
+ cle.flags = CLEF_TCHAR;
- hContact = db_find_first();
+ HANDLE hContact = db_find_first();
while (hContact) {
- hDbEvent = (HANDLE)CallService(MS_DB_EVENT_FINDFIRSTUNREAD, (WPARAM)hContact, 0);
+ HANDLE hDbEvent = db_event_firstUnread(hContact);
while (hDbEvent) {
- dbei.cbBlob = 0;
- CallService(MS_DB_EVENT_GET, (WPARAM)hDbEvent, (LPARAM)&dbei);
+ DBEVENTINFO dbei = { sizeof(dbei) };
+ db_event_get(hDbEvent, &dbei);
if ( !(dbei.flags&(DBEF_SENT|DBEF_READ)) && dbei.eventType == EVENTTYPE_URL) {
+ TCHAR toolTip[256];
+ mir_sntprintf(toolTip, SIZEOF(toolTip), TranslateT("URL from %s"), pcli->pfnGetContactDisplayName(hContact, 0));
+
cle.hContact = hContact;
cle.hDbEvent = hDbEvent;
- cle.flags = CLEF_TCHAR;
- mir_sntprintf(toolTip, SIZEOF(toolTip), TranslateT("URL from %s"), pcli->pfnGetContactDisplayName(hContact, 0));
cle.ptszTooltip = toolTip;
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/stdurl/urldialogs.cpp b/src/core/stdurl/urldialogs.cpp index dc0ef67bf4..b824c20618 100644 --- a/src/core/stdurl/urldialogs.cpp +++ b/src/core/stdurl/urldialogs.cpp @@ -97,30 +97,26 @@ INT_PTR CALLBACK DlgProcUrlRecv(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP WindowList_Add(hUrlWindowList, hwndDlg, dat->hContact);
{
- DBEVENTINFO dbei;
- TCHAR* contactName;
- TCHAR msg[128];
-
- ZeroMemory(&dbei, sizeof(dbei));
- dbei.cbSize = sizeof(dbei);
- dbei.cbBlob = CallService(MS_DB_EVENT_GETBLOBSIZE, (WPARAM)dat->hDbEvent, 0);
+ DBEVENTINFO dbei = { sizeof(dbei) };
+ dbei.cbBlob = db_event_getBlobSize(dat->hDbEvent);
dbei.pBlob = (PBYTE)mir_alloc(dbei.cbBlob);
- CallService(MS_DB_EVENT_GET, (WPARAM)dat->hDbEvent, (LPARAM)&dbei);
+ db_event_get(dat->hDbEvent, &dbei);
SetDlgItemTextA(hwndDlg, IDC_URL, (char*)dbei.pBlob);
SetDlgItemTextA(hwndDlg, IDC_MSG, (char*)dbei.pBlob+lstrlenA((char*)dbei.pBlob)+1);
mir_free(dbei.pBlob);
- CallService(MS_DB_EVENT_MARKREAD, (WPARAM)dat->hContact, (LPARAM)dat->hDbEvent);
+ db_event_markRead(dat->hContact, dat->hDbEvent);
- contactName = pcli->pfnGetContactDisplayName(dat->hContact, 0);
+ TCHAR *contactName = pcli->pfnGetContactDisplayName(dat->hContact, 0), msg[128];
mir_sntprintf(msg, SIZEOF(msg), TranslateT("URL from %s"), contactName);
SetWindowText(hwndDlg, msg);
SetDlgItemText(hwndDlg, IDC_FROM, contactName);
SendDlgItemMessage(hwndDlg, IDOK, BUTTONSETARROW, 1, 0);
- { TCHAR str[128];
- tmi.printTimeStamp(NULL, dbei.timestamp, _T("t d"), str, SIZEOF(str), 0);
- SetDlgItemText(hwndDlg, IDC_DATE, str);
- } }
+
+ TCHAR str[128];
+ tmi.printTimeStamp(NULL, dbei.timestamp, _T("t d"), str, SIZEOF(str), 0);
+ SetDlgItemText(hwndDlg, IDC_DATE, str);
+ }
// From message dlg
if ( !DBGetContactSettingByte(dat->hContact, "CList", "NotOnList", 0))
@@ -537,13 +533,13 @@ INT_PTR CALLBACK DlgProcUrlSend(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP case WM_COMMAND:
if (CallService(MS_CLIST_MENUPROCESSCOMMAND, MAKEWPARAM(LOWORD(wParam), MPCF_CONTACTMENU), (LPARAM)dat->hContact))
break;
- switch (LOWORD(wParam))
- {
- case IDOK:
+
+ switch (LOWORD(wParam)) {
+ case IDOK:
{
char *body, *url;
int bodySize, urlSize;
-
+
urlSize = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_URLS))+1;
url = (char*)mir_alloc(urlSize);
GetDlgItemTextA(hwndDlg, IDC_URLS, url, urlSize);
@@ -572,72 +568,75 @@ INT_PTR CALLBACK DlgProcUrlSend(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP return TRUE;
}
- case IDCANCEL:
- DestroyWindow(hwndDlg);
- return TRUE;
- case IDC_URLS:
- if (HIWORD(wParam) == CBN_SELCHANGE) {
- int i, urlSize;
- char *title;
- i = SendDlgItemMessage(hwndDlg, IDC_URLS, CB_GETCURSEL, 0, 0);
- title = (char*)SendDlgItemMessage(hwndDlg, IDC_URLS, CB_GETITEMDATA, (WPARAM)i, 0);
- SetDlgItemTextA(hwndDlg, IDC_MESSAGE, title);
- urlSize = SendDlgItemMessage(hwndDlg, IDC_URLS, CB_GETLBTEXTLEN, (WPARAM)i, 0);
- EnableWindow(GetDlgItem(hwndDlg, IDOK), (urlSize>0));
- }
- else if (HIWORD(wParam) == CBN_EDITCHANGE) {
- int urlSize = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_URLS));
- EnableWindow(GetDlgItem(hwndDlg, IDOK), (urlSize>0));
- }
- break;
- case IDC_USERMENU:
- { RECT rc;
- HMENU hMenu = (HMENU)CallService(MS_CLIST_MENUBUILDCONTACT, (WPARAM)dat->hContact, 0);
- GetWindowRect(GetDlgItem(hwndDlg, IDC_USERMENU), &rc);
- TrackPopupMenu(hMenu, 0, rc.left, rc.bottom, 0, hwndDlg, NULL);
- DestroyMenu(hMenu);
- }
- break;
- case IDC_HISTORY:
- CallService(MS_HISTORY_SHOWCONTACTHISTORY, (WPARAM)dat->hContact, 0);
- break;
- case IDC_DETAILS:
- CallService(MS_USERINFO_SHOWDIALOG, (WPARAM)dat->hContact, 0);
- break;
- case IDC_ADD:
- { ADDCONTACTSTRUCT acs = {0};
+ case IDCANCEL:
+ DestroyWindow(hwndDlg);
+ return TRUE;
- acs.handle = dat->hContact;
- acs.handleType = HANDLE_CONTACT;
- acs.szProto = 0;
- CallService(MS_ADDCONTACT_SHOW, (WPARAM)hwndDlg, (LPARAM)&acs);
- }
- if ( !DBGetContactSettingByte(dat->hContact, "CList", "NotOnList", 0)) {
- ShowWindow(GetDlgItem(hwndDlg, IDC_ADD), FALSE);
- }
- break;
+ case IDC_URLS:
+ if (HIWORD(wParam) == CBN_SELCHANGE) {
+ int i, urlSize;
+ char *title;
+ i = SendDlgItemMessage(hwndDlg, IDC_URLS, CB_GETCURSEL, 0, 0);
+ title = (char*)SendDlgItemMessage(hwndDlg, IDC_URLS, CB_GETITEMDATA, (WPARAM)i, 0);
+ SetDlgItemTextA(hwndDlg, IDC_MESSAGE, title);
+ urlSize = SendDlgItemMessage(hwndDlg, IDC_URLS, CB_GETLBTEXTLEN, (WPARAM)i, 0);
+ EnableWindow(GetDlgItem(hwndDlg, IDOK), (urlSize>0));
+ }
+ else if (HIWORD(wParam) == CBN_EDITCHANGE) {
+ int urlSize = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_URLS));
+ EnableWindow(GetDlgItem(hwndDlg, IDOK), (urlSize>0));
+ }
+ break;
+ case IDC_USERMENU:
+ {
+ RECT rc;
+ HMENU hMenu = (HMENU)CallService(MS_CLIST_MENUBUILDCONTACT, (WPARAM)dat->hContact, 0);
+ GetWindowRect(GetDlgItem(hwndDlg, IDC_USERMENU), &rc);
+ TrackPopupMenu(hMenu, 0, rc.left, rc.bottom, 0, hwndDlg, NULL);
+ DestroyMenu(hMenu);
+ }
+ break;
+
+ case IDC_HISTORY:
+ CallService(MS_HISTORY_SHOWCONTACTHISTORY, (WPARAM)dat->hContact, 0);
+ break;
+
+ case IDC_DETAILS:
+ CallService(MS_USERINFO_SHOWDIALOG, (WPARAM)dat->hContact, 0);
+ break;
+
+ case IDC_ADD:
+ ADDCONTACTSTRUCT acs = {0};
+ acs.handle = dat->hContact;
+ acs.handleType = HANDLE_CONTACT;
+ acs.szProto = 0;
+ CallService(MS_ADDCONTACT_SHOW, (WPARAM)hwndDlg, (LPARAM)&acs);
+
+ if ( !DBGetContactSettingByte(dat->hContact, "CList", "NotOnList", 0))
+ ShowWindow(GetDlgItem(hwndDlg, IDC_ADD), FALSE);
}
break;
+
case HM_EVENTSENT:
- { ACKDATA *ack = (ACKDATA*)lParam;
- DBEVENTINFO dbei;
- if (ack->hProcess != dat->hSendId) break;
- if (ack->hContact != dat->hContact) break;
- if (ack->type != ACKTYPE_URL || ack->result != ACKRESULT_SUCCESS) break;
-
- ZeroMemory(&dbei, sizeof(dbei));
- dbei.cbSize = sizeof(dbei);
- dbei.eventType = EVENTTYPE_URL;
- dbei.flags = DBEF_SENT;
- dbei.szModule = GetContactProto(dat->hContact);
- dbei.timestamp = time(NULL);
- dbei.cbBlob = (DWORD)(strlen(dat->sendBuffer)+strlen(dat->sendBuffer+strlen(dat->sendBuffer)+1)+2);
- dbei.pBlob = (PBYTE)dat->sendBuffer;
- CallService(MS_DB_EVENT_ADD, (WPARAM)dat->hContact, (LPARAM)&dbei);
- KillTimer(hwndDlg, 0);
- DestroyWindow(hwndDlg);
+ {
+ ACKDATA *ack = (ACKDATA*)lParam;
+ if (ack->hProcess != dat->hSendId) break;
+ if (ack->hContact != dat->hContact) break;
+ if (ack->type != ACKTYPE_URL || ack->result != ACKRESULT_SUCCESS) break;
+
+ DBEVENTINFO dbei = { sizeof(dbei) };
+ dbei.eventType = EVENTTYPE_URL;
+ dbei.flags = DBEF_SENT;
+ dbei.szModule = GetContactProto(dat->hContact);
+ dbei.timestamp = time(NULL);
+ dbei.cbBlob = (DWORD)(strlen(dat->sendBuffer)+strlen(dat->sendBuffer+strlen(dat->sendBuffer)+1)+2);
+ dbei.pBlob = (PBYTE)dat->sendBuffer;
+ db_event_add(dat->hContact, &dbei);
+ KillTimer(hwndDlg, 0);
+ DestroyWindow(hwndDlg);
+ }
break;
- }
+
case WM_DESTROY:
Window_FreeIcon_IcoLib(hwndDlg);
Button_FreeIcon_IcoLib(hwndDlg, IDC_ADD);
@@ -650,10 +649,9 @@ INT_PTR CALLBACK DlgProcUrlSend(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP if (dat->sendBuffer != NULL) mir_free(dat->sendBuffer);
mir_free(dat);
Utils_SaveWindowPosition(hwndDlg, NULL, "SRUrl", "send");
- { int i;
- for (i = SendDlgItemMessage(hwndDlg, IDC_URLS, CB_GETCOUNT, 0, 0)-1;i>=0;i--)
- mir_free((char*)SendDlgItemMessage(hwndDlg, IDC_URLS, CB_GETITEMDATA, i, 0));
- }
+
+ for (int i = SendDlgItemMessage(hwndDlg, IDC_URLS, CB_GETCOUNT, 0, 0)-1;i>=0;i--)
+ mir_free((char*)SendDlgItemMessage(hwndDlg, IDC_URLS, CB_GETITEMDATA, i, 0));
break;
}
|