summaryrefslogtreecommitdiff
path: root/protocols
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 /protocols
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 'protocols')
-rw-r--r--protocols/AimOscar/src/server.cpp5
-rw-r--r--protocols/EmLanProto/src/mlan.cpp40
-rw-r--r--protocols/FacebookRM/src/process.cpp2
-rw-r--r--protocols/FacebookRM/src/proto.cpp2
-rw-r--r--protocols/Gadu-Gadu/src/core.cpp5
-rw-r--r--protocols/IRCG/src/clist.cpp6
-rw-r--r--protocols/IRCG/src/commandmonitor.cpp7
-rw-r--r--protocols/IRCG/src/services.cpp2
-rw-r--r--protocols/IRCG/src/userinfo.cpp8
-rw-r--r--protocols/IcqOscarJ/src/icq_db.cpp7
-rw-r--r--protocols/IcqOscarJ/src/icq_proto.cpp7
-rw-r--r--protocols/IcqOscarJ/src/utilities.cpp2
-rw-r--r--protocols/JabberG/src/jabber_archive.cpp30
-rw-r--r--protocols/JabberG/src/jabber_misc.cpp7
-rw-r--r--protocols/JabberG/src/jabber_proto.cpp30
-rw-r--r--protocols/JabberG/src/jabber_rc.cpp22
-rw-r--r--protocols/JabberG/src/jabber_thread.cpp14
-rw-r--r--protocols/MRA/src/MraAntiSpam.cpp11
-rw-r--r--protocols/MRA/src/MraProto.cpp23
-rw-r--r--protocols/MRA/src/Mra_proto.cpp14
-rw-r--r--protocols/MSN/src/msn_commands.cpp2
-rw-r--r--protocols/MSN/src/msn_lists.cpp38
-rw-r--r--protocols/MSN/src/msn_proto.cpp23
-rw-r--r--protocols/Tlen/src/jabber_misc.cpp6
-rw-r--r--protocols/Tlen/src/jabber_svc.cpp60
-rw-r--r--protocols/Tlen/src/jabber_thread.cpp7
-rw-r--r--protocols/Twitter/src/connection.cpp4
-rw-r--r--protocols/Xfire/src/main.cpp44
-rw-r--r--protocols/Yahoo/src/im.cpp4
-rw-r--r--protocols/Yahoo/src/proto.cpp22
30 files changed, 182 insertions, 272 deletions
diff --git a/protocols/AimOscar/src/server.cpp b/protocols/AimOscar/src/server.cpp
index 571878833d..a56fbbaab3 100644
--- a/protocols/AimOscar/src/server.cpp
+++ b/protocols/AimOscar/src/server.cpp
@@ -1349,15 +1349,14 @@ void CAimProto::snac_received_message(SNAC &snac,HANDLE hServerConn,unsigned sho
mir_snprintf(buf, len, "%s %s", away, s_msg);
mir_free(away);
- DBEVENTINFO dbei = {0};
- dbei.cbSize = sizeof(dbei);
+ DBEVENTINFO dbei = { sizeof(dbei) };
dbei.szModule = m_szModuleName;
dbei.timestamp = (DWORD)time(NULL);
dbei.flags = DBEF_SENT | DBEF_UTF;
dbei.eventType = EVENTTYPE_MESSAGE;
dbei.cbBlob = (int)len;
dbei.pBlob = (PBYTE)buf;
- CallService(MS_DB_EVENT_ADD, (WPARAM)hContact, (LPARAM)&dbei);
+ db_event_add(hContact, &dbei);
aim_send_message(hServerConn, seqno, sn, s_msg, true, getBool(hContact, AIM_KEY_BLS, false));
mir_free(s_msg);
diff --git a/protocols/EmLanProto/src/mlan.cpp b/protocols/EmLanProto/src/mlan.cpp
index cd9ea200e0..09627c327f 100644
--- a/protocols/EmLanProto/src/mlan.cpp
+++ b/protocols/EmLanProto/src/mlan.cpp
@@ -127,18 +127,14 @@ void CMLan::SetMirandaStatus(u_int status)
void CMLan::SetAllOffline()
{
- HANDLE hContact =(HANDLE)CallService(MS_DB_CONTACT_FINDFIRST,0,0);
- while(hContact!=NULL)
- {
- char* svc = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO,(WPARAM)hContact,0);
- if (svc!=NULL && lstrcmp(PROTONAME,svc)==0)
- {
+ HANDLE hContact = db_find_first();
+ while (hContact != NULL) {
+ char *svc = GetContactProto(hContact);
+ if (svc != NULL && lstrcmp(PROTONAME,svc) == 0) {
DBWriteContactSettingWord(hContact,PROTONAME,"Status",ID_STATUS_OFFLINE);
- //Delet all temp contact settings
DBDeleteContactSetting(hContact, PROTONAME, "IP");
- //DBDeleteContactSetting(hContact, PROTONAME, "UID");
}
- hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hContact,0);
+ hContact = db_find_next(hContact);
}
DeleteCache();
}
@@ -247,15 +243,12 @@ void CMLan::SendPacketExt(TPacket& pak, u_long addr)
HANDLE CMLan::FindContact(in_addr addr, const char* nick, bool add_to_list, bool make_permanent, bool make_visible, u_int status)
{
- HANDLE res=(HANDLE)CallService(MS_DB_CONTACT_FINDFIRST,0,0);
- while(res!=NULL)
- {
- char *szProto=(char*)CallService(MS_PROTO_GETCONTACTBASEPROTO,(WPARAM)res,0);
- if (szProto!=NULL && !lstrcmp(PROTONAME,szProto))
- {
+ HANDLE res = db_find_first();
+ while (res != NULL) {
+ char *szProto = GetContactProto(res);
+ if (szProto!=NULL && !lstrcmp(PROTONAME, szProto)) {
u_long caddr = db_get_dw(res, PROTONAME, "ipaddr", -1);
- if (caddr==addr.S_un.S_addr)
- {
+ if (caddr==addr.S_un.S_addr) {
if (make_permanent)
DBDeleteContactSetting(res,"CList","NotOnList");
if (make_visible)
@@ -263,11 +256,10 @@ HANDLE CMLan::FindContact(in_addr addr, const char* nick, bool add_to_list, boo
return res;
}
}
- res=(HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)res,0);
+ res = db_find_next(res);
}
- if (add_to_list)
- {
+ if (add_to_list) {
res=(HANDLE)CallService(MS_DB_CONTACT_ADD,0,0);
CallService(MS_PROTO_ADDTOCONTACT,(WPARAM)res,(LPARAM)PROTONAME);
DBWriteContactSettingDword(res,PROTONAME, "ipaddr", addr.S_un.S_addr);
@@ -467,7 +459,7 @@ void CMLan::RecvMessageUrl(CCSDATA* ccs)
DBDeleteContactSetting(ccs->hContact,"CList","Hidden");
- CallService(MS_DB_EVENT_ADD,(WPARAM)ccs->hContact,(LPARAM)&dbei);
+ db_event_add(ccs->hContact, &dbei);
}
int CMLan::AddToContactList(u_int flags, EMPSEARCHRESULT* psr)
@@ -1125,7 +1117,6 @@ void CMLan::FileRemoveFromList(TFileConnection* conn)
void CMLan::RecvFile(CCSDATA* ccs)
{
- DBEVENTINFO dbei;
PROTORECVEVENT *pre = (PROTORECVEVENT *)ccs->lParam;
char *szDesc, *szFile;
@@ -1134,15 +1125,14 @@ void CMLan::RecvFile(CCSDATA* ccs)
szFile = pre->szMessage + sizeof(DWORD);
szDesc = szFile + strlen(szFile) + 1;
- ZeroMemory(&dbei, sizeof(dbei));
- dbei.cbSize = sizeof(dbei);
+ DBEVENTINFO dbei = { sizeof(dbei) };
dbei.szModule = PROTONAME;
dbei.timestamp = pre->timestamp;
dbei.flags = pre->flags & (PREF_CREATEREAD ? DBEF_READ : 0);
dbei.eventType = EVENTTYPE_FILE;
dbei.cbBlob = DWORD(sizeof(DWORD) + strlen(szFile) + strlen(szDesc) + 2);
dbei.pBlob = (PBYTE)pre->szMessage;
- CallService(MS_DB_EVENT_ADD, (WPARAM)ccs->hContact, (LPARAM)&dbei);
+ db_event_add(ccs->hContact, &dbei);
}
void CMLan::OnInTCPConnection(u_long addr, SOCKET in_sock)
diff --git a/protocols/FacebookRM/src/process.cpp b/protocols/FacebookRM/src/process.cpp
index f7e99ddaf7..a89862a2f4 100644
--- a/protocols/FacebookRM/src/process.cpp
+++ b/protocols/FacebookRM/src/process.cpp
@@ -628,7 +628,7 @@ void FacebookProto::ProcessFriendRequests( void* )
*pCurBlob = '\0'; pCurBlob++; // E-mail
*pCurBlob = '\0'; // Reason
- CallService(MS_DB_EVENT_ADD, 0, (LPARAM)&dbei);
+ db_event_add(0, &dbei);
LOG(" (New) Friendship request from: %s (%s) [%s]", fbu->real_name.c_str(), fbu->user_id.c_str(), time.c_str());
} else {
diff --git a/protocols/FacebookRM/src/proto.cpp b/protocols/FacebookRM/src/proto.cpp
index 8024127dbc..5b88516ffe 100644
--- a/protocols/FacebookRM/src/proto.cpp
+++ b/protocols/FacebookRM/src/proto.cpp
@@ -581,7 +581,7 @@ HANDLE FacebookProto::HContactFromAuthEvent(HANDLE hEvent)
dbei.cbBlob = sizeof(DWORD)*2;
dbei.pBlob = (PBYTE)&body;
- if (CallService(MS_DB_EVENT_GET, (WPARAM)hEvent, (LPARAM)&dbei))
+ if (db_event_get(hEvent, &dbei))
return INVALID_HANDLE_VALUE;
if (dbei.eventType != EVENTTYPE_AUTHREQUEST)
diff --git a/protocols/Gadu-Gadu/src/core.cpp b/protocols/Gadu-Gadu/src/core.cpp
index dd73329a0a..7fb2b52aea 100644
--- a/protocols/Gadu-Gadu/src/core.cpp
+++ b/protocols/Gadu-Gadu/src/core.cpp
@@ -941,15 +941,14 @@ retry:
else if (!e->event.multilogon_msg.recipients_count && e->event.multilogon_msg.message && *e->event.multilogon_msg.message
&& strcmp(e->event.multilogon_msg.message, "\xA0\0"))
{
- DBEVENTINFO dbei = {0};
- dbei.cbSize = sizeof(dbei);
+ DBEVENTINFO dbei = { sizeof(dbei) };
dbei.szModule = m_szModuleName;
dbei.timestamp = (DWORD)e->event.multilogon_msg.time;
dbei.flags = DBEF_SENT | DBEF_UTF;
dbei.eventType = EVENTTYPE_MESSAGE;
dbei.cbBlob = (DWORD)strlen(e->event.multilogon_msg.message) + 1;
dbei.pBlob = (PBYTE)e->event.multilogon_msg.message;
- CallService(MS_DB_EVENT_ADD, (WPARAM)getcontact(e->event.multilogon_msg.sender, 1, 0, NULL), (LPARAM)&dbei);
+ db_event_add( getcontact(e->event.multilogon_msg.sender, 1, 0, NULL), &dbei);
}
break;
diff --git a/protocols/IRCG/src/clist.cpp b/protocols/IRCG/src/clist.cpp
index 4d189ce3bb..e2b0454a35 100644
--- a/protocols/IRCG/src/clist.cpp
+++ b/protocols/IRCG/src/clist.cpp
@@ -146,8 +146,8 @@ bool CIrcProto::CList_SetAllOffline(BYTE ChatsToo)
HANDLE hContact = db_find_first();
while ( hContact ) {
- char* szProto = ( char* ) CallService( MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hContact, 0 );
- if ( szProto != NULL && !lstrcmpiA( szProto, m_szModuleName )) {
+ char* szProto = GetContactProto(hContact);
+ if (szProto != NULL && !lstrcmpiA( szProto, m_szModuleName)) {
if ( getByte( hContact, "ChatRoom", 0 ) == 0 ) {
if ( getByte(hContact, "DCC", 0 ) != 0 ) {
if ( ChatsToo )
@@ -184,7 +184,7 @@ HANDLE CIrcProto::CList_FindContact (CONTACT* user)
DBVARIANT dbv5;
HANDLE hContact = db_find_first();
while (hContact) {
- szProto = ( char* ) CallService( MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hContact, 0);
+ szProto = GetContactProto(hContact);
if ( szProto != NULL && !lstrcmpiA( szProto, m_szModuleName )) {
if ( getByte( hContact, "ChatRoom", 0) == 0) {
HANDLE hContact_temp = NULL;
diff --git a/protocols/IRCG/src/commandmonitor.cpp b/protocols/IRCG/src/commandmonitor.cpp
index 83bbd9689e..3108066951 100644
--- a/protocols/IRCG/src/commandmonitor.cpp
+++ b/protocols/IRCG/src/commandmonitor.cpp
@@ -143,7 +143,7 @@ VOID CALLBACK OnlineNotifTimerProc( HWND, UINT, UINT_PTR idEvent, DWORD )
HANDLE hContact = db_find_first();
while ( hContact ) {
- szProto = ( char* )CallService( MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hContact, 0);
+ szProto = GetContactProto(hContact);
if ( szProto != NULL && !lstrcmpiA( szProto, ppro->m_szModuleName )) {
BYTE bRoom = ppro->getByte(hContact, "ChatRoom", 0);
if ( bRoom == 0 ) {
@@ -223,15 +223,14 @@ int CIrcProto::AddOutgoingMessageToDB(HANDLE hContact, TCHAR* msg)
CMString S = DoColorCodes( msg, TRUE, FALSE );
- DBEVENTINFO dbei = {0};
- dbei.cbSize = sizeof(dbei);
+ DBEVENTINFO dbei = { sizeof(dbei) };
dbei.szModule = m_szModuleName;
dbei.eventType = EVENTTYPE_MESSAGE;
dbei.timestamp = (DWORD)time(NULL);
dbei.flags = DBEF_SENT + DBEF_UTF;
dbei.pBlob = ( PBYTE )mir_utf8encodeW( S.c_str());
dbei.cbBlob = (DWORD)strlen(( char* )dbei.pBlob) + 1;
- CallService( MS_DB_EVENT_ADD, (WPARAM) hContact, (LPARAM) & dbei);
+ db_event_add(hContact, &dbei);
mir_free( dbei.pBlob );
return 1;
}
diff --git a/protocols/IRCG/src/services.cpp b/protocols/IRCG/src/services.cpp
index 54dbfd2ea2..b65c92f728 100644
--- a/protocols/IRCG/src/services.cpp
+++ b/protocols/IRCG/src/services.cpp
@@ -1013,7 +1013,7 @@ int __cdecl CIrcProto::OnMenuPreBuild(WPARAM wParam, LPARAM)
CLISTMENUITEM mi = { sizeof(mi) };
mi.flags = CMIM_FLAGS | CMIM_NAME | CMIM_ICON;
- char *szProto = ( char* ) CallService( MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) wParam, 0);
+ char *szProto = GetContactProto(hContact);
if ( szProto && !lstrcmpiA(szProto, m_szModuleName)) {
bool bIsOnline = getWord(hContact, "Status", ID_STATUS_OFFLINE)== ID_STATUS_OFFLINE ? false : true;
if ( getByte(hContact, "ChatRoom", 0) == GCW_CHATROOM) {
diff --git a/protocols/IRCG/src/userinfo.cpp b/protocols/IRCG/src/userinfo.cpp
index 9a5793c979..35a23f3ca1 100644
--- a/protocols/IRCG/src/userinfo.cpp
+++ b/protocols/IRCG/src/userinfo.cpp
@@ -188,15 +188,15 @@ INT_PTR CALLBACK UserDetailsDlgProc(HWND m_hwnd, UINT msg, WPARAM wParam, LPARAM
int __cdecl CIrcProto::OnInitUserInfo(WPARAM wParam, LPARAM lParam)
{
- char* szProto = ( char* )CallService( MS_PROTO_GETCONTACTBASEPROTO, lParam, 0);
- HANDLE hContact = (HANDLE) lParam;
+ HANDLE hContact = (HANDLE)lParam;
+ char *szProto = GetContactProto(hContact);
if ( !hContact || !szProto || lstrcmpiA( szProto, m_szModuleName ))
return 0;
- if ( getByte( hContact, "ChatRoom", 0 ) != 0 )
+ if ( getByte( hContact, "ChatRoom", 0) != 0 )
return 0;
- if ( getByte( hContact, "DCC", 0 ) != 0 )
+ if ( getByte( hContact, "DCC", 0) != 0)
return 0;
DBVARIANT dbv;
diff --git a/protocols/IcqOscarJ/src/icq_db.cpp b/protocols/IcqOscarJ/src/icq_db.cpp
index ebb0f08ac1..ed45b307db 100644
--- a/protocols/IcqOscarJ/src/icq_db.cpp
+++ b/protocols/IcqOscarJ/src/icq_db.cpp
@@ -292,17 +292,14 @@ int CIcqProto::IsICQContact(HANDLE hContact)
HANDLE CIcqProto::AddEvent(HANDLE hContact, WORD wType, DWORD dwTime, DWORD flags, DWORD cbBlob, PBYTE pBlob)
{
- DBEVENTINFO dbei = {0};
-
- dbei.cbSize = sizeof(dbei);
+ DBEVENTINFO dbei = { sizeof(dbei) };
dbei.szModule = m_szModuleName;
dbei.timestamp = dwTime;
dbei.flags = flags;
dbei.eventType = wType;
dbei.cbBlob = cbBlob;
dbei.pBlob = pBlob;
-
- return (HANDLE)CallService(MS_DB_EVENT_ADD, (WPARAM)hContact, (LPARAM)&dbei);
+ return db_event_add(hContact, &dbei);
}
HANDLE CIcqProto::FindFirstContact()
diff --git a/protocols/IcqOscarJ/src/icq_proto.cpp b/protocols/IcqOscarJ/src/icq_proto.cpp
index 73ecda2a7c..690e5011dc 100644
--- a/protocols/IcqOscarJ/src/icq_proto.cpp
+++ b/protocols/IcqOscarJ/src/icq_proto.cpp
@@ -372,15 +372,14 @@ HANDLE __cdecl CIcqProto::AddToListByEvent( int flags, int iContact, HANDLE hDbE
DWORD uin = 0;
uid_str uid = {0};
- DBEVENTINFO dbei = {0};
- dbei.cbSize = sizeof(dbei);
- if ((dbei.cbBlob = CallService(MS_DB_EVENT_GETBLOBSIZE, (WPARAM)hDbEvent, 0)) == -1)
+ DBEVENTINFO dbei = { sizeof(dbei) };
+ if ((dbei.cbBlob = db_event_getBlobSize(hDbEvent)) == -1)
return 0;
dbei.pBlob = (PBYTE)_alloca(dbei.cbBlob + 1);
dbei.pBlob[dbei.cbBlob] = '\0';
- if (CallService(MS_DB_EVENT_GET, (WPARAM)hDbEvent, (LPARAM)&dbei))
+ if ( db_event_get(hDbEvent, &dbei))
return 0; // failed to get event
if (strcmpnull(dbei.szModule, m_szModuleName))
diff --git a/protocols/IcqOscarJ/src/utilities.cpp b/protocols/IcqOscarJ/src/utilities.cpp
index 53cf92c3f8..633e798259 100644
--- a/protocols/IcqOscarJ/src/utilities.cpp
+++ b/protocols/IcqOscarJ/src/utilities.cpp
@@ -599,7 +599,7 @@ HANDLE CIcqProto::HContactFromAuthEvent(HANDLE hEvent)
dbei.cbBlob = sizeof(DWORD)*2;
dbei.pBlob = (PBYTE)&body;
- if (CallService(MS_DB_EVENT_GET, (WPARAM)hEvent, (LPARAM)&dbei))
+ if (db_event_get(hEvent, &dbei))
return INVALID_HANDLE_VALUE;
if (dbei.eventType != EVENTTYPE_AUTHREQUEST)
diff --git a/protocols/JabberG/src/jabber_archive.cpp b/protocols/JabberG/src/jabber_archive.cpp
index 74aaa227b8..5cfb124a34 100644
--- a/protocols/JabberG/src/jabber_archive.cpp
+++ b/protocols/JabberG/src/jabber_archive.cpp
@@ -107,15 +107,13 @@ BOOL IsDuplicateEvent(HANDLE hContact, DBEVENTINFO& dbei)
{
HANDLE hExistingDbEvent;
DWORD dwEventTimeStamp;
- DBEVENTINFO dbeiExisting;
// get last event
- if (!(hExistingDbEvent = (HANDLE)CallService(MS_DB_EVENT_FINDLAST, (WPARAM)hContact, 0)))
+ if (!(hExistingDbEvent = db_event_last(hContact)))
return FALSE;
- ZeroMemory(&dbeiExisting, sizeof(dbeiExisting));
- dbeiExisting.cbSize = sizeof(dbeiExisting);
- CallService(MS_DB_EVENT_GET, (WPARAM)hExistingDbEvent, (LPARAM)&dbeiExisting);
+ DBEVENTINFO dbeiExisting = { sizeof(dbeiExisting) };
+ db_event_get(hExistingDbEvent, &dbeiExisting);
dwEventTimeStamp = dbeiExisting.timestamp;
// compare with last timestamp
@@ -133,12 +131,12 @@ BOOL IsDuplicateEvent(HANDLE hContact, DBEVENTINFO& dbei)
dwPreviousTimeStamp = dwEventTimeStamp;
// get first event
- if (!(hExistingDbEvent = (HANDLE)CallService(MS_DB_EVENT_FINDFIRST, (WPARAM)hContact, 0)))
+ if (!(hExistingDbEvent = db_event_first(hContact)))
return FALSE;
ZeroMemory(&dbeiExisting, sizeof(dbeiExisting));
dbeiExisting.cbSize = sizeof(dbeiExisting);
- CallService(MS_DB_EVENT_GET, (WPARAM)hExistingDbEvent, (LPARAM)&dbeiExisting);
+ db_event_get(hExistingDbEvent, &dbeiExisting);
dwEventTimeStamp = dbeiExisting.timestamp;
// compare with first timestamp
@@ -156,7 +154,7 @@ BOOL IsDuplicateEvent(HANDLE hContact, DBEVENTINFO& dbei)
if (dbei.timestamp == dwPreviousTimeStamp) {
ZeroMemory(&dbeiExisting, sizeof(dbeiExisting));
dbeiExisting.cbSize = sizeof(dbeiExisting);
- CallService(MS_DB_EVENT_GET, (WPARAM)hPreviousDbEvent, (LPARAM)&dbeiExisting);
+ db_event_get(hPreviousDbEvent, &dbeiExisting);
if ((dbei.timestamp == dbeiExisting.timestamp) &&
(dbei.eventType == dbeiExisting.eventType) &&
@@ -165,11 +163,11 @@ BOOL IsDuplicateEvent(HANDLE hContact, DBEVENTINFO& dbei)
return TRUE;
// find event with another timestamp
- hExistingDbEvent = (HANDLE)CallService(MS_DB_EVENT_FINDNEXT, (WPARAM)hPreviousDbEvent, 0);
+ hExistingDbEvent = db_event_next(hPreviousDbEvent);
while (hExistingDbEvent != NULL) {
ZeroMemory(&dbeiExisting, sizeof(dbeiExisting));
dbeiExisting.cbSize = sizeof(dbeiExisting);
- CallService(MS_DB_EVENT_GET, (WPARAM)hExistingDbEvent, (LPARAM)&dbeiExisting);
+ db_event_get(hExistingDbEvent, &dbeiExisting);
if (dbeiExisting.timestamp != dwPreviousTimeStamp) {
// use found event
@@ -179,7 +177,7 @@ BOOL IsDuplicateEvent(HANDLE hContact, DBEVENTINFO& dbei)
}
hPreviousDbEvent = hExistingDbEvent;
- hExistingDbEvent = (HANDLE)CallService(MS_DB_EVENT_FINDNEXT, (WPARAM)hExistingDbEvent, 0);
+ hExistingDbEvent = db_event_next(hExistingDbEvent);
}
}
@@ -190,7 +188,7 @@ BOOL IsDuplicateEvent(HANDLE hContact, DBEVENTINFO& dbei)
while (hExistingDbEvent != NULL) {
ZeroMemory(&dbeiExisting, sizeof(dbeiExisting));
dbeiExisting.cbSize = sizeof(dbeiExisting);
- CallService(MS_DB_EVENT_GET, (WPARAM)hExistingDbEvent, (LPARAM)&dbeiExisting);
+ db_event_get(hExistingDbEvent, &dbeiExisting);
if (dbei.timestamp > dbeiExisting.timestamp) {
// remember event
@@ -212,7 +210,7 @@ BOOL IsDuplicateEvent(HANDLE hContact, DBEVENTINFO& dbei)
}
// Get previous event in chain
- hExistingDbEvent = (HANDLE)CallService(MS_DB_EVENT_FINDPREV, (WPARAM)hExistingDbEvent, 0);
+ hExistingDbEvent = db_event_prev(hExistingDbEvent);
}
}
else {
@@ -220,7 +218,7 @@ BOOL IsDuplicateEvent(HANDLE hContact, DBEVENTINFO& dbei)
while (hExistingDbEvent != NULL) {
ZeroMemory(&dbeiExisting, sizeof(dbeiExisting));
dbeiExisting.cbSize = sizeof(dbeiExisting);
- CallService(MS_DB_EVENT_GET, (WPARAM)hExistingDbEvent, (LPARAM)&dbeiExisting);
+ db_event_get(hExistingDbEvent, &dbeiExisting);
if (dbei.timestamp < dbeiExisting.timestamp) {
// remember event
@@ -242,7 +240,7 @@ BOOL IsDuplicateEvent(HANDLE hContact, DBEVENTINFO& dbei)
}
// Get next event in chain
- hExistingDbEvent = (HANDLE)CallService(MS_DB_EVENT_FINDNEXT, (WPARAM)hExistingDbEvent, 0);
+ hExistingDbEvent = db_event_next(hExistingDbEvent);
}
}
// reset last event
@@ -304,6 +302,6 @@ void CJabberProto::OnIqResultGetCollection(HXML iqNode)
dbei.pBlob = (PBYTE)(char*)szEventText;
dbei.timestamp = tmStart + _ttol(tszSecs) - timezone;
if ( !IsDuplicateEvent(hContact, dbei))
- CallService(MS_DB_EVENT_ADD, (WPARAM)hContact, (LPARAM)&dbei);
+ db_event_add(hContact, &dbei);
}
}
diff --git a/protocols/JabberG/src/jabber_misc.cpp b/protocols/JabberG/src/jabber_misc.cpp
index 0d8167fa89..da614d2e33 100644
--- a/protocols/JabberG/src/jabber_misc.cpp
+++ b/protocols/JabberG/src/jabber_misc.cpp
@@ -142,7 +142,7 @@ void CJabberProto::DBAddAuthRequest(const TCHAR *jid, const TCHAR *nick)
strcpy((char*)pCurBlob, szJid); pCurBlob += strlen(szJid)+1;
*pCurBlob = '\0'; //reason
- CallService(MS_DB_EVENT_ADD, (WPARAM)(HANDLE)NULL, (LPARAM)&dbei);
+ db_event_add(NULL, &dbei);
Log("Setup DBAUTHREQUEST with nick='%s' jid='%s'", szNick, szJid);
mir_free(szJid);
@@ -227,15 +227,14 @@ BOOL CJabberProto::AddDbPresenceEvent(HANDLE hContact, BYTE btEventType)
break;
}
- DBEVENTINFO dbei;
- dbei.cbSize = sizeof(dbei);
+ DBEVENTINFO dbei = { sizeof(dbei) };
dbei.pBlob = &btEventType;
dbei.cbBlob = sizeof(btEventType);
dbei.eventType = JABBER_DB_EVENT_TYPE_PRESENCE;
dbei.flags = DBEF_READ;
dbei.timestamp = time(NULL);
dbei.szModule = m_szModuleName;
- CallService(MS_DB_EVENT_ADD, (WPARAM)hContact, (LPARAM)&dbei);
+ db_event_add(hContact, &dbei);
return TRUE;
}
diff --git a/protocols/JabberG/src/jabber_proto.cpp b/protocols/JabberG/src/jabber_proto.cpp
index 684d784dbe..19a4745d34 100644
--- a/protocols/JabberG/src/jabber_proto.cpp
+++ b/protocols/JabberG/src/jabber_proto.cpp
@@ -414,18 +414,14 @@ HANDLE CJabberProto::AddToList(int flags, PROTOSEARCHRESULT* psr)
HANDLE __cdecl CJabberProto::AddToListByEvent(int flags, int /*iContact*/, HANDLE hDbEvent)
{
- DBEVENTINFO dbei;
- HANDLE hContact;
- char* nick, *firstName, *lastName, *jid;
-
Log("AddToListByEvent");
- ZeroMemory(&dbei, sizeof(dbei));
- dbei.cbSize = sizeof(dbei);
- if ((dbei.cbBlob = CallService(MS_DB_EVENT_GETBLOBSIZE, (WPARAM)hDbEvent, 0)) == (DWORD)(-1))
+
+ DBEVENTINFO dbei = { sizeof(dbei) };
+ if ((dbei.cbBlob = db_event_getBlobSize(hDbEvent)) == (DWORD)(-1))
return NULL;
if ((dbei.pBlob=(PBYTE)alloca(dbei.cbBlob)) == NULL)
return NULL;
- if (CallService(MS_DB_EVENT_GET, (WPARAM)hDbEvent, (LPARAM)&dbei))
+ if (db_event_get(hDbEvent, &dbei))
return NULL;
if (strcmp(dbei.szModule, m_szModuleName))
return NULL;
@@ -440,13 +436,13 @@ HANDLE __cdecl CJabberProto::AddToListByEvent(int flags, int /*iContact*/, HANDL
if (dbei.eventType != EVENTTYPE_AUTHREQUEST)
return NULL;
- nick = (char*)(dbei.pBlob + sizeof(DWORD)*2);
- firstName = nick + strlen(nick) + 1;
- lastName = firstName + strlen(firstName) + 1;
- jid = lastName + strlen(lastName) + 1;
+ char *nick = (char*)(dbei.pBlob + sizeof(DWORD)*2);
+ char *firstName = nick + strlen(nick) + 1;
+ char *lastName = firstName + strlen(firstName) + 1;
+ char *jid = lastName + strlen(lastName) + 1;
TCHAR *newJid = (dbei.flags & DBEF_UTF) ? mir_utf8decodeT(jid) : mir_a2t(jid);
- hContact = (HANDLE)AddToListByJID(newJid, flags);
+ HANDLE hContact = (HANDLE)AddToListByJID(newJid, flags);
mir_free(newJid);
return hContact;
}
@@ -460,11 +456,11 @@ int CJabberProto::Authorize(HANDLE hDbEvent)
return 1;
DBEVENTINFO dbei = { sizeof(dbei) };
- if ((dbei.cbBlob = CallService(MS_DB_EVENT_GETBLOBSIZE, (WPARAM)hDbEvent, 0)) == (DWORD)(-1))
+ if ((dbei.cbBlob = db_event_getBlobSize(hDbEvent)) == (DWORD)(-1))
return 1;
if ((dbei.pBlob = (PBYTE)alloca(dbei.cbBlob)) == NULL)
return 1;
- if (CallService(MS_DB_EVENT_GET, (WPARAM)hDbEvent, (LPARAM)&dbei))
+ if (db_event_get(hDbEvent, &dbei))
return 1;
if (dbei.eventType != EVENTTYPE_AUTHREQUEST)
return 1;
@@ -510,11 +506,11 @@ int CJabberProto::AuthDeny(HANDLE hDbEvent, const TCHAR*)
Log("Entering AuthDeny");
DBEVENTINFO dbei = { sizeof(dbei) };
- if ((dbei.cbBlob=CallService(MS_DB_EVENT_GETBLOBSIZE, (WPARAM)hDbEvent, 0)) == (DWORD)(-1))
+ if ((dbei.cbBlob = db_event_getBlobSize(hDbEvent)) == (DWORD)(-1))
return 1;
if ((dbei.pBlob=(PBYTE) mir_alloc(dbei.cbBlob)) == NULL)
return 1;
- if (CallService(MS_DB_EVENT_GET, (WPARAM)hDbEvent, (LPARAM)&dbei)) {
+ if (db_event_get(hDbEvent, &dbei)) {
mir_free(dbei.pBlob);
return 1;
}
diff --git a/protocols/JabberG/src/jabber_rc.cpp b/protocols/JabberG/src/jabber_rc.cpp
index 6a49f9e718..23800fc307 100644
--- a/protocols/JabberG/src/jabber_rc.cpp
+++ b/protocols/JabberG/src/jabber_rc.cpp
@@ -483,14 +483,13 @@ int CJabberProto::RcGetUnreadEventsCount()
if (szProto != NULL && !strcmp(szProto, m_szModuleName)) {
DBVARIANT dbv;
if ( !JGetStringT(hContact, "jid", &dbv)) {
- HANDLE hDbEvent = (HANDLE)CallService(MS_DB_EVENT_FINDFIRSTUNREAD, (WPARAM)hContact, 0);
+ HANDLE hDbEvent = db_event_firstUnread(hContact);
while (hDbEvent) {
- 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);
if (dbei.cbBlob != -1) {
dbei.pBlob = (PBYTE)mir_alloc(dbei.cbBlob + 1);
- int nGetTextResult = CallService(MS_DB_EVENT_GET, (WPARAM)hDbEvent, (LPARAM)&dbei);
+ int nGetTextResult = db_event_get(hDbEvent, &dbei);
if ( !nGetTextResult && dbei.eventType == EVENTTYPE_MESSAGE && !(dbei.flags & DBEF_READ) && !(dbei.flags & DBEF_SENT)) {
TCHAR* szEventText = DbGetEventTextT(&dbei, CP_ACP);
if (szEventText) {
@@ -500,7 +499,7 @@ int CJabberProto::RcGetUnreadEventsCount()
}
mir_free(dbei.pBlob);
}
- hDbEvent = (HANDLE)CallService(MS_DB_EVENT_FINDNEXT, (WPARAM)hDbEvent, 0);
+ hDbEvent = db_event_next(hDbEvent);
}
db_free(&dbv);
}
@@ -580,15 +579,14 @@ int CJabberProto::AdhocForwardHandler(HXML, CJabberIqInfo* pInfo, CJabberAdhocSe
if (szProto != NULL && !strcmp(szProto, m_szModuleName)) {
DBVARIANT dbv;
if ( !JGetStringT(hContact, "jid", &dbv)) {
-
- HANDLE hDbEvent = (HANDLE)CallService(MS_DB_EVENT_FINDFIRSTUNREAD, (WPARAM)hContact, 0);
+ HANDLE hDbEvent = db_event_firstUnread(hContact);
while (hDbEvent) {
DBEVENTINFO dbei = { 0 };
dbei.cbSize = sizeof(dbei);
- dbei.cbBlob = CallService(MS_DB_EVENT_GETBLOBSIZE, (WPARAM)hDbEvent, 0);
+ dbei.cbBlob = db_event_getBlobSize(hDbEvent);
if (dbei.cbBlob != -1) {
dbei.pBlob = (PBYTE)mir_alloc(dbei.cbBlob + 1);
- int nGetTextResult = CallService(MS_DB_EVENT_GET, (WPARAM)hDbEvent, (LPARAM)&dbei);
+ int nGetTextResult = db_event_get(hDbEvent, &dbei);
if ( !nGetTextResult && dbei.eventType == EVENTTYPE_MESSAGE && !(dbei.flags & DBEF_READ) && !(dbei.flags & DBEF_SENT)) {
TCHAR* szEventText = DbGetEventTextT(&dbei, CP_ACP);
if (szEventText) {
@@ -619,7 +617,7 @@ int CJabberProto::AdhocForwardHandler(HXML, CJabberIqInfo* pInfo, CJabberAdhocSe
nEventsSent++;
- CallService(MS_DB_EVENT_MARKREAD, (WPARAM)hContact, (LPARAM)hDbEvent);
+ db_event_markRead(hContact, hDbEvent);
if (bRemoveCListEvents)
CallService(MS_CLIST_REMOVEEVENT, (WPARAM)hContact, (LPARAM)hDbEvent);
@@ -628,7 +626,7 @@ int CJabberProto::AdhocForwardHandler(HXML, CJabberIqInfo* pInfo, CJabberAdhocSe
}
mir_free(dbei.pBlob);
}
- hDbEvent = (HANDLE)CallService(MS_DB_EVENT_FINDNEXT, (WPARAM)hDbEvent, 0);
+ hDbEvent = db_event_next(hDbEvent);
}
db_free(&dbv);
}
diff --git a/protocols/JabberG/src/jabber_thread.cpp b/protocols/JabberG/src/jabber_thread.cpp
index 7edfdb49b2..e38dbf1c67 100644
--- a/protocols/JabberG/src/jabber_thread.cpp
+++ b/protocols/JabberG/src/jabber_thread.cpp
@@ -1078,18 +1078,17 @@ void CJabberProto::OnProcessPubsubEvent(HXML node)
DWORD JabberGetLastContactMessageTime(HANDLE hContact)
{
// TODO: time cache can improve performance
- HANDLE hDbEvent = (HANDLE)CallService(MS_DB_EVENT_FINDLAST, (WPARAM)hContact, 0);
+ HANDLE hDbEvent = db_event_last(hContact);
if ( !hDbEvent)
return 0;
DWORD dwTime = 0;
- 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);
if (dbei.cbBlob != -1) {
dbei.pBlob = (PBYTE)mir_alloc(dbei.cbBlob + 1);
- int nGetTextResult = CallService(MS_DB_EVENT_GET, (WPARAM)hDbEvent, (LPARAM)&dbei);
+ int nGetTextResult = db_event_get(hDbEvent, &dbei);
if ( !nGetTextResult)
dwTime = dbei.timestamp;
mir_free(dbei.pBlob);
@@ -1248,16 +1247,15 @@ void CJabberProto::OnProcessMessage(HXML node, ThreadData* info)
// chatstates gone event
if (hContact && xmlGetChildByTag(node, "gone", "xmlns", _T(JABBER_FEAT_CHATSTATES)) && m_options.LogChatstates) {
- DBEVENTINFO dbei;
BYTE bEventType = JABBER_DB_EVENT_CHATSTATES_GONE; // gone event
- dbei.cbSize = sizeof(dbei);
+ DBEVENTINFO dbei = { sizeof(dbei) };
dbei.pBlob = &bEventType;
dbei.cbBlob = 1;
dbei.eventType = JABBER_DB_EVENT_TYPE_CHATSTATES;
dbei.flags = DBEF_READ;
dbei.timestamp = time(NULL);
dbei.szModule = m_szModuleName;
- CallService(MS_DB_EVENT_ADD, (WPARAM)hContact, (LPARAM)&dbei);
+ db_event_add(hContact, &dbei);
}
if ((n = xmlGetChildByTag(node, "confirm", "xmlns", _T(JABBER_FEAT_HTTP_AUTH))) && m_options.AcceptHttpAuth) {
diff --git a/protocols/MRA/src/MraAntiSpam.cpp b/protocols/MRA/src/MraAntiSpam.cpp
index 4fbbb3c744..8b60ade855 100644
--- a/protocols/MRA/src/MraAntiSpam.cpp
+++ b/protocols/MRA/src/MraAntiSpam.cpp
@@ -398,16 +398,14 @@ DWORD CMraProto::MraAntiSpamReceivedMessageW(LPSTR lpszEMail, size_t dwEMailSize
CHAR szBuff[MRA_MAXLENOFMESSAGE*2];
WideCharToMultiByte(CP_UTF8, 0, wszBuff, DWORD(dwDBMessageSize), szBuff, SIZEOF(szBuff), NULL, NULL);
- DBEVENTINFO dbei = {0};
- dbei.cbSize = sizeof(dbei);
+ DBEVENTINFO dbei = { sizeof(dbei) };
dbei.szModule = m_szModuleName;
dbei.timestamp = _time32(NULL);
dbei.flags = (DBEF_READ|DBEF_UTF);
dbei.eventType = EVENTTYPE_MESSAGE;
dbei.cbBlob = DWORD(dwDBMessageSize*sizeof(WCHAR));
dbei.pBlob = (PBYTE)szBuff;
-
- CallService(MS_DB_EVENT_ADD, 0, (LPARAM)&dbei);
+ db_event_add(NULL, &dbei);
}
if (hContact && bAntiSpamDeteleSpamBotContacts) {
@@ -423,15 +421,14 @@ DWORD CMraProto::MraAntiSpamReceivedMessageW(LPSTR lpszEMail, size_t dwEMailSize
CHAR szBuff[MRA_MAXLENOFMESSAGE*2];
WideCharToMultiByte(CP_UTF8, 0, wszBuff, DWORD(dwDBMessageSize), szBuff, SIZEOF(szBuff), NULL, NULL);
- DBEVENTINFO dbei = {0};
- dbei.cbSize = sizeof(dbei);
+ DBEVENTINFO dbei = { sizeof(dbei) };
dbei.szModule = m_szModuleName;
dbei.timestamp = _time32(NULL);
dbei.flags = (DBEF_READ|DBEF_UTF);
dbei.eventType = EVENTTYPE_MESSAGE;
dbei.cbBlob = DWORD(dwDBMessageSize*sizeof(WCHAR));
dbei.pBlob = (PBYTE)szBuff;
- CallService(MS_DB_EVENT_ADD, 0, (LPARAM)&dbei);
+ db_event_add(NULL, &dbei);
}
}
}
diff --git a/protocols/MRA/src/MraProto.cpp b/protocols/MRA/src/MraProto.cpp
index b1294148b5..e28eded3af 100644
--- a/protocols/MRA/src/MraProto.cpp
+++ b/protocols/MRA/src/MraProto.cpp
@@ -227,9 +227,9 @@ HANDLE CMraProto::AddToListByEvent(int flags, int iContact, HANDLE hDbEvent)
{
DBEVENTINFO dbei = {0};
dbei.cbSize = sizeof(dbei);
- if ((dbei.cbBlob = CallService(MS_DB_EVENT_GETBLOBSIZE, (WPARAM)hDbEvent, 0)) != -1) {
+ if ((dbei.cbBlob = db_event_getBlobSize(hDbEvent)) != -1) {
dbei.pBlob = (PBYTE)alloca(dbei.cbBlob);
- if ( CallService(MS_DB_EVENT_GET, (WPARAM)hDbEvent, (LPARAM)&dbei) == 0 &&
+ if ( db_event_get(hDbEvent, &dbei) == 0 &&
!strcmp(dbei.szModule, m_szModuleName) &&
(dbei.eventType == EVENTTYPE_AUTHREQUEST || dbei.eventType == EVENTTYPE_CONTACTS)) {
@@ -259,13 +259,12 @@ int CMraProto::Authorize(HANDLE hDBEvent)
{
if (!m_bLoggedIn) return 1;
- DBEVENTINFO dbei = {0};
- dbei.cbSize = sizeof(dbei);
- if ((dbei.cbBlob = CallService(MS_DB_EVENT_GETBLOBSIZE, (WPARAM)hDBEvent, 0)) == -1)
+ DBEVENTINFO dbei = { sizeof(dbei) };
+ if ((dbei.cbBlob = db_event_getBlobSize(hDBEvent)) == -1)
return 1;
dbei.pBlob = (PBYTE)alloca(dbei.cbBlob);
- if ( CallService(MS_DB_EVENT_GET, (WPARAM)hDBEvent, (LPARAM)&dbei)) return 1;
+ if ( db_event_get(hDBEvent, &dbei)) return 1;
if (dbei.eventType != EVENTTYPE_AUTHREQUEST) return 1;
if ( strcmp(dbei.szModule, m_szModuleName)) return 1;
@@ -281,13 +280,12 @@ int CMraProto::AuthDeny(HANDLE hDBEvent, const TCHAR* szReason)
{
if (!m_bLoggedIn) return 1;
- DBEVENTINFO dbei = {0};
- dbei.cbSize = sizeof(dbei);
- if ((dbei.cbBlob = CallService(MS_DB_EVENT_GETBLOBSIZE, (WPARAM)hDBEvent, 0)) == -1)
+ DBEVENTINFO dbei = { sizeof(dbei) };
+ if ((dbei.cbBlob = db_event_getBlobSize(hDBEvent)) == -1)
return 1;
dbei.pBlob = (PBYTE)alloca(dbei.cbBlob);
- if ( CallService(MS_DB_EVENT_GET, (WPARAM)hDBEvent, (LPARAM)&dbei)) return 1;
+ if ( db_event_get(hDBEvent, &dbei)) return 1;
if (dbei.eventType != EVENTTYPE_AUTHREQUEST) return 1;
if ( strcmp(dbei.szModule, m_szModuleName)) return 1;
@@ -413,15 +411,14 @@ HANDLE CMraProto::SearchByName(const TCHAR *pszNick, const TCHAR *pszFirstName,
int CMraProto::RecvContacts(HANDLE hContact, PROTORECVEVENT* pre)
{
- DBEVENTINFO dbei = {0};
- dbei.cbSize = sizeof(dbei);
+ DBEVENTINFO dbei = { sizeof(dbei) };
dbei.szModule = m_szModuleName;
dbei.timestamp = pre->timestamp;
dbei.flags = (pre->flags & PREF_CREATEREAD) ? DBEF_READ : 0;
dbei.eventType = EVENTTYPE_CONTACTS;
dbei.cbBlob = pre->lParam;
dbei.pBlob = (PBYTE)pre->szMessage;
- CallService(MS_DB_EVENT_ADD, (WPARAM)hContact, (LPARAM)&dbei);
+ db_event_add(hContact, &dbei);
return 0;
}
diff --git a/protocols/MRA/src/Mra_proto.cpp b/protocols/MRA/src/Mra_proto.cpp
index ea501f1dcd..162dd9686c 100644
--- a/protocols/MRA/src/Mra_proto.cpp
+++ b/protocols/MRA/src/Mra_proto.cpp
@@ -655,24 +655,21 @@ DWORD CMraProto::MraCommandDispatcher(mrim_packet_header_t *pmaHeader, DWORD *pd
{
BOOL bAdded;
BYTE btBuff[BUFF_SIZE_BLOB];
- DBEVENTINFO dbei = {0};
GetLPS(lpbData, dwDataSize, &lpbDataCurrent, &lpsEMail);
hContact = MraHContactFromEmail(lpsEMail.lpszData, lpsEMail.dwSize, TRUE, TRUE, &bAdded);
if (bAdded) MraUpdateContactInfo(hContact);
if (IsEMailChatAgent(lpsEMail.lpszData, lpsEMail.dwSize) == FALSE) {
- dbei.cbSize = sizeof(dbei);
+ DBEVENTINFO dbei = { sizeof(dbei) };
dbei.szModule = m_szModuleName;
dbei.timestamp = (DWORD)_time32(NULL);
dbei.flags = 0;
dbei.eventType = EVENTTYPE_ADDED;
- //dbei.cbBlob = 0;
CreateBlobFromContact(hContact, NULL, 0, (LPBYTE)&btBuff, SIZEOF(btBuff), &dwStringSize);
dbei.cbBlob = dwStringSize;
dbei.pBlob = btBuff;
-
- CallService(MS_DB_EVENT_ADD, 0, (LPARAM)&dbei);
+ db_event_add(0, &dbei);
}
GetContactBasicInfoW(hContact, NULL, NULL, NULL, &dwTemp, NULL, NULL, 0, NULL, NULL, 0, NULL, NULL, 0, NULL);
@@ -2004,17 +2001,14 @@ DWORD CMraProto::MraRecvCommand_Message(DWORD dwTime, DWORD dwFlags, MRA_LPS *pl
DBWriteContactSettingByte(hContact, "CList", "Hidden", 1);
if (bAutoGrantAuth) { // auto grant auth
- DBEVENTINFO dbei = {0};
-
- dbei.cbSize = sizeof(dbei);
+ DBEVENTINFO dbei = { sizeof(dbei) };
dbei.szModule = m_szModuleName;
dbei.timestamp = _time32(NULL);
dbei.flags = DBEF_READ;
dbei.eventType = EVENTTYPE_AUTHREQUEST;
dbei.pBlob = (PBYTE)btBuff;
-
CreateBlobFromContact(hContact, lpwszMessage, dwMessageSize, btBuff, SIZEOF(btBuff), (size_t*)&dbei.cbBlob);
- CallService(MS_DB_EVENT_ADD, 0, (LPARAM)&dbei);
+ db_event_add(0, &dbei);
MraAuthorize(plpsFrom->lpszData, plpsFrom->dwSize);
}
else {
diff --git a/protocols/MSN/src/msn_commands.cpp b/protocols/MSN/src/msn_commands.cpp
index e3da3c541b..c86c1779f8 100644
--- a/protocols/MSN/src/msn_commands.cpp
+++ b/protocols/MSN/src/msn_commands.cpp
@@ -523,7 +523,7 @@ void CMsnProto::MSN_ReceiveMessage(ThreadData* info, char* cmdString, char* para
dbei.timestamp = time(NULL);
dbei.cbBlob = (unsigned)strlen(msgBody) + 1;
dbei.pBlob = (PBYTE)msgBody;
- CallService(MS_DB_EVENT_ADD, (WPARAM)hContact, (LPARAM)&dbei);
+ db_event_add(hContact, &dbei);
}
}
}
diff --git a/protocols/MSN/src/msn_lists.cpp b/protocols/MSN/src/msn_lists.cpp
index 97f632a870..bf23f84ce2 100644
--- a/protocols/MSN/src/msn_lists.cpp
+++ b/protocols/MSN/src/msn_lists.cpp
@@ -265,59 +265,46 @@ void CMsnProto::Lists_Populate(void)
void CMsnProto::MSN_CleanupLists(void)
{
-// EnterCriticalSection(&csLists);
- for (int i=contList.getCount(); i--;)
- {
+ for (int i=contList.getCount(); i--;) {
MsnContact& p = contList[i];
+ if (p.list & LIST_FL)
+ MSN_SetContactDb(p.hContact, p.email);
- if (p.list & LIST_FL) MSN_SetContactDb(p.hContact, p.email);
-
- if (p.list & LIST_PL)
- {
+ if (p.list & LIST_PL) {
if (p.list & (LIST_AL | LIST_BL))
MSN_AddUser(NULL, p.email, p.netId, LIST_PL + LIST_REMOVE);
else
MSN_AddAuthRequest(p.email, p.nick, p.invite);
}
-// if (p.list == LIST_RL)
-// MSN_AddAuthRequest(p.email, NULL, p.invite);
-
- if (p.hContact && !(p.list & (LIST_LL | LIST_FL | LIST_PL)) && p.list != LIST_RL)
- {
- int count = CallService(MS_DB_EVENT_GETCOUNT, (WPARAM)p.hContact, 0);
- if (count)
- {
+ if (p.hContact && !(p.list & (LIST_LL | LIST_FL | LIST_PL)) && p.list != LIST_RL) {
+ int count = db_event_count(p.hContact);
+ if (count) {
TCHAR text[256];
- TCHAR* sze = mir_a2t(p.email);
+ TCHAR *sze = mir_a2t(p.email);
mir_sntprintf(text, SIZEOF(text), TranslateT("Contact %s has been removed from the server.\nWould you like to keep it as \"Local Only\" contact to preserve history?"), sze);
mir_free(sze);
TCHAR title[128];
mir_sntprintf(title, SIZEOF(title), TranslateT("%s protocol"), m_tszUserName);
- if (MessageBox(NULL, text, title, MB_YESNO | MB_ICONQUESTION | MB_SETFOREGROUND) == IDYES)
- {
+ if (MessageBox(NULL, text, title, MB_YESNO | MB_ICONQUESTION | MB_SETFOREGROUND) == IDYES) {
MSN_AddUser(p.hContact, p.email, 0, LIST_LL);
setByte(p.hContact, "LocalList", 1);
continue;
}
}
- if (!(p.list & (LIST_LL | LIST_FL)))
- {
+ if (!(p.list & (LIST_LL | LIST_FL))) {
CallService(MS_DB_CONTACT_DELETE, (WPARAM)p.hContact, 0);
p.hContact = NULL;
}
-
}
- if (p.list & (LIST_LL | LIST_FL) && p.hContact)
- {
+ if (p.list & (LIST_LL | LIST_FL) && p.hContact) {
TCHAR path[MAX_PATH];
MSN_GetCustomSmileyFileName(p.hContact, path, SIZEOF(path), "", 0);
- if (path[0])
- {
+ if (path[0]) {
SMADD_CONT cont;
cont.cbSize = sizeof(SMADD_CONT);
cont.hContact = p.hContact;
@@ -328,7 +315,6 @@ void CMsnProto::MSN_CleanupLists(void)
}
}
}
-// LeaveCriticalSection(&csLists);
}
void CMsnProto::MSN_CreateContList(void)
diff --git a/protocols/MSN/src/msn_proto.cpp b/protocols/MSN/src/msn_proto.cpp
index c1ed5e4f56..8df8e48531 100644
--- a/protocols/MSN/src/msn_proto.cpp
+++ b/protocols/MSN/src/msn_proto.cpp
@@ -282,13 +282,12 @@ HANDLE __cdecl CMsnProto::AddToList(int flags, PROTOSEARCHRESULT* psr)
HANDLE __cdecl CMsnProto::AddToListByEvent(int flags, int iContact, HANDLE hDbEvent)
{
- DBEVENTINFO dbei = {0};
- dbei.cbSize = sizeof(dbei);
- if ((dbei.cbBlob = CallService(MS_DB_EVENT_GETBLOBSIZE, (WPARAM)hDbEvent, 0)) == (DWORD)(-1))
+ DBEVENTINFO dbei = { sizeof(dbei) };
+ if ((dbei.cbBlob = db_event_getBlobSize(hDbEvent)) == (DWORD)(-1))
return NULL;
dbei.pBlob=(PBYTE) alloca(dbei.cbBlob);
- if (CallService(MS_DB_EVENT_GET, (WPARAM)hDbEvent, (LPARAM)&dbei)) return NULL;
+ if (db_event_get(hDbEvent, &dbei)) return NULL;
if (strcmp(dbei.szModule, m_szModuleName)) return NULL;
if (dbei.eventType != EVENTTYPE_AUTHREQUEST) return NULL;
@@ -353,14 +352,12 @@ int CMsnProto::Authorize(HANDLE hDbEvent)
if (!msnLoggedIn)
return 1;
- DBEVENTINFO dbei = { 0 };
- dbei.cbSize = sizeof(dbei);
-
- if ((int)(dbei.cbBlob = CallService(MS_DB_EVENT_GETBLOBSIZE, (WPARAM)hDbEvent, 0)) == -1)
+ DBEVENTINFO dbei = { sizeof(dbei) };
+ if ((dbei.cbBlob = db_event_getBlobSize(hDbEvent)) == -1)
return 1;
dbei.pBlob = (PBYTE)alloca(dbei.cbBlob);
- if (CallService(MS_DB_EVENT_GET, (WPARAM)hDbEvent, (LPARAM)&dbei))
+ if (db_event_get(hDbEvent, &dbei))
return 1;
if (dbei.eventType != EVENTTYPE_AUTHREQUEST)
@@ -393,14 +390,12 @@ int CMsnProto::AuthDeny(HANDLE hDbEvent, const TCHAR* szReason)
if (!msnLoggedIn)
return 1;
- DBEVENTINFO dbei = { 0 };
- dbei.cbSize = sizeof(dbei);
-
- if ((int)(dbei.cbBlob = CallService(MS_DB_EVENT_GETBLOBSIZE, (WPARAM)hDbEvent, 0)) == -1)
+ DBEVENTINFO dbei = { sizeof(dbei) };
+ if ((dbei.cbBlob = db_event_getBlobSize(hDbEvent)) == -1)
return 1;
dbei.pBlob = (PBYTE)alloca(dbei.cbBlob);
- if (CallService(MS_DB_EVENT_GET, (WPARAM)hDbEvent, (LPARAM)&dbei))
+ if (db_event_get(hDbEvent, &dbei))
return 1;
if (dbei.eventType != EVENTTYPE_AUTHREQUEST)
diff --git a/protocols/Tlen/src/jabber_misc.cpp b/protocols/Tlen/src/jabber_misc.cpp
index b31dcd7815..fccf376f72 100644
--- a/protocols/Tlen/src/jabber_misc.cpp
+++ b/protocols/Tlen/src/jabber_misc.cpp
@@ -26,16 +26,16 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
void JabberDBAddEvent(TlenProtocol *proto, HANDLE hContact, int eventType, DWORD flags, PBYTE pBlob, DWORD cbBlob)
{
- DBEVENTINFO dbei = {0};
- dbei.cbSize = sizeof(DBEVENTINFO);
+ DBEVENTINFO dbei = { sizeof(dbei) };
dbei.szModule = proto->m_szModuleName;
dbei.timestamp = (DWORD) time(NULL);
dbei.flags = flags;
dbei.eventType = eventType;
dbei.cbBlob = cbBlob;
dbei.pBlob = pBlob;
- CallService(MS_DB_EVENT_ADD, (WPARAM) hContact, (LPARAM) &dbei);
+ db_event_add(hContact, &dbei);
}
+
void JabberDBAddAuthRequest(TlenProtocol *proto, char *jid, char *nick)
{
char *s;
diff --git a/protocols/Tlen/src/jabber_svc.cpp b/protocols/Tlen/src/jabber_svc.cpp
index a064aeb591..30e4764e4f 100644
--- a/protocols/Tlen/src/jabber_svc.cpp
+++ b/protocols/Tlen/src/jabber_svc.cpp
@@ -234,17 +234,12 @@ HANDLE __cdecl TlenProtocol::AddToList(int flags, PROTOSEARCHRESULT *psr)
HANDLE __cdecl TlenProtocol::AddToListByEvent( int flags, int iContact, HANDLE hDbEvent )
{
- DBEVENTINFO dbei;
- HANDLE hContact;
- char *nick, *firstName, *lastName, *jid;
-
- ZeroMemory(&dbei, sizeof(dbei));
- dbei.cbSize = sizeof(dbei);
- if ((dbei.cbBlob=CallService(MS_DB_EVENT_GETBLOBSIZE, (WPARAM)hDbEvent, 0)) == (DWORD)(-1))
+ DBEVENTINFO dbei = { sizeof(dbei) };
+ if ((dbei.cbBlob = db_event_getBlobSize(hDbEvent)) == (DWORD)(-1))
return (HANDLE) NULL;
if ((dbei.pBlob=(PBYTE) mir_alloc(dbei.cbBlob)) == NULL)
return (HANDLE) NULL;
- if (CallService(MS_DB_EVENT_GET, (WPARAM)hDbEvent, (LPARAM) &dbei)) {
+ if (db_event_get(hDbEvent, &dbei)) {
mir_free(dbei.pBlob);
return (HANDLE) NULL;
}
@@ -265,32 +260,27 @@ HANDLE __cdecl TlenProtocol::AddToListByEvent( int flags, int iContact, HANDLE h
return (HANDLE) NULL;
}
- nick = (char *)dbei.pBlob + sizeof(DWORD)*2;
- firstName = nick + strlen(nick) + 1;
- lastName = firstName + strlen(firstName) + 1;
- jid = lastName + strlen(lastName) + 1;
+ char *nick = (char *)dbei.pBlob + sizeof(DWORD)*2;
+ char *firstName = nick + strlen(nick) + 1;
+ char *lastName = firstName + strlen(firstName) + 1;
+ char *jid = lastName + strlen(lastName) + 1;
- hContact = (HANDLE) AddToListByJID(this, jid, flags);
+ HANDLE hContact = (HANDLE) AddToListByJID(this, jid, flags);
mir_free(dbei.pBlob);
-
return hContact;
}
int __cdecl TlenProtocol::Authorize(HANDLE hDbEvent)
{
- DBEVENTINFO dbei;
- char *nick, *firstName, *lastName, *jid;
-
if (!isOnline)
return 1;
- memset(&dbei, sizeof(dbei), 0);
- dbei.cbSize = sizeof(dbei);
- if (( dbei.cbBlob=CallService( MS_DB_EVENT_GETBLOBSIZE, ( WPARAM )hDbEvent, 0 )) == ( DWORD )( -1 ))
+ DBEVENTINFO dbei = { sizeof(dbei) };
+ if ((dbei.cbBlob = db_event_getBlobSize(hDbEvent)) == (DWORD)-1)
return 1;
if ((dbei.pBlob=(PBYTE) mir_alloc(dbei.cbBlob)) == NULL)
return 1;
- if ( CallService( MS_DB_EVENT_GET, ( WPARAM )hDbEvent, ( LPARAM )&dbei )){
+ if (db_event_get(hDbEvent, &dbei)){
mir_free(dbei.pBlob);
return 1;
}
@@ -303,10 +293,10 @@ int __cdecl TlenProtocol::Authorize(HANDLE hDbEvent)
return 1;
}
- nick = (char *)dbei.pBlob + sizeof(DWORD)*2;
- firstName = nick + strlen(nick) + 1;
- lastName = firstName + strlen(firstName) + 1;
- jid = lastName + strlen(lastName) + 1;
+ char *nick = (char *)dbei.pBlob + sizeof(DWORD)*2;
+ char *firstName = nick + strlen(nick) + 1;
+ char *lastName = firstName + strlen(firstName) + 1;
+ char *jid = lastName + strlen(lastName) + 1;
JabberSend(this, "<presence to='%s' type='subscribed'/>", jid);
@@ -331,19 +321,15 @@ int __cdecl TlenProtocol::Authorize(HANDLE hDbEvent)
int __cdecl TlenProtocol::AuthDeny(HANDLE hDbEvent, const PROTOCHAR* szReason)
{
- DBEVENTINFO dbei;
- char *nick, *firstName, *lastName, *jid;
-
if (!isOnline)
return 1;
- memset(&dbei, sizeof(dbei), 0);
- dbei.cbSize = sizeof(dbei);
- if ((dbei.cbBlob=CallService(MS_DB_EVENT_GETBLOBSIZE, (WPARAM)hDbEvent/*hContact*/, 0)) == (DWORD)(-1))
+ DBEVENTINFO dbei = { sizeof(dbei) };
+ if ((dbei.cbBlob = db_event_getBlobSize(hDbEvent)) == (DWORD)(-1))
return 1;
- if ((dbei.pBlob=(PBYTE) mir_alloc(dbei.cbBlob)) == NULL)
+ if ((dbei.pBlob = (PBYTE) mir_alloc(dbei.cbBlob)) == NULL)
return 1;
- if (CallService(MS_DB_EVENT_GET, (WPARAM)hDbEvent/*hContact*/, (LPARAM) &dbei)) {
+ if (db_event_get(hDbEvent, &dbei)) {
mir_free(dbei.pBlob);
return 1;
}
@@ -356,10 +342,10 @@ int __cdecl TlenProtocol::AuthDeny(HANDLE hDbEvent, const PROTOCHAR* szReason)
return 1;
}
- nick = (char *)dbei.pBlob + sizeof(DWORD)*2;
- firstName = nick + strlen(nick) + 1;
- lastName = firstName + strlen(firstName) + 1;
- jid = lastName + strlen(lastName) + 1;
+ char *nick = (char *)dbei.pBlob + sizeof(DWORD)*2;
+ char *firstName = nick + strlen(nick) + 1;
+ char *lastName = firstName + strlen(firstName) + 1;
+ char *jid = lastName + strlen(lastName) + 1;
JabberSend(this, "<presence to='%s' type='unsubscribed'/>", jid);
JabberSend(this, "<iq type='set'><query xmlns='jabber:iq:roster'><item jid='%s' subscription='remove'/></query></iq>", jid);
diff --git a/protocols/Tlen/src/jabber_thread.cpp b/protocols/Tlen/src/jabber_thread.cpp
index d32bd35a32..3b93aa51d5 100644
--- a/protocols/Tlen/src/jabber_thread.cpp
+++ b/protocols/Tlen/src/jabber_thread.cpp
@@ -710,11 +710,10 @@ static void JabberProcessMessage(XmlNode *node, ThreadData *info)
if (msgTime == 0) {
msgTime = time(NULL);
} else {
- HANDLE hDbEvent = (HANDLE) CallService(MS_DB_EVENT_FINDLAST, (WPARAM) hContact, 0);
+ HANDLE hDbEvent = db_event_last(hContact);
if (hDbEvent != NULL) {
- 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 (msgTime < dbei.timestamp) {
msgTime = dbei.timestamp + 1;
}
diff --git a/protocols/Twitter/src/connection.cpp b/protocols/Twitter/src/connection.cpp
index 178357c36b..0e39bdf63c 100644
--- a/protocols/Twitter/src/connection.cpp
+++ b/protocols/Twitter/src/connection.cpp
@@ -583,15 +583,13 @@ void TwitterProto::UpdateStatuses(bool pre_read, bool popups, bool tweetToMsg)
// i think we maybe should just do that DBEF_READ line instead of stopping ALL this code. have to test.
if (tweetToMsg) {
DBEVENTINFO dbei = {sizeof(dbei)};
-
dbei.pBlob = (BYTE*)(i->status.text.c_str());
dbei.cbBlob = (int)i->status.text.size()+1;
dbei.eventType = TWITTER_DB_EVENT_TYPE_TWEET;
dbei.flags = DBEF_UTF | DBEF_READ;
- //dbei.flags = DBEF_READ; // i had commented this line out.. can't remember why :( might need to do it again, uncommented for mrQQ for testing (added to the DBEF_UTF line)
dbei.timestamp = static_cast<DWORD>(i->status.time);
dbei.szModule = m_szModuleName;
- CallService(MS_DB_EVENT_ADD, (WPARAM)hContact, (LPARAM)&dbei);
+ db_event_add(hContact, &dbei);
}
db_set_utf(hContact,"CList","StatusMsg",i->status.text.c_str());
diff --git a/protocols/Xfire/src/main.cpp b/protocols/Xfire/src/main.cpp
index 4848b19fe6..ae7fcc07e3 100644
--- a/protocols/Xfire/src/main.cpp
+++ b/protocols/Xfire/src/main.cpp
@@ -1042,8 +1042,7 @@ int ExtraImageApply(WPARAM wparam, LPARAM lparam)
{
HANDLE hContact=(HANDLE)wparam;
// TODO: maybe need to fix extra icons
- char *szProto;
- szProto = ( char* ) CallService( MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hContact, 0);
+ char *szProto = GetContactProto(hContact);
if ( szProto != NULL && !lstrcmpiA( szProto, protocolname ) && DBGetContactSettingWord(hContact, protocolname, "Status", ID_STATUS_OFFLINE)!=ID_STATUS_OFFLINE) {
int gameid=DBGetContactSettingWord(hContact, protocolname, "GameId", 0);
int gameid2=DBGetContactSettingWord(hContact, protocolname, "VoiceId", 0);
@@ -1384,8 +1383,7 @@ INT_PTR RecvMessage(WPARAM wParam, LPARAM lParam)
CCSDATA *ccs = ( CCSDATA* )lParam;
DBDeleteContactSetting(ccs->hContact, "CList", "Hidden");
- char *szProto;
- szProto = ( char* ) CallService( MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) ccs->hContact, 0);
+ char *szProto = GetContactProto(ccs->hContact);
if ( szProto != NULL && !lstrcmpiA( szProto, protocolname ))
return CallService( MS_PROTO_RECVMSG, wParam, lParam );
@@ -1802,29 +1800,23 @@ HANDLE CList_AddContact(XFireContact xfc, bool InList, bool SetOnline,int clan)
BOOL IsXFireContact(HANDLE hContact)
{
- char *szProto;
- szProto = ( char* ) CallService( MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hContact, 0);
- if ( szProto != NULL && !lstrcmpiA( szProto, protocolname )) {
+ char *szProto = GetContactProto(hContact);
+ if (szProto != NULL && !lstrcmpiA(szProto, protocolname))
return TRUE;
- }
- else
- return FALSE;
+
+ return FALSE;
}
HANDLE CList_FindContact (int uid)
{
- char *szProto;
-
- HANDLE hContact = (HANDLE) CallService( MS_DB_CONTACT_FINDFIRST, 0, 0);
+ HANDLE hContact = db_find_first();
while (hContact) {
- szProto = ( char* ) CallService( MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hContact, 0);
+ char *szProto = GetContactProto(hContact);
if ( szProto != NULL && !lstrcmpiA( szProto, protocolname )) {
- if ( DBGetContactSettingDword(hContact, protocolname, "UserId",-1)==uid)
- {
- return (HANDLE)hContact;
- }
+ if ( DBGetContactSettingDword(hContact, protocolname, "UserId",-1)==uid)
+ return hContact;
}
- hContact = (HANDLE) CallService( MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0);
+ hContact = db_find_next(hContact);
}
return 0;
}
@@ -1832,10 +1824,9 @@ HANDLE CList_FindContact (int uid)
void CList_MakeAllOffline()
{
vector<HANDLE> fhandles;
- char *szProto;
- HANDLE hContact = (HANDLE) CallService( MS_DB_CONTACT_FINDFIRST, 0, 0);
+ HANDLE hContact = db_find_first();
while (hContact) {
- szProto = ( char* ) CallService( MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hContact, 0);
+ char *szProto = GetContactProto(hContact);
if ( szProto != NULL && !lstrcmpiA( szProto, protocolname )) {
//freunde von freunden in eine seperate liste setzen
//nur wenn das nicht abgestellt wurde
@@ -1845,9 +1836,6 @@ void CList_MakeAllOffline()
fhandles.push_back(hContact);
}
- //DBDeleteContactSetting(hContact, protocolname, "XStatusMsg");
- //DBDeleteContactSetting(hContact, protocolname, "XStatusId");
- //DBDeleteContactSetting(hContact, protocolname, "XStatusName");
DBDeleteContactSetting(hContact, "CList", "StatusMsg");
DBDeleteContactSetting(hContact, protocolname, "ServerIP");
DBDeleteContactSetting(hContact, protocolname, "Port");
@@ -1857,7 +1845,6 @@ void CList_MakeAllOffline()
DBDeleteContactSetting(hContact, protocolname, "Players");
DBDeleteContactSetting(hContact, protocolname, "Passworded");
- //DBWriteContactSettingUTF8String(hContact, "CList", "StatusMsg", "");
DBDeleteContactSetting(hContact, protocolname, "XStatusMsg");
DBDeleteContactSetting(hContact, protocolname, "XStatusId");
DBDeleteContactSetting(hContact, protocolname, "XStatusName");
@@ -1898,13 +1885,12 @@ void CList_MakeAllOffline()
}
DBWriteContactSettingWord(hContact,protocolname,"Status",ID_STATUS_OFFLINE);
}
- hContact = (HANDLE) CallService( MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0);
+ hContact = db_find_next(hContact);
}
+
//alle gefundenen handles lsöchen
for(uint i=0;i<fhandles.size();i++)
- {
CallService( MS_DB_CONTACT_DELETE, (WPARAM) fhandles.at(i), 0);
- }
}
void SetIcon(HANDLE hcontact,HANDLE hicon,int ctype)
diff --git a/protocols/Yahoo/src/im.cpp b/protocols/Yahoo/src/im.cpp
index 1c07e73903..607221d2c9 100644
--- a/protocols/Yahoo/src/im.cpp
+++ b/protocols/Yahoo/src/im.cpp
@@ -108,14 +108,14 @@ void CYahooProto::ext_got_im(const char *me, const char *who, int protocol, cons
pre.flags = (utf8) ? PREF_UTF : 0;
if (tm) {
- HANDLE hEvent = (HANDLE)CallService(MS_DB_EVENT_FINDLAST, (WPARAM)hContact, 0);
+ HANDLE hEvent = db_event_last(hContact);
if (hEvent) { // contact has events
DWORD dummy;
DBEVENTINFO dbei = { sizeof (dbei) };
dbei.pBlob = (BYTE*)&dummy;
dbei.cbBlob = 2;
- if (!CallService(MS_DB_EVENT_GET, (WPARAM)hEvent, (LPARAM)&dbei))
+ if (!db_event_get(hEvent, &dbei))
// got that event, if newer than ts then reset to current time
if ((DWORD)tm < dbei.timestamp) tm = (long)time(NULL);
}
diff --git a/protocols/Yahoo/src/proto.cpp b/protocols/Yahoo/src/proto.cpp
index d78943f4b7..245a1fbd1f 100644
--- a/protocols/Yahoo/src/proto.cpp
+++ b/protocols/Yahoo/src/proto.cpp
@@ -147,28 +147,28 @@ HANDLE CYahooProto::AddToList( int flags, PROTOSEARCHRESULT* psr )
HANDLE __cdecl CYahooProto::AddToListByEvent( int flags, int /*iContact*/, HANDLE hDbEvent )
{
DebugLog("[YahooAddToListByEvent]");
- if ( !m_bLoggedIn )
+ if (!m_bLoggedIn)
return 0;
DBEVENTINFO dbei = { sizeof( dbei ) };
- if (( dbei.cbBlob = CallService( MS_DB_EVENT_GETBLOBSIZE, (LPARAM)hDbEvent, 0)) == -1 ) {
+ if ((dbei.cbBlob = db_event_getBlobSize(hDbEvent)) == -1 ) {
DebugLog("[YahooAddToListByEvent] ERROR: Can't get blob size.");
return 0;
}
DebugLog("[YahooAddToListByEvent] Got blob size: %lu", dbei.cbBlob);
dbei.pBlob = ( PBYTE )_alloca( dbei.cbBlob );
- if ( CallService( MS_DB_EVENT_GET, ( WPARAM )hDbEvent, (LPARAM)&dbei )) {
+ if (db_event_get(hDbEvent, &dbei)) {
DebugLog("[YahooAddToListByEvent] ERROR: Can't get event.");
return 0;
}
- if ( dbei.eventType != EVENTTYPE_AUTHREQUEST ) {
+ if (dbei.eventType != EVENTTYPE_AUTHREQUEST) {
DebugLog("[YahooAddToListByEvent] ERROR: Not an authorization request.");
return 0;
}
- if ( strcmp( dbei.szModule, m_szModuleName )) {
+ if ( strcmp(dbei.szModule, m_szModuleName)) {
DebugLog("[YahooAddToListByEvent] ERROR: Not Yahoo protocol.");
return 0;
}
@@ -194,11 +194,11 @@ int CYahooProto::Authorize( HANDLE hdbe )
}
DBEVENTINFO dbei = { sizeof(dbei) };
- if (( dbei.cbBlob = CallService( MS_DB_EVENT_GETBLOBSIZE, ( WPARAM )hdbe, 0)) == -1 )
+ if (( dbei.cbBlob = db_event_getBlobSize(hdbe)) == -1 )
return 1;
dbei.pBlob = ( PBYTE )_alloca( dbei.cbBlob );
- if ( CallService( MS_DB_EVENT_GET, ( WPARAM )hdbe, (LPARAM)&dbei ))
+ if (db_event_get(hdbe, &dbei))
return 1;
if (dbei.eventType != EVENTTYPE_AUTHREQUEST)
@@ -235,23 +235,23 @@ int CYahooProto::AuthDeny( HANDLE hdbe, const TCHAR* reason )
return 1;
DBEVENTINFO dbei = { sizeof( dbei ) };
- if (( dbei.cbBlob = CallService( MS_DB_EVENT_GETBLOBSIZE, ( WPARAM )hdbe, 0)) == -1 ) {
+ if (( dbei.cbBlob = db_event_getBlobSize(hdbe)) == -1 ) {
DebugLog("[YahooAuthDeny] ERROR: Can't get blob size");
return 1;
}
dbei.pBlob = ( PBYTE )alloca( dbei.cbBlob );
- if ( CallService( MS_DB_EVENT_GET, ( WPARAM )hdbe, (LPARAM)&dbei )) {
+ if (db_event_get(hdbe, &dbei)) {
DebugLog("YahooAuthDeny - Can't get db event!");
return 1;
}
- if ( dbei.eventType != EVENTTYPE_AUTHREQUEST ) {
+ if (dbei.eventType != EVENTTYPE_AUTHREQUEST) {
DebugLog("YahooAuthDeny - not Authorization event");
return 1;
}
- if ( strcmp( dbei.szModule, m_szModuleName )) {
+ if (strcmp( dbei.szModule, m_szModuleName)) {
DebugLog("YahooAuthDeny - wrong module?");
return 1;
}