diff options
Diffstat (limited to 'protocols')
49 files changed, 78 insertions, 106 deletions
diff --git a/protocols/AimOscar/src/proto.cpp b/protocols/AimOscar/src/proto.cpp index f4c9580841..f3dbb61265 100644 --- a/protocols/AimOscar/src/proto.cpp +++ b/protocols/AimOscar/src/proto.cpp @@ -673,7 +673,7 @@ int __cdecl CAimProto::OnEvent(PROTOEVENTTYPE eventType, WPARAM wParam, LPARAM l case EV_PROTO_ONERASE:
char szDbsettings[64];
mir_snprintf(szDbsettings, "%sP2P", m_szModuleName);
- DbModule_Delete(0, szDbsettings);
+ db_delete_module(0, szDbsettings);
break;
case EV_PROTO_ONCONTACTDELETED:
diff --git a/protocols/AimOscar/src/server.cpp b/protocols/AimOscar/src/server.cpp index a41ea0d5ce..50bddbceb9 100644 --- a/protocols/AimOscar/src/server.cpp +++ b/protocols/AimOscar/src/server.cpp @@ -889,7 +889,7 @@ void CAimProto::delete_ssi_list(SNAC &snac, int &offset) }
}
if (i == 1)
- CallService(MS_DB_CONTACT_DELETE, hContact, 0);
+ db_delete_contact(hContact);
break;
case 0x0001: //group record
diff --git a/protocols/AimOscar/src/utility.cpp b/protocols/AimOscar/src/utility.cpp index 69c60f9cfc..6ac3457ed4 100755 --- a/protocols/AimOscar/src/utility.cpp +++ b/protocols/AimOscar/src/utility.cpp @@ -197,7 +197,7 @@ MCONTACT CAimProto::contact_from_sn(const char* sn, bool addIfNeeded, bool tempo }
if (addIfNeeded) {
- MCONTACT hContact = (MCONTACT)CallService(MS_DB_CONTACT_ADD, 0, 0);
+ MCONTACT hContact = db_add_contact();
if (hContact) {
if (Proto_AddToContact(hContact, m_szModuleName) == 0) {
setString(hContact, AIM_KEY_SN, norm_sn);
@@ -207,7 +207,7 @@ MCONTACT CAimProto::contact_from_sn(const char* sn, bool addIfNeeded, bool tempo db_set_b(hContact, "CList", "NotOnList", 1);
return hContact;
}
- CallService(MS_DB_CONTACT_DELETE, hContact, 0);
+ db_delete_contact(hContact);
}
}
diff --git a/protocols/Dummy/src/dummy_proto.cpp b/protocols/Dummy/src/dummy_proto.cpp index 801d977a8e..56a4d3b8b8 100644 --- a/protocols/Dummy/src/dummy_proto.cpp +++ b/protocols/Dummy/src/dummy_proto.cpp @@ -157,10 +157,9 @@ MCONTACT CDummyProto::AddToList(int flags, PROTOSEARCHRESULT* psr) if (psr->id.w == NULL) return NULL; - MCONTACT hContact = (MCONTACT)CallService(MS_DB_CONTACT_ADD); - + MCONTACT hContact = db_add_contact(); if (hContact && Proto_AddToContact(hContact, m_szModuleName) != 0) { - CallService(MS_DB_CONTACT_DELETE, hContact); + db_delete_contact(hContact); hContact = NULL; } diff --git a/protocols/EmLanProto/src/mlan.cpp b/protocols/EmLanProto/src/mlan.cpp index 8b502d2fb9..60b126ff56 100644 --- a/protocols/EmLanProto/src/mlan.cpp +++ b/protocols/EmLanProto/src/mlan.cpp @@ -218,7 +218,7 @@ MCONTACT CMLan::FindContact(in_addr addr, const char* nick, bool add_to_list, bo } if (add_to_list) { - MCONTACT res = (MCONTACT)CallService(MS_DB_CONTACT_ADD, 0, 0); + MCONTACT res = db_add_contact(); Proto_AddToContact(res, PROTONAME); db_set_dw(res, PROTONAME, "ipaddr", addr.S_un.S_addr); db_set_s(res, PROTONAME, "Nick", nick); diff --git a/protocols/FacebookRM/src/contacts.cpp b/protocols/FacebookRM/src/contacts.cpp index 36d2536f92..f0b8852938 100644 --- a/protocols/FacebookRM/src/contacts.cpp +++ b/protocols/FacebookRM/src/contacts.cpp @@ -97,7 +97,7 @@ MCONTACT FacebookProto::ChatIDToHContact(const std::string &chat_id) auto it = facy.chat_id_to_hcontact.find(chat_id); if (it != facy.chat_id_to_hcontact.end()) { // Check if contact is still valid - if (CallService(MS_DB_CONTACT_IS, (WPARAM)it->second) == 1) + if (db_is_contact((WPARAM)it->second) == 1) return it->second; else facy.chat_id_to_hcontact.erase(it); @@ -129,7 +129,7 @@ MCONTACT FacebookProto::ContactIDToHContact(const std::string &user_id) std::map<std::string, MCONTACT>::iterator it = facy.user_id_to_hcontact.find(user_id); if (it != facy.user_id_to_hcontact.end()) { // Check if contact is still valid - if (CallService(MS_DB_CONTACT_IS, (WPARAM)it->second) == 1) + if (db_is_contact((WPARAM)it->second) == 1) return it->second; else facy.user_id_to_hcontact.erase(it); @@ -401,10 +401,10 @@ MCONTACT FacebookProto::AddToContactList(facebook_user* fbu, bool force_add, boo } // Try to make a new contact - MCONTACT hContact = (MCONTACT)CallService(MS_DB_CONTACT_ADD); + MCONTACT hContact = db_add_contact(); if (hContact && Proto_AddToContact(hContact, m_szModuleName) != 0) { - CallService(MS_DB_CONTACT_DELETE, hContact); + db_delete_contact(hContact); hContact = NULL; } @@ -625,7 +625,7 @@ void FacebookProto::IgnoreFriendshipRequest(void *data) // Delete this contact, if he's temporary if (db_get_b(hContact, "CList", "NotOnList", 0)) - CallService(MS_DB_CONTACT_DELETE, hContact); + db_delete_contact(hContact); } else facy.client_notify(TranslateT("Error occurred when ignoring friendship request.")); diff --git a/protocols/GTalkExt/src/notifications.cpp b/protocols/GTalkExt/src/notifications.cpp index e80e573742..eecfe8abd8 100644 --- a/protocols/GTalkExt/src/notifications.cpp +++ b/protocols/GTalkExt/src/notifications.cpp @@ -168,7 +168,7 @@ MCONTACT SetupPseudocontact(LPCTSTR jid, LPCTSTR unreadCount, LPCSTR acc, LPCTST {
MCONTACT hContact = db_get_dw(NULL, acc, PSEUDOCONTACT_LINK, 0);
if (!hContact || !db_get_b(hContact, SHORT_PLUGIN_NAME, PSEUDOCONTACT_FLAG, 0)) {
- hContact = (MCONTACT)CallService(MS_DB_CONTACT_ADD, 0, 0);
+ hContact = db_add_contact();
db_set_dw(0, acc, PSEUDOCONTACT_LINK, hContact);
db_set_b(hContact, SHORT_PLUGIN_NAME, PSEUDOCONTACT_FLAG, 1);
Proto_AddToContact(hContact, acc);
diff --git a/protocols/Gadu-Gadu/src/core.cpp b/protocols/Gadu-Gadu/src/core.cpp index 8440ab94ab..ffce72b6b5 100644 --- a/protocols/Gadu-Gadu/src/core.cpp +++ b/protocols/Gadu-Gadu/src/core.cpp @@ -1536,7 +1536,7 @@ MCONTACT GGPROTO::getcontact(uin_t uin, int create, int inlist, wchar_t *szNick) if (!create)
return NULL;
- MCONTACT hContact = (MCONTACT)CallService(MS_DB_CONTACT_ADD, 0, 0);
+ MCONTACT hContact = db_add_contact();
if (!hContact) {
debugLogW(L"getcontact(): Failed to create Gadu-Gadu contact %s", szNick);
return NULL;
@@ -1544,7 +1544,7 @@ MCONTACT GGPROTO::getcontact(uin_t uin, int create, int inlist, wchar_t *szNick) if (Proto_AddToContact(hContact, m_szModuleName) != 0) {
// For some reason we failed to register the protocol for this contact
- CallService(MS_DB_CONTACT_DELETE, hContact, 0);
+ db_delete_contact(hContact);
debugLogA("getcontact(): Failed to register GG contact %d", uin);
return NULL;
}
diff --git a/protocols/Gadu-Gadu/src/groupchat.cpp b/protocols/Gadu-Gadu/src/groupchat.cpp index 29f3e39abc..65db400791 100644 --- a/protocols/Gadu-Gadu/src/groupchat.cpp +++ b/protocols/Gadu-Gadu/src/groupchat.cpp @@ -139,7 +139,7 @@ int GGPROTO::gc_event(WPARAM, LPARAM lParam) DBVARIANT dbv;
if (!getWString(hContact, "ChatRoomID", &dbv)) {
if (dbv.ptszVal && !mir_wstrcmp(gch->pDest->ptszID, dbv.ptszVal))
- CallService(MS_DB_CONTACT_DELETE, hContact, 0);
+ db_delete_contact(hContact);
db_free(&dbv);
}
hContact = hNext;
diff --git a/protocols/Gadu-Gadu/src/services.cpp b/protocols/Gadu-Gadu/src/services.cpp index fbb314a22c..78542d1802 100644 --- a/protocols/Gadu-Gadu/src/services.cpp +++ b/protocols/Gadu-Gadu/src/services.cpp @@ -380,7 +380,7 @@ INT_PTR GGPROTO::get_acc_mgr_gui(WPARAM, LPARAM lParam) INT_PTR GGPROTO::leavechat(WPARAM hContact, LPARAM)
{
if (hContact)
- CallService(MS_DB_CONTACT_DELETE, hContact, 0);
+ db_delete_contact(hContact);
return 0;
}
diff --git a/protocols/ICQCorp/src/protocol.cpp b/protocols/ICQCorp/src/protocol.cpp index 19b51ca642..5b112d6e83 100644 --- a/protocols/ICQCorp/src/protocol.cpp +++ b/protocols/ICQCorp/src/protocol.cpp @@ -1317,7 +1317,7 @@ ICQUser *ICQ::addUser(unsigned int uin, bool persistent) u = new ICQUser();
u->uin = uin;
- u->hContact = (MCONTACT)CallService(MS_DB_CONTACT_ADD, 0, 0);
+ u->hContact = db_add_contact();
icqUsers.push_back(u);
Proto_AddToContact(u->hContact, protoName);
diff --git a/protocols/IRCG/src/clist.cpp b/protocols/IRCG/src/clist.cpp index 8ef7cab404..a0406973c6 100644 --- a/protocols/IRCG/src/clist.cpp +++ b/protocols/IRCG/src/clist.cpp @@ -97,7 +97,7 @@ MCONTACT CIrcProto::CList_AddContact(CONTACT *user, bool InList, bool SetOnline) }
// here we create a new one since no one is to be found
- hContact = (MCONTACT)CallService(MS_DB_CONTACT_ADD, 0, 0);
+ hContact = db_add_contact();
if (hContact) {
Proto_AddToContact(hContact, m_szModuleName);
diff --git a/protocols/IRCG/src/ircproto.cpp b/protocols/IRCG/src/ircproto.cpp index 50ac719935..a7befd3419 100644 --- a/protocols/IRCG/src/ircproto.cpp +++ b/protocols/IRCG/src/ircproto.cpp @@ -246,11 +246,7 @@ int CIrcProto::OnModulesLoaded(WPARAM, LPARAM) if (!getByte("PerformConversionDone", 0)) {
OBJLIST<CMStringA> performToConvert(10);
- DBCONTACTENUMSETTINGS dbces = { 0 };
- dbces.pfnEnumProc = sttCheckPerform;
- dbces.lParam = (LPARAM)&performToConvert;
- dbces.szModule = m_szModuleName;
- CallService(MS_DB_CONTACT_ENUMSETTINGS, NULL, (LPARAM)&dbces);
+ db_enum_settings(NULL, sttCheckPerform, m_szModuleName, &performToConvert);
for (int i = 0; i < performToConvert.getCount(); i++) {
CMStringA s = performToConvert[i];
diff --git a/protocols/IRCG/src/options.cpp b/protocols/IRCG/src/options.cpp index 1a249a3fc3..20a7899faf 100644 --- a/protocols/IRCG/src/options.cpp +++ b/protocols/IRCG/src/options.cpp @@ -165,10 +165,7 @@ void RereadServers() {
g_servers.destroy();
- DBCONTACTENUMSETTINGS dbces = { 0 };
- dbces.pfnEnumProc = sttServerEnum;
- dbces.szModule = SERVERSMODULE;
- CallService(MS_DB_CONTACT_ENUMSETTINGS, NULL, (LPARAM)&dbces);
+ db_enum_settings(NULL, sttServerEnum, SERVERSMODULE);
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -747,7 +744,7 @@ void CConnectPrefsDlg::OnApply() if (m_serverlistModified) {
m_serverlistModified = false;
- DbModule_Delete(0, SERVERSMODULE);
+ db_delete_module(0, SERVERSMODULE);
int j = m_serverCombo.GetCount();
if (j != CB_ERR && j != 0) {
diff --git a/protocols/IcqOscarJ/src/fam_01service.cpp b/protocols/IcqOscarJ/src/fam_01service.cpp index faec561278..412dec2b39 100644 --- a/protocols/IcqOscarJ/src/fam_01service.cpp +++ b/protocols/IcqOscarJ/src/fam_01service.cpp @@ -470,7 +470,7 @@ char* CIcqProto::buildUinList(int subtype, size_t wMaxLen, MCONTACT *hContactRes WORD wCurrentLen = 0;
int add;
- char *szList = (char*)SAFE_MALLOC(CallService(MS_DB_CONTACT_GETCOUNT, 0, 0) * UINMAXLEN);
+ char *szList = (char*)SAFE_MALLOC(db_get_contact_count() * UINMAXLEN);
char szLen[2];
szLen[1] = '\0';
diff --git a/protocols/IcqOscarJ/src/fam_03buddy.cpp b/protocols/IcqOscarJ/src/fam_03buddy.cpp index f78ba6541c..21978f1886 100644 --- a/protocols/IcqOscarJ/src/fam_03buddy.cpp +++ b/protocols/IcqOscarJ/src/fam_03buddy.cpp @@ -520,7 +520,7 @@ void CIcqProto::handleUserOnline(BYTE *buf, size_t wLen, serverthread_info*) AddToSpammerList(dwUIN);
if (getByte("PopupsSpamEnabled", DEFAULT_SPAM_POPUPS_ENABLED))
ShowPopupMsg(hContact, LPGEN("Spambot Detected"), LPGEN("Contact deleted & further events blocked."), POPTYPE_SPAM);
- CallService(MS_DB_CONTACT_DELETE, hContact, 0);
+ db_delete_contact(hContact);
debugLogA("Contact %u deleted", dwUIN);
}
diff --git a/protocols/IcqOscarJ/src/icq_proto.cpp b/protocols/IcqOscarJ/src/icq_proto.cpp index 91d2014802..d9ed1b32dd 100644 --- a/protocols/IcqOscarJ/src/icq_proto.cpp +++ b/protocols/IcqOscarJ/src/icq_proto.cpp @@ -415,7 +415,7 @@ int CIcqProto::AuthDeny(MEVENT hDbEvent, const wchar_t* szReason) icq_sendAuthResponseServ(uin, uid, 0, szReason);
if (db_get_b(hContact, "CList", "NotOnList", 0))
- CallService(MS_DB_CONTACT_DELETE, hContact, 0);
+ db_delete_contact(hContact);
return 0; // Success
}
@@ -1862,11 +1862,11 @@ int __cdecl CIcqProto::OnEvent(PROTOEVENTTYPE eventType, WPARAM wParam, LPARAM l {
char szDbSetting[MAX_PATH];
mir_snprintf(szDbSetting, "%sP2P", m_szModuleName);
- DbModule_Delete(0, szDbSetting);
+ db_delete_module(0, szDbSetting);
mir_snprintf(szDbSetting, "%sSrvGroups", m_szModuleName);
- DbModule_Delete(0, szDbSetting);
+ db_delete_module(0, szDbSetting);
mir_snprintf(szDbSetting, "%sGroups", m_szModuleName);
- DbModule_Delete(0, szDbSetting);
+ db_delete_module(0, szDbSetting);
}
break;
diff --git a/protocols/IcqOscarJ/src/icq_servlist.cpp b/protocols/IcqOscarJ/src/icq_servlist.cpp index 9c9ae7a703..2a031977e5 100644 --- a/protocols/IcqOscarJ/src/icq_servlist.cpp +++ b/protocols/IcqOscarJ/src/icq_servlist.cpp @@ -854,11 +854,7 @@ void CIcqProto::LoadServerIDs() mir_snprintf(szModule, "%sSrvGroups", m_szModuleName);
GroupReserveIdsEnumParam param = { this, szModule };
- DBCONTACTENUMSETTINGS dbces = { 0 };
- dbces.pfnEnumProc = &GroupReserveIdsEnumProc;
- dbces.szModule = szModule;
- dbces.lParam = (LPARAM)¶m;
- CallService(MS_DB_CONTACT_ENUMSETTINGS, 0, (LPARAM)&dbces);
+ db_enum_settings(NULL, &GroupReserveIdsEnumProc, szModule, ¶m);
nGroups = nServerIDListCount - nStart;
@@ -1180,7 +1176,7 @@ int CIcqProto::IsServerGroupsDefined() // flush obsolete linking data
mir_snprintf(szModule, "%sGroups", m_szModuleName);
- DbModule_Delete(0, szModule);
+ db_delete_module(0, szModule);
iRes = 0; // no groups defined, or older version
}
@@ -1194,7 +1190,7 @@ void CIcqProto::FlushSrvGroupsCache() {
char szModule[MAX_PATH];
mir_snprintf(szModule, "%sSrvGroups", m_szModuleName);
- DbModule_Delete(0, szModule);
+ db_delete_module(0, szModule);
}
// Look thru DB and collect all ContactIDs from a group
@@ -1279,12 +1275,7 @@ void CIcqProto::removeGroupPathLinks(WORD wGroupID) pars[1] = (char*)wGroupID;
pars[2] = szModule;
- DBCONTACTENUMSETTINGS dbces = { 0 };
- dbces.pfnEnumProc = &GroupLinksEnumProc;
- dbces.szModule = szModule;
- dbces.lParam = (LPARAM)pars;
-
- if (!CallService(MS_DB_CONTACT_ENUMSETTINGS, 0, (LPARAM)&dbces)) { // we found some links, remove them
+ if (!db_enum_settings(NULL, &GroupLinksEnumProc, szModule, pars)) { // we found some links, remove them
char** list = (char**)pars[0];
while (list) {
void* bet;
@@ -1515,7 +1506,6 @@ static int SrvGroupNamesEnumProc(const char *szSetting, LPARAM lParam) char* CIcqProto::getServListUniqueGroupName(const char *szGroupName, int bAlloced)
{
// enum ICQSrvGroups and create unique name if neccessary
- DBCONTACTENUMSETTINGS dbces;
char szModule[MAX_PATH];
char *pars[4];
int uniqueID = 1;
@@ -1533,11 +1523,7 @@ char* CIcqProto::getServListUniqueGroupName(const char *szGroupName, int bAlloce pars[1] = NULL;
pars[2] = szNewGroupName ? szNewGroupName : szGroupNameBase;
pars[3] = szModule;
-
- dbces.pfnEnumProc = &SrvGroupNamesEnumProc;
- dbces.szModule = szModule;
- dbces.lParam = (LPARAM)pars;
- CallService(MS_DB_CONTACT_ENUMSETTINGS, 0, (LPARAM)&dbces);
+ db_enum_settings(NULL, &SrvGroupNamesEnumProc, szModule, pars);
if (pars[1]) { // the groupname already exists, create another
SAFE_FREE((void**)&szNewGroupName);
diff --git a/protocols/IcqOscarJ/src/icq_uploadui.cpp b/protocols/IcqOscarJ/src/icq_uploadui.cpp index b99b17b95e..021331a978 100644 --- a/protocols/IcqOscarJ/src/icq_uploadui.cpp +++ b/protocols/IcqOscarJ/src/icq_uploadui.cpp @@ -150,12 +150,7 @@ static void enumServerGroups(CIcqProto* ppro) {
char szModule[MAX_PATH + 9];
mir_snprintf(szModule, "%s%s", ppro->m_szModuleName, "SrvGroups");
-
- DBCONTACTENUMSETTINGS dbces = { 0 };
- dbces.pfnEnumProc = &GroupEnumIdsEnumProc;
- dbces.szModule = szModule;
- dbces.lParam = (LPARAM)szModule;
- CallService(MS_DB_CONTACT_ENUMSETTINGS, 0, (LPARAM)&dbces);
+ db_enum_settings(NULL, &GroupEnumIdsEnumProc, szModule, szModule);
}
static DWORD sendUploadGroup(CIcqProto* ppro, WORD wAction, WORD wGroupId, char* szItemName)
diff --git a/protocols/IcqOscarJ/src/utilities.cpp b/protocols/IcqOscarJ/src/utilities.cpp index 3ecc78a9df..d15779ae08 100644 --- a/protocols/IcqOscarJ/src/utilities.cpp +++ b/protocols/IcqOscarJ/src/utilities.cpp @@ -442,7 +442,7 @@ MCONTACT CIcqProto::HContactFromUIN(DWORD dwUin, int *Added) if (Added) {
debugLogA("Attempt to create ICQ contact %u", dwUin);
- hContact = (MCONTACT)CallService(MS_DB_CONTACT_ADD, 0, 0);
+ hContact = db_add_contact();
if (!hContact) {
debugLogA("Failed to create ICQ contact %u", dwUin);
return INVALID_CONTACT_ID;
@@ -450,7 +450,7 @@ MCONTACT CIcqProto::HContactFromUIN(DWORD dwUin, int *Added) if (Proto_AddToContact(hContact, m_szModuleName) != 0) {
// For some reason we failed to register the protocol to this contact
- CallService(MS_DB_CONTACT_DELETE, hContact, 0);
+ db_delete_contact(hContact);
debugLogA("Failed to register ICQ contact %u", dwUin);
return INVALID_CONTACT_ID;
}
@@ -515,7 +515,7 @@ MCONTACT CIcqProto::HContactFromUID(DWORD dwUin, const char *szUid, int *Added) if (Added) {
debugLogA("Attempt to create ICQ contact by string <%s>", szUid);
- hContact = (MCONTACT)CallService(MS_DB_CONTACT_ADD, 0, 0);
+ hContact = db_add_contact();
Proto_AddToContact(hContact, m_szModuleName);
setString(hContact, UNIQUEIDSETTING, szUid);
diff --git a/protocols/JabberG/src/jabber_iqid.cpp b/protocols/JabberG/src/jabber_iqid.cpp index 186d2da1a9..d2c836869d 100644 --- a/protocols/JabberG/src/jabber_iqid.cpp +++ b/protocols/JabberG/src/jabber_iqid.cpp @@ -496,7 +496,7 @@ void CJabberProto::OnIqResultGetRoster(HXML iqNode, CJabberIqInfo *pInfo) JABBER_LIST_ITEM *item = ListGetItemPtrFromIndex(i);
if (item && item->hContact && !item->bRealContact) {
debugLogW(L"Syncing roster: preparing to delete %s (hContact=0x%x)", item->jid, item->hContact);
- CallService(MS_DB_CONTACT_DELETE, item->hContact, 0);
+ db_delete_contact(item->hContact);
}
}
}
diff --git a/protocols/JabberG/src/jabber_misc.cpp b/protocols/JabberG/src/jabber_misc.cpp index 0a4600cecb..c6e995a074 100644 --- a/protocols/JabberG/src/jabber_misc.cpp +++ b/protocols/JabberG/src/jabber_misc.cpp @@ -101,7 +101,7 @@ MCONTACT CJabberProto::DBCreateContact(const wchar_t *jid, const wchar_t *nick, else
wcsncpy_s(szJid, jid, _TRUNCATE);
- MCONTACT hNewContact = (MCONTACT)CallService(MS_DB_CONTACT_ADD, 0, 0);
+ MCONTACT hNewContact = db_add_contact();
Proto_AddToContact(hNewContact, m_szModuleName);
setWString(hNewContact, "jid", szJid);
if (nick != NULL && *nick != '\0')
diff --git a/protocols/JabberG/src/jabber_thread.cpp b/protocols/JabberG/src/jabber_thread.cpp index f869c96f1c..6c193d8618 100755 --- a/protocols/JabberG/src/jabber_thread.cpp +++ b/protocols/JabberG/src/jabber_thread.cpp @@ -1326,7 +1326,7 @@ void CJabberProto::OnProcessMessage(HXML node, ThreadData *info) else if (!mir_wstrcmp(action, L"delete")) {
MCONTACT cc = HContactFromJID(jid);
if (cc)
- CallService(MS_DB_CONTACT_DELETE, cc, 0);
+ db_delete_contact(cc);
}
}
}
diff --git a/protocols/MRA/src/Mra_functions.cpp b/protocols/MRA/src/Mra_functions.cpp index 92a44be899..ea2913deba 100644 --- a/protocols/MRA/src/Mra_functions.cpp +++ b/protocols/MRA/src/Mra_functions.cpp @@ -547,7 +547,7 @@ MCONTACT CMraProto::MraHContactFromEmail(const CMStringA &szEmail, BOOL bAddIfNe }
}
else {
- hContact = (MCONTACT)CallService(MS_DB_CONTACT_ADD, 0, 0);
+ hContact = db_add_contact();
Proto_AddToContact(hContact, m_szModuleName);
}
diff --git a/protocols/MSN/src/msn_commands.cpp b/protocols/MSN/src/msn_commands.cpp index 190fb1e704..93ac87ce7c 100644 --- a/protocols/MSN/src/msn_commands.cpp +++ b/protocols/MSN/src/msn_commands.cpp @@ -1590,7 +1590,7 @@ void CMsnProto::MSN_ProcessRemove(char* buf, size_t len) MsnContact* msc = Lists_Get(szEmail);
if (msc == NULL || (msc->list & (LIST_RL | LIST_FL | LIST_LL)) == 0) {
if (msc->hContact && _stricmp(szEmail, MyOptions.szEmail)) {
- CallService(MS_DB_CONTACT_DELETE, (WPARAM)msc->hContact, 0);
+ db_delete_contact(msc->hContact);
msc->hContact = NULL;
}
}
diff --git a/protocols/MSN/src/msn_contact.cpp b/protocols/MSN/src/msn_contact.cpp index fd3dde5643..921415024d 100644 --- a/protocols/MSN/src/msn_contact.cpp +++ b/protocols/MSN/src/msn_contact.cpp @@ -36,7 +36,7 @@ MCONTACT CMsnProto::MSN_HContactFromEmail(const char* wlid, const char* msnNick, if (hContact == NULL && addIfNeeded) {
int netId = (msc && msc->netId)?msc->netId:(szNet?atoi(szNet):NETID_MSN);
- hContact = (MCONTACT)CallService(MS_DB_CONTACT_ADD, 0, 0);
+ hContact = db_add_contact();
Proto_AddToContact(hContact, m_szModuleName);
if (netId != NETID_SKYPE) setString(hContact, "e-mail", szEmail);
setStringUtf(hContact, "Nick", msnNick ? msnNick : szEmail);
diff --git a/protocols/MSN/src/msn_lists.cpp b/protocols/MSN/src/msn_lists.cpp index acd43695cb..fdbaeb732e 100644 --- a/protocols/MSN/src/msn_lists.cpp +++ b/protocols/MSN/src/msn_lists.cpp @@ -222,7 +222,7 @@ void CMsnProto::Lists_Populate(void) else
Lists_Add(0, netId, szEmail, hContact);
}
- else if (!isChatRoom(hContact)) CallService(MS_DB_CONTACT_DELETE, hContact, 0);
+ else if (!isChatRoom(hContact)) db_delete_contact(hContact);
hContact = hNext;
}
}
@@ -260,7 +260,7 @@ void CMsnProto::MSN_CleanupLists(void) }
if (!(p.list & (LIST_LL | LIST_FL))) {
- CallService(MS_DB_CONTACT_DELETE, (WPARAM)p.hContact, 0);
+ db_delete_contact(p.hContact);
p.hContact = NULL;
}
}
@@ -483,7 +483,7 @@ static void SaveSettings(MCONTACT hItem, HWND hwndList, CMsnProto* proto) if (xorMask & (LIST_FL | LIST_LL) && !(newMask & (LIST_FL | LIST_LL))) {
if (!IsHContactInfo(hItem)) {
- CallService(MS_DB_CONTACT_DELETE, (WPARAM)hItem, 0);
+ db_delete_contact(hItem);
MsnContact* msc = proto->Lists_Get(szEmail);
if (msc) msc->hContact = NULL;
}
diff --git a/protocols/MSN/src/msn_proto.cpp b/protocols/MSN/src/msn_proto.cpp index f66e293edd..745505288c 100644 --- a/protocols/MSN/src/msn_proto.cpp +++ b/protocols/MSN/src/msn_proto.cpp @@ -385,10 +385,10 @@ int CMsnProto::AuthDeny(MEVENT hDbEvent, const wchar_t*) MSN_AddUser(NULL, email, msc->netId, LIST_RL);
if (!(msc->list & (LIST_FL | LIST_LL))) {
- if (msc->hContact) CallService(MS_DB_CONTACT_DELETE, (WPARAM)msc->hContact, 0);
+ if (msc->hContact) db_delete_contact(msc->hContact);
msc->hContact = NULL;
MCONTACT hContact = MSN_HContactFromEmail(email);
- if (hContact) CallService(MS_DB_CONTACT_DELETE, hContact, 0);
+ if (hContact) db_delete_contact(hContact);
}
return 0;
@@ -1199,7 +1199,7 @@ int __cdecl CMsnProto::OnEvent(PROTOEVENTTYPE eventType, WPARAM wParam, LPARAM l case EV_PROTO_ONERASE:
char szDbsettings[64];
mir_snprintf(szDbsettings, "%s_HTTPS", m_szModuleName);
- DbModule_Delete(0, szDbsettings);
+ db_delete_module(0, szDbsettings);
break;
case EV_PROTO_ONCONTACTDELETED:
diff --git a/protocols/Sametime/src/sametime.cpp b/protocols/Sametime/src/sametime.cpp index 9217b49663..bcac4f2532 100644 --- a/protocols/Sametime/src/sametime.cpp +++ b/protocols/Sametime/src/sametime.cpp @@ -227,7 +227,7 @@ void CSametimeProto::SetAllOffline() for (MCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) {
if (db_get_b(hContact, m_szModuleName, "ChatRoom", 0)) {
- CallService(MS_DB_CONTACT_DELETE, (WPARAM)hContact, 0);
+ db_delete_contact(hContact);
continue;
}
diff --git a/protocols/Sametime/src/userlist.cpp b/protocols/Sametime/src/userlist.cpp index cb91800016..11c8591827 100644 --- a/protocols/Sametime/src/userlist.cpp +++ b/protocols/Sametime/src/userlist.cpp @@ -64,13 +64,13 @@ MCONTACT CSametimeProto::AddContact(mwSametimeUser* user, bool temporary) MCONTACT hContact = FindContactByUserId(id);
bool new_contact = false;
if (!hContact) {
- hContact = (MCONTACT)CallService(MS_DB_CONTACT_ADD, 0, 0);
+ hContact = db_add_contact();
if (!hContact) {
debugLogW(L"AddContact(): Failed to create Sametime contact");
return NULL; ///TODO error handling
}
if (Proto_AddToContact(hContact, m_szModuleName) != 0) {
- CallService(MS_DB_CONTACT_DELETE, (WPARAM)hContact, 0);
+ db_delete_contact(hContact);
debugLogW(L"AddContact(): Failed to register Sametime contact");
return NULL; ///TODO error handling
}
diff --git a/protocols/SkypeWeb/src/skype_chatrooms.cpp b/protocols/SkypeWeb/src/skype_chatrooms.cpp index 71c924d51c..3f1ce32b1d 100644 --- a/protocols/SkypeWeb/src/skype_chatrooms.cpp +++ b/protocols/SkypeWeb/src/skype_chatrooms.cpp @@ -293,7 +293,7 @@ INT_PTR CSkypeProto::OnLeaveChatRoom(WPARAM hContact, LPARAM) SendRequest(new KickUserRequest(_T2A(idT), li.szSkypename, li));
- CallService(MS_DB_CONTACT_DELETE, (WPARAM)hContact, 0);
+ db_delete_contact(hContact);
}
return 0;
}
diff --git a/protocols/SkypeWeb/src/skype_contacts.cpp b/protocols/SkypeWeb/src/skype_contacts.cpp index 38bc23ecc5..acabbd7b7a 100644 --- a/protocols/SkypeWeb/src/skype_contacts.cpp +++ b/protocols/SkypeWeb/src/skype_contacts.cpp @@ -89,7 +89,7 @@ MCONTACT CSkypeProto::AddContact(const char *skypename, bool isTemporary) if (!hContact)
{
- hContact = (MCONTACT)CallService(MS_DB_CONTACT_ADD, 0, 0);
+ hContact = db_add_contact();
Proto_AddToContact(hContact, m_szModuleName);
setString(hContact, SKYPE_SETTINGS_ID, skypename);
diff --git a/protocols/Steam/src/steam_contacts.cpp b/protocols/Steam/src/steam_contacts.cpp index a6a8c0668e..39bd619363 100644 --- a/protocols/Steam/src/steam_contacts.cpp +++ b/protocols/Steam/src/steam_contacts.cpp @@ -357,7 +357,7 @@ MCONTACT CSteamProto::AddContact(const char *steamId, bool isTemporary) if (!hContact) { // create contact - hContact = (MCONTACT)CallService(MS_DB_CONTACT_ADD, 0, 0); + hContact = db_add_contact(); Proto_AddToContact(hContact, this->m_szModuleName); setString(hContact, "SteamID", steamId); diff --git a/protocols/Tlen/src/tlen_iqid.cpp b/protocols/Tlen/src/tlen_iqid.cpp index 4e04784de1..dd749424be 100644 --- a/protocols/Tlen/src/tlen_iqid.cpp +++ b/protocols/Tlen/src/tlen_iqid.cpp @@ -217,7 +217,7 @@ void TlenIqResultRoster(TlenProtocol *proto, XmlNode *iqNode) if (szJid != NULL) {
if (!TlenListExist(proto, LIST_ROSTER, szJid)) {
proto->debugLogA("Syncing roster: deleting 0x%x", hContact);
- CallService(MS_DB_CONTACT_DELETE, hContact, 0);
+ db_delete_contact(hContact);
}
}
hContact = hNext;
diff --git a/protocols/Tlen/src/tlen_misc.cpp b/protocols/Tlen/src/tlen_misc.cpp index 732af24769..48f2bf617a 100644 --- a/protocols/Tlen/src/tlen_misc.cpp +++ b/protocols/Tlen/src/tlen_misc.cpp @@ -45,7 +45,7 @@ void TlenDBAddAuthRequest(TlenProtocol *proto, char *jid, char *nick) MCONTACT hContact;
if ((hContact=TlenHContactFromJID(proto, jid)) == NULL) {
- hContact = (MCONTACT) CallService(MS_DB_CONTACT_ADD, 0, 0);
+ hContact = db_add_contact();
Proto_AddToContact(hContact, proto->m_szModuleName);
// strip resource if present
s = TlenLoginFromJID(jid);
@@ -113,7 +113,7 @@ MCONTACT TlenDBCreateContact(TlenProtocol *proto, char *jid, char *nick, BOOL te return NULL;
if ((hContact=TlenHContactFromJID(proto, jid)) == NULL) {
- hContact = (MCONTACT) CallService(MS_DB_CONTACT_ADD, 0, 0);
+ hContact = db_add_contact();
Proto_AddToContact(hContact, proto->m_szModuleName);
db_set_s(hContact, proto->m_szModuleName, "jid", jid);
if (nick != NULL && nick[0] != '\0')
diff --git a/protocols/Tlen/src/tlen_svc.cpp b/protocols/Tlen/src/tlen_svc.cpp index dcc6395496..be6431cfc3 100644 --- a/protocols/Tlen/src/tlen_svc.cpp +++ b/protocols/Tlen/src/tlen_svc.cpp @@ -183,7 +183,7 @@ static MCONTACT AddToListByJID(TlenProtocol *proto, const char *newJid, DWORD fl if (hContact == NULL) {
// not already there: add
char *jid = mir_strdup(newJid); _strlwr(jid);
- hContact = (MCONTACT)CallService(MS_DB_CONTACT_ADD, 0, 0);
+ hContact = db_add_contact();
Proto_AddToContact(hContact, proto->m_szModuleName);
db_set_s(hContact, proto->m_szModuleName, "jid", jid);
char *nick = TlenNickFromJID(newJid);
diff --git a/protocols/Tox/src/tox_chatrooms.cpp b/protocols/Tox/src/tox_chatrooms.cpp index e44b337a18..82805ab96e 100644 --- a/protocols/Tox/src/tox_chatrooms.cpp +++ b/protocols/Tox/src/tox_chatrooms.cpp @@ -23,7 +23,7 @@ MCONTACT CToxProto::AddChatRoom(int groupNumber) MCONTACT hContact = GetChatRoom(groupNumber);
if (!hContact)
{
- hContact = (MCONTACT)CallService(MS_DB_CONTACT_ADD, 0, 0);
+ hContact = db_add_contact();
Proto_AddToContact(hContact, m_szModuleName);
setWord(hContact, TOX_SETTINGS_CHAT_ID, groupNumber);
diff --git a/protocols/Tox/src/tox_contacts.cpp b/protocols/Tox/src/tox_contacts.cpp index 63091d2408..fa6b05a7c2 100644 --- a/protocols/Tox/src/tox_contacts.cpp +++ b/protocols/Tox/src/tox_contacts.cpp @@ -85,7 +85,7 @@ MCONTACT CToxProto::AddContact(const char *address, const char *nick, const char if (hContact)
return hContact;
- hContact = (MCONTACT)CallService(MS_DB_CONTACT_ADD, 0, 0);
+ hContact = db_add_contact();
Proto_AddToContact(hContact, m_szModuleName);
setString(hContact, TOX_SETTINGS_ID, address);
diff --git a/protocols/Twitter/src/contacts.cpp b/protocols/Twitter/src/contacts.cpp index d5d56f9d85..2e28000c1f 100644 --- a/protocols/Twitter/src/contacts.cpp +++ b/protocols/Twitter/src/contacts.cpp @@ -240,7 +240,7 @@ MCONTACT TwitterProto::AddToClientList(const char *name, const char *status) AddChatContact(name);
// If not, make a new contact!
- hContact = (MCONTACT)CallService(MS_DB_CONTACT_ADD, 0, 0);
+ hContact = db_add_contact();
if (hContact) {
if (Proto_AddToContact(hContact, m_szModuleName) == 0) {
setString(hContact, TWITTER_KEY_UN, name);
@@ -258,7 +258,7 @@ MCONTACT TwitterProto::AddToClientList(const char *name, const char *status) return hContact;
}
- CallService(MS_DB_CONTACT_DELETE, hContact, 0);
+ db_delete_contact(hContact);
}
return 0;
diff --git a/protocols/Twitter/src/proto.cpp b/protocols/Twitter/src/proto.cpp index 763d269344..f44f1ce6b4 100644 --- a/protocols/Twitter/src/proto.cpp +++ b/protocols/Twitter/src/proto.cpp @@ -446,7 +446,7 @@ void TwitterProto::UpdateSettings() for (MCONTACT hContact = db_find_first(m_szModuleName); hContact;) {
MCONTACT hNext = db_find_next(hContact, m_szModuleName);
if (isChatRoom(hContact))
- CallService(MS_DB_CONTACT_DELETE, WPARAM(hContact), 0);
+ db_delete_contact(hContact);
hContact = hNext;
}
}
diff --git a/protocols/Twitter/src/ui.cpp b/protocols/Twitter/src/ui.cpp index f2bad47bed..f66d051a8c 100644 --- a/protocols/Twitter/src/ui.cpp +++ b/protocols/Twitter/src/ui.cpp @@ -318,8 +318,7 @@ namespace popup_options // Pick a random contact
MCONTACT hContact = 0;
- int n_contacts = (int)CallService(MS_DB_CONTACT_GETCOUNT, 0, 0);
-
+ int n_contacts = db_get_contact_count();
if (n_contacts != 0) {
int contact = rand() % n_contacts;
hContact = db_find_first();
diff --git a/protocols/VKontakte/src/misc.cpp b/protocols/VKontakte/src/misc.cpp index 4857b38430..3691ae82ff 100644 --- a/protocols/VKontakte/src/misc.cpp +++ b/protocols/VKontakte/src/misc.cpp @@ -190,7 +190,7 @@ MCONTACT CVkProto::FindUser(LONG dwUserid, bool bCreate) if (!bCreate)
return NULL;
- MCONTACT hNewContact = (MCONTACT)CallService(MS_DB_CONTACT_ADD);
+ MCONTACT hNewContact = db_add_contact();
Proto_AddToContact(hNewContact, m_szModuleName);
setDword(hNewContact, "ID", dwUserid);
db_set_ws(hNewContact, "CList", "Group", m_vkOptions.pwszDefaultGroup);
diff --git a/protocols/VKontakte/src/vk_chats.cpp b/protocols/VKontakte/src/vk_chats.cpp index f26d1ae631..fa0a1d8b09 100644 --- a/protocols/VKontakte/src/vk_chats.cpp +++ b/protocols/VKontakte/src/vk_chats.cpp @@ -676,7 +676,7 @@ void CVkProto::LeaveChat(int chat_id, bool close_window, bool delete_chat) gcd.iType = GC_EVENT_CONTROL;
CallServiceSync(MS_GC_EVENT, close_window? SESSION_TERMINATE:SESSION_OFFLINE, (LPARAM)&gce);
if (delete_chat)
- CallService(MS_DB_CONTACT_DELETE, (WPARAM)cc->m_hContact);
+ db_delete_contact(cc->m_hContact);
else
setByte(cc->m_hContact, "off", (int)true);
m_chats.remove(cc);
@@ -746,7 +746,7 @@ INT_PTR __cdecl CVkProto::SvcDestroyKickChat(WPARAM hContact, LPARAM) Push(new AsyncHttpRequest(this, REQUEST_GET, "/method/execute.json", true, &CVkProto::OnReceiveSmth)
<< CHAR_PARAM("code", code));
- CallService(MS_DB_CONTACT_DELETE, (WPARAM)hContact);
+ db_delete_contact(hContact);
return 0;
}
diff --git a/protocols/VKontakte/src/vk_feed.cpp b/protocols/VKontakte/src/vk_feed.cpp index 64c020b12a..85e4fe73a8 100644 --- a/protocols/VKontakte/src/vk_feed.cpp +++ b/protocols/VKontakte/src/vk_feed.cpp @@ -24,7 +24,7 @@ void CVkProto::AddFeedSpecialUser() MCONTACT hContact = FindUser(VK_FEED_USER);
if (!bSpecialContact) {
if (hContact)
- CallService(MS_DB_CONTACT_DELETE, (WPARAM)hContact);
+ db_delete_contact(hContact);
return;
}
diff --git a/protocols/VKontakte/src/vk_thread.cpp b/protocols/VKontakte/src/vk_thread.cpp index 5b47e4de2c..b546761193 100644 --- a/protocols/VKontakte/src/vk_thread.cpp +++ b/protocols/VKontakte/src/vk_thread.cpp @@ -756,7 +756,7 @@ void CVkProto::OnReceiveFriends(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq bool bIsFriendGroup = IsGroupUser(hContact) && getBool(hContact, "friend");
if (userID == m_myUserId || userID == VK_FEED_USER || bIsFriendGroup)
continue;
- CallService(MS_DB_CONTACT_DELETE, (WPARAM)hContact);
+ db_delete_contact(hContact);
}
arContacts.destroy();
@@ -898,7 +898,7 @@ INT_PTR __cdecl CVkProto::SvcBanUser(WPARAM hContact, LPARAM) << CHAR_PARAM("code", code));
if (m_vkOptions.bRemoveFromCList)
- CallService(MS_DB_CONTACT_DELETE, (WPARAM)hContact);
+ db_delete_contact(hContact);
return 0;
}
diff --git a/protocols/WhatsApp/src/chat.cpp b/protocols/WhatsApp/src/chat.cpp index eded520031..bc2d6c9fb0 100644 --- a/protocols/WhatsApp/src/chat.cpp +++ b/protocols/WhatsApp/src/chat.cpp @@ -489,7 +489,7 @@ void WhatsAppProto::onLeaveGroup(const std::string &gjid) gce.ptszUID = pInfo->tszJid;
CallServiceSync(MS_GC_EVENT, SESSION_TERMINATE, (LPARAM)&gce);
- CallService(MS_DB_CONTACT_DELETE, pInfo->hContact, 0);
+ db_delete_contact(pInfo->hContact);
m_chats.erase((char*)_T2A(pInfo->tszJid));
}
diff --git a/protocols/WhatsApp/src/contacts.cpp b/protocols/WhatsApp/src/contacts.cpp index e4f0d50330..f35fc5c565 100644 --- a/protocols/WhatsApp/src/contacts.cpp +++ b/protocols/WhatsApp/src/contacts.cpp @@ -33,7 +33,7 @@ MCONTACT WhatsAppProto::AddToContactList(const std::string &jid, const char *new }
// If not, make a new contact!
- if ((hContact = CallService(MS_DB_CONTACT_ADD, 0, 0)) == 0)
+ if ((hContact = db_add_contact()) == 0)
return INVALID_CONTACT_ID;
Proto_AddToContact(hContact, m_szModuleName);
diff --git a/protocols/Yahoo/src/proto.cpp b/protocols/Yahoo/src/proto.cpp index ed7e110a8d..353baf3c16 100644 --- a/protocols/Yahoo/src/proto.cpp +++ b/protocols/Yahoo/src/proto.cpp @@ -255,7 +255,7 @@ int CYahooProto::AuthDeny(MEVENT hdbe, const wchar_t *reason) debugLogA("Rejecting buddy:%s msg: %s", who, u_reason);
reject(myid, who, getWord(hContact, "yprotoid", 0), u_reason);
- CallService(MS_DB_CONTACT_DELETE, hContact);
+ db_delete_contact(hContact);
}
}
return 0;
diff --git a/protocols/Yahoo/src/yahoo.cpp b/protocols/Yahoo/src/yahoo.cpp index 499528b520..5baf2caf4c 100644 --- a/protocols/Yahoo/src/yahoo.cpp +++ b/protocols/Yahoo/src/yahoo.cpp @@ -263,7 +263,7 @@ MCONTACT CYahooProto::add_buddy(const char *yahoo_id, const char *yahoo_name, in //not already there: add
LOG(("[add_buddy] Adding buddy id: %s (Nick: %s), flags: %lu", yid, yahoo_name, flags));
- hContact = (MCONTACT)CallService(MS_DB_CONTACT_ADD);
+ hContact = db_add_contact();
Proto_AddToContact(hContact, m_szModuleName);
setString(hContact, YAHOO_LOGINID, yid);
Set_Protocol(hContact, protocol);
@@ -668,7 +668,7 @@ void CYahooProto::ext_rejected(const char *who, const char *msg) * Make sure the contact is temporary so we could delete it w/o extra traffic
*/
db_set_b(hContact, "CList", "NotOnList", 1);
- CallService(MS_DB_CONTACT_DELETE, hContact);
+ db_delete_contact(hContact);
}
else LOG(("[ext_rejected] Buddy not on our buddy list"));
@@ -700,7 +700,7 @@ void CYahooProto::ext_buddy_added(char *myid, char *who, char *group, int status ShowPopup(TranslateT("Invalid Contact"), TranslateT("The ID you tried to add is invalid."), NULL);
/* Make it TEMP first, we don't want to send any extra packets for FALSE ids */
db_set_b(hContact, "CList", "NotOnList", 1);
- CallService(MS_DB_CONTACT_DELETE, hContact);
+ db_delete_contact(hContact);
}
break;
@@ -710,7 +710,7 @@ void CYahooProto::ext_buddy_added(char *myid, char *who, char *group, int status ShowPopup(TranslateT("Invalid Contact"), TranslateT("Unknown Error."), NULL);
/* Make it TEMP first, we don't want to send any extra packets for FALSE ids */
db_set_b(hContact, "CList", "NotOnList", 1);
- CallService(MS_DB_CONTACT_DELETE, hContact);
+ db_delete_contact(hContact);
}
break;
|