summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2012-10-10 07:46:53 +0000
committerGeorge Hazan <george.hazan@gmail.com>2012-10-10 07:46:53 +0000
commitf90be5cdeec5875d1022e1ef35f5b101bd76ac84 (patch)
tree59e5e8bf3b6a87dbee148bd63f841a8a62daac5f /protocols
parented10055737300c07e485eb22b27ccf92ffadab7c (diff)
service call replaced with the direct function call
git-svn-id: http://svn.miranda-ng.org/main/trunk@1857 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols')
-rw-r--r--protocols/AimOscar/theme.cpp16
-rw-r--r--protocols/AimOscar/utility.cpp24
-rw-r--r--protocols/FacebookRM/contacts.cpp12
-rw-r--r--protocols/FacebookRM/process.cpp4
-rw-r--r--protocols/GTalkExt/db.cpp4
-rw-r--r--protocols/Gadu-Gadu/core.cpp16
-rw-r--r--protocols/Gadu-Gadu/gg.cpp8
-rw-r--r--protocols/Gadu-Gadu/groupchat.cpp16
-rw-r--r--protocols/Gadu-Gadu/import.cpp4
-rw-r--r--protocols/IRCG/clist.cpp8
-rw-r--r--protocols/IRCG/commandmonitor.cpp4
-rw-r--r--protocols/IcqOscarJ/icq_db.cpp9
-rw-r--r--protocols/IcqOscarJ/icq_uploadui.cpp8
-rw-r--r--protocols/JabberG/jabber_chat.cpp8
-rw-r--r--protocols/JabberG/jabber_icolib.cpp4
-rw-r--r--protocols/JabberG/jabber_iqid.cpp4
-rw-r--r--protocols/JabberG/jabber_misc.cpp8
-rw-r--r--protocols/JabberG/jabber_opt.cpp4
-rw-r--r--protocols/JabberG/jabber_privacy.cpp16
-rw-r--r--protocols/JabberG/jabber_proto.cpp8
-rw-r--r--protocols/JabberG/jabber_rc.cpp8
-rw-r--r--protocols/JabberG/jabber_thread.cpp4
-rw-r--r--protocols/JabberG/jabber_util.cpp8
-rw-r--r--protocols/MRA/MraProto.cpp4
-rw-r--r--protocols/MRA/Mra_functions.cpp4
-rw-r--r--protocols/MRA/Mra_proto.cpp4
-rw-r--r--protocols/MRA/Mra_svcs.cpp12
-rw-r--r--protocols/MSN/msn_lists.cpp4
-rw-r--r--protocols/MSN/msn_proto.cpp4
-rw-r--r--protocols/NewsAggregator/Src/Options.cpp12
-rw-r--r--protocols/NewsAggregator/Src/Services.cpp12
-rw-r--r--protocols/NewsAggregator/Src/Update.cpp4
-rw-r--r--protocols/NewsAggregator/Src/Utils.cpp4
-rw-r--r--protocols/Quotes/ImportExport.cpp2
-rw-r--r--protocols/Quotes/QuotesProviders.cpp2
-rw-r--r--protocols/Twitter/chat.cpp4
-rw-r--r--protocols/Twitter/contacts.cpp8
-rw-r--r--protocols/Twitter/proto.cpp4
-rw-r--r--protocols/Twitter/ui.cpp4
-rw-r--r--protocols/Weather/weather_addstn.cpp4
-rw-r--r--protocols/Weather/weather_contacts.cpp4
-rw-r--r--protocols/Weather/weather_data.cpp4
-rw-r--r--protocols/Weather/weather_mwin.cpp8
-rw-r--r--protocols/Weather/weather_update.cpp4
-rw-r--r--protocols/YAMN/proto/pop3/pop3comm.cpp4
-rw-r--r--protocols/Yahoo/services.cpp4
-rw-r--r--protocols/Yahoo/yahoo.cpp8
47 files changed, 165 insertions, 168 deletions
diff --git a/protocols/AimOscar/theme.cpp b/protocols/AimOscar/theme.cpp
index 9217c68d1c..085c7335d7 100644
--- a/protocols/AimOscar/theme.cpp
+++ b/protocols/AimOscar/theme.cpp
@@ -283,13 +283,13 @@ void remove_AT_icons(CAimProto* ppro)
{
if (!ServiceExists(MS_CLIST_EXTRA_ADD_ICON)) return;
- HANDLE hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ HANDLE hContact = db_find_first();
while (hContact)
{
if (ppro->is_my_contact(hContact) && !ppro->getByte(hContact, "ChatRoom", 0))
clear_AT_icon(hContact);
- hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0);
+ hContact = db_find_next(hContact);
}
}
@@ -297,36 +297,36 @@ void remove_ES_icons(CAimProto* ppro)
{
if (!ServiceExists(MS_CLIST_EXTRA_ADD_ICON)) return;
- HANDLE hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ HANDLE hContact = db_find_first();
while (hContact)
{
if (ppro->is_my_contact(hContact) && !ppro->getByte(hContact, "ChatRoom", 0))
clear_ES_icon(hContact);
- hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0);
+ hContact = db_find_next(hContact);
}
}
void add_AT_icons(CAimProto* ppro)
{
- HANDLE hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ HANDLE hContact = db_find_first();
while (hContact)
{
if (ppro->is_my_contact(hContact))
set_AT_icon(ppro, hContact);
- hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0);
+ hContact = db_find_next(hContact);
}
}
void add_ES_icons(CAimProto* ppro)
{
- HANDLE hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ HANDLE hContact = db_find_first();
while (hContact)
{
if (ppro->is_my_contact(hContact))
set_ES_icon(ppro, hContact);
- hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0);
+ hContact = db_find_next(hContact);
}
}
diff --git a/protocols/AimOscar/utility.cpp b/protocols/AimOscar/utility.cpp
index b1a2709d74..4c487cf818 100644
--- a/protocols/AimOscar/utility.cpp
+++ b/protocols/AimOscar/utility.cpp
@@ -169,7 +169,7 @@ bool CAimProto::is_my_contact(HANDLE hContact)
HANDLE CAimProto::find_chat_contact(const char* room)
{
- HANDLE hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ HANDLE hContact = db_find_first();
while (hContact)
{
if (is_my_contact(hContact))
@@ -182,7 +182,7 @@ HANDLE CAimProto::find_chat_contact(const char* room)
if (found) return hContact;
}
}
- hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0);
+ hContact = db_find_next(hContact);
}
return NULL;
}
@@ -191,7 +191,7 @@ HANDLE CAimProto::contact_from_sn(const char* sn, bool addIfNeeded, bool tempora
{
char* norm_sn = normalize_name(sn);
- HANDLE hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ HANDLE hContact = db_find_first();
while (hContact)
{
if (is_my_contact(hContact))
@@ -208,7 +208,7 @@ HANDLE CAimProto::contact_from_sn(const char* sn, bool addIfNeeded, bool tempora
}
}
}
- hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0);
+ hContact = db_find_next(hContact);
}
if (addIfNeeded)
@@ -341,12 +341,12 @@ void CAimProto::offline_contact(HANDLE hContact, bool remove_settings)
void CAimProto::offline_contacts(void)
{
- HANDLE hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ HANDLE hContact = db_find_first();
while (hContact)
{
if (is_my_contact(hContact))
offline_contact(hContact,true);
- hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0);
+ hContact = db_find_next(hContact);
}
allow_list.destroy();
block_list.destroy();
@@ -410,7 +410,7 @@ unsigned short CAimProto::search_for_free_item_id(HANDLE hbuddy)//returns a free
retry:
id = get_random();
- HANDLE hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ HANDLE hContact = db_find_first();
while (hContact)
{
if (is_my_contact(hContact))
@@ -423,7 +423,7 @@ retry:
if (item_id == id) goto retry; //found one no need to look through anymore
}
}
- hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0);
+ hContact = db_find_next(hContact);
}
setBuddyId(hbuddy, 1, id);
@@ -436,7 +436,7 @@ unsigned short* CAimProto::get_members_of_group(unsigned short group_id, unsigne
unsigned short* list = NULL;
size = 0;
- HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ HANDLE hContact = db_find_first();
while (hContact)
{
if (is_my_contact(hContact))
@@ -457,14 +457,14 @@ unsigned short* CAimProto::get_members_of_group(unsigned short group_id, unsigne
}
}
}
- hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0);
+ hContact = db_find_next(hContact);
}
return list;
}
void CAimProto::upload_nicks(void)
{
- HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ HANDLE hContact = db_find_first();
while (hContact)
{
DBVARIANT dbv;
@@ -473,7 +473,7 @@ void CAimProto::upload_nicks(void)
set_local_nick(hContact, dbv.pszVal, NULL);
DBFreeVariant(&dbv);
}
- hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0);
+ hContact = db_find_next(hContact);
}
}
diff --git a/protocols/FacebookRM/contacts.cpp b/protocols/FacebookRM/contacts.cpp
index ab953e809d..9e6c6abfa0 100644
--- a/protocols/FacebookRM/contacts.cpp
+++ b/protocols/FacebookRM/contacts.cpp
@@ -40,9 +40,9 @@ bool FacebookProto::IsMyContact(HANDLE hContact, bool include_chat)
HANDLE FacebookProto::ChatIDToHContact(std::string chat_id)
{
- for(HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST,0,0);
+ for(HANDLE hContact = db_find_first();
hContact;
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hContact,0))
+ hContact = db_find_next(hContact))
{
if(!IsMyContact(hContact, true))
continue;
@@ -65,9 +65,9 @@ HANDLE FacebookProto::ChatIDToHContact(std::string chat_id)
HANDLE FacebookProto::ContactIDToHContact(std::string user_id)
{
- for(HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST,0,0);
+ for(HANDLE hContact = db_find_first();
hContact;
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hContact,0))
+ hContact = db_find_next(hContact))
{
if(!IsMyContact(hContact))
continue;
@@ -143,9 +143,9 @@ HANDLE FacebookProto::AddToContactList(facebook_user* fbu, BYTE type, bool dont_
void FacebookProto::SetAllContactStatuses(int status)
{
- for (HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST,0,0);
+ for (HANDLE hContact = db_find_first();
hContact;
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hContact,0))
+ hContact = db_find_next(hContact))
{
if (!IsMyContact(hContact))
continue;
diff --git a/protocols/FacebookRM/process.cpp b/protocols/FacebookRM/process.cpp
index 1691fcda08..0acff0f36f 100644
--- a/protocols/FacebookRM/process.cpp
+++ b/protocols/FacebookRM/process.cpp
@@ -129,9 +129,9 @@ void FacebookProto::ProcessFriendList( void* data )
// Check and update old contacts
- for(HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST,0,0);
+ for(HANDLE hContact = db_find_first();
hContact;
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hContact,0))
+ hContact = db_find_next(hContact))
{
if (!IsMyContact(hContact))
continue;
diff --git a/protocols/GTalkExt/db.cpp b/protocols/GTalkExt/db.cpp
index 1e9c3deb23..a1658dbdcf 100644
--- a/protocols/GTalkExt/db.cpp
+++ b/protocols/GTalkExt/db.cpp
@@ -89,12 +89,12 @@ void RenewPseudocontactHandles()
DBDeleteContactSetting(0, protos[i]->szModuleName, "GMailExtNotifyContact"); // remove this
}
- HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ HANDLE hContact = db_find_first();
while (hContact) {
if (DBGetContactSettingByte(hContact, SHORT_PLUGIN_NAME, PSEUDOCONTACT_FLAG, 0)) {
LPCSTR proto = (LPCSTR)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0);
DBWriteContactSettingDword(0, proto, PSEUDOCONTACT_LINK, (DWORD)hContact);
}
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0);
+ hContact = db_find_next(hContact);
};
} \ No newline at end of file
diff --git a/protocols/Gadu-Gadu/core.cpp b/protocols/Gadu-Gadu/core.cpp
index 48662e00df..63d5d37b24 100644
--- a/protocols/Gadu-Gadu/core.cpp
+++ b/protocols/Gadu-Gadu/core.cpp
@@ -1354,7 +1354,7 @@ void GGPROTO::setalloffline()
{
netlog("gg_setalloffline(): Setting buddies offline");
db_set_w(NULL, m_szModuleName, GG_KEY_STATUS, ID_STATUS_OFFLINE);
- HANDLE hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ HANDLE hContact = db_find_first();
while (hContact)
{
char *szProto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hContact, 0);
@@ -1367,7 +1367,7 @@ void GGPROTO::setalloffline()
// Delete status descr
db_unset(hContact, "CList", GG_KEY_STATUSDESCR);
}
- hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0);
+ hContact = db_find_next(hContact);
}
#ifdef DEBUGMODE
netlog("gg_setalloffline(): End");
@@ -1424,12 +1424,12 @@ void GGPROTO::notifyall()
netlog("gg_notifyall(): Subscribing notification to all users");
// Readup count
- hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ hContact = db_find_first();
while (hContact)
{
szProto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hContact, 0);
if (szProto != NULL && !strcmp(szProto, m_szModuleName)) count ++;
- hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0);
+ hContact = db_find_next(hContact);
}
// Readup list
@@ -1447,7 +1447,7 @@ void GGPROTO::notifyall()
uins = (uin_t*)calloc(sizeof(uin_t), count);
types = (char*)calloc(sizeof(char), count);
- hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ hContact = db_find_first();
while (hContact && cc < count)
{
szProto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hContact, 0);
@@ -1462,7 +1462,7 @@ void GGPROTO::notifyall()
types[cc] = GG_USER_NORMAL;
cc ++;
}
- hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0);
+ hContact = db_find_next(hContact);
}
if (cc < count) count = cc;
@@ -1484,7 +1484,7 @@ void GGPROTO::notifyall()
HANDLE GGPROTO::getcontact(uin_t uin, int create, int inlist, TCHAR *szNick)
{
// Look for contact in DB
- HANDLE hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ HANDLE hContact = db_find_first();
while (hContact) {
char *szProto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hContact, 0);
if (szProto != NULL && !strcmp(szProto, m_szModuleName)) {
@@ -1498,7 +1498,7 @@ HANDLE GGPROTO::getcontact(uin_t uin, int create, int inlist, TCHAR *szNick)
return hContact;
}
}
- hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0);
+ hContact = db_find_next(hContact);
}
if (!create) return NULL;
diff --git a/protocols/Gadu-Gadu/gg.cpp b/protocols/Gadu-Gadu/gg.cpp
index 3ac4c54871..5bd9f6ceb5 100644
--- a/protocols/Gadu-Gadu/gg.cpp
+++ b/protocols/Gadu-Gadu/gg.cpp
@@ -157,7 +157,7 @@ void GGPROTO::cleanuplastplugin(DWORD version)
netlog("gg_cleanuplastplugin(%d): Cleaning junk Phone settings from < 0.0.1.4 ...", version);
#endif
// Look for contact in DB
- hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ hContact = db_find_first();
while (hContact)
{
szProto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hContact, 0);
@@ -167,7 +167,7 @@ void GGPROTO::cleanuplastplugin(DWORD version)
db_unset(hContact, m_szModuleName, GG_KEY_EMAIL);
db_unset(hContact, m_szModuleName, "Phone");
}
- hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0);
+ hContact = db_find_next(hContact);
}
}
@@ -178,7 +178,7 @@ void GGPROTO::cleanuplastplugin(DWORD version)
netlog("gg_cleanuplastplugin(%d): Cleaning junk Nick settings from < 0.0.3.5 ...", version);
#endif
// Look for contact in DB
- hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ hContact = db_find_first();
while (hContact)
{
szProto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hContact, 0);
@@ -187,7 +187,7 @@ void GGPROTO::cleanuplastplugin(DWORD version)
// Do nick entry cleanup
db_unset(hContact, m_szModuleName, GG_KEY_NICK);
}
- hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0);
+ hContact = db_find_next(hContact);
}
}
diff --git a/protocols/Gadu-Gadu/groupchat.cpp b/protocols/Gadu-Gadu/groupchat.cpp
index df45da9ea4..4089c8fac3 100644
--- a/protocols/Gadu-Gadu/groupchat.cpp
+++ b/protocols/Gadu-Gadu/groupchat.cpp
@@ -145,7 +145,7 @@ int GGPROTO::gc_event(WPARAM wParam, LPARAM lParam)
free(chat->recipients);
list_remove(&chats, chat, 1);
// Remove contact from contact list (duh!) should be done by chat.dll !!
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ hContact = db_find_first();
while (hContact)
{
DBVARIANT dbv;
@@ -155,7 +155,7 @@ int GGPROTO::gc_event(WPARAM wParam, LPARAM lParam)
CallService(MS_DB_CONTACT_DELETE, (WPARAM)hContact, 0);
DBFreeVariant(&dbv);
}
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0);
+ hContact = db_find_next(hContact);
}
return 1;
}
@@ -422,13 +422,13 @@ static void gg_gc_resetclistopts(HWND hwndList)
static int gg_gc_countcheckmarks(HWND hwndList)
{
int count = 0;
- HANDLE hItem, hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ HANDLE hItem, hContact = db_find_first();
while (hContact)
{
hItem = (HANDLE)SendMessage(hwndList, CLM_FINDCONTACT, (WPARAM)hContact, 0);
if (hItem && SendMessage(hwndList, CLM_GETCHECKMARK, (WPARAM)hItem, 0))
count++;
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0);
+ hContact = db_find_next(hContact);
}
return count;
}
@@ -476,7 +476,7 @@ static INT_PTR CALLBACK gg_gc_openconfdlg(HWND hwndDlg, UINT message, WPARAM wPa
// Create new participiants table
char* chat;
uin_t* participants = (uin_t*)calloc(count, sizeof(uin_t));
- HANDLE hItem, hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ HANDLE hItem, hContact = db_find_first();
gg->netlog("gg_gc_getchat(): Opening new conference for %d contacts.", count);
while (hContact && i < count)
{
@@ -486,7 +486,7 @@ static INT_PTR CALLBACK gg_gc_openconfdlg(HWND hwndDlg, UINT message, WPARAM wPa
HANDLE hMetaContact = gg_getsubcontact(gg, hContact); // MetaContacts support
participants[i++] = db_get_dw(hMetaContact ? hMetaContact : hContact, gg->m_szModuleName, GG_KEY_UIN, 0);
}
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0);
+ hContact = db_find_next(hContact);
}
if (count > i) i = count;
chat = gg->gc_getchat(0, participants, count);
@@ -532,7 +532,7 @@ static INT_PTR CALLBACK gg_gc_openconfdlg(HWND hwndDlg, UINT message, WPARAM wPa
if (!gg) break;
// Delete non-gg contacts
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ hContact = db_find_first();
while (hContact)
{
hItem = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_FINDCONTACT, (WPARAM)hContact, 0);
@@ -553,7 +553,7 @@ static INT_PTR CALLBACK gg_gc_openconfdlg(HWND hwndDlg, UINT message, WPARAM wPa
if (szProto == NULL || lstrcmpA(szProto, gg->m_szModuleName) || !uin || uin == db_get_dw(NULL, gg->m_szModuleName, GG_KEY_UIN, 0))
SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_DELETEITEM, (WPARAM)hItem, 0);
}
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0);
+ hContact = db_find_next(hContact);
}
}
break;
diff --git a/protocols/Gadu-Gadu/import.cpp b/protocols/Gadu-Gadu/import.cpp
index 8c81e1140f..e4ff066d11 100644
--- a/protocols/Gadu-Gadu/import.cpp
+++ b/protocols/Gadu-Gadu/import.cpp
@@ -101,7 +101,7 @@ char *gg_makecontacts(GGPROTO *gg, int cr)
char *contacts;
// Readup contacts
- HANDLE hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ HANDLE hContact = db_find_first();
while (hContact)
{
char *szProto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hContact, 0);
@@ -175,7 +175,7 @@ char *gg_makecontacts(GGPROTO *gg, int cr)
else
string_append(s, ";0;;0;\n");
}
- hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0);
+ hContact = db_find_next(hContact);
}
contacts = string_free(s, 0);
diff --git a/protocols/IRCG/clist.cpp b/protocols/IRCG/clist.cpp
index 31c81db884..94bb460db9 100644
--- a/protocols/IRCG/clist.cpp
+++ b/protocols/IRCG/clist.cpp
@@ -144,7 +144,7 @@ bool CIrcProto::CList_SetAllOffline(BYTE ChatsToo)
DisconnectAllDCCSessions(false);
- HANDLE hContact = (HANDLE) CallService( MS_DB_CONTACT_FINDFIRST, 0, 0 );
+ HANDLE hContact = db_find_first();
while ( hContact ) {
char* szProto = ( char* ) CallService( MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hContact, 0 );
if ( szProto != NULL && !lstrcmpiA( szProto, m_szModuleName )) {
@@ -163,7 +163,7 @@ bool CIrcProto::CList_SetAllOffline(BYTE ChatsToo)
setString( hContact, "Host", "" );
} }
- hContact = (HANDLE) CallService( MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0);
+ hContact = db_find_next(hContact);
}
return true;
}
@@ -182,7 +182,7 @@ HANDLE CIrcProto::CList_FindContact (CONTACT* user)
DBVARIANT dbv3;
DBVARIANT dbv4;
DBVARIANT dbv5;
- 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);
if ( szProto != NULL && !lstrcmpiA( szProto, m_szModuleName )) {
@@ -240,7 +240,7 @@ HANDLE CIrcProto::CList_FindContact (CONTACT* user)
return 0;
} } }
- hContact = (HANDLE) CallService( MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0);
+ hContact = db_find_next(hContact);
}
mir_free(lowercasename);
return 0;
diff --git a/protocols/IRCG/commandmonitor.cpp b/protocols/IRCG/commandmonitor.cpp
index 842db74ea1..79d4579ae6 100644
--- a/protocols/IRCG/commandmonitor.cpp
+++ b/protocols/IRCG/commandmonitor.cpp
@@ -141,7 +141,7 @@ VOID CALLBACK OnlineNotifTimerProc( HWND, UINT, UINT_PTR idEvent, DWORD )
DBVARIANT dbv;
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);
if ( szProto != NULL && !lstrcmpiA( szProto, ppro->m_szModuleName )) {
@@ -179,7 +179,7 @@ VOID CALLBACK OnlineNotifTimerProc( HWND, UINT, UINT_PTR idEvent, DWORD )
if ( DBWildcard ) DBFreeVariant(&dbv2);
} } } } }
- hContact = (HANDLE) CallService( MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0);
+ hContact = db_find_next(hContact);
} }
if ( ppro->m_namesToWho.IsEmpty() && ppro->m_namesToUserhost.IsEmpty()) {
diff --git a/protocols/IcqOscarJ/icq_db.cpp b/protocols/IcqOscarJ/icq_db.cpp
index b142c30cac..f199860df8 100644
--- a/protocols/IcqOscarJ/icq_db.cpp
+++ b/protocols/IcqOscarJ/icq_db.cpp
@@ -364,7 +364,7 @@ HANDLE CIcqProto::AddEvent(HANDLE hContact, WORD wType, DWORD dwTime, DWORD flag
HANDLE CIcqProto::FindFirstContact()
{
- HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, (LPARAM)m_szModuleName);
+ HANDLE hContact = db_find_first(m_szModuleName);
if (IsICQContact(hContact))
return hContact;
@@ -375,15 +375,12 @@ HANDLE CIcqProto::FindFirstContact()
HANDLE CIcqProto::FindNextContact(HANDLE hContact)
{
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hContact,(LPARAM)m_szModuleName);
-
+ hContact = db_find_next(hContact, m_szModuleName);
while (hContact != NULL)
{
if (IsICQContact(hContact))
- {
return hContact;
- }
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hContact,(LPARAM)m_szModuleName);
+ hContact = db_find_next(hContact, m_szModuleName);
}
return hContact;
}
diff --git a/protocols/IcqOscarJ/icq_uploadui.cpp b/protocols/IcqOscarJ/icq_uploadui.cpp
index 217389b463..f5e5c937b3 100644
--- a/protocols/IcqOscarJ/icq_uploadui.cpp
+++ b/protocols/IcqOscarJ/icq_uploadui.cpp
@@ -115,7 +115,7 @@ static void DeleteOtherContactsFromControl(HWND hCtrl, CIcqProto* ppro)
HANDLE hContact;
HANDLE hItem;
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ hContact = db_find_first();
while (hContact)
{
hItem = (HANDLE)SendMessage(hCtrl, CLM_FINDCONTACT, (WPARAM)hContact, 0);
@@ -124,7 +124,7 @@ static void DeleteOtherContactsFromControl(HWND hCtrl, CIcqProto* ppro)
if (!ppro->IsICQContact(hContact))
SendMessage(hCtrl, CLM_DELETEITEM, (WPARAM)hItem, 0);
}
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0);
+ hContact = db_find_next(hContact);
}
}
@@ -709,7 +709,7 @@ static INT_PTR CALLBACK DlgProcUploadList(HWND hwndDlg,UINT message,WPARAM wPara
SAFE_FREE((void**)&pszGroup);
}
}
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0);
+ hContact = db_find_next(hContact);
}
if (!hContact)
{
@@ -785,7 +785,7 @@ static INT_PTR CALLBACK DlgProcUploadList(HWND hwndDlg,UINT message,WPARAM wPara
break;
}
}
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0);
+ hContact = db_find_next(hContact);
}
if (!hContact)
{
diff --git a/protocols/JabberG/jabber_chat.cpp b/protocols/JabberG/jabber_chat.cpp
index 7a36012092..8dacc24619 100644
--- a/protocols/JabberG/jabber_chat.cpp
+++ b/protocols/JabberG/jabber_chat.cpp
@@ -707,9 +707,9 @@ class CGroupchatInviteDlg : public CJabberDlgBase
void FilterList(CCtrlClc *)
{
- for (HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ for (HANDLE hContact = db_find_first();
hContact;
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0))
+ hContact = db_find_next(hContact))
{
char *proto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0);
if (lstrcmpA(proto, m_proto->m_szModuleName) || DBGetContactSettingByte(hContact, proto, "ChatRoom", 0))
@@ -825,9 +825,9 @@ public:
HWND hwndList = GetDlgItem(m_hwnd, IDC_CLIST);
// invite users from roster
- for (HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ for (HANDLE hContact = db_find_first();
hContact;
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0))
+ hContact = db_find_next(hContact))
{
char *proto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0);
if (!lstrcmpA(proto, m_proto->m_szModuleName) && !DBGetContactSettingByte(hContact, proto, "ChatRoom", 0))
diff --git a/protocols/JabberG/jabber_icolib.cpp b/protocols/JabberG/jabber_icolib.cpp
index 8313246718..f29a827313 100644
--- a/protocols/JabberG/jabber_icolib.cpp
+++ b/protocols/JabberG/jabber_icolib.cpp
@@ -585,7 +585,7 @@ BOOL CJabberProto::DBCheckIsTransportedContact(const TCHAR* jid, HANDLE hContact
void CJabberProto::CheckAllContactsAreTransported()
{
- HANDLE hContact = ( HANDLE ) CallService( MS_DB_CONTACT_FINDFIRST, 0, 0 );
+ HANDLE hContact = ( HANDLE ) db_find_first();
while ( hContact != NULL ) {
char* szProto = ( char* )CallService( MS_PROTO_GETCONTACTBASEPROTO, ( WPARAM ) hContact, 0 );
if ( !lstrcmpA( m_szModuleName, szProto )) {
@@ -595,7 +595,7 @@ void CJabberProto::CheckAllContactsAreTransported()
JFreeVariant( &dbv );
} }
- hContact = ( HANDLE )CallService( MS_DB_CONTACT_FINDNEXT, ( WPARAM )hContact, 0 );
+ hContact = db_find_next(hContact);
} }
/////////////////////////////////////////////////////////////////////////////////////////
diff --git a/protocols/JabberG/jabber_iqid.cpp b/protocols/JabberG/jabber_iqid.cpp
index acac62cfdb..7679450d59 100644
--- a/protocols/JabberG/jabber_iqid.cpp
+++ b/protocols/JabberG/jabber_iqid.cpp
@@ -526,7 +526,7 @@ void CJabberProto::OnIqResultGetRoster( HXML iqNode, CJabberIqInfo* pInfo )
if ( m_options.RosterSync == TRUE ) {
int listSize = 0, listAllocSize = 0;
HANDLE* list = NULL;
- HANDLE hContact = ( HANDLE ) CallService( MS_DB_CONTACT_FINDFIRST, 0, 0 );
+ HANDLE hContact = ( HANDLE ) db_find_first();
while ( hContact != NULL ) {
char* str = ( char* )CallService( MS_PROTO_GETCONTACTBASEPROTO, ( WPARAM ) hContact, 0 );
if ( str != NULL && !strcmp( str, m_szModuleName )) {
@@ -546,7 +546,7 @@ void CJabberProto::OnIqResultGetRoster( HXML iqNode, CJabberIqInfo* pInfo )
JFreeVariant( &dbv );
} }
- hContact = ( HANDLE ) CallService( MS_DB_CONTACT_FINDNEXT, ( WPARAM ) hContact, 0 );
+ hContact = db_find_next(hContact);
}
for ( i=0; i < listSize; i++ ) {
diff --git a/protocols/JabberG/jabber_misc.cpp b/protocols/JabberG/jabber_misc.cpp
index 2fb483f905..e13c0d450d 100644
--- a/protocols/JabberG/jabber_misc.cpp
+++ b/protocols/JabberG/jabber_misc.cpp
@@ -175,7 +175,7 @@ HANDLE CJabberProto::DBCreateContact( const TCHAR* jid, const TCHAR* nick, BOOL
len = _tcslen( s );
// We can't use JabberHContactFromJID() here because of the stripResource option
- HANDLE hContact = ( HANDLE ) CallService( MS_DB_CONTACT_FINDFIRST, 0, 0 );
+ HANDLE hContact = ( HANDLE ) db_find_first();
while ( hContact != NULL ) {
szProto = ( char* )CallService( MS_PROTO_GETCONTACTBASEPROTO, ( WPARAM ) hContact, 0 );
if ( szProto!=NULL && !strcmp( m_szModuleName, szProto )) {
@@ -188,7 +188,7 @@ HANDLE CJabberProto::DBCreateContact( const TCHAR* jid, const TCHAR* nick, BOOL
}
JFreeVariant( &dbv );
} }
- hContact = ( HANDLE ) CallService( MS_DB_CONTACT_FINDNEXT, ( WPARAM ) hContact, 0 );
+ hContact = db_find_next(hContact);
}
if ( hContact == NULL ) {
@@ -327,9 +327,9 @@ void CJabberProto::ResolveTransportNicks( const TCHAR* jid )
// Set all contacts to offline
HANDLE hContact = m_ThreadInfo->resolveContact;
if ( hContact == NULL )
- hContact = ( HANDLE ) CallService( MS_DB_CONTACT_FINDFIRST, 0, 0 );
+ hContact = ( HANDLE ) db_find_first();
- for ( ; hContact != NULL; hContact = ( HANDLE )CallService( MS_DB_CONTACT_FINDNEXT, ( WPARAM ) hContact, 0 )) {
+ for ( ; hContact != NULL; hContact = db_find_next(hContact)) {
char* szProto = ( char* )CallService( MS_PROTO_GETCONTACTBASEPROTO, ( WPARAM ) hContact, 0 );
if ( lstrcmpA( szProto, m_szModuleName ))
continue;
diff --git a/protocols/JabberG/jabber_opt.cpp b/protocols/JabberG/jabber_opt.cpp
index b3e02d96fc..1f1270a8a1 100644
--- a/protocols/JabberG/jabber_opt.cpp
+++ b/protocols/JabberG/jabber_opt.cpp
@@ -1062,7 +1062,7 @@ void CJabberProto::_RosterHandleGetRequest( HXML node )
}
// now it is require to process whole contact list to add not in roster contacts
{
- HANDLE hContact = ( HANDLE ) CallService( MS_DB_CONTACT_FINDFIRST, 0, 0 );
+ HANDLE hContact = ( HANDLE ) db_find_first();
while ( hContact != NULL )
{
char* str = ( char* )CallService( MS_PROTO_GETCONTACTBASEPROTO, ( WPARAM ) hContact, 0 );
@@ -1100,7 +1100,7 @@ void CJabberProto::_RosterHandleGetRequest( HXML node )
DBFreeVariant( &dbv );
}
}
- hContact = ( HANDLE ) CallService( MS_DB_CONTACT_FINDNEXT, ( WPARAM ) hContact, 0 );
+ hContact = db_find_next(hContact);
}
}
rrud.bReadyToDownload = FALSE;
diff --git a/protocols/JabberG/jabber_privacy.cpp b/protocols/JabberG/jabber_privacy.cpp
index bb9c9fb97b..636cf50bf6 100644
--- a/protocols/JabberG/jabber_privacy.cpp
+++ b/protocols/JabberG/jabber_privacy.cpp
@@ -432,7 +432,7 @@ public:
SendDlgItemMessage( m_hwnd, IDC_COMBO_VALUES, CB_RESETCONTENT, 0, 0 );
- HANDLE hContact = ( HANDLE ) CallService( MS_DB_CONTACT_FINDFIRST, 0, 0 );
+ HANDLE hContact = ( HANDLE ) db_find_first();
while ( hContact != NULL )
{
char* szProto = ( char* )CallService( MS_PROTO_GETCONTACTBASEPROTO, ( WPARAM ) hContact, 0 );
@@ -445,7 +445,7 @@ public:
JFreeVariant( &dbv );
}
}
- hContact = ( HANDLE ) CallService( MS_DB_CONTACT_FINDNEXT, ( WPARAM ) hContact, 0 );
+ hContact = db_find_next(hContact);
}
// append known chatroom jids from bookmarks
@@ -1368,9 +1368,9 @@ void CJabberDlgPrivacyLists::CListResetOptions(HWND)
void CJabberDlgPrivacyLists::CListFilter(HWND)
{
- for (HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ for (HANDLE hContact = db_find_first();
hContact;
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0))
+ hContact = db_find_next(hContact))
{
char *proto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0);
if (!proto || lstrcmpA(proto, m_proto->m_szModuleName))
@@ -1471,8 +1471,8 @@ void CJabberDlgPrivacyLists::CListApplyList(HWND hwndList, CPrivacyList *pList)
CListResetIcons(hwndList, hItem, bHideIcons);
}
- for (HANDLE hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDFIRST,0,0); hContact;
- hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hContact,0))
+ for (HANDLE hContact=db_find_first(); hContact;
+ hContact=db_find_next(hContact))
{
HANDLE hItem = m_clcClist.FindContact(hContact);
if (!hItem) continue;
@@ -1583,8 +1583,8 @@ void CJabberDlgPrivacyLists::CListBuildList(HWND hwndList, CPrivacyList *pList)
pList->AddRule(Jid, szJid, FALSE, dwOrder++, dwPackets);
}
- for (HANDLE hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDFIRST,0,0); hContact;
- hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hContact,0))
+ for (HANDLE hContact=db_find_first(); hContact;
+ hContact=db_find_next(hContact))
{
hItem = m_clcClist.FindContact(hContact);
diff --git a/protocols/JabberG/jabber_proto.cpp b/protocols/JabberG/jabber_proto.cpp
index 3057267688..6444482ee6 100644
--- a/protocols/JabberG/jabber_proto.cpp
+++ b/protocols/JabberG/jabber_proto.cpp
@@ -320,12 +320,12 @@ int CJabberProto::OnModulesLoadedEx( WPARAM, LPARAM )
JHookEvent( ME_MSG_ICONPRESSED, &CJabberProto::OnProcessSrmmIconClick );
JHookEvent( ME_MSG_WINDOWEVENT, &CJabberProto::OnProcessSrmmEvent );
- HANDLE hContact = ( HANDLE ) CallService( MS_DB_CONTACT_FINDFIRST, 0, 0 );
+ HANDLE hContact = ( HANDLE ) db_find_first();
while ( hContact != NULL ) {
char* szProto = ( char* )CallService( MS_PROTO_GETCONTACTBASEPROTO, ( WPARAM ) hContact, 0 );
if ( szProto != NULL && !strcmp( szProto, m_szModuleName ))
MenuHideSrmmIcon(hContact);
- hContact = ( HANDLE ) CallService( MS_DB_CONTACT_FINDNEXT, ( WPARAM ) hContact, 0 );
+ hContact = db_find_next(hContact);
} }
DBEVENTTYPEDESCR dbEventType = {0};
@@ -345,7 +345,7 @@ int CJabberProto::OnModulesLoadedEx( WPARAM, LPARAM )
CheckAllContactsAreTransported();
// Set all contacts to offline
- HANDLE hContact = ( HANDLE )CallService( MS_DB_CONTACT_FINDFIRST, 0, 0 );
+ HANDLE hContact = db_find_first();
while ( hContact != NULL ) {
char* szProto = ( char* )CallService( MS_PROTO_GETCONTACTBASEPROTO, ( WPARAM ) hContact, 0 );
if ( szProto != NULL && !strcmp( szProto, m_szModuleName )) {
@@ -362,7 +362,7 @@ int CJabberProto::OnModulesLoadedEx( WPARAM, LPARAM )
JFreeVariant( &dbv );
} } }
- hContact = ( HANDLE )CallService( MS_DB_CONTACT_FINDNEXT, ( WPARAM ) hContact, 0 );
+ hContact = db_find_next(hContact);
}
CleanLastResourceMap();
diff --git a/protocols/JabberG/jabber_rc.cpp b/protocols/JabberG/jabber_rc.cpp
index f0a6f658d2..0021733356 100644
--- a/protocols/JabberG/jabber_rc.cpp
+++ b/protocols/JabberG/jabber_rc.cpp
@@ -476,7 +476,7 @@ int CJabberProto::AdhocOptionsHandler( HXML, CJabberIqInfo* pInfo, CJabberAdhocS
int CJabberProto::RcGetUnreadEventsCount()
{
int nEventsSent = 0;
- HANDLE hContact = ( HANDLE ) CallService( MS_DB_CONTACT_FINDFIRST, 0, 0 );
+ HANDLE hContact = ( HANDLE ) db_find_first();
while ( hContact != NULL ) {
char* szProto = ( char* )CallService( MS_PROTO_GETCONTACTBASEPROTO, ( WPARAM ) hContact, 0 );
if ( szProto != NULL && !strcmp( szProto, m_szModuleName )) {
@@ -504,7 +504,7 @@ int CJabberProto::RcGetUnreadEventsCount()
JFreeVariant( &dbv );
}
}
- hContact = ( HANDLE ) CallService( MS_DB_CONTACT_FINDNEXT, ( WPARAM ) hContact, 0 );
+ hContact = db_find_next(hContact);
}
return nEventsSent;
}
@@ -573,7 +573,7 @@ int CJabberProto::AdhocForwardHandler( HXML, CJabberIqInfo* pInfo, CJabberAdhocS
m_options.RcMarkMessagesAsRead = bRemoveCListEvents ? 1 : 0;
int nEventsSent = 0;
- HANDLE hContact = ( HANDLE ) CallService( MS_DB_CONTACT_FINDFIRST, 0, 0 );
+ HANDLE hContact = ( HANDLE ) db_find_first();
while ( hContact != NULL ) {
char* szProto = ( char* )CallService( MS_PROTO_GETCONTACTBASEPROTO, ( WPARAM ) hContact, 0 );
if ( szProto != NULL && !strcmp( szProto, m_szModuleName )) {
@@ -632,7 +632,7 @@ int CJabberProto::AdhocForwardHandler( HXML, CJabberIqInfo* pInfo, CJabberAdhocS
JFreeVariant( &dbv );
}
}
- hContact = ( HANDLE ) CallService( MS_DB_CONTACT_FINDNEXT, ( WPARAM ) hContact, 0 );
+ hContact = db_find_next(hContact);
}
mir_sntprintf( szMsg, SIZEOF(szMsg), TranslateT("%d message(s) forwarded"), nEventsSent );
diff --git a/protocols/JabberG/jabber_thread.cpp b/protocols/JabberG/jabber_thread.cpp
index 07c609fc84..d71fd2ab60 100644
--- a/protocols/JabberG/jabber_thread.cpp
+++ b/protocols/JabberG/jabber_thread.cpp
@@ -583,7 +583,7 @@ recvRest:
JSendBroadcast( NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, ( HANDLE ) oldStatus, m_iStatus );
// Set all contacts to offline
- HANDLE hContact = ( HANDLE ) CallService( MS_DB_CONTACT_FINDFIRST, 0, 0 );
+ HANDLE hContact = ( HANDLE ) db_find_first();
while ( hContact != NULL ) {
if ( !lstrcmpA(( char* )CallService( MS_PROTO_GETCONTACTBASEPROTO, ( WPARAM ) hContact, 0 ), m_szModuleName ))
{
@@ -591,7 +591,7 @@ recvRest:
MenuHideSrmmIcon( hContact );
}
- hContact = ( HANDLE ) CallService( MS_DB_CONTACT_FINDNEXT, ( WPARAM ) hContact, 0 );
+ hContact = db_find_next(hContact);
}
mir_free( m_szJabberJID );
diff --git a/protocols/JabberG/jabber_util.cpp b/protocols/JabberG/jabber_util.cpp
index a290b56ba2..a7650c5cd0 100644
--- a/protocols/JabberG/jabber_util.cpp
+++ b/protocols/JabberG/jabber_util.cpp
@@ -74,7 +74,7 @@ HANDLE CJabberProto::ChatRoomHContactFromJID( const TCHAR* jid )
return ( HANDLE )NULL;
HANDLE hContactMatched = NULL;
- HANDLE hContact = ( HANDLE ) CallService( MS_DB_CONTACT_FINDFIRST, 0, 0 );
+ HANDLE hContact = ( HANDLE ) db_find_first();
while ( hContact != NULL ) {
char* szProto = ( char* )CallService( MS_PROTO_GETCONTACTBASEPROTO, ( WPARAM ) hContact, 0 );
if ( szProto != NULL && !strcmp( m_szModuleName, szProto )) {
@@ -92,7 +92,7 @@ HANDLE CJabberProto::ChatRoomHContactFromJID( const TCHAR* jid )
break;
} } }
- hContact = ( HANDLE ) CallService( MS_DB_CONTACT_FINDNEXT, ( WPARAM ) hContact, 0 );
+ hContact = db_find_next(hContact);
}
return hContactMatched;
@@ -109,7 +109,7 @@ HANDLE CJabberProto::HContactFromJID( const TCHAR* jid , BOOL bStripResource )
JABBER_LIST_ITEM* item = ListGetItemPtr( LIST_CHATROOM, jid );
HANDLE hContactMatched = NULL;
- HANDLE hContact = ( HANDLE ) CallService( MS_DB_CONTACT_FINDFIRST, 0, 0 );
+ HANDLE hContact = ( HANDLE ) db_find_first();
while ( hContact != NULL ) {
char* szProto = ( char* )CallService( MS_PROTO_GETCONTACTBASEPROTO, ( WPARAM ) hContact, 0 );
if ( szProto != NULL && !strcmp( m_szModuleName, szProto )) {
@@ -145,7 +145,7 @@ HANDLE CJabberProto::HContactFromJID( const TCHAR* jid , BOOL bStripResource )
break;
} } }
- hContact = ( HANDLE ) CallService( MS_DB_CONTACT_FINDNEXT, ( WPARAM ) hContact, 0 );
+ hContact = db_find_next(hContact);
}
return hContactMatched;
diff --git a/protocols/MRA/MraProto.cpp b/protocols/MRA/MraProto.cpp
index 1cddb8425f..f1b826767c 100644
--- a/protocols/MRA/MraProto.cpp
+++ b/protocols/MRA/MraProto.cpp
@@ -119,7 +119,7 @@ int CMraProto::OnModulesLoaded(WPARAM, LPARAM)
HookEvent(ME_WAT_NEWSTATUS, &CMraProto::MraMusicChanged);
// всех в offline // тк unsaved values сохраняются их нужно инициализировать
- for (HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0); hContact != NULL; hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0))
+ for (HANDLE hContact = db_find_first(); hContact != NULL; hContact = db_find_next(hContact))
SetContactBasicInfoW(hContact, SCBIFSI_LOCK_CHANGES_EVENTS, (SCBIF_ID|SCBIF_GROUP_ID|SCBIF_SERVER_FLAG|SCBIF_STATUS), -1, -1, 0, 0, ID_STATUS_OFFLINE, NULL, 0, NULL, 0, NULL, 0);
// unsaved values
@@ -628,7 +628,7 @@ int CMraProto::SetStatus(int iNewStatus)
// всех в offline, только если мы бывали подключены
if (dwOldStatusMode > ID_STATUS_OFFLINE) {
// функция сама проверяет принадлежность контакта к MRA
- for (HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);hContact != NULL;hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0))
+ for (HANDLE hContact = db_find_first();hContact != NULL;hContact = db_find_next(hContact))
SetContactBasicInfoW(hContact, SCBIFSI_LOCK_CHANGES_EVENTS, (SCBIF_ID|SCBIF_GROUP_ID|SCBIF_SERVER_FLAG|SCBIF_STATUS), -1, -1, 0, 0, ID_STATUS_OFFLINE, NULL, 0, NULL, 0, NULL, 0);
}
Netlib_CloseHandle(hConnection);
diff --git a/protocols/MRA/Mra_functions.cpp b/protocols/MRA/Mra_functions.cpp
index b5bd00ff8c..7083da1b8d 100644
--- a/protocols/MRA/Mra_functions.cpp
+++ b/protocols/MRA/Mra_functions.cpp
@@ -571,7 +571,7 @@ HANDLE CMraProto::MraHContactFromEmail(LPSTR lpszEMail, size_t dwEMailSize, BOOL
if (dwEMailSize == -1) dwEMailSize = lstrlenA(lpszEMail);
//check not already on list
- for (hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);hContact != NULL;hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0))
+ for (hContact = db_find_first();hContact != NULL;hContact = db_find_next(hContact))
{
if (IsContactMra(hContact))
if (mraGetStaticStringA(hContact, "e-mail", szEMailLocal, SIZEOF(szEMailLocal), &dwEMailLocalSize))
@@ -601,7 +601,7 @@ HANDLE CMraProto::MraHContactFromEmail(LPSTR lpszEMail, size_t dwEMailSize, BOOL
if (CallServiceSync(MS_GC_NEWSESSION, NULL, (LPARAM)&gcw) == 0)
{
BOOL bChatAdded = FALSE;
- for (hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);hContact != NULL;hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0))
+ for (hContact = db_find_first();hContact != NULL;hContact = db_find_next(hContact))
{
if (IsContactMra(hContact))
if (mraGetStaticStringA(hContact, "ChatRoomID", szEMailLocal, SIZEOF(szEMailLocal), &dwEMailLocalSize))
diff --git a/protocols/MRA/Mra_proto.cpp b/protocols/MRA/Mra_proto.cpp
index e1fd7d2e4b..0e6753fb7d 100644
--- a/protocols/MRA/Mra_proto.cpp
+++ b/protocols/MRA/Mra_proto.cpp
@@ -1516,7 +1516,7 @@ DWORD CMraProto::MraCommandDispatcher(mrim_packet_header_t *pmaHeader, DWORD *pd
dwAuthMessageSize = lstrlenW(wszAuthMessage);
}
- for (hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);hContact != NULL;hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0)) {
+ for (hContact = db_find_first();hContact != NULL;hContact = db_find_next(hContact)) {
if (GetContactBasicInfoW(hContact, &dwID, NULL, NULL, NULL, NULL, szEMail, SIZEOF(szEMail), &dwEMailSize, NULL, 0, NULL, NULL, 0, NULL) == NO_ERROR)
if (dwID == -1) {
if (IsEMailChatAgent(szEMail, dwEMailSize)) {// чат: ещё раз запросим авторизацию, пометим как видимый в списке, постоянный
@@ -1544,7 +1544,7 @@ DWORD CMraProto::MraCommandDispatcher(mrim_packet_header_t *pmaHeader, DWORD *pd
}
else { // контакт лист почемуто не получили
// всех в offline и id в нестандарт
- for (HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);hContact != NULL;hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0)) {
+ for (HANDLE hContact = db_find_first();hContact != NULL;hContact = db_find_next(hContact)) {
SetContactBasicInfoW(hContact, SCBIFSI_LOCK_CHANGES_EVENTS, (SCBIF_ID|SCBIF_GROUP_ID|SCBIF_SERVER_FLAG|SCBIF_STATUS), -1, -2, 0, 0, ID_STATUS_OFFLINE, NULL, 0, NULL, 0, NULL, 0);
// request user info from server
MraUpdateContactInfo(hContact);
diff --git a/protocols/MRA/Mra_svcs.cpp b/protocols/MRA/Mra_svcs.cpp
index 16d69d0dc9..28c761a5c4 100644
--- a/protocols/MRA/Mra_svcs.cpp
+++ b/protocols/MRA/Mra_svcs.cpp
@@ -225,9 +225,9 @@ INT_PTR CMraProto::MraWebSearch(WPARAM wParam, LPARAM lParam)
INT_PTR CMraProto::MraUpdateAllUsersInfo(WPARAM wParam, LPARAM lParam)
{
if ( MessageBox(NULL, TranslateT("Are you sure?"), TranslateW(MRA_UPD_ALL_USERS_INFO_STR), MB_YESNO | MB_ICONQUESTION) == IDYES ) {
- for (HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ for (HANDLE hContact = db_find_first();
hContact != NULL;
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0)) {
+ hContact = db_find_next(hContact)) {
size_t dwEMailSize;
CHAR szEMail[MAX_EMAIL_LEN];
if ( IsContactMra(hContact))
@@ -241,9 +241,9 @@ INT_PTR CMraProto::MraUpdateAllUsersInfo(WPARAM wParam, LPARAM lParam)
INT_PTR CMraProto::MraCheckUpdatesUsersAvt(WPARAM wParam, LPARAM lParam)
{
if ( MessageBox(NULL, TranslateT("Are you sure?"), TranslateW(MRA_CHK_USERS_AVATARS_STR), MB_YESNO | MB_ICONQUESTION) == IDYES) {
- for (HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ for (HANDLE hContact = db_find_first();
hContact != NULL;
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0)) {
+ hContact = db_find_next(hContact)) {
size_t dwEMailSize;
CHAR szEMail[MAX_EMAIL_LEN];
@@ -259,9 +259,9 @@ INT_PTR CMraProto::MraCheckUpdatesUsersAvt(WPARAM wParam, LPARAM lParam)
INT_PTR CMraProto::MraRequestAuthForAll(WPARAM wParam, LPARAM lParam)
{
if ( MessageBox(NULL, TranslateT("Are you sure?"), TranslateW(MRA_REQ_AUTH_FOR_ALL_STR), MB_YESNO | MB_ICONQUESTION) == IDYES) {
- for (HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ for (HANDLE hContact = db_find_first();
hContact != NULL;
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0)) {
+ hContact = db_find_next(hContact)) {
DWORD dwContactSeverFlags;
if (GetContactBasicInfoW(hContact, NULL, NULL, NULL, &dwContactSeverFlags, NULL, NULL, 0, NULL, NULL, 0, NULL, NULL, 0, NULL) == NO_ERROR)
if (dwContactSeverFlags&CONTACT_INTFLAG_NOT_AUTHORIZED && dwContactSeverFlags != -1)
diff --git a/protocols/MSN/msn_lists.cpp b/protocols/MSN/msn_lists.cpp
index 8e4b48a129..4930db54d6 100644
--- a/protocols/MSN/msn_lists.cpp
+++ b/protocols/MSN/msn_lists.cpp
@@ -236,10 +236,10 @@ void CMsnProto::Lists_Remove(int list, const char* email)
void CMsnProto::Lists_Populate(void)
{
- HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ HANDLE hContact = db_find_first();
while (hContact != NULL)
{
- HANDLE hContactN = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0);
+ HANDLE hContactN = db_find_next(hContact);
if (MSN_IsMyContact(hContact))
{
char szEmail[MSN_MAX_EMAIL_LEN] = "";;
diff --git a/protocols/MSN/msn_proto.cpp b/protocols/MSN/msn_proto.cpp
index 200b34d3df..41fe2f09e5 100644
--- a/protocols/MSN/msn_proto.cpp
+++ b/protocols/MSN/msn_proto.cpp
@@ -94,7 +94,7 @@ CMsnProto::CMsnProto(const char* aProtoName, const TCHAR* aUserName) :
LoadOptions();
- HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ HANDLE hContact = db_find_first();
while (hContact != NULL)
{
if (MSN_IsMyContact(hContact))
@@ -104,7 +104,7 @@ CMsnProto::CMsnProto(const char* aProtoName, const TCHAR* aUserName) :
deleteSetting(hContact, "p2pMsgId");
deleteSetting(hContact, "AccList");
}
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hContact, 0);
+ hContact = db_find_next(hContact);
}
deleteSetting(NULL, "MobileEnabled");
deleteSetting(NULL, "MobileAllowed");
diff --git a/protocols/NewsAggregator/Src/Options.cpp b/protocols/NewsAggregator/Src/Options.cpp
index 21285a32c1..4869867d9a 100644
--- a/protocols/NewsAggregator/Src/Options.cpp
+++ b/protocols/NewsAggregator/Src/Options.cpp
@@ -162,7 +162,7 @@ INT_PTR CALLBACK DlgProcChangeFeedOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP
SendDlgItemMessage(hwndDlg, IDC_CHECKTIME, EM_LIMITTEXT, 3, 0);
SendDlgItemMessage(hwndDlg, IDC_TIMEOUT_VALUE_SPIN, UDM_SETRANGE32, 0, 999);
- HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ HANDLE hContact = db_find_first();
while (hContact != NULL)
{
if (IsMyContact(hContact))
@@ -214,7 +214,7 @@ INT_PTR CALLBACK DlgProcChangeFeedOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP
}
DBFreeVariant(&dbNick);
}
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0);
+ hContact = db_find_next(hContact);
}
WindowList_Add(hChangeFeedDlgList,hwndDlg,hContact);
Utils_RestoreWindowPositionNoSize(hwndDlg,hContact,MODULE,"ChangeDlg");
@@ -547,7 +547,7 @@ INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPA
ListView_GetItemText(hwndList, sel, 0, nick, MAX_PATH);
ListView_GetItemText(hwndList, sel, 1, url, MAX_PATH);
- HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ HANDLE hContact = db_find_first();
while (hContact != NULL)
{
if(IsMyContact(hContact))
@@ -572,7 +572,7 @@ INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPA
}
DBFreeVariant(&dbNick);
}
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0);
+ hContact = db_find_next(hContact);
}
}
return FALSE;
@@ -587,7 +587,7 @@ INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPA
{
case PSN_APPLY:
{
- HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ HANDLE hContact = db_find_first();
int i = 0;
while (hContact != NULL)
{
@@ -600,7 +600,7 @@ INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPA
DBDeleteContactSetting(hContact,"CList","Hidden");
i += 1;
}
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0);
+ hContact = db_find_next(hContact);
}
break;
}
diff --git a/protocols/NewsAggregator/Src/Services.cpp b/protocols/NewsAggregator/Src/Services.cpp
index ed53a2a048..b057f515be 100644
--- a/protocols/NewsAggregator/Src/Services.cpp
+++ b/protocols/NewsAggregator/Src/Services.cpp
@@ -42,27 +42,27 @@ static void __cdecl WorkingThread(void* param)
{
int nStatus = (int)param;
// UpdateAll(FALSE, FALSE);
- HANDLE hContact= (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ HANDLE hContact= db_find_first();
while (hContact != NULL)
{
if(IsMyContact(hContact))
{
SetContactStatus(hContact, nStatus);
}
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0);
+ hContact = db_find_next(hContact);
}
}
int NewsAggrInit(WPARAM wParam,LPARAM lParam)
{
- HANDLE hContact= (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ HANDLE hContact= db_find_first();
while (hContact != NULL)
{
if(IsMyContact(hContact))
{
SetContactStatus(hContact, ID_STATUS_OFFLINE);
}
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0);
+ hContact = db_find_next(hContact);
}
NetlibInit();
InitIcons();
@@ -169,14 +169,14 @@ INT_PTR NewsAggrGetInfo(WPARAM wParam,LPARAM lParam)
INT_PTR CheckAllFeeds(WPARAM wParam,LPARAM lParam)
{
- HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ HANDLE hContact = db_find_first();
while (hContact != NULL)
{
if (IsMyContact(hContact) && lParam && DBGetContactSettingDword(hContact, MODULE, "UpdateTime", 60))
UpdateListAdd(hContact);
else if (IsMyContact(hContact) && !lParam)
UpdateListAdd(hContact);
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0);
+ hContact = db_find_next(hContact);
}
if (!ThreadRunning)
mir_forkthread(UpdateThreadProc, NULL);
diff --git a/protocols/NewsAggregator/Src/Update.cpp b/protocols/NewsAggregator/Src/Update.cpp
index 0c2431e9a0..c0b42eb759 100644
--- a/protocols/NewsAggregator/Src/Update.cpp
+++ b/protocols/NewsAggregator/Src/Update.cpp
@@ -31,7 +31,7 @@ VOID CALLBACK timerProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime)
if (!ThreadRunning && !Miranda_Terminated())
{
BOOL HaveUpdates = FALSE;
- HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ HANDLE hContact = db_find_first();
while (hContact != NULL)
{
if(IsMyContact(hContact))
@@ -46,7 +46,7 @@ VOID CALLBACK timerProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime)
}
}
}
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0);
+ hContact = db_find_next(hContact);
}
if (!ThreadRunning && HaveUpdates)
mir_forkthread(UpdateThreadProc, NULL);
diff --git a/protocols/NewsAggregator/Src/Utils.cpp b/protocols/NewsAggregator/Src/Utils.cpp
index 1fb25eddb3..197cc5a0ba 100644
--- a/protocols/NewsAggregator/Src/Utils.cpp
+++ b/protocols/NewsAggregator/Src/Utils.cpp
@@ -267,7 +267,7 @@ VOID UpdateList(HWND hwndList)
// Some code to create the list-view control.
// Initialize LVITEM members that are common to all
// items.
- HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ HANDLE hContact = db_find_first();
int i = 0;
while (hContact != NULL)
{
@@ -295,7 +295,7 @@ VOID UpdateList(HWND hwndList)
DBFreeVariant(&dbNick);
}
}
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0);
+ hContact = db_find_next(hContact);
}
UpdateListFlag = FALSE;
}
diff --git a/protocols/Quotes/ImportExport.cpp b/protocols/Quotes/ImportExport.cpp
index 2e38be0c0f..80ab41d309 100644
--- a/protocols/Quotes/ImportExport.cpp
+++ b/protocols/Quotes/ImportExport.cpp
@@ -313,7 +313,7 @@ INT_PTR Quotes_Export(WPARAM wp,LPARAM lp)
}
else
{
- for(hContact = reinterpret_cast<HANDLE>(CallService(MS_DB_CONTACT_FINDFIRST,0,0));hContact;hContact = reinterpret_cast<HANDLE>(CallService(MS_DB_CONTACT_FINDNEXT,reinterpret_cast<WPARAM>(hContact),0)))
+ for(hContact = db_find_first(); hContact; hContact = db_find_next(hContact))
{
CQuotesProviders::TQuotesProviderPtr pProvider = pProviders->GetContactProviderPtr(hContact);
if(pProvider)
diff --git a/protocols/Quotes/QuotesProviders.cpp b/protocols/Quotes/QuotesProviders.cpp
index 5fac2af14f..c7d6823cec 100644
--- a/protocols/Quotes/QuotesProviders.cpp
+++ b/protocols/Quotes/QuotesProviders.cpp
@@ -68,7 +68,7 @@ void CQuotesProviders::InitProviders()
const WORD nCurrentVersion = 17;
WORD nVersion = DBGetContactSettingWord(NULL,QUOTES_MODULE_NAME,LAST_RUN_VERSION,1);
- for(HANDLE hContact = reinterpret_cast<HANDLE>(CallService(MS_DB_CONTACT_FINDFIRST,0,0));hContact;hContact = reinterpret_cast<HANDLE>(CallService(MS_DB_CONTACT_FINDNEXT,reinterpret_cast<WPARAM>(hContact),0)))
+ for(HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact))
{
TQuotesProviderPtr pProvider = GetContactProviderPtr(hContact);
if(pProvider)
diff --git a/protocols/Twitter/chat.cpp b/protocols/Twitter/chat.cpp
index f73b885034..cafb46025c 100644
--- a/protocols/Twitter/chat.cpp
+++ b/protocols/Twitter/chat.cpp
@@ -197,9 +197,9 @@ void TwitterProto::SetChatStatus(int status)
if(status == ID_STATUS_ONLINE)
{
// Add all friends to contact list
- for(HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST,0,0);
+ for(HANDLE hContact = db_find_first();
hContact;
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hContact,0))
+ hContact = db_find_next(hContact))
{
if(!IsMyContact(hContact))
continue;
diff --git a/protocols/Twitter/contacts.cpp b/protocols/Twitter/contacts.cpp
index ec75795694..78a53f47be 100644
--- a/protocols/Twitter/contacts.cpp
+++ b/protocols/Twitter/contacts.cpp
@@ -227,9 +227,9 @@ bool TwitterProto::IsMyContact(HANDLE hContact,bool include_chat)
HANDLE TwitterProto::UsernameToHContact(const char *name)
{
- for(HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST,0,0);
+ for(HANDLE hContact = db_find_first();
hContact;
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hContact,0))
+ hContact = db_find_next(hContact))
{
if(!IsMyContact(hContact))
continue;
@@ -292,9 +292,9 @@ HANDLE TwitterProto::AddToClientList(const char *name,const char *status)
void TwitterProto::SetAllContactStatuses(int status)
{
- for(HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST,0,0);
+ for(HANDLE hContact = db_find_first();
hContact;
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hContact,0))
+ hContact = db_find_next(hContact))
{
if(!IsMyContact(hContact))
continue;
diff --git a/protocols/Twitter/proto.cpp b/protocols/Twitter/proto.cpp
index 03949607ec..ae843d8b07 100644
--- a/protocols/Twitter/proto.cpp
+++ b/protocols/Twitter/proto.cpp
@@ -557,9 +557,9 @@ void TwitterProto::UpdateSettings()
if(in_chat_)
OnLeaveChat(0,0);
- for(HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST,0,0);
+ for(HANDLE hContact = db_find_first();
hContact;
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hContact,0))
+ hContact = db_find_next(hContact))
{
if(!IsMyContact(hContact,true))
continue;
diff --git a/protocols/Twitter/ui.cpp b/protocols/Twitter/ui.cpp
index f5f571fdef..fa6899c13d 100644
--- a/protocols/Twitter/ui.cpp
+++ b/protocols/Twitter/ui.cpp
@@ -399,9 +399,9 @@ namespace popup_options
if(n_contacts != 0)
{
int contact = rand() % n_contacts;
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST,0,0);
+ hContact = db_find_first();
for(int i=0; i<contact; i++)
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hContact,0);
+ hContact = db_find_next(hContact);
}
// Pick a random quote
diff --git a/protocols/Weather/weather_addstn.cpp b/protocols/Weather/weather_addstn.cpp
index 363dd8240d..31a83f75fc 100644
--- a/protocols/Weather/weather_addstn.cpp
+++ b/protocols/Weather/weather_addstn.cpp
@@ -37,7 +37,7 @@ INT_PTR WeatherAddToList(WPARAM wParam, LPARAM lParam)
WIDATA *sData;
// search for existing contact
- HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ HANDLE hContact = db_find_first();
while (hContact != NULL) {
// check if it is a weather contact
if ( IsMyContact(hContact)) {
@@ -58,7 +58,7 @@ INT_PTR WeatherAddToList(WPARAM wParam, LPARAM lParam)
DBFreeVariant(&dbv);
}
}
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0);
+ hContact = db_find_next(hContact);
}
// if contact with the same ID was not found, add it
diff --git a/protocols/Weather/weather_contacts.cpp b/protocols/Weather/weather_contacts.cpp
index 06c7463fe3..9111ea3d92 100644
--- a/protocols/Weather/weather_contacts.cpp
+++ b/protocols/Weather/weather_contacts.cpp
@@ -447,7 +447,7 @@ int ContactDeleted(WPARAM wParam, LPARAM lParam)
// now the default station is deleted, try to get a new one
// start looking for other weather stations
- HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ HANDLE hContact = db_find_first();
while(hContact) {
if (IsMyContact(hContact)) {
if (!DBGetContactSettingTString(hContact, WEATHERPROTONAME, "ID", &dbv)) {
@@ -469,7 +469,7 @@ int ContactDeleted(WPARAM wParam, LPARAM lParam)
DBFreeVariant(&dbv);
}
}
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0);
+ hContact = db_find_next(hContact);
}
// got here if no more weather station left
opt.Default[0] = 0; // no default station
diff --git a/protocols/Weather/weather_data.cpp b/protocols/Weather/weather_data.cpp
index b1ae960bd7..3fadde88e7 100644
--- a/protocols/Weather/weather_data.cpp
+++ b/protocols/Weather/weather_data.cpp
@@ -131,7 +131,7 @@ void EraseAllInfo(DWORD lastver)
HANDLE hContact, LastContact = NULL;
DBVARIANT dbv;
// loop through all contacts
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ hContact = db_find_first();
while(hContact)
{
// see if the contact is a weather contact
@@ -183,7 +183,7 @@ void EraseAllInfo(DWORD lastver)
ContactCount++; // increment counter
LastContact = hContact;
}
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0);
+ hContact = db_find_next(hContact);
}
// if weather contact exists, set the status to online so it is ready for update
// if (ContactCount != 0) status = ONLINE;
diff --git a/protocols/Weather/weather_mwin.cpp b/protocols/Weather/weather_mwin.cpp
index fb02af94a9..c5fa204f85 100644
--- a/protocols/Weather/weather_mwin.cpp
+++ b/protocols/Weather/weather_mwin.cpp
@@ -386,7 +386,7 @@ void InitMwin(void)
FontRegisterT(&fontid);
}
- HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ HANDLE hContact = db_find_first();
while(hContact)
{
// see if the contact is a weather contact
@@ -395,14 +395,14 @@ void InitMwin(void)
if (DBGetContactSettingDword(hContact, WEATHERPROTONAME, "mwin", 0))
addWindow(hContact);
}
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0);
+ hContact = db_find_next(hContact);
}
hFontHook = HookEvent(ME_FONT_RELOAD, RedrawFrame);
}
void DestroyMwin(void)
{
- HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ HANDLE hContact = db_find_first();
while(hContact)
{
// see if the contact is a weather contact
@@ -412,7 +412,7 @@ void DestroyMwin(void)
if (frameId)
CallService(MS_CLIST_FRAMES_REMOVEFRAME, frameId, 0);
}
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0);
+ hContact = db_find_next(hContact);
}
UnregisterClass( _T("WeatherFrame"), hInst);
UnhookEvent(hFontHook);
diff --git a/protocols/Weather/weather_update.cpp b/protocols/Weather/weather_update.cpp
index c4c78edec8..48ed3d84c2 100644
--- a/protocols/Weather/weather_update.cpp
+++ b/protocols/Weather/weather_update.cpp
@@ -284,7 +284,7 @@ void DestroyUpdateList(void)
void UpdateAll(BOOL AutoUpdate, BOOL RemoveData)
{
// add all weather contact to the update queue list
- HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ HANDLE hContact = db_find_first();
while (hContact != NULL)
{
if (IsMyContact(hContact))
@@ -295,7 +295,7 @@ void UpdateAll(BOOL AutoUpdate, BOOL RemoveData)
UpdateListAdd(hContact);
}
}
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0);
+ hContact = db_find_next(hContact);
}
// if it is not updating, then start the update thread process
diff --git a/protocols/YAMN/proto/pop3/pop3comm.cpp b/protocols/YAMN/proto/pop3/pop3comm.cpp
index 4fbfb86a7f..954f1b5860 100644
--- a/protocols/YAMN/proto/pop3/pop3comm.cpp
+++ b/protocols/YAMN/proto/pop3/pop3comm.cpp
@@ -284,7 +284,7 @@ int RegisterPOP3Plugin(WPARAM,LPARAM)
for (Finder=POP3Plugin->FirstAccount;Finder!=NULL;Finder=Finder->Next)
{
Finder->hContact = NULL;
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ hContact = db_find_first();
while(hContact)
{
szProto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0);
@@ -304,7 +304,7 @@ int RegisterPOP3Plugin(WPARAM,LPARAM)
DBFreeVariant(&dbv);
}
}
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0);
+ hContact = db_find_next(hContact);
}
if (Finder->hContact == NULL && (Finder->Flags & YAMN_ACC_ENA) && (Finder->NewMailN.Flags & YAMN_ACC_CONT)) {
diff --git a/protocols/Yahoo/services.cpp b/protocols/Yahoo/services.cpp
index 2ea817d279..40166100ed 100644
--- a/protocols/Yahoo/services.cpp
+++ b/protocols/Yahoo/services.cpp
@@ -31,7 +31,7 @@
void CYahooProto::logoff_buddies()
{
//set all contacts to 'offline'
- HANDLE hContact = ( HANDLE )CallService( MS_DB_CONTACT_FINDFIRST, 0, 0 );
+ HANDLE hContact = db_find_first();
while ( hContact != NULL )
{
if (IsMyContact(hContact)) {
@@ -45,7 +45,7 @@ void CYahooProto::logoff_buddies()
//DBDeleteContactSetting(hContact, m_szModuleName, "MirVer" );
}
- hContact = ( HANDLE )CallService( MS_DB_CONTACT_FINDNEXT,( WPARAM )hContact, 0 );
+ hContact = db_find_next(hContact);
}
}
diff --git a/protocols/Yahoo/yahoo.cpp b/protocols/Yahoo/yahoo.cpp
index 591a651d10..54e0ed3005 100644
--- a/protocols/Yahoo/yahoo.cpp
+++ b/protocols/Yahoo/yahoo.cpp
@@ -286,9 +286,9 @@ HANDLE CYahooProto::getbuddyH(const char *yahoo_id)
{
HANDLE hContact;
- for ( hContact = ( HANDLE )CallService( MS_DB_CONTACT_FINDFIRST, 0, 0 );
+ for ( hContact = db_find_first();
hContact != NULL;
- hContact = ( HANDLE )CallService( MS_DB_CONTACT_FINDNEXT, ( WPARAM )hContact, 0 ))
+ hContact = db_find_next(hContact))
{
if (IsMyContact(hContact))
{
@@ -621,9 +621,9 @@ void CYahooProto::ext_got_stealth(char *stealthlist)
if (stealthlist)
stealth = y_strsplit(stealthlist, ",", -1);
- for ( hContact = ( HANDLE )CallService( MS_DB_CONTACT_FINDFIRST, 0, 0 );
+ for ( hContact = db_find_first();
hContact != NULL;
- hContact = ( HANDLE )CallService( MS_DB_CONTACT_FINDNEXT, ( WPARAM )hContact, 0 ))
+ hContact = db_find_next(hContact))
{
if (IsMyContact(hContact)) {
DBVARIANT dbv;