diff options
author | George Hazan <george.hazan@gmail.com> | 2012-10-10 07:46:53 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-10-10 07:46:53 +0000 |
commit | f90be5cdeec5875d1022e1ef35f5b101bd76ac84 (patch) | |
tree | 59e5e8bf3b6a87dbee148bd63f841a8a62daac5f | |
parent | ed10055737300c07e485eb22b27ccf92ffadab7c (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
170 files changed, 606 insertions, 651 deletions
diff --git a/plugins/AVS/src/options.cpp b/plugins/AVS/src/options.cpp index 58502a9655..54858c99c3 100644 --- a/plugins/AVS/src/options.cpp +++ b/plugins/AVS/src/options.cpp @@ -434,14 +434,14 @@ INT_PTR CALLBACK DlgProcOptionsProtos(HWND hwndDlg, UINT msg, WPARAM wParam, LPA if (oldVal && !newVal)
{
- HANDLE hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ HANDLE hContact = db_find_first();
while (hContact != NULL)
{
char* szContactProto = (char*) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hContact, 0);
if (szContactProto != NULL && !strcmp(szContactProto, szProto))
DeleteAvatarFromCache(hContact, TRUE);
- hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0);
+ hContact = db_find_next(hContact);
}
}
diff --git a/plugins/AssocMgr/src/test.cpp b/plugins/AssocMgr/src/test.cpp index 73112af5a5..3c6169a11d 100644 --- a/plugins/AssocMgr/src/test.cpp +++ b/plugins/AssocMgr/src/test.cpp @@ -74,7 +74,7 @@ static int __inline AssocMgr_AddNewUrlType(const char *prefix,const char *desc,H #define AIM_KEY_NL "NotOnList"
struct oscar_data { HINSTANCE hInstance; } static conn;
static __inline HANDLE find_contact(const char *nick) { nick; return NULL; }
-static __inline HANDLE add_contact(const char *nick) { nick; return (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST,0,0); }
+static __inline HANDLE add_contact(const char *nick) { nick; return db_find_first(); }
static __inline void aim_gchat_joinrequest(const char *room, int exchange) { room; exchange; MessageBoxA(NULL,"Join group chat!",room,MB_OK); return; }
#include <m_protosvc.h>
#include <m_addcontact.h>
@@ -205,7 +205,7 @@ void aim_links_destroy() #define gpszICQProtoName "ICQ"
#define IDI_ICQ 101
#define hInst GetModuleHandleA("ICQ")
-static __inline HANDLE HContactFromUIN(DWORD dwUIN,int *Added) { dwUIN; Added; return (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST,0,0); }
+static __inline HANDLE HContactFromUIN(DWORD dwUIN,int *Added) { dwUIN; Added; return db_find_first(); }
static __inline HANDLE ICQFindFirstContact(void) { return NULL; }
static __inline HANDLE ICQFindNextContact(HANDLE hContact) { hContact; return NULL; }
static __inline void AddToCache(HANDLE hContact,DWORD dwUin) { hContact; dwUin; }
@@ -402,7 +402,7 @@ void UninitIcqFiles(void) #define IDI_YAHOO 10101
#define hinstance GetModuleHandleA("YAHOO")
static __inline HANDLE getbuddyH(const char *yahoo_id) { yahoo_id; return NULL; }
-static __inline HANDLE add_buddy(const char *yahoo_id,const char *yahoo_name,DWORD flags) { yahoo_id; yahoo_name; flags; return (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST,0,0); }
+static __inline HANDLE add_buddy(const char *yahoo_id,const char *yahoo_name,DWORD flags) { yahoo_id; yahoo_name; flags; return db_find_first(); }
#include <m_protosvc.h>
#include <m_addcontact.h>
#include <m_message.h>
@@ -513,7 +513,7 @@ void YmsgrLinksUninit(void) #define IDI_MSN 101
#define hInst GetModuleHandleA("MSN")
static __inline HANDLE MSN_HContactFromEmailT(const char *msnEmail) { msnEmail; return NULL; }
-static __inline HANDLE MSN_HContactFromEmail(const char *msnEmail,const char *msnNick,int addIfNeeded,int temporary) { msnEmail; msnNick; addIfNeeded; temporary; return (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST,0,0); }
+static __inline HANDLE MSN_HContactFromEmail(const char *msnEmail,const char *msnNick,int addIfNeeded,int temporary) { msnEmail; msnNick; addIfNeeded; temporary; return db_find_first(); }
#include <m_protosvc.h>
#include <m_addcontact.h>
#include <m_message.h>
@@ -622,7 +622,7 @@ void UnloadMsnLinks(void) #define IDI_GG 251
#define hInstance GetModuleHandleA("GG")
typedef DWORD uin_t;
-static __inline HANDLE gg_getcontact(uin_t uin,int create,int inlist,char *szNick) { uin; create; inlist; szNick; return (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST,0,0); }
+static __inline HANDLE gg_getcontact(uin_t uin,int create,int inlist,char *szNick) { uin; create; inlist; szNick; return db_find_first(); }
#include <m_protosvc.h>
#include <m_addcontact.h>
#include <m_message.h>
@@ -687,7 +687,7 @@ void gg_unregisterlinks(void) #define IDI_JABBER 102
#define hInst GetModuleHandleA("JABBER")
static __inline HANDLE JabberHContactFromJID(const char *jid) { jid; return NULL; }
-static __inline HANDLE JabberDBCreateContact(char *jid,char *nick,BOOL temporary,BOOL stripResource) { jid; nick; temporary; stripResource; return (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST,0,0); }
+static __inline HANDLE JabberDBCreateContact(char *jid,char *nick,BOOL temporary,BOOL stripResource) { jid; nick; temporary; stripResource; return db_find_first(); }
#include <m_protosvc.h>
#include <m_addcontact.h>
#include <m_message.h>
diff --git a/plugins/AuthState/src/main.cpp b/plugins/AuthState/src/main.cpp index 29224bd3d3..6e8bcdb99a 100644 --- a/plugins/AuthState/src/main.cpp +++ b/plugins/AuthState/src/main.cpp @@ -248,10 +248,10 @@ int onModulesLoaded(WPARAM wParam,LPARAM lParam) hExtraIcon = ExtraIcon_Register("authstate", "Auth State", "authgrant_icon");
if (hExtraIcon != NULL) {
// Set initial value for all contacts
- HANDLE hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ HANDLE hContact = db_find_first();
while (hContact != NULL) {
onExtraImageApplying((WPARAM)hContact, 1);
- hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0);
+ hContact = db_find_next(hContact);
}
}
else {
diff --git a/plugins/AuthState/src/options.cpp b/plugins/AuthState/src/options.cpp index d2248d9e44..cef1db78b8 100644 --- a/plugins/AuthState/src/options.cpp +++ b/plugins/AuthState/src/options.cpp @@ -100,21 +100,21 @@ INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP clistIcon = SendMessage(GetDlgItem(hwndDlg, IDC_ADVICON), CB_GETCURSEL, 0, 0);
clistIcon++;
- HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ HANDLE hContact = db_find_first();
while (hContact)
{
CallService(MS_CLIST_EXTRA_SET_ICON, (WPARAM)hContact, (LPARAM)&g_IECClear);
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0);
+ hContact = db_find_next(hContact);
}
g_IECClear.ColumnType = clistIcon;
onExtraImageListRebuild(0,0);
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ hContact = db_find_first();
while (hContact)
{
onExtraImageApplying((WPARAM)hContact,0);
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0);
+ hContact = db_find_next(hContact);
}
//Store options values to DB
diff --git a/plugins/AutoShutdown/src/watcher.cpp b/plugins/AutoShutdown/src/watcher.cpp index 3121248cba..99c3d524c5 100644 --- a/plugins/AutoShutdown/src/watcher.cpp +++ b/plugins/AutoShutdown/src/watcher.cpp @@ -180,7 +180,7 @@ static BOOL CheckAllContactsOffline(void) HANDLE hContact;
char *pszProto;
fSmartCheck=DBGetContactSettingByte(NULL,"AutoShutdown","SmartOfflineCheck",SETTING_SMARTOFFLINECHECK_DEFAULT);
- hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDFIRST,0,0);
+ hContact=db_find_first();
while(hContact!=NULL) {
pszProto=(char*)CallService(MS_PROTO_GETCONTACTBASEPROTO,(WPARAM)hContact,0);
if(pszProto!=NULL && CallProtoService(pszProto,PS_GETSTATUS,0,0)!=ID_STATUS_OFFLINE)
@@ -193,7 +193,7 @@ static BOOL CheckAllContactsOffline(void) fAllOffline=FALSE;
break;
}
- hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hContact,0);
+ hContact=db_find_next(hContact);
}
return fAllOffline;
}
diff --git a/plugins/AvatarHistory/src/options.cpp b/plugins/AvatarHistory/src/options.cpp index bd4da44d7f..fbf7f8312f 100644 --- a/plugins/AvatarHistory/src/options.cpp +++ b/plugins/AvatarHistory/src/options.cpp @@ -220,7 +220,7 @@ static INT_PTR CALLBACK PopupsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPA op.popup_use_win_colors = IsDlgButtonChecked(hwndDlg, IDC_WINCOLORS) != 0;
op.popup_use_default_colors = IsDlgButtonChecked(hwndDlg, IDC_DEFAULTCOLORS) != 0;
- HANDLE hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST,0,0);
+ HANDLE hContact = db_find_first();
ShowTestPopup(hContact,TranslateT("Test Contact"), TranslateT("Test description"), &op);
break;
diff --git a/plugins/BasicHistory/src/HistoryWindow.cpp b/plugins/BasicHistory/src/HistoryWindow.cpp index a518914278..a8dfcefd14 100644 --- a/plugins/BasicHistory/src/HistoryWindow.cpp +++ b/plugins/BasicHistory/src/HistoryWindow.cpp @@ -1799,7 +1799,7 @@ void HistoryWindow::ReloadContacts() }
}
- HANDLE _hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ HANDLE _hContact = db_find_first();
while(_hContact)
{
if(EventList::GetContactMessageNumber(_hContact) && (metaContactProto == NULL || DBGetContactSettingByte(_hContact, metaContactProto, "IsSubcontact", 0) == 0))
@@ -1819,7 +1819,7 @@ void HistoryWindow::ReloadContacts() }
}
- _hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)_hContact, 0);
+ _hContact = db_find_next(_hContact);
}
if(hContact != NULL)
@@ -1970,7 +1970,7 @@ void HistoryWindow::SavePos(bool all) HANDLE contactToSave = hContact;
if(all)
{
- HANDLE _hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ HANDLE _hContact = db_find_first();
while(_hContact)
{
DBDeleteContactSetting(_hContact, MODULE, "history_x");
@@ -1980,7 +1980,7 @@ void HistoryWindow::SavePos(bool all) DBDeleteContactSetting(_hContact, MODULE, "history_ismax");
DBDeleteContactSetting(_hContact, MODULE, "history_splitterv");
DBDeleteContactSetting(_hContact, MODULE, "history_splitter");
- _hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)_hContact, 0);
+ _hContact = db_find_next(_hContact);
}
contactToSave = NULL;
@@ -2460,7 +2460,7 @@ HANDLE HistoryWindow::GetNextContact(HANDLE hContact, int adder) {
if(hContact != NULL)
{
- _hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0);
+ _hContact = db_find_next(hContact);
while(_hContact)
{
HANDLE hItem = (HANDLE)SendMessage(contactList, CLM_FINDCONTACT, (WPARAM)_hContact, 0);
@@ -2470,7 +2470,7 @@ HANDLE HistoryWindow::GetNextContact(HANDLE hContact, int adder) break;
}
- _hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)_hContact, 0);
+ _hContact = db_find_next(_hContact);
}
if(!find && EventList::GetContactMessageNumber(NULL))
@@ -2482,7 +2482,7 @@ HANDLE HistoryWindow::GetNextContact(HANDLE hContact, int adder) if(!find)
{
- _hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ _hContact = db_find_first();
while(_hContact && _hContact != hContact)
{
HANDLE hItem = (HANDLE)SendMessage(contactList, CLM_FINDCONTACT, (WPARAM)_hContact, 0);
@@ -2492,14 +2492,14 @@ HANDLE HistoryWindow::GetNextContact(HANDLE hContact, int adder) break;
}
- _hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)_hContact, 0);
+ _hContact = db_find_next(_hContact);
}
}
}
else
{
HANDLE lastContact = NULL;
- _hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ _hContact = db_find_first();
while(_hContact && _hContact != hContact)
{
HANDLE hItem = (HANDLE)SendMessage(contactList, CLM_FINDCONTACT, (WPARAM)_hContact, 0);
@@ -2508,14 +2508,14 @@ HANDLE HistoryWindow::GetNextContact(HANDLE hContact, int adder) lastContact = _hContact;
}
- _hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)_hContact, 0);
+ _hContact = db_find_next(_hContact);
}
if(hContact != NULL)
{
if(lastContact == NULL && !EventList::GetContactMessageNumber(NULL))
{
- _hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0);
+ _hContact = db_find_next(hContact);
while(_hContact)
{
HANDLE hItem = (HANDLE)SendMessage(contactList, CLM_FINDCONTACT, (WPARAM)_hContact, 0);
@@ -2524,7 +2524,7 @@ HANDLE HistoryWindow::GetNextContact(HANDLE hContact, int adder) lastContact = _hContact;
}
- _hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)_hContact, 0);
+ _hContact = db_find_next(_hContact);
}
}
diff --git a/plugins/BasicHistory/src/Options.cpp b/plugins/BasicHistory/src/Options.cpp index 67610e7724..4d8b759d7e 100644 --- a/plugins/BasicHistory/src/Options.cpp +++ b/plugins/BasicHistory/src/Options.cpp @@ -598,12 +598,12 @@ void Options::SaveTasks(std::list<TaskOptions>* tasks) sprintf_s(buf, "Task_zipPassword_%d", i);
DBWriteContactSettingString(0, MODULE, buf, it->zipPassword.c_str());
- HANDLE _hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ HANDLE _hContact = db_find_first();
sprintf_s(buf, "IsInTask_%d", i);
while(_hContact)
{
DBDeleteContactSetting(_hContact, MODULE, buf);
- _hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)_hContact, 0);
+ _hContact = db_find_next(_hContact);
}
for(size_t j = 0; j < it->contacts.size(); ++j)
@@ -660,12 +660,12 @@ void Options::SaveTasks(std::list<TaskOptions>* tasks) sprintf_s(buf, "Task_taskName_%d", i);
DBDeleteContactSetting(NULL, MODULE, buf);
- HANDLE _hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ HANDLE _hContact = db_find_first();
sprintf_s(buf, "IsInTask_%d", i);
while(_hContact)
{
DBDeleteContactSetting(_hContact, MODULE, buf);
- _hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)_hContact, 0);
+ _hContact = db_find_next(_hContact);
}
}
@@ -758,7 +758,7 @@ void Options::LoadTasks() DBFreeVariant(&var);
}
- HANDLE _hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ HANDLE _hContact = db_find_first();
sprintf_s(buf, "IsInTask_%d", i);
while(_hContact)
{
@@ -767,7 +767,7 @@ void Options::LoadTasks() to.contacts.push_back(_hContact);
}
- _hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)_hContact, 0);
+ _hContact = db_find_next(_hContact);
}
to.orderNr = i;
@@ -1770,14 +1770,14 @@ void SaveList(HWND hwnd, HANDLE hSystem, TaskOptions* to) to->contacts.clear();
if (hSystem)
to->isSystem = SendMessage(hwnd, CLM_GETCHECKMARK, (WPARAM) hSystem, 0) != 0;
- hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ hContact = db_find_first();
do
{
hItem = (HANDLE) SendMessage(hwnd, CLM_FINDCONTACT, (WPARAM) hContact, 0);
if (hItem && SendMessage(hwnd, CLM_GETCHECKMARK, (WPARAM) hItem, 0))
to->contacts.push_back(hContact);
}
- while (hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0));
+ while (hContact = db_find_next(hContact));
}
bool IsValidTask(TaskOptions& to, std::list<TaskOptions>* top = NULL, std::wstring* err = NULL, std::wstring* errDescr = NULL);
diff --git a/plugins/BuddyExpectator/src/BuddyExpectator.cpp b/plugins/BuddyExpectator/src/BuddyExpectator.cpp index 5f9e37e266..8a5093564f 100644 --- a/plugins/BuddyExpectator/src/BuddyExpectator.cpp +++ b/plugins/BuddyExpectator/src/BuddyExpectator.cpp @@ -672,7 +672,7 @@ int SettingChanged(WPARAM wParam, LPARAM lParam) void CALLBACK TimerProc(HWND, UINT, UINT_PTR, DWORD)
{
- HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ HANDLE hContact = db_find_first();
char *proto;
while (hContact != 0)
{
@@ -704,7 +704,7 @@ void CALLBACK TimerProc(HWND, UINT, UINT_PTR, DWORD) GoneNotify(hContact, message);
}
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0);
+ hContact = db_find_next(hContact);
}
}
/**
@@ -873,7 +873,7 @@ extern "C" int __declspec(dllexport) Load(void) // ensure all contacts are timestamped
DBVARIANT dbv;
- HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ HANDLE hContact = db_find_first();
DWORD current_time = (DWORD)time(0);
while (hContact != 0) {
if ( !DBGetContactSetting(hContact, MODULE_NAME, "CreationTime", &dbv))
@@ -881,7 +881,7 @@ extern "C" int __declspec(dllexport) Load(void) else
DBWriteContactSettingDword(hContact, MODULE_NAME, "CreationTime", current_time);
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0);
+ hContact = db_find_next(hContact);
}
return 0;
diff --git a/plugins/BuddyExpectator/src/options.cpp b/plugins/BuddyExpectator/src/options.cpp index e8f9de8e8c..f0a8e8cf7e 100644 --- a/plugins/BuddyExpectator/src/options.cpp +++ b/plugins/BuddyExpectator/src/options.cpp @@ -267,13 +267,13 @@ static INT_PTR CALLBACK OptionsFrameProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, SaveOptions();
// clear all notified settings
- HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ HANDLE hContact = db_find_first();
while (hContact != 0)
{
if(DBGetContactSettingByte(hContact, MODULE_NAME, "StillAbsentNotified", 0))
DBWriteContactSettingByte(hContact, MODULE_NAME, "StillAbsentNotified", 0);
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0);
+ hContact = db_find_next(hContact);
}
// restart timer & run check
diff --git a/plugins/Clist_modern/src/modern_clcitems.cpp b/plugins/Clist_modern/src/modern_clcitems.cpp index 7550a420d5..7c1ec84dda 100644 --- a/plugins/Clist_modern/src/modern_clcitems.cpp +++ b/plugins/Clist_modern/src/modern_clcitems.cpp @@ -392,7 +392,7 @@ void cliRebuildEntireList(HWND hwnd,struct ClcData *dat) }
}
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST,0,0);
+ hContact = db_find_first();
while(hContact)
{
pdisplayNameCacheEntry cacheEntry = NULL;
@@ -436,7 +436,7 @@ void cliRebuildEntireList(HWND hwnd,struct ClcData *dat) if (cont->proto && g_szMetaModuleName && dat->IsMetaContactsEnabled && strcmp(cont->proto,g_szMetaModuleName) == 0)
AddSubcontacts(dat,cont,CLCItems_IsShowOfflineGroup(group));
}
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hContact,0);
+ hContact = db_find_next(hContact);
}
if (style&CLS_HIDEEMPTYGROUPS) {
diff --git a/plugins/Clist_modern/src/modern_extraimage.cpp b/plugins/Clist_modern/src/modern_extraimage.cpp index 5a9cc7bcbc..8cfec7f76c 100644 --- a/plugins/Clist_modern/src/modern_extraimage.cpp +++ b/plugins/Clist_modern/src/modern_extraimage.cpp @@ -243,7 +243,7 @@ void ClearExtraIcons() {
SetNewExtraColumnCount();
- HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST,0,0);
+ HANDLE hContact = db_find_first();
do {
HANDLE hItem = (HANDLE)SendMessage(pcli->hwndContactTree,CLM_FINDCONTACT,(WPARAM)hContact,0);
if (hItem == 0)
@@ -252,7 +252,7 @@ void ClearExtraIcons() for (int i=0;i < EnabledColumnCount;i++)
SendMessage(pcli->hwndContactTree,CLM_SETEXTRAIMAGE,(WPARAM)hItem,MAKELPARAM(i,0xFF));
}
- while(hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hContact,0));
+ while(hContact = db_find_next(hContact));
};
void ExtraImage_SetAllExtraIcons(HWND hwndList,HANDLE hContact)
@@ -301,7 +301,7 @@ void ExtraImage_SetAllExtraIcons(HWND hwndList,HANDLE hContact) if (hContact == NULL)
{
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST,0,0);
+ hContact = db_find_first();
}
do {
@@ -416,7 +416,7 @@ void ExtraImage_SetAllExtraIcons(HWND hwndList,HANDLE hContact) NotifyEventHooks(g_CluiData.hEventExtraImageApplying,(WPARAM)hContact,0);
if (hcontgiven) break;
Sleep(0);
- } while(hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hContact,0));
+ } while(hContact = db_find_next(hContact));
tick = GetTickCount()-tick;
g_mutex_bSetAllExtraIconsCycle = 0;
diff --git a/plugins/Clist_modern/src/modern_viewmodebar.cpp b/plugins/Clist_modern/src/modern_viewmodebar.cpp index ed156c8496..788ef91564 100644 --- a/plugins/Clist_modern/src/modern_viewmodebar.cpp +++ b/plugins/Clist_modern/src/modern_viewmodebar.cpp @@ -190,7 +190,7 @@ static void UpdateStickies() int i;
HANDLE hItem;
- HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ HANDLE hContact = db_find_first();
while(hContact)
{
hItem = (HANDLE)SendDlgItemMessage(clvmHwnd, IDC_CLIST, CLM_FINDCONTACT, (WPARAM)hContact, 0);
@@ -198,7 +198,7 @@ static void UpdateStickies() SendDlgItemMessage(clvmHwnd, IDC_CLIST, CLM_SETCHECKMARK, (WPARAM)hItem, (BYTE)db_get_dw(hContact, CLVM_MODULE, g_szModename, 0) ? 1 : 0);
localMask = HIWORD(db_get_dw(hContact, CLVM_MODULE, g_szModename, 0));
UpdateClistItem(hItem, (localMask == 0 || localMask == stickyStatusMask) ? stickyStatusMask : localMask);
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0);
+ hContact = db_find_next(hContact);
}
for (i = ID_STATUS_OFFLINE; i <= ID_STATUS_OUTTOLUNCH; i++)
@@ -479,7 +479,7 @@ void SaveState() }
dwGlobalMask = GetMaskForItem(hInfoItem);
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ hContact = db_find_first();
while(hContact)
{
hItem = (HANDLE)SendDlgItemMessage(clvmHwnd, IDC_CLIST, CLM_FINDCONTACT, (WPARAM)hContact, 0);
@@ -497,7 +497,7 @@ void SaveState() db_set_dw(hContact, CLVM_MODULE, szModeName, 0);
}
}
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0);
+ hContact = db_find_next(hContact);
}
operators |= ((SendDlgItemMessage(clvmHwnd, IDC_PROTOGROUPOP, CB_GETCURSEL, 0, 0) == 1 ? CLVM_PROTOGROUP_OP : 0) |
(SendDlgItemMessage(clvmHwnd, IDC_GROUPSTATUSOP, CB_GETCURSEL, 0, 0) == 1 ? CLVM_GROUPSTATUS_OP : 0) |
@@ -690,12 +690,12 @@ void DeleteViewMode( char * szName ) pcli->pfnClcBroadcast(CLM_AUTOREBUILD, 0, 0);
SetWindowText(hwndSelector, TranslateT("All contacts"));
}
- HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ HANDLE hContact = db_find_first();
while(hContact)
{
if (db_get_dw(hContact, CLVM_MODULE, szName, -1) != -1)
db_set_dw(hContact, CLVM_MODULE, szName, 0);
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0);
+ hContact = db_find_next(hContact);
}
}
@@ -893,14 +893,14 @@ INT_PTR CALLBACK DlgProcViewModesSetup(HWND hwndDlg, UINT msg, WPARAM wParam, LP case IDC_CLEARALL:
{
HANDLE hItem;
- HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ HANDLE hContact = db_find_first();
while(hContact)
{
hItem = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_FINDCONTACT, (WPARAM)hContact, 0);
if (hItem)
SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETCHECKMARK, (WPARAM)hItem, 0);
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0);
+ hContact = db_find_next(hContact);
}
}
case IDOK:
diff --git a/plugins/Clist_mw/src/CLUIFrames/extraimage.cpp b/plugins/Clist_mw/src/CLUIFrames/extraimage.cpp index 4cec640ebb..ca993eb818 100644 --- a/plugins/Clist_mw/src/CLUIFrames/extraimage.cpp +++ b/plugins/Clist_mw/src/CLUIFrames/extraimage.cpp @@ -247,7 +247,7 @@ void ClearExtraIcons() //SendMessage(pcli->hwndContactTree,CLM_SETEXTRACOLUMNS,EnabledColumnCount,0);
SetNewExtraColumnCount();
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST,0,0);
+ hContact = db_find_first();
do {
hItem = (HANDLE)SendMessage(pcli->hwndContactTree,CLM_FINDCONTACT,(WPARAM)hContact,0);
@@ -257,7 +257,7 @@ void ClearExtraIcons() SendMessage(pcli->hwndContactTree,CLM_SETEXTRAIMAGE,(WPARAM)hItem,MAKELPARAM(i,0xFF));
};
- } while(hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hContact,0));
+ } while(hContact = db_find_next(hContact));
};
void SetAllExtraIcons(HWND hwndList,HANDLE hContact)
@@ -304,7 +304,7 @@ void SetAllExtraIcons(HWND hwndList,HANDLE hContact) }
if ( hContact == NULL )
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST,0,0);
+ hContact = db_find_first();
do {
szProto = NULL;
@@ -385,7 +385,7 @@ void SetAllExtraIcons(HWND hwndList,HANDLE hContact) if (hcontgiven) break;
Sleep(0);
}
- while(hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hContact,0));
+ while(hContact = db_find_next(hContact));
tick = GetTickCount()-tick;
InvalidateRect(hwndList,NULL,FALSE);
diff --git a/plugins/Clist_mw/src/clc.cpp b/plugins/Clist_mw/src/clc.cpp index 305a9a9ded..386fa06f11 100644 --- a/plugins/Clist_mw/src/clc.cpp +++ b/plugins/Clist_mw/src/clc.cpp @@ -49,7 +49,7 @@ static int stopStatusUpdater = 0; void StatusUpdaterThread(void*)
{
int i,curdelay,lastcheck = 0;
- HANDLE hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ HANDLE hContact = db_find_first();
SetThreadPriority(GetCurrentThread(),THREAD_PRIORITY_LOWEST);
@@ -67,10 +67,10 @@ void StatusUpdaterThread(void*) if (pdnce && !pdnce->protoNotExists && pdnce->szProto)
CallContactService(hContact, PSS_GETAWAYMSG, 0, 0);
- hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0);
+ hContact = db_find_next(hContact);
}
if (hContact == NULL) {
- hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ hContact = db_find_first();
if (hContact == NULL)
break;
}
diff --git a/plugins/Clist_mw/src/clcitems.cpp b/plugins/Clist_mw/src/clcitems.cpp index 788cc8f3fd..cf3909024f 100644 --- a/plugins/Clist_mw/src/clcitems.cpp +++ b/plugins/Clist_mw/src/clcitems.cpp @@ -354,7 +354,7 @@ void RebuildEntireList(HWND hwnd,struct ClcData *dat) }
}
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST,0,0);
+ hContact = db_find_first();
while(hContact) {
pdisplayNameCacheEntry cacheEntry;
@@ -393,7 +393,7 @@ void RebuildEntireList(HWND hwnd,struct ClcData *dat) if (strcmp(cont->proto,"MetaContacts") == 0)
AddSubcontacts(cont);
}
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hContact,0);
+ hContact = db_find_next(hContact);
}
if (style&CLS_HIDEEMPTYGROUPS) {
diff --git a/plugins/Clist_mw/src/clistmod.cpp b/plugins/Clist_mw/src/clistmod.cpp index 5f769427f8..2c0561fd7c 100644 --- a/plugins/Clist_mw/src/clistmod.cpp +++ b/plugins/Clist_mw/src/clistmod.cpp @@ -129,10 +129,10 @@ static int ContactListShutdownProc(WPARAM wParam,LPARAM lParam) int LoadContactListModule(void)
{
- HANDLE hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ HANDLE hContact = db_find_first();
while (hContact != NULL) {
DBWriteContactSettingString(hContact, "CList", "StatusMsg", "");
- hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0);
+ hContact = db_find_next(hContact);
}
hCListImages = (HIMAGELIST)CallService(MS_CLIST_GETICONSIMAGELIST, 0, 0);
diff --git a/plugins/Clist_mw/src/clistsettings.cpp b/plugins/Clist_mw/src/clistsettings.cpp index f18a4452f2..d3a9be197a 100644 --- a/plugins/Clist_mw/src/clistsettings.cpp +++ b/plugins/Clist_mw/src/clistsettings.cpp @@ -46,7 +46,7 @@ void InitDisplayNameCache(SortedList *list) list->sortFunc = (FSortFunc)handleCompare;
list->increment = CallService(MS_DB_CONTACT_GETCOUNT,0,0)+1;
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST,0,0);
+ hContact = db_find_first();
i = 0;
while (hContact != 0)
{
@@ -55,7 +55,7 @@ void InitDisplayNameCache(SortedList *list) InvalidateDisplayNameCacheEntryByPDNE(hContact,pdnce,0);
List_GetIndex(list,pdnce,&idx);
List_Insert(list,pdnce,idx);
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hContact,0);
+ hContact = db_find_next(hContact);
i++;
} }
diff --git a/plugins/Clist_mw/src/contact.cpp b/plugins/Clist_mw/src/contact.cpp index d8cf0f37d4..c3c75ec8f4 100644 --- a/plugins/Clist_mw/src/contact.cpp +++ b/plugins/Clist_mw/src/contact.cpp @@ -89,7 +89,7 @@ void LoadContactTree(void) }
hideOffline = DBGetContactSettingByte(NULL,"CList","HideOffline",SETTING_HIDEOFFLINE_DEFAULT);
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST,0,0);
+ hContact = db_find_first();
while(hContact != NULL) {
cacheEntry = GetContactFullCacheEntry(hContact);
@@ -101,7 +101,7 @@ void LoadContactTree(void) status = cacheEntry->status;
if ((!hideOffline || status != ID_STATUS_OFFLINE) && !cacheEntry->bIsHidden)
ChangeContactIcon(hContact,ExtIconFromStatusMode(hContact,(char*)cacheEntry->szProto,status),1);
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hContact,0);
+ hContact = db_find_next(hContact);
}
sortByStatus = DBGetContactSettingByte(NULL,"CList","SortByStatus",SETTING_SORTBYSTATUS_DEFAULT);
sortByProto = DBGetContactSettingByte(NULL,"CList","SortByProto",SETTING_SORTBYPROTO_DEFAULT);
diff --git a/plugins/Clist_nicer/src/clcitems.cpp b/plugins/Clist_nicer/src/clcitems.cpp index fb2ac94c3f..7bc8154533 100644 --- a/plugins/Clist_nicer/src/clcitems.cpp +++ b/plugins/Clist_nicer/src/clcitems.cpp @@ -201,7 +201,7 @@ void RebuildEntireList(HWND hwnd, struct ClcData *dat) }
}
- hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ hContact = db_find_first();
while (hContact) {
if (style & CLS_SHOWHIDDEN || !CLVM_GetContactHiddenStatus(hContact, NULL, dat)) {
ZeroMemory((void *)&dbv, sizeof(dbv));
@@ -225,7 +225,7 @@ void RebuildEntireList(HWND hwnd, struct ClcData *dat) AddContactToGroup(dat, group, hContact);
}
}
- hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0);
+ hContact = db_find_next(hContact);
}
if (style & CLS_HIDEEMPTYGROUPS) {
diff --git a/plugins/Clist_nicer/src/contact.cpp b/plugins/Clist_nicer/src/contact.cpp index 25ac81aaec..ef614af287 100644 --- a/plugins/Clist_nicer/src/contact.cpp +++ b/plugins/Clist_nicer/src/contact.cpp @@ -123,13 +123,13 @@ DWORD WINAPI MF_UpdateThread(LPVOID p) ResetEvent(hEvent);
while(mf_updatethread_running) {
- hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ hContact = db_find_first();
while (hContact != NULL && mf_updatethread_running) {
MF_CalcFrequency(hContact, 50, 1);
if (mf_updatethread_running)
WaitForSingleObject(hEvent, 5000);
ResetEvent(hEvent);
- hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0);
+ hContact = db_find_next(hContact);
}
if (mf_updatethread_running)
WaitForSingleObject(hEvent, 1000000);
@@ -157,7 +157,7 @@ void LoadContactTree(void) }
hideOffline = cfg::getByte("CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT);
- hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ hContact = db_find_first();
while (hContact != NULL) {
status = GetContactStatus(hContact);
if ((!hideOffline || status != ID_STATUS_OFFLINE) && !CLVM_GetContactHiddenStatus(hContact, NULL, NULL))
@@ -175,7 +175,7 @@ void LoadContactTree(void) if (!bMsgFrequency)
MF_CalcFrequency(hContact, 100, 0);
- hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0);
+ hContact = db_find_next(hContact);
}
cfg::writeByte("CList", "fhistdata", 1);
mc_hgh_removed = TRUE;
diff --git a/plugins/Clist_nicer/src/extBackg.cpp b/plugins/Clist_nicer/src/extBackg.cpp index 3b5eda0220..42767f9ad6 100644 --- a/plugins/Clist_nicer/src/extBackg.cpp +++ b/plugins/Clist_nicer/src/extBackg.cpp @@ -1324,7 +1324,7 @@ void LoadPerContactSkins(TCHAR *tszFileName) }
if (items) {
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ hContact = db_find_first();
while(hContact) {
char UIN[40];
int j;
@@ -1380,7 +1380,7 @@ void LoadPerContactSkins(TCHAR *tszFileName) }
}
}
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0);
+ hContact = db_find_next(hContact);
}
}
free(szSections);
diff --git a/plugins/Clist_nicer/src/viewmodes.cpp b/plugins/Clist_nicer/src/viewmodes.cpp index 68608b67c3..17ee84f07a 100644 --- a/plugins/Clist_nicer/src/viewmodes.cpp +++ b/plugins/Clist_nicer/src/viewmodes.cpp @@ -150,7 +150,7 @@ static DWORD GetMaskForItem(HANDLE hItem) static void UpdateStickies()
{
- HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ HANDLE hContact = db_find_first();
HANDLE hItem;
DWORD localMask;
int i;
@@ -161,7 +161,7 @@ static void UpdateStickies() SendDlgItemMessage(clvmHwnd, IDC_CLIST, CLM_SETCHECKMARK, (WPARAM)hItem, cfg::getByte(hContact, "CLVM", g_szModename, 0) ? 1 : 0);
localMask = HIWORD(cfg::getDword(hContact, "CLVM", g_szModename, 0));
UpdateClistItem(hItem, (localMask == 0 || localMask == stickyStatusMask) ? stickyStatusMask : localMask);
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0);
+ hContact = db_find_next(hContact);
}
{
@@ -424,7 +424,7 @@ void SaveState() // GetDlgItemTextA(clvmHwnd, IDC_VARIABLES, vastring, len);
SendDlgItemMessageA(clvmHwnd, IDC_VIEWMODES, LB_GETTEXT, clvm_curItem, (LPARAM)szModeName);
dwGlobalMask = GetMaskForItem(hInfoItem);
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ hContact = db_find_first();
while(hContact) {
hItem = (HANDLE)SendDlgItemMessage(clvmHwnd, IDC_CLIST, CLM_FINDCONTACT, (WPARAM)hContact, 0);
if (hItem) {
@@ -438,7 +438,7 @@ void SaveState() cfg::writeDword(hContact, "CLVM", szModeName, 0);
}
}
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0);
+ hContact = db_find_next(hContact);
}
operators |= ((SendDlgItemMessage(clvmHwnd, IDC_PROTOGROUPOP, CB_GETCURSEL, 0, 0) == 1 ? CLVM_PROTOGROUP_OP : 0) |
(SendDlgItemMessage(clvmHwnd, IDC_GROUPSTATUSOP, CB_GETCURSEL, 0, 0) == 1 ? CLVM_GROUPSTATUS_OP : 0) |
@@ -708,11 +708,11 @@ INT_PTR CALLBACK DlgProcViewModesSetup(HWND hwndDlg, UINT msg, WPARAM wParam, LP pcli->pfnClcBroadcast(CLM_AUTOREBUILD, 0, 0);
SetWindowTextA(hwndSelector, Translate("No view mode"));
}
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ hContact = db_find_first();
while(hContact) {
if (cfg::getDword(hContact, "CLVM", szBuf, -1) != -1)
cfg::writeDword(hContact, "CLVM", szBuf, 0);
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0);
+ hContact = db_find_next(hContact);
}
SendDlgItemMessage(hwndDlg, IDC_VIEWMODES, LB_DELETESTRING, SendDlgItemMessage(hwndDlg, IDC_VIEWMODES, LB_GETCURSEL, 0, 0), 0);
if (SendDlgItemMessage(hwndDlg, IDC_VIEWMODES, LB_SETCURSEL, 0, 0) != LB_ERR) {
@@ -757,13 +757,13 @@ INT_PTR CALLBACK DlgProcViewModesSetup(HWND hwndDlg, UINT msg, WPARAM wParam, LP case IDC_CLEARALL:
{
HANDLE hItem;
- HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ HANDLE hContact = db_find_first();
while(hContact) {
hItem = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_FINDCONTACT, (WPARAM)hContact, 0);
if (hItem)
SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETCHECKMARK, (WPARAM)hItem, 0);
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0);
+ hContact = db_find_next(hContact);
}
}
case IDOK:
@@ -1147,7 +1147,7 @@ void ApplyViewMode(const char *name) g_CluiData.bFilterEffective |= CLVM_FILTER_VARIABLES;
mir_free(dbv.ptszVal);
if (g_CluiData.bFilterEffective & CLVM_FILTER_VARIABLES) {
- HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ HANDLE hContact = db_find_first();
char UIN[256];
char *id, *szProto;
const char *varstring;
@@ -1180,7 +1180,7 @@ void ApplyViewMode(const char *name) }
}
}
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0);
+ hContact = db_find_next(hContact);
}
}
}*/
diff --git a/plugins/CmdLine/src/mimcmd_handlers.cpp b/plugins/CmdLine/src/mimcmd_handlers.cpp index 05994188ae..061edf07b2 100644 --- a/plugins/CmdLine/src/mimcmd_handlers.cpp +++ b/plugins/CmdLine/src/mimcmd_handlers.cpp @@ -1841,7 +1841,7 @@ void HandleContactsCommand(PCommand command, TArgument *argv, int argc, PReply r char buffer[1024];
char protocol[128];
- hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ hContact = db_find_first();
int count = 0;
reply->code = MIMRES_SUCCESS;
@@ -1878,7 +1878,7 @@ void HandleContactsCommand(PCommand command, TArgument *argv, int argc, PReply r free(contact);
free(id);
- hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0);
+ hContact = db_find_next(hContact);
}
}
else{
@@ -1888,7 +1888,7 @@ void HandleContactsCommand(PCommand command, TArgument *argv, int argc, PReply r {
HANDLE hContact = NULL;
char protocol[128];
- hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ hContact = db_find_first();
reply->code = MIMRES_SUCCESS;
*reply->message = 0;
@@ -1907,14 +1907,14 @@ void HandleContactsCommand(PCommand command, TArgument *argv, int argc, PReply r free(contact);
free(id);
- hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0);
+ hContact = db_find_next(hContact);
}
}
else{
if (argc == 3)
{
HANDLE hContact = NULL;
- hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ hContact = db_find_first();
reply->code = MIMRES_SUCCESS;
*reply->message = 0;
@@ -1928,7 +1928,7 @@ void HandleContactsCommand(PCommand command, TArgument *argv, int argc, PReply r HANDLE thread = CreateThread(NULL, NULL, OpenMessageWindowThread, hContact, NULL, &threadID);
}
- hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0);
+ hContact = db_find_next(hContact);
}
}
else {
@@ -1998,7 +1998,7 @@ void HandleHistoryCommand(PCommand command, TArgument *argv, int argc, PReply re {
if (_stricmp(cmd, "unread") == 0)
{
- HANDLE hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ HANDLE hContact = db_find_first();
char buffer[4096];
int count;
int contacts = 0;
@@ -2047,7 +2047,7 @@ void HandleHistoryCommand(PCommand command, TArgument *argv, int argc, PReply re free(contact);
}
- hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0);
+ hContact = db_find_next(hContact);
}
}
else{
diff --git a/plugins/CmdLine/src/utils.cpp b/plugins/CmdLine/src/utils.cpp index 7d1136602f..70e86085cc 100644 --- a/plugins/CmdLine/src/utils.cpp +++ b/plugins/CmdLine/src/utils.cpp @@ -337,7 +337,7 @@ TCHAR *GetContactID(HANDLE hContact, char *szProto) #pragma warning (disable: 4312)
HANDLE GetContactFromID(TCHAR *szID, char *szProto)
{
- HANDLE hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ HANDLE hContact = db_find_first();
TCHAR *szHandle;
TCHAR dispName[1024];
char cProtocol[256];
@@ -359,7 +359,7 @@ HANDLE GetContactFromID(TCHAR *szID, char *szProto) if (szHandle) { free(szHandle); }
if (found) { break; }
- hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0);
+ hContact = db_find_next(hContact);
}
return hContact;
diff --git a/plugins/ContactsPlus/src/utils.cpp b/plugins/ContactsPlus/src/utils.cpp index 1838b3bea8..f0971a37ae 100644 --- a/plugins/ContactsPlus/src/utils.cpp +++ b/plugins/ContactsPlus/src/utils.cpp @@ -125,12 +125,12 @@ TCHAR* MirandaStatusToStringT(int mirandaStatus) HANDLE __fastcall SRCFindFirstContact()
{
- return (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ return db_find_first();
}
HANDLE __fastcall SRCFindNextContact(HANDLE hContact)
{
- return (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0);
+ return db_find_next(hContact);
}
int DBGetContactSettingT(HANDLE hContact, const char *szModule, const char* szSetting, DBVARIANT *dbv)
diff --git a/plugins/CountryFlags/src/extraimg.cpp b/plugins/CountryFlags/src/extraimg.cpp index f019827e21..ccf26b517e 100644 --- a/plugins/CountryFlags/src/extraimg.cpp +++ b/plugins/CountryFlags/src/extraimg.cpp @@ -97,11 +97,11 @@ static void RemoveExtraImages(void) iec.ColumnType=idExtraColumn;
iec.hImage=INVALID_HANDLE_VALUE;
/* enum all contacts */
- hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDFIRST,0,0);
+ hContact=db_find_first();
while(hContact!=NULL) {
/* invalidate icon */
CallService(MS_CLIST_EXTRA_SET_ICON,(WPARAM)hContact,(LPARAM)&iec);
- hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hContact,0);
+ hContact=db_find_next(hContact);
}
}
@@ -119,10 +119,10 @@ static void EnsureExtraImages(void) if(idExtraColumnNew!=idExtraColumn) RemoveExtraImages();
idExtraColumn=idExtraColumnNew;
/* enum all contacts */
- hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDFIRST,0,0);
+ hContact=db_find_first();
while(hContact!=NULL) {
CallFunctionBuffered(SetExtraImage,(LPARAM)hContact,TRUE,EXTRAIMAGE_REFRESHDELAY);
- hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hContact,0);
+ hContact=db_find_next(hContact);
}
}
@@ -250,7 +250,7 @@ static void CALLBACK UpdateStatusIcons(LPARAM lParam) msgwi.uFlags=MSG_WINDOW_UFLAG_MSG_BOTH;
/* enum all opened message windows */
fShow=DBGetContactSettingByte(NULL,"Flags","ShowStatusIconFlag",SETTING_SHOWSTATUSICONFLAG_DEFAULT);
- msgwi.hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDFIRST,0,0);
+ msgwi.hContact=db_find_first();
while(msgwi.hContact!=NULL) {
/* is a message window opened for this contact? */
if (!CallService(MS_MSG_GETWINDOWDATA,(WPARAM)&msgwi,(LPARAM)&msgw) && msgw.uState&MSG_WINDOW_STATE_EXISTS) {
@@ -258,7 +258,7 @@ static void CALLBACK UpdateStatusIcons(LPARAM lParam) if(fShow) SetStatusIcon(msgwi.hContact,countryNumber);
else UnsetStatusIcon(msgwi.hContact,countryNumber);
}
- msgwi.hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)msgw.hContact,0);
+ msgwi.hContact = db_find_next(msgw.hContact);
}
}
diff --git a/plugins/CyrTranslit/src/MirandaContact.cpp b/plugins/CyrTranslit/src/MirandaContact.cpp index 1a0f149ef8..0f5df412b2 100644 --- a/plugins/CyrTranslit/src/MirandaContact.cpp +++ b/plugins/CyrTranslit/src/MirandaContact.cpp @@ -127,8 +127,9 @@ void MirandaContact::generateMenuItemsForAllContacts() void MirandaContact::activateTransliterationProtocolForSubscribedContacts()
{
- int hContact = CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
- if(!hContact) return;
+ HANDLE hContact = db_find_first();
+ if(!hContact)
+ return;
do
{
@@ -138,7 +139,7 @@ void MirandaContact::activateTransliterationProtocolForSubscribedContacts() {
TransliterationProtocol::activateForContact(mc.handle);
}
- } while(hContact = CallService(MS_DB_CONTACT_FINDNEXT, hContact, 0));
+ } while(hContact = db_find_next(hContact));
}
//------------------------------------------------------------------------------
diff --git a/plugins/DbEditorPP/src/copymodule.cpp b/plugins/DbEditorPP/src/copymodule.cpp index 25489a7f52..7dad7a6934 100644 --- a/plugins/DbEditorPP/src/copymodule.cpp +++ b/plugins/DbEditorPP/src/copymodule.cpp @@ -48,7 +48,7 @@ INT_PTR CALLBACK copyModDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara {
int index, loaded;
char szProto[256];
- HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ HANDLE hContact = db_find_first();
while (hContact)
{
@@ -60,7 +60,7 @@ INT_PTR CALLBACK copyModDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara // filter
if ((loaded && Mode == MODE_UNLOADED) || (!loaded && Mode == MODE_LOADED))
{
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0);
+ hContact = db_find_next(hContact);
continue;
}
@@ -127,7 +127,7 @@ INT_PTR CALLBACK copyModDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara SendMessage(GetDlgItem(hwnd, IDC_CONTACTS), CB_SETITEMDATA, index, (LPARAM)hContact);
}
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)(HANDLE)hContact, 0);
+ hContact = db_find_next(hContact);
}
index = (int)SendMessage(GetDlgItem(hwnd, IDC_CONTACTS), CB_INSERTSTRING, 0, (LPARAM)(char*)Translate("Settings"));
@@ -157,12 +157,12 @@ INT_PTR CALLBACK copyModDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara else
{
SetCursor(LoadCursor(NULL,IDC_WAIT));
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ hContact = db_find_first();
while (hContact)
{
copyModule(mac->module, mac->hContact, hContact);
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)(HANDLE)hContact, 0);
+ hContact = db_find_next(hContact);
}
SetCursor(LoadCursor(NULL,IDC_ARROW));
diff --git a/plugins/DbEditorPP/src/deletemodule.cpp b/plugins/DbEditorPP/src/deletemodule.cpp index a0eddf73a1..c4a3fba820 100644 --- a/plugins/DbEditorPP/src/deletemodule.cpp +++ b/plugins/DbEditorPP/src/deletemodule.cpp @@ -53,7 +53,7 @@ void __cdecl PopulateModuleDropListThreadFunc(LPVOID di) module = (struct ModSetLinkLinkItem *)module->next;
continue;
}
- for (hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);moduleEmpty && hContact;hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0))
+ for (hContact = db_find_first();moduleEmpty && hContact;hContact = db_find_next(hContact))
{
if (!IsModuleEmpty(hContact,module->name))
{
@@ -103,13 +103,13 @@ INT_PTR CALLBACK DeleteModuleDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM case IDOK:
{
char text[128];
- HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ HANDLE hContact = db_find_first();
GetDlgItemText(hwnd,IDC_CONTACTS,text,128);
SetCursor(LoadCursor(NULL,IDC_WAIT));
while (hContact)
{
deleteModule(text,hContact,1);
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0);
+ hContact = db_find_next(hContact);
}
// do the null
deleteModule(text,NULL,1);
diff --git a/plugins/DbEditorPP/src/exportimport.cpp b/plugins/DbEditorPP/src/exportimport.cpp index ad9f508a21..ee5f6762f8 100644 --- a/plugins/DbEditorPP/src/exportimport.cpp +++ b/plugins/DbEditorPP/src/exportimport.cpp @@ -243,7 +243,7 @@ void exportDB(HANDLE hContact, char* module) // hContact == -1 export entire db. if (module == "") module = NULL; // reset module for all contacts export
}
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ hContact = db_find_first();
while (hContact)
{
@@ -260,7 +260,7 @@ void exportDB(HANDLE hContact, char* module) // hContact == -1 export entire db. if ((loaded && Mode == MODE_UNLOADED) || (!loaded && Mode == MODE_LOADED))
{
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0);
+ hContact = db_find_next(hContact);
continue;
}
}
@@ -287,7 +287,7 @@ void exportDB(HANDLE hContact, char* module) // hContact == -1 export entire db. {
exportModule(hContact, module, file);
}
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)(HANDLE)hContact, 0);
+ hContact = db_find_next(hContact);
}
}
// exporting a contact
@@ -337,7 +337,7 @@ HANDLE CheckNewContact(char *myProto, char *uid, char *myName) {
char szProto[256], szName[256];
HANDLE resultHandle = INVALID_HANDLE_VALUE;
- HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ HANDLE hContact = db_find_first();
while (hContact)
{
@@ -358,7 +358,7 @@ HANDLE CheckNewContact(char *myProto, char *uid, char *myName) }
}
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0);
+ hContact = db_find_next(hContact);
}
return resultHandle;
diff --git a/plugins/DbEditorPP/src/findwindow.cpp b/plugins/DbEditorPP/src/findwindow.cpp index b9957cd246..e8fd22aa70 100644 --- a/plugins/DbEditorPP/src/findwindow.cpp +++ b/plugins/DbEditorPP/src/findwindow.cpp @@ -563,10 +563,10 @@ void __cdecl FindSettings(LPVOID di) else
{
NULLContactDone = 1;
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ hContact = db_find_first();
}
}
- else hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0);
+ else hContact = db_find_next(hContact);
module = ModuleList.first;
while (module)
diff --git a/plugins/DbEditorPP/src/modules.cpp b/plugins/DbEditorPP/src/modules.cpp index 4053180038..2e650b2fe4 100644 --- a/plugins/DbEditorPP/src/modules.cpp +++ b/plugins/DbEditorPP/src/modules.cpp @@ -63,13 +63,13 @@ INT_PTR CALLBACK AddModDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam GetDlgItemText(hwnd, IDC_MODNAME, modulename, 256);
if (IsDlgButtonChecked(hwnd,CHK_ADD2ALL))
{
- HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ HANDLE hContact = db_find_first();
// null contact
DBWriteContactSettingByte(NULL, modulename, "(Default)", 0);
while (hContact)
{
DBWriteContactSettingByte(hContact, modulename, "(Default)", 0);
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)(HANDLE)hContact, 0);
+ hContact = db_find_next(hContact);
}
}
else
diff --git a/plugins/DbEditorPP/src/moduletree.cpp b/plugins/DbEditorPP/src/moduletree.cpp index b5554cabc5..292e3a6af6 100644 --- a/plugins/DbEditorPP/src/moduletree.cpp +++ b/plugins/DbEditorPP/src/moduletree.cpp @@ -24,7 +24,7 @@ int doContacts(HWND hwnd2Tree,HTREEITEM contactsRoot,ModuleSettingLL *modlist, H // mir_snprintf(title, sizeof(title),Translate("Loading contacts..."));
SetWindowText(hwnd2mainWindow, Translate("Loading contacts..."));
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ hContact = db_find_first();
tvi.hInsertAfter = TVI_SORT;
tvi.item.cChildren = 1;
@@ -48,7 +48,7 @@ int doContacts(HWND hwnd2Tree,HTREEITEM contactsRoot,ModuleSettingLL *modlist, H // filter
if ((loaded && Mode == MODE_UNLOADED) || (!loaded && Mode == MODE_LOADED))
{
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0);
+ hContact = db_find_next(hContact);
continue;
}
@@ -177,7 +177,7 @@ int doContacts(HWND hwnd2Tree,HTREEITEM contactsRoot,ModuleSettingLL *modlist, H }
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0);
+ hContact = db_find_next(hContact);
}
@@ -795,7 +795,7 @@ void moduleListWM_NOTIFY(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam)// hwnd if (mtis->type == CONTACT_ROOT_ITEM && !hContact)
{
multi = 1;
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ hContact = db_find_first();
}
while(hContact && hwnd2mainWindow)
@@ -810,7 +810,7 @@ void moduleListWM_NOTIFY(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam)// hwnd if ((loaded && Mode == MODE_UNLOADED) || (!loaded && Mode == MODE_LOADED))
{
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0);
+ hContact = db_find_next(hContact);
continue;
}
}
@@ -831,7 +831,7 @@ void moduleListWM_NOTIFY(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam)// hwnd if (!multi) break;
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0);
+ hContact = db_find_next(hContact);
}
}
diff --git a/plugins/Dbx_mmap_SA/src/security.cpp b/plugins/Dbx_mmap_SA/src/security.cpp index 260ab11727..172c1ff2f6 100644 --- a/plugins/Dbx_mmap_SA/src/security.cpp +++ b/plugins/Dbx_mmap_SA/src/security.cpp @@ -201,7 +201,7 @@ void CDdxMmapSA::EncodeAll() {
HANDLE hContact;
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ hContact = db_find_first();
if (hContact){
do {
EncodeContactEvents(hContact);
@@ -218,12 +218,12 @@ void CDdxMmapSA::DecodeAll() {
HANDLE hContact;
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ hContact = db_find_first();
if (hContact){
do{
DecodeContactEvents(hContact);
DecodeContactSettings(hContact);
- }while(hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0));
+ }while(hContact = db_find_next(hContact));
}
DecodeContactEvents(NULL);
DecodeContactSettings(NULL);
diff --git a/plugins/ExtraIcons/src/DefaultExtraIcons.cpp b/plugins/ExtraIcons/src/DefaultExtraIcons.cpp index 8da08d6b4b..05d1f9eed6 100644 --- a/plugins/ExtraIcons/src/DefaultExtraIcons.cpp +++ b/plugins/ExtraIcons/src/DefaultExtraIcons.cpp @@ -298,14 +298,14 @@ static void DBExtraIconsInit() info.hExtraIcon = ExtraIcon_Register(info.name, info.desc, info.icon);
}
- HANDLE hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ HANDLE hContact = db_find_first();
while (hContact != NULL)
{
SetExtraIcons(hContact);
SetVisibility(hContact, -1, FALSE);
SetGender(hContact, -1, FALSE);
- hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0);
+ hContact = db_find_next(hContact);
}
HookEvent(ME_DB_CONTACT_SETTINGCHANGED, SettingChanged);
diff --git a/plugins/ExtraIcons/src/ExtraIcon.cpp b/plugins/ExtraIcons/src/ExtraIcon.cpp index e681e3139d..4ace1dee02 100644 --- a/plugins/ExtraIcons/src/ExtraIcon.cpp +++ b/plugins/ExtraIcons/src/ExtraIcon.cpp @@ -63,7 +63,7 @@ void ExtraIcon::applyIcons() if (!isEnabled())
return;
- HANDLE hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ HANDLE hContact = db_find_first();
while (hContact != NULL)
{
// Clear to assert that it will be cleared
@@ -71,7 +71,7 @@ void ExtraIcon::applyIcons() applyIcon(hContact);
- hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0);
+ hContact = db_find_next(hContact);
}
}
diff --git a/plugins/ExtraIcons/src/options.cpp b/plugins/ExtraIcons/src/options.cpp index f1f1371403..18d7b361a6 100644 --- a/plugins/ExtraIcons/src/options.cpp +++ b/plugins/ExtraIcons/src/options.cpp @@ -56,12 +56,12 @@ BOOL ScreenToClient(HWND hWnd, LPRECT lpRect) static void RemoveExtraIcons(int slot)
{
- HANDLE hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ HANDLE hContact = db_find_first();
while (hContact != NULL)
{
Clist_SetExtraIcon(hContact, slot, INVALID_HANDLE_VALUE);
- hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0);
+ hContact = db_find_next(hContact);
}
}
diff --git a/plugins/FavContacts/src/contact_cache.cpp b/plugins/FavContacts/src/contact_cache.cpp index 9464c22a77..19d3c42d82 100644 --- a/plugins/FavContacts/src/contact_cache.cpp +++ b/plugins/FavContacts/src/contact_cache.cpp @@ -84,7 +84,7 @@ void CContactCache::Rebuild() unsigned long timestamp = time(NULL);
m_lastUpdate = time(NULL);
- HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ HANDLE hContact = db_find_first();
while (hContact)
{
TContactInfo *info = new TContactInfo;
@@ -111,7 +111,7 @@ void CContactCache::Rebuild() }
m_cache.insert(info);
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0);
+ hContact = db_find_next(hContact);
}
}
diff --git a/plugins/FavContacts/src/favlist.h b/plugins/FavContacts/src/favlist.h index 6201126b44..0b793b2185 100644 --- a/plugins/FavContacts/src/favlist.h +++ b/plugins/FavContacts/src/favlist.h @@ -103,8 +103,8 @@ public: nGroups = 1;
- HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
- for ( ; hContact; hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0))
+ HANDLE hContact = db_find_first();
+ for ( ; hContact; hContact = db_find_next(hContact))
if (DBGetContactSettingByte(hContact, "FavContacts", "IsFavourite", 0))
{
TCHAR *group = addContact(hContact, true)->getGroup();
diff --git a/plugins/FavContacts/src/main.cpp b/plugins/FavContacts/src/main.cpp index c359462267..f49df5b5c5 100644 --- a/plugins/FavContacts/src/main.cpp +++ b/plugins/FavContacts/src/main.cpp @@ -257,8 +257,8 @@ int ProcessModulesLoaded(WPARAM wParam, LPARAM lParam) Hotkey_Register(&hotkey);
if (ServiceExists(MS_AV_GETAVATARBITMAP)) {
- HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
- for ( ; hContact; hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0))
+ HANDLE hContact = db_find_first();
+ for ( ; hContact; hContact = db_find_next(hContact))
if (DBGetContactSettingByte(hContact, "FavContacts", "IsFavourite", 0))
CallService(MS_AV_GETAVATARBITMAP, (WPARAM)hContact, 0);
}
@@ -1211,10 +1211,10 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA SendMessage(GetDlgItem(hwnd, IDC_CLIST), CLM_SETEXSTYLE, CLS_EX_DISABLEDRAGDROP|CLS_EX_TRACKSELECT, 0);
sttResetListOptions(GetDlgItem(hwnd, IDC_CLIST));
- hSelectedContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ hSelectedContact = db_find_first();
- HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
- for ( ; hContact; hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0))
+ HANDLE hContact = db_find_first();
+ for ( ; hContact; hContact = db_find_next(hContact))
{
SendDlgItemMessage(hwnd, IDC_CLIST, CLM_SETCHECKMARK,
SendDlgItemMessage(hwnd, IDC_CLIST, CLM_FINDCONTACT, (WPARAM)hContact, 0),
@@ -1343,8 +1343,8 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA sttSaveOptions();
- HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
- for ( ; hContact; hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0))
+ HANDLE hContact = db_find_first();
+ for ( ; hContact; hContact = db_find_next(hContact))
{
BYTE fav = SendDlgItemMessage(hwnd, IDC_CLIST, CLM_GETCHECKMARK,
SendDlgItemMessage(hwnd, IDC_CLIST, CLM_FINDCONTACT, (WPARAM)hContact, 0), 0);
@@ -1366,8 +1366,8 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA case CLN_NEWCONTACT:
{
int iSelection = (int)((NMCLISTCONTROL *)lParam)->hItem;
- HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
- for ( ; hContact; hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0))
+ HANDLE hContact = db_find_first();
+ for ( ; hContact; hContact = db_find_next(hContact))
if (SendDlgItemMessage(hwnd, IDC_CLIST, CLM_FINDCONTACT, (WPARAM)hContact, 0) == iSelection)
{
SendDlgItemMessage(hwnd, IDC_CLIST, CLM_SETCHECKMARK, iSelection,
@@ -1380,8 +1380,8 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA case CLN_CHECKCHANGED:
{
int iSelection = (int)((NMCLISTCONTROL *)lParam)->hItem;
- HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
- for ( ; hContact; hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0))
+ HANDLE hContact = db_find_first();
+ for ( ; hContact; hContact = db_find_next(hContact))
if (SendDlgItemMessage(hwnd, IDC_CLIST, CLM_FINDCONTACT, (WPARAM)hContact, 0) == iSelection)
break;
if (hContact)
diff --git a/plugins/FloatingContacts/src/main.cpp b/plugins/FloatingContacts/src/main.cpp index f51e1f6d34..e7b8c054bb 100644 --- a/plugins/FloatingContacts/src/main.cpp +++ b/plugins/FloatingContacts/src/main.cpp @@ -1045,10 +1045,10 @@ void SaveContactsPos() static void LoadContacts()
{
- HANDLE hContact = (HANDLE)CallService( MS_DB_CONTACT_FINDFIRST, 0, 0) ;
+ HANDLE hContact = db_find_first() ;
while( hContact != NULL ) {
LoadContact( hContact );
- hContact = (HANDLE)CallService( MS_DB_CONTACT_FINDNEXT, ( WPARAM ) hContact, 0 );
+ hContact = db_find_next(hContact);
}
}
diff --git a/plugins/Gender/src/main.cpp b/plugins/Gender/src/main.cpp index fad396db26..f778fa11f6 100644 --- a/plugins/Gender/src/main.cpp +++ b/plugins/Gender/src/main.cpp @@ -288,12 +288,12 @@ int onModulesLoaded(WPARAM wParam,LPARAM lParam) g_hExtraIcon = ExtraIcon_Register("gender", "Gender", "menu_icon");
if (g_hExtraIcon != NULL)
{
- HANDLE hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ HANDLE hContact = db_find_first();
while (hContact != NULL)
{
onExtraImageApplying((WPARAM) hContact, 0);
- hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0);
+ hContact = db_find_next(hContact);
}
}
else
diff --git a/plugins/Gender/src/options.cpp b/plugins/Gender/src/options.cpp index 4d4875c0af..c6537e4ca2 100644 --- a/plugins/Gender/src/options.cpp +++ b/plugins/Gender/src/options.cpp @@ -108,11 +108,11 @@ INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP if (bEnableClistIcon)
{
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ hContact = db_find_first();
while (hContact)
{
CallService(MS_CLIST_EXTRA_SET_ICON, (WPARAM)hContact, (LPARAM)&g_IECClear);
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0);
+ hContact = db_find_next(hContact);
}
}
@@ -127,11 +127,11 @@ INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP if (g_hExtraIcon != NULL || bEnableClistIcon)
{
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ hContact = db_find_first();
while (hContact)
{
onExtraImageApplying((WPARAM)hContact,0);
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0);
+ hContact = db_find_next(hContact);
}
}
diff --git a/plugins/HistorySweeperLight/src/historysweeperlight.cpp b/plugins/HistorySweeperLight/src/historysweeperlight.cpp index 50e37ddc34..ce59001dda 100644 --- a/plugins/HistorySweeperLight/src/historysweeperlight.cpp +++ b/plugins/HistorySweeperLight/src/historysweeperlight.cpp @@ -215,7 +215,7 @@ void SweepHistoryFromContact(HANDLE hContact, CriteriaStruct Criteria, BOOL keep void ShutdownAction(void)
{
CriteriaStruct Criteria;
- HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ HANDLE hContact = db_find_first();
Criteria.keep = KeepCriteria(DBGetContactSettingByte(NULL, ModuleName, "StartupShutdownKeep", 0));
Criteria.time = BuildCriteria(DBGetContactSettingByte(NULL, ModuleName, "StartupShutdownOlder", 0));
@@ -226,7 +226,7 @@ void ShutdownAction(void) {
SweepHistoryFromContact(hContact, Criteria, TRUE); // sweep contact history, keepunread==1
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0); // go to next contact
+ hContact = db_find_next(hContact); // go to next contact
}
}
diff --git a/plugins/HistorySweeperLight/src/main.cpp b/plugins/HistorySweeperLight/src/main.cpp index fdbb6f3cd3..64fcc8a4f3 100644 --- a/plugins/HistorySweeperLight/src/main.cpp +++ b/plugins/HistorySweeperLight/src/main.cpp @@ -78,7 +78,7 @@ int OnModulesLoaded(WPARAM wParam, LPARAM lParam) {
StatusIconData sid = {0};
int i, sweep = DBGetContactSettingByte(NULL, ModuleName, "SweepHistory", 0);
- HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ HANDLE hContact = db_find_first();
sid.cbSize = sizeof(sid);
sid.szModule = ModuleName;
@@ -136,7 +136,7 @@ int OnModulesLoaded(WPARAM wParam, LPARAM lParam) CallService(MS_MSG_MODIFYICON, (WPARAM)hContact, (LPARAM)&sid);
}
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0);
+ hContact = db_find_next(hContact);
}
hHooks[2] = HookEvent(ME_MSG_WINDOWEVENT, OnWindowEvent);
diff --git a/plugins/HistorySweeperLight/src/options.cpp b/plugins/HistorySweeperLight/src/options.cpp index 2963f8bb2b..a49cf77684 100644 --- a/plugins/HistorySweeperLight/src/options.cpp +++ b/plugins/HistorySweeperLight/src/options.cpp @@ -133,8 +133,8 @@ static void ShowAllContactIcons(HWND hwndList) SendMessage(hwndList, CLM_SETEXTRAIMAGE, (WPARAM)hSystemHistory,
MAKELPARAM(0, DBGetContactSettingByte(NULL, ModuleName, "SweepSHistory", 0)));
- for (hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDFIRST,0,0); hContact;
- hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hContact,0))
+ for (hContact=db_find_first(); hContact;
+ hContact=db_find_next(hContact))
{
hItem = (HANDLE)SendMessage(hwndList, CLM_FINDCONTACT, (WPARAM)hContact, 0);
SendMessage(hwndList, CLM_SETEXTRAIMAGE, (WPARAM)hItem,
@@ -201,8 +201,8 @@ void SaveSettings(HWND hwndDlg) DBWriteContactSettingByte(NULL, ModuleName, "SweepSHistory",
(BYTE)SendMessage(hwndList, CLM_GETEXTRAIMAGE, (WPARAM)hSystemHistory, 0));
- for (hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDFIRST,0,0); hContact;
- hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hContact,0))
+ for (hContact=db_find_first(); hContact;
+ hContact=db_find_next(hContact))
{
hItem = (HANDLE)SendMessage(hwndList, CLM_FINDCONTACT, (WPARAM)hContact, 0);
diff --git a/plugins/IgnoreState/src/main.cpp b/plugins/IgnoreState/src/main.cpp index c68e6f6d2d..2cea928f09 100644 --- a/plugins/IgnoreState/src/main.cpp +++ b/plugins/IgnoreState/src/main.cpp @@ -229,11 +229,11 @@ int onModulesLoaded(WPARAM wParam,LPARAM lParam) if (hExtraIcon != NULL)
{
// Set initial value for all contacts
- HANDLE hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ HANDLE hContact = db_find_first();
while (hContact != NULL)
{
onExtraImageApplying((WPARAM)hContact, NULL);
- hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0);
+ hContact = db_find_next(hContact);
}
}
else
diff --git a/plugins/IgnoreState/src/options.cpp b/plugins/IgnoreState/src/options.cpp index eda6b6ffea..ba1f01488e 100644 --- a/plugins/IgnoreState/src/options.cpp +++ b/plugins/IgnoreState/src/options.cpp @@ -230,20 +230,20 @@ INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP //Store options values to DB
DBWriteContactSettingByte(NULL, MODULENAME, "AdvancedIcon", clistIcon);
- HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ HANDLE hContact = db_find_first();
while (hContact)
{
CallService(MS_CLIST_EXTRA_SET_ICON, (WPARAM)hContact, (LPARAM)&g_IECClear);
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0);
+ hContact = db_find_next(hContact);
}
g_IECClear.ColumnType = clistIcon;
if (hExtraIcon == NULL)
onExtraImageListRebuild(0,0);
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ hContact = db_find_first();
while (hContact)
{
onExtraImageApplying((WPARAM)hContact,0);
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0);
+ hContact = db_find_next(hContact);
}
}
}
diff --git a/plugins/KeyboardNotify/src/ignore.cpp b/plugins/KeyboardNotify/src/ignore.cpp index 4ad9e593f2..d27907efcc 100644 --- a/plugins/KeyboardNotify/src/ignore.cpp +++ b/plugins/KeyboardNotify/src/ignore.cpp @@ -192,7 +192,7 @@ static void SetAllContactIcons(HWND hwndList) DWORD protoCaps;
char *szProto;
- hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ hContact=db_find_first();
do {
hItem = (HANDLE)SendMessage(hwndList, CLM_FINDCONTACT, (WPARAM)hContact, 0);
if(hItem && SendMessage(hwndList, CLM_GETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(IGNOREEVENT_MAX, 0)) == 0xFF) {
@@ -203,7 +203,7 @@ static void SetAllContactIcons(HWND hwndList) protoCaps = CallProtoService(szProto, PS_GETCAPS,PFLAGNUM_1, 0);
InitialiseItem(hwndList, hContact, hItem, protoCaps);
}
- } while(hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0));
+ } while(hContact = db_find_next(hContact));
}
INT_PTR CALLBACK DlgProcIgnoreOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -318,12 +318,12 @@ INT_PTR CALLBACK DlgProcIgnoreOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPA case PSN_APPLY:
{ HANDLE hContact, hItem;
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ hContact = db_find_first();
do {
hItem = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_FINDCONTACT, (WPARAM)hContact, 0);
if(hItem)
SaveItemMask(GetDlgItem(hwndDlg, IDC_LIST), hContact, hItem, "Mask1");
- } while(hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0));
+ } while(hContact = db_find_next(hContact));
SaveItemMask(GetDlgItem(hwndDlg, IDC_LIST), NULL, hItemAll, "Default1");
SaveItemMask(GetDlgItem(hwndDlg, IDC_LIST), NULL, hItemUnknown, "Mask1");
return TRUE;
diff --git a/plugins/ListeningTo/src/listeningto.cpp b/plugins/ListeningTo/src/listeningto.cpp index 1aa54ba0af..f8fa9e701c 100644 --- a/plugins/ListeningTo/src/listeningto.cpp +++ b/plugins/ListeningTo/src/listeningto.cpp @@ -317,7 +317,7 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam) hExtraIcon = ExtraIcon_Register(MODULE_NAME, "Listening to music", "listening_to_icon");
if (hExtraIcon != NULL)
{
- HANDLE hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ HANDLE hContact = db_find_first();
while (hContact != NULL)
{
char *proto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hContact, 0);
@@ -333,7 +333,7 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam) }
}
- hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0);
+ hContact = db_find_next(hContact);
}
}
else if (hExtraIcon == NULL && ServiceExists(MS_CLIST_EXTRA_ADD_ICON))
diff --git a/plugins/ListeningTo/src/players/mradio.cpp b/plugins/ListeningTo/src/players/mradio.cpp index 27b4685cb7..84fdd61b95 100644 --- a/plugins/ListeningTo/src/players/mradio.cpp +++ b/plugins/ListeningTo/src/players/mradio.cpp @@ -38,7 +38,7 @@ int MRadio::GetData() {
HANDLE hContact;
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ hContact = db_find_first();
while (hContact != NULL)
{
char *proto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0);
@@ -52,7 +52,7 @@ int MRadio::GetData() }
}
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0);
+ hContact = db_find_next(hContact);
}
if (hContact)
diff --git a/plugins/MetaContacts/src/addto.cpp b/plugins/MetaContacts/src/addto.cpp index b92e97b978..efde87e05f 100644 --- a/plugins/MetaContacts/src/addto.cpp +++ b/plugins/MetaContacts/src/addto.cpp @@ -54,7 +54,7 @@ typedef struct { int FillList(HWND list, BOOL sort)
{
DWORD metaID;
- HANDLE hMetaUser = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST,0,0);
+ HANDLE hMetaUser = db_find_first();
int i=0;
int index;
//BOOL mbs = FALSE;
@@ -64,11 +64,10 @@ int FillList(HWND list, BOOL sort) if ((metaID=DBGetContactSettingDword(hMetaUser,META_PROTO,META_ID,(DWORD)-1))==(DWORD)-1)
{
// This isn't a MetaContact, go to the next
- hMetaUser = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hMetaUser,0);
+ hMetaUser = db_find_next(hMetaUser);
continue;
}
-
{
// get contact display name from clist
char *szCDN = (char *) CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hMetaUser, 0);
@@ -128,7 +127,7 @@ int FillList(HWND list, BOOL sort) i++;
- hMetaUser = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hMetaUser,0);
+ hMetaUser = db_find_next(hMetaUser);
}
return i;
}
diff --git a/plugins/MetaContacts/src/meta_main.cpp b/plugins/MetaContacts/src/meta_main.cpp index 5aae726ace..8a05fe1f7b 100644 --- a/plugins/MetaContacts/src/meta_main.cpp +++ b/plugins/MetaContacts/src/meta_main.cpp @@ -168,7 +168,7 @@ extern "C" __declspec(dllexport) int Load(void) //set all contacts to 'offline', and initialize subcontact counter for db consistency check
{
- HANDLE hContact = (HANDLE)CallService( MS_DB_CONTACT_FINDFIRST, 0, 0);
+ HANDLE hContact = db_find_first();
char *proto;
while(hContact != NULL) {
//proto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0);
@@ -189,7 +189,7 @@ extern "C" __declspec(dllexport) int Load(void) DBFreeVariant(&dbv);
}
- hContact = ( HANDLE )CallService( MS_DB_CONTACT_FINDNEXT,( WPARAM )hContact, 0 );
+ hContact = db_find_next(hContact);
}
}
diff --git a/plugins/MetaContacts/src/meta_menu.cpp b/plugins/MetaContacts/src/meta_menu.cpp index e71e9357a5..9cb430f8d5 100644 --- a/plugins/MetaContacts/src/meta_menu.cpp +++ b/plugins/MetaContacts/src/meta_menu.cpp @@ -260,7 +260,7 @@ INT_PTR Meta_Delete(WPARAM wParam,LPARAM lParam) }
}
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST,0,0);
+ hContact = db_find_first();
while(hContact)
{ // Scans the database to get all the contacts that have been previously linked to this MetaContact
if (DBGetContactSettingDword(hContact,META_PROTO,META_LINK,(DWORD)-1)==metaID)
@@ -278,7 +278,7 @@ INT_PTR Meta_Delete(WPARAM wParam,LPARAM lParam) if (options.suppress_status)
CallService(MS_IGNORE_UNIGNORE, (WPARAM)hContact, (WPARAM)IGNOREEVENT_USERONLINE);
}
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hContact,0);
+ hContact = db_find_next(hContact);
}
//DBDeleteContactSetting((HANDLE)wParam, META_PROTO, META_ID);
//DBDeleteContactSetting((HANDLE)wParam, META_PROTO, "NumContacts");
diff --git a/plugins/MetaContacts/src/meta_services.cpp b/plugins/MetaContacts/src/meta_services.cpp index d4c5ea8a1b..26609d23be 100644 --- a/plugins/MetaContacts/src/meta_services.cpp +++ b/plugins/MetaContacts/src/meta_services.cpp @@ -711,13 +711,13 @@ int Meta_SettingChanged(WPARAM wParam, LPARAM lParam) // import process has just been run...call startup routines...
Meta_SetHandles();
{
- HANDLE hContact = ( HANDLE )CallService( MS_DB_CONTACT_FINDFIRST, 0, 0 );
+ HANDLE hContact = db_find_first();
int meta_id;
while ( hContact != NULL ) {
if ((meta_id = DBGetContactSettingDword(hContact,META_PROTO,META_ID,(DWORD)-1))!=(DWORD)-1) {
Meta_CopyData(hContact);
}
- hContact = ( HANDLE )CallService( MS_DB_CONTACT_FINDNEXT,( WPARAM )hContact, 0 );
+ hContact = db_find_next(hContact);
}
}
@@ -1257,13 +1257,13 @@ int Meta_ModulesLoaded(WPARAM wParam, LPARAM lParam) // loop and copy data from subcontacts
if (options.copydata) {
- HANDLE hContact = ( HANDLE )CallService( MS_DB_CONTACT_FINDFIRST, 0, 0 );
+ HANDLE hContact = db_find_first();
int meta_id;
while ( hContact != NULL ) {
if ((meta_id = DBGetContactSettingDword(hContact,META_PROTO,META_ID,(DWORD)-1))!=(DWORD)-1) {
Meta_CopyData(hContact);
}
- hContact = ( HANDLE )CallService( MS_DB_CONTACT_FINDNEXT,( WPARAM )hContact, 0 );
+ hContact = db_find_next(hContact);
}
}
diff --git a/plugins/MetaContacts/src/meta_utils.cpp b/plugins/MetaContacts/src/meta_utils.cpp index 0ed0abf9c8..0b9c6a24e1 100644 --- a/plugins/MetaContacts/src/meta_utils.cpp +++ b/plugins/MetaContacts/src/meta_utils.cpp @@ -114,7 +114,7 @@ HANDLE Meta_GetHandle(const char *protocol, DBVARIANT *id) return NULL;
field = (char *)CallProtoService(protocol,PS_GETCAPS,PFLAG_UNIQUEIDSETTING,0);
- hUser = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST,0,0);
+ hUser = db_find_first();
while(hUser)
{ // Scan the database and retrieve the field for each contact
if (!DBGetContactSetting(hUser,protocol,field,&dbv))
@@ -179,7 +179,7 @@ HANDLE Meta_GetHandle(const char *protocol, DBVARIANT *id) DBFreeVariant(&dbv);
} // end if (!DBGetContactSetting(hUser,protocol,field,&dbv))
// This contact wasn't the good one, go to the next.
- hUser = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hUser,0);
+ hUser = db_find_next(hUser);
} // end while
return NULL;
}
@@ -762,7 +762,7 @@ HANDLE Meta_GetContactHandle(HANDLE hMeta, int contact_number) { int Meta_SetHandles(void) {
DWORD meta_id, num_contacts, contact_number;
- HANDLE hContact2, hContact = ( HANDLE )CallService( MS_DB_CONTACT_FINDFIRST, 0, 0 ), hNextContact;
+ HANDLE hContact2, hContact = db_find_first(), hNextContact;
char buffer[512], buffer2[512];
char nick_buffer[128];
BOOL found;
@@ -783,7 +783,7 @@ int Meta_SetHandles(void) { // problem!
MessageBox(0, Translate("Subcontact contact number < 0 - deleting MetaContact"), nick_buffer, MB_OK | MB_ICONERROR);
//CallService(MS_DB_CONTACT_DELETE, (WPARMA)hContact, 0);
- hNextContact = ( HANDLE )CallService( MS_DB_CONTACT_FINDNEXT,( WPARAM )hContact, 0 );
+ hNextContact = db_find_next(hContact);
Meta_Delete((WPARAM)hContact, (LPARAM)1);
hContact = hNextContact;
continue;
@@ -796,7 +796,7 @@ int Meta_SetHandles(void) { // find metacontact
found = FALSE;
- hContact2 = ( HANDLE )CallService( MS_DB_CONTACT_FINDFIRST, 0, 0 );
+ hContact2 = db_find_first();
while ( hContact2 != NULL ) {
if (DBGetContactSettingDword(hContact2,META_PROTO,META_ID,(DWORD)-1) == meta_id) {
@@ -821,7 +821,7 @@ int Meta_SetHandles(void) { sprintf(buff, Translate("Subcontact contact number (%d) > meta num contacts (%d) - deleting MetaContact"), (int)contact_number, (int)num_contacts);
MessageBox(0, buff, nick_buffer, MB_OK | MB_ICONERROR);
//CallService(MS_DB_CONTACT_DELETE, (WPARMA)hContact, 0);
- hNextContact = ( HANDLE )CallService( MS_DB_CONTACT_FINDNEXT,( WPARAM )hContact, 0 );
+ hNextContact = db_find_next(hContact);
Meta_Delete((WPARAM)hContact, (LPARAM)1);
hContact = hNextContact;
continue;
@@ -829,7 +829,7 @@ int Meta_SetHandles(void) { }
}
- hContact2 = ( HANDLE )CallService( MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact2, 0 );
+ hContact2 = db_find_next(hContact2);
}
if (!found) {
@@ -875,7 +875,7 @@ int Meta_SetHandles(void) { // problem
MessageBox(0, Translate("MetaContact number of contacts < 0 - deleting MetaContact"), nick_buffer, MB_OK | MB_ICONERROR);
//CallService(MS_DB_CONTACT_DELETE, (WPARMA)hContact, 0);
- hNextContact = ( HANDLE )CallService( MS_DB_CONTACT_FINDNEXT,( WPARAM )hContact, 0 );
+ hNextContact = db_find_next(hContact);
Meta_Delete((WPARAM)hContact, (LPARAM)1);
hContact = hNextContact;
continue;
@@ -885,7 +885,7 @@ int Meta_SetHandles(void) { if (contact_number < 0 || contact_number >= num_contacts) {
// problem
MessageBox(0, Translate("MetaContact default contact number out of range - deleting MetaContact"), nick_buffer, MB_OK | MB_ICONERROR);
- hNextContact = ( HANDLE )CallService( MS_DB_CONTACT_FINDNEXT,( WPARAM )hContact, 0 );
+ hNextContact = db_find_next(hContact);
Meta_Delete((WPARAM)hContact, (LPARAM)1);
hContact = hNextContact;
//CallService(MS_DB_CONTACT_DELETE, (WPARMA)hContact, 0);
@@ -894,11 +894,11 @@ int Meta_SetHandles(void) { }
}
- hContact = ( HANDLE )CallService( MS_DB_CONTACT_FINDNEXT,( WPARAM )hContact, 0 );
+ hContact = db_find_next(hContact);
}
// loop through one more time - check contact counts match
- hContact = ( HANDLE )CallService( MS_DB_CONTACT_FINDFIRST, 0, 0 );
+ hContact = db_find_first();
while ( hContact != NULL ) {
if ((meta_id = DBGetContactSettingDword(hContact,META_PROTO,META_ID,(DWORD)-1))!=(DWORD)-1) {
// get nick for debug messages
@@ -912,14 +912,14 @@ int Meta_SetHandles(void) { // Meta_Delete((WPARAM)hContact, (LPARAM)1); // second param prevents confirm dialog
//} else
// return 1;
- hNextContact = ( HANDLE )CallService( MS_DB_CONTACT_FINDNEXT,( WPARAM )hContact, 0 );
+ hNextContact = db_find_next(hContact);
MessageBox(0, Translate("MetaContact corrupted - the number of subcontacts is incorrect.\nDeleting MetaContact."), nick_buffer, MB_OK | MB_ICONERROR);
Meta_Delete((WPARAM)hContact, (LPARAM)1);
hContact = hNextContact;
continue;
}
}
- hContact = ( HANDLE )CallService( MS_DB_CONTACT_FINDNEXT,( WPARAM )hContact, 0 );
+ hContact = db_find_next(hContact);
}
return 0;
@@ -939,7 +939,7 @@ int Meta_HideLinkedContacts(void) { char *proto, *group_name;
int hGroup = 1;
- HANDLE hContact2, hContact = ( HANDLE )CallService( MS_DB_CONTACT_FINDFIRST, 0, 0 );
+ HANDLE hContact2, hContact = db_find_first();
// ensure the hidden group does not exist (how this occurs i wonder but there have been reports!)
// (sometimes protocol server side groups are to blame - msn and icq)
@@ -980,7 +980,7 @@ int Meta_HideLinkedContacts(void) { Meta_SetGroup(hContact);
// find metacontact
- hContact2 = ( HANDLE )CallService( MS_DB_CONTACT_FINDFIRST, 0, 0 );
+ hContact2 = db_find_first();
while ( hContact2 != NULL ) {
if (DBGetContactSettingDword(hContact2,META_PROTO,META_ID,(DWORD)-1) == meta_id) {
@@ -1024,18 +1024,18 @@ int Meta_HideLinkedContacts(void) { }
}
- hContact2 = ( HANDLE )CallService( MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact2, 0 );
+ hContact2 = db_find_next(hContact2);
}
if (options.suppress_status)
CallService(MS_IGNORE_IGNORE, (WPARAM)hContact, (WPARAM)IGNOREEVENT_USERONLINE);
}
- hContact = ( HANDLE )CallService( MS_DB_CONTACT_FINDNEXT,( WPARAM )hContact, 0 );
+ hContact = db_find_next(hContact);
}
// do metacontacts after handles set properly above
- hContact = ( HANDLE )CallService( MS_DB_CONTACT_FINDFIRST, 0, 0 );
+ hContact = db_find_first();
while ( hContact != NULL ) {
if (DBGetContactSettingDword(hContact,META_PROTO,META_ID,(DWORD)-1)!=(DWORD)-1) {
// is a meta contact
@@ -1046,7 +1046,7 @@ int Meta_HideLinkedContacts(void) { }
- hContact = ( HANDLE )CallService( MS_DB_CONTACT_FINDNEXT,( WPARAM )hContact, 0 );
+ hContact = db_find_next(hContact);
}
CallService(MS_CLUI_SORTLIST, 0, 0);
@@ -1057,7 +1057,7 @@ int Meta_HideLinkedContacts(void) { *
*/
int Meta_UnhideLinkedContacts(void) {
- HANDLE hContact = ( HANDLE )CallService( MS_DB_CONTACT_FINDFIRST, 0, 0 );
+ HANDLE hContact = db_find_first();
while ( hContact != NULL ) {
if (DBGetContactSettingDword(hContact,META_PROTO,META_LINK,(DWORD)-1)!=(DWORD)-1) {
@@ -1066,7 +1066,7 @@ int Meta_UnhideLinkedContacts(void) { Meta_RestoreGroup(hContact);
}
- hContact = ( HANDLE )CallService( MS_DB_CONTACT_FINDNEXT,( WPARAM )hContact, 0 );
+ hContact = db_find_next(hContact);
}
if (!CallService(MS_SYSTEM_TERMINATED, 0, 0))
@@ -1075,7 +1075,7 @@ int Meta_UnhideLinkedContacts(void) { }
int Meta_HideMetaContacts(int hide) {
- HANDLE hContact = ( HANDLE )CallService( MS_DB_CONTACT_FINDFIRST, 0, 0 );
+ HANDLE hContact = db_find_first();
// set status suppression
if (hide) Meta_SuppressStatus(FALSE);
@@ -1099,7 +1099,7 @@ int Meta_HideMetaContacts(int hide) { }
}
- hContact = ( HANDLE )CallService( MS_DB_CONTACT_FINDNEXT,( WPARAM )hContact, 0 );
+ hContact = db_find_next(hContact);
}
if (!CallService(MS_SYSTEM_TERMINATED, 0, 0))
@@ -1253,7 +1253,7 @@ void Meta_GetStatusString(int status, char *buf, size_t size) { }
int Meta_SuppressStatus(BOOL suppress) {
- HANDLE hContact = ( HANDLE )CallService( MS_DB_CONTACT_FINDFIRST, 0, 0 );
+ HANDLE hContact = db_find_first();
while ( hContact != NULL ) {
if (DBGetContactSettingDword(hContact,META_PROTO,META_LINK,(DWORD)-1)!=(DWORD)-1) {
@@ -1264,7 +1264,7 @@ int Meta_SuppressStatus(BOOL suppress) { CallService(MS_IGNORE_UNIGNORE, (WPARAM)hContact, (WPARAM)IGNOREEVENT_USERONLINE);
}
- hContact = ( HANDLE )CallService( MS_DB_CONTACT_FINDNEXT,( WPARAM )hContact, 0 );
+ hContact = db_find_next(hContact);
}
return 0;
@@ -1319,7 +1319,7 @@ int Meta_CopyContactNick(HANDLE hMeta, HANDLE hContact) { }
int Meta_SetAllNicks() {
- HANDLE hContact = ( HANDLE )CallService( MS_DB_CONTACT_FINDFIRST, 0, 0 ), most_online;
+ HANDLE hContact = db_find_first(), most_online;
while ( hContact != NULL ) {
if (DBGetContactSettingDword(hContact,META_PROTO,META_ID,(DWORD)-1)!=(DWORD)-1) {
@@ -1329,7 +1329,7 @@ int Meta_SetAllNicks() { Meta_CopyData(hContact);
}
- hContact = ( HANDLE )CallService( MS_DB_CONTACT_FINDNEXT,( WPARAM )hContact, 0 );
+ hContact = db_find_next(hContact);
}
return 0;
}
diff --git a/plugins/MirOTR/MirOTR/dllmain.cpp b/plugins/MirOTR/MirOTR/dllmain.cpp index 59841d4e1d..80833c9b2e 100644 --- a/plugins/MirOTR/MirOTR/dllmain.cpp +++ b/plugins/MirOTR/MirOTR/dllmain.cpp @@ -110,10 +110,10 @@ DLLFUNC int Load(void) // remove us as a filter to all contacts - fix filter type problem
if(DBGetContactSettingByte(0, MODULENAME, "FilterOrderFix", 0) != 2) {
- HANDLE hContact = ( HANDLE )CallService( MS_DB_CONTACT_FINDFIRST, 0, 0 );
+ HANDLE hContact = db_find_first();
while ( hContact != NULL ) {
CallService( MS_PROTO_REMOVEFROMCONTACT, ( WPARAM )hContact, ( LPARAM )MODULENAME );
- hContact = ( HANDLE )CallService( MS_DB_CONTACT_FINDNEXT,( WPARAM )hContact, 0 );
+ hContact = db_find_next(hContact);
}
DBWriteContactSettingByte(0, MODULENAME, "FilterOrderFix", 2);
}
diff --git a/plugins/MirOTR/MirOTR/options.cpp b/plugins/MirOTR/MirOTR/options.cpp index 91a3cd34df..8af221d5da 100644 --- a/plugins/MirOTR/MirOTR/options.cpp +++ b/plugins/MirOTR/MirOTR/options.cpp @@ -578,7 +578,7 @@ static INT_PTR CALLBACK DlgProcMirOTROptsContacts(HWND hwndDlg, UINT msg, WPARAM const char *proto;
TCHAR *proto_t;
- HANDLE hContact = ( HANDLE )CallService( MS_DB_CONTACT_FINDFIRST, 0, 0 );
+ HANDLE hContact = db_find_first();
while ( hContact != NULL )
{
proto = contact_get_proto(hContact);
@@ -600,7 +600,7 @@ static INT_PTR CALLBACK DlgProcMirOTROptsContacts(HWND hwndDlg, UINT msg, WPARAM }
- hContact = ( HANDLE )CallService( MS_DB_CONTACT_FINDNEXT,( WPARAM )hContact, 0 );
+ hContact = db_find_next(hContact);
}
}
return TRUE;
diff --git a/plugins/MirOTR/MirOTR/utils.cpp b/plugins/MirOTR/MirOTR/utils.cpp index 2b592742d4..ce2bbc5b9a 100644 --- a/plugins/MirOTR/MirOTR/utils.cpp +++ b/plugins/MirOTR/MirOTR/utils.cpp @@ -19,7 +19,7 @@ void lib_cs_unlock() { }
HANDLE find_contact(const char* userid, const char* protocol) {
- HANDLE hContact = ( HANDLE )CallService( MS_DB_CONTACT_FINDFIRST, 0, 0 );
+ HANDLE hContact = db_find_first();
while ( hContact != NULL )
{
const char *proto = contact_get_proto(hContact);
@@ -31,7 +31,7 @@ HANDLE find_contact(const char* userid, const char* protocol) { }
mir_free(name);
}
- hContact = ( HANDLE )CallService( MS_DB_CONTACT_FINDNEXT,( WPARAM )hContact, 0 );
+ hContact = db_find_next(hContact);
}
return 0;
diff --git a/plugins/ModernOpt/src/mopt_ignore.cpp b/plugins/ModernOpt/src/mopt_ignore.cpp index 74f8b1524d..1d2ed1a202 100644 --- a/plugins/ModernOpt/src/mopt_ignore.cpp +++ b/plugins/ModernOpt/src/mopt_ignore.cpp @@ -49,7 +49,7 @@ static void ResetListOptions(HWND hwndList) static void SetAllContactIcons(HWND hwndList, int count)
{
- HANDLE hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDFIRST,0,0);
+ HANDLE hContact=db_find_first();
do {
DWORD hItem = SendMessage(hwndList,CLM_FINDCONTACT,(WPARAM)hContact,0);
for (int i = 0; i < count; ++i)
@@ -57,5 +57,5 @@ static void SetAllContactIcons(HWND hwndList, int count) if (!DBGetContactSettingByte(hContact,"CList","Hidden",0))
SendMessage(hwndList,CLM_SETCHECKMARK,hItem,1);
}
- while(hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hContact,0));
+ while(hContact=db_find_next(hContact));
}
diff --git a/plugins/Msg_Export/src/options.cpp b/plugins/Msg_Export/src/options.cpp index 9bfe4a054a..d413961f26 100755 --- a/plugins/Msg_Export/src/options.cpp +++ b/plugins/Msg_Export/src/options.cpp @@ -733,7 +733,7 @@ static INT_PTR CALLBACK DlgProcMsgExportOpts(HWND hwndDlg, UINT msg, WPARAM wPar {
tstring sTmp;
LVITEM sItem = { 0 };
- HANDLE hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ HANDLE hContact = db_find_first();
for( int nUser = 0; /*hContact*/ ; nUser++ )
{
sItem.mask = LVIF_TEXT | LVIF_PARAM | LVIF_IMAGE;
@@ -771,7 +771,7 @@ static INT_PTR CALLBACK DlgProcMsgExportOpts(HWND hwndDlg, UINT msg, WPARAM wPar if( ! hContact ) // written like this to add the current user ( handle = 0 )
break;
- hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0);
+ hContact = db_find_next(hContact);
}
ListView_SortItems( hMapUser , CompareFunc , 1 );
diff --git a/plugins/Msg_Export/src/utils.cpp b/plugins/Msg_Export/src/utils.cpp index cc53a06555..ae45d82bad 100755 --- a/plugins/Msg_Export/src/utils.cpp +++ b/plugins/Msg_Export/src/utils.cpp @@ -910,7 +910,7 @@ void UpdateFileToColWidth() {
clFileTo1ColWidth.clear();
- HANDLE hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ HANDLE hContact = db_find_first();
for(;;)
{
tstring sNick = NickFromHandle( hContact );
@@ -921,7 +921,7 @@ void UpdateFileToColWidth() if( ! hContact )
break;
- hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0);
+ hContact = db_find_next(hContact);
}
}
@@ -1626,7 +1626,7 @@ int nContactDeleted(WPARAM wparam,LPARAM /*lparam*/) tstring sFilePath = GetFilePathFromUser( hContact );
{ // Test if there is another user using this file
- HANDLE hOtherContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ HANDLE hOtherContact = db_find_first();
for(;;)
{
if( hContact != hOtherContact && sFilePath == GetFilePathFromUser( hOtherContact ) )
@@ -1636,7 +1636,7 @@ int nContactDeleted(WPARAM wparam,LPARAM /*lparam*/) if( ! hOtherContact )
break;
- hOtherContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hOtherContact, 0);
+ hOtherContact = db_find_next(hOtherContact);
}
}
diff --git a/plugins/NewXstatusNotify/src/indsnd.cpp b/plugins/NewXstatusNotify/src/indsnd.cpp index 27a8b9a02a..5516fc945d 100644 --- a/plugins/NewXstatusNotify/src/indsnd.cpp +++ b/plugins/NewXstatusNotify/src/indsnd.cpp @@ -371,7 +371,7 @@ __inline void SetExtraImage(HWND hwndList, HANDLE hItem, int column, int imageID void SetAllContactsIcons(HWND hwndList)
{
BYTE EnableSounds, EnablePopups, EnableXStatus, EnableLogging;
- HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ HANDLE hContact = db_find_first();
while (hContact)
{
HANDLE hItem = (HANDLE)SendMessage(hwndList, CLM_FINDCONTACT, (WPARAM)hContact, 0);
@@ -396,7 +396,7 @@ void SetAllContactsIcons(HWND hwndList) SetExtraImage(hwndList, hItem, EXTRA_IMAGE_ENABLEALL, EXTRA_IMAGE_ENABLEALL);
}
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0);
+ hContact = db_find_next(hContact);
}
}
@@ -631,7 +631,7 @@ INT_PTR CALLBACK DlgProcFiltering(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM {
case PSN_APPLY:
{
- HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ HANDLE hContact = db_find_first();
do
{
HANDLE hItem = (HANDLE)SendMessage(hList, CLM_FINDCONTACT, (WPARAM)hContact, 0);
@@ -658,7 +658,7 @@ INT_PTR CALLBACK DlgProcFiltering(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM DBWriteContactSettingByte(hContact, MODULE, "EnableLogging", 0);
}
- } while(hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0));
+ } while(hContact = db_find_next(hContact));
return TRUE;
}
diff --git a/plugins/New_GPG/src/icons.cpp b/plugins/New_GPG/src/icons.cpp index a1d02df1b6..3f89da2e53 100755 --- a/plugins/New_GPG/src/icons.cpp +++ b/plugins/New_GPG/src/icons.cpp @@ -141,11 +141,11 @@ void RefreshContactListIcons() {
extern HANDLE g_hCLIcon;
CallService(MS_CLUI_LISTBEGINREBUILD,0,0);
- HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ HANDLE hContact = db_find_first();
while (hContact)
{
setClistIcon(hContact);
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0);
+ hContact = db_find_next(hContact);
}
CallService(MS_CLUI_LISTENDREBUILD,0,0);
}
diff --git a/plugins/New_GPG/src/init.cpp b/plugins/New_GPG/src/init.cpp index c091612d24..6d8956b219 100755 --- a/plugins/New_GPG/src/init.cpp +++ b/plugins/New_GPG/src/init.cpp @@ -252,7 +252,7 @@ static int OnModulesLoaded(WPARAM wParam,LPARAM lParam) extern list<wstring> transfers;
extern "C" int __declspec(dllexport) Unload(void)
{
-// 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))
// DBDeleteContactSetting(hContact, szGPGModuleName, "KeyID_Prescense");
if(!transfers.empty())
{
diff --git a/plugins/New_GPG/src/options.cpp b/plugins/New_GPG/src/options.cpp index 88b46459f3..e6e194c864 100755 --- a/plugins/New_GPG/src/options.cpp +++ b/plugins/New_GPG/src/options.cpp @@ -145,7 +145,7 @@ static INT_PTR CALLBACK DlgProcGpgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP ListView_SetExtendedListViewStyleEx(hwndList, 0, LVS_EX_CHECKBOXES | LVS_EX_FULLROWSELECT); int i = 1, iRow = 0; bool isContactHaveKey(HANDLE); - 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)) { if(isContactHaveKey(hContact)) { @@ -241,7 +241,7 @@ static INT_PTR CALLBACK DlgProcGpgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP ismetacontact = true; } tmp = UniGetContactSettingUtf(hContact, szGPGModuleName, "KeyID", ""); - for(HANDLE hcnttmp = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0); hcnttmp != NULL; hcnttmp = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hcnttmp, 0)) + for(HANDLE hcnttmp = db_find_first(); hcnttmp != NULL; hcnttmp = db_find_next(hcnttmp)) { if(hcnttmp != hContact) { diff --git a/plugins/New_GPG/src/utilities.cpp b/plugins/New_GPG/src/utilities.cpp index 8175917d05..e2841d6c85 100755 --- a/plugins/New_GPG/src/utilities.cpp +++ b/plugins/New_GPG/src/utilities.cpp @@ -1305,7 +1305,7 @@ INT_PTR ExportGpGKeys(WPARAM w, LPARAM l) int exported_keys = 0; if(!file.is_open()) return 1; //TODO: handle error - 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)) { char *k = UniGetContactSettingUtf(hContact, szGPGModuleName, "GPGPubKey", ""); if(!k[0]) @@ -1573,7 +1573,7 @@ INT_PTR ImportGpGKeys(WPARAM w, LPARAM l) if(acc.length()) { const char * uid = (const char*)CallProtoService(acc.c_str(), PS_GETCAPS, (WPARAM)PFLAG_UNIQUEIDSETTING, 0); - for(HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, (LPARAM)acc.c_str()); hContact; hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, (LPARAM)acc.c_str())) + for(HANDLE hContact = db_find_first(acc.c_str()); hContact; hContact = db_find_next(hContact, acc.c_str())) { DBVARIANT dbv = {0}; DBCONTACTGETSETTING dbcgs = {0}; diff --git a/plugins/Nudge/src/main.cpp b/plugins/Nudge/src/main.cpp index 1bf81f87c3..932e462333 100644 --- a/plugins/Nudge/src/main.cpp +++ b/plugins/Nudge/src/main.cpp @@ -569,7 +569,7 @@ void LoadPopupClass() int Preview()
{
- HANDLE hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST,0,0);
+ HANDLE hContact = db_find_first();
if ( GlobalNudge.useByProtocol )
{
for(NudgeElementList *n = NudgeList;n != NULL; n = n->next)
diff --git a/plugins/Popup/src/config.cpp b/plugins/Popup/src/config.cpp index e7908f1099..2ecf985d1f 100644 --- a/plugins/Popup/src/config.cpp +++ b/plugins/Popup/src/config.cpp @@ -122,8 +122,8 @@ void PopUpPreview() #if defined(_DEBUG)
// test per-contact popups
- 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))
{
if (DBGetContactSettingDword(hContact, "ICQ", "UIN", 0) == 256771455)
{
diff --git a/plugins/Popup/src/opt_contacts.cpp b/plugins/Popup/src/opt_contacts.cpp index 16a1963e14..3aaf0b3520 100644 --- a/plugins/Popup/src/opt_contacts.cpp +++ b/plugins/Popup/src/opt_contacts.cpp @@ -122,8 +122,8 @@ INT_PTR CALLBACK DlgProcContactOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l case PSN_APPLY:
{
HWND hwndList = GetDlgItem(hwnd, IDC_LIST);
- 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 = (HANDLE)SendMessage(hwndList, CLM_FINDCONTACT, (WPARAM)hContact, 0);
for (int i = 0; i < 4 /*SIZEOF(sttIcons)*/; ++i)
@@ -162,8 +162,8 @@ static void sttResetListOptions(HWND hwndList) static void sttSetAllContactIcons(HWND hwndList)
{
- 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 = (HANDLE)SendMessage(hwndList, CLM_FINDCONTACT, (WPARAM)hContact, 0);
DWORD dwMode = DBGetContactSettingByte(hContact, MODULNAME, "ShowMode", 0);
diff --git a/plugins/Popup/src/srmm_menu.cpp b/plugins/Popup/src/srmm_menu.cpp index 398d500e81..005cdf5765 100644 --- a/plugins/Popup/src/srmm_menu.cpp +++ b/plugins/Popup/src/srmm_menu.cpp @@ -77,11 +77,11 @@ void SrmmMenu_Load() hIconPressed = HookEvent(ME_MSG_ICONPRESSED, SrmmMenu_ProcessIconClick);
hWindowEvent = HookEvent(ME_MSG_WINDOWEVENT, SrmmMenu_ProcessEvent);
/*
- HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ HANDLE hContact = db_find_first();
while (hContact)
{
SrmmMenu_UpdateIcon(hContact);
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0);
+ hContact = db_find_next(hContact);
}
*/
}
diff --git a/plugins/QuickContacts/src/quickcontacts.cpp b/plugins/QuickContacts/src/quickcontacts.cpp index 697a64674e..94fef144c4 100644 --- a/plugins/QuickContacts/src/quickcontacts.cpp +++ b/plugins/QuickContacts/src/quickcontacts.cpp @@ -376,9 +376,9 @@ void LoadContacts(HWND hwndDlg, BOOL show_all) // enumerate all contacts and write them to the array
// item data of listbox-strings is the array position
FreeContacts();
- 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))
{
char *pszProto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0);
if(pszProto != NULL)
diff --git a/plugins/Rate/src/main.cpp b/plugins/Rate/src/main.cpp index 8fe42060f1..10a6ca24bd 100644 --- a/plugins/Rate/src/main.cpp +++ b/plugins/Rate/src/main.cpp @@ -196,11 +196,11 @@ int onModulesLoaded(WPARAM wParam,LPARAM lParam) if (hExtraIcon != NULL)
{
// Set initial value for all contacts
- HANDLE hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ HANDLE hContact = db_find_first();
while (hContact != NULL)
{
setExtaIcon(hContact, -1, FALSE);
- hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0);
+ hContact = db_find_next(hContact);
}
}
else
diff --git a/plugins/Rate/src/options.cpp b/plugins/Rate/src/options.cpp index bd8c3a228e..e435e4b215 100644 --- a/plugins/Rate/src/options.cpp +++ b/plugins/Rate/src/options.cpp @@ -178,19 +178,19 @@ INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP if (usedClist == clist_modern )
clistIcon++;
- HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ HANDLE hContact = db_find_first();
while (hContact)
{
CallService(MS_CLIST_EXTRA_SET_ICON, (WPARAM)hContact, (LPARAM)&g_IECClear);
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0);
+ hContact = db_find_next(hContact);
}
g_IECClear.ColumnType = clistIcon;
onExtraImageListRebuild(0,0);
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ hContact = db_find_first();
while (hContact)
{
onExtraImageApplying((WPARAM)hContact,0);
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0);
+ hContact = db_find_next(hContact);
}
//Store options values to DB
DBWriteContactSettingByte(NULL, MODULENAME, "AdvancedIcon", clistIcon);
diff --git a/plugins/RecentContacts/src/RecentContacts.cpp b/plugins/RecentContacts/src/RecentContacts.cpp index dea6b69b88..797129a385 100644 --- a/plugins/RecentContacts/src/RecentContacts.cpp +++ b/plugins/RecentContacts/src/RecentContacts.cpp @@ -384,8 +384,8 @@ INT_PTR OnMenuCommandShowList(WPARAM wParam, LPARAM lParam) BYTE buf[1];
dbe.pBlob = buf;
HANDLE curEvent;
- HANDLE curContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
- for (; curContact != NULL; curContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)curContact, 0))
+ HANDLE curContact = db_find_first();
+ for (; curContact != NULL; curContact = db_find_next(curContact))
{
// if (IsMessageAPI)
{
diff --git a/plugins/Scriver/src/chat/clist.cpp b/plugins/Scriver/src/chat/clist.cpp index cdffbd30c6..7cbe58c572 100644 --- a/plugins/Scriver/src/chat/clist.cpp +++ b/plugins/Scriver/src/chat/clist.cpp @@ -102,7 +102,7 @@ BOOL CList_SetOffline(HANDLE hContact, BOOL bHide) BOOL CList_SetAllOffline(BOOL bHide, const char *pszModule)
{
- 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 ( MM_FindModule( szProto )) {
@@ -114,7 +114,7 @@ BOOL CList_SetAllOffline(BOOL bHide, const char *pszModule) }
}
}
- hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0);
+ hContact = db_find_next(hContact);
}
return TRUE;
}
@@ -294,7 +294,7 @@ BOOL CList_AddEvent(HANDLE hContact, HICON Icon, HANDLE event, int type, TCHAR* HANDLE CList_FindRoom ( const char* pszModule, const TCHAR* pszRoom)
{
- 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 && !lstrcmpiA( szProto, pszModule )) {
@@ -308,7 +308,7 @@ HANDLE CList_FindRoom ( const char* pszModule, const TCHAR* pszRoom) DBFreeVariant(&dbv);
} } }
- hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0);
+ hContact = db_find_next(hContact);
}
return 0;
}
diff --git a/plugins/Scriver/src/msgoptions.cpp b/plugins/Scriver/src/msgoptions.cpp index ea103245bd..c323e6bb39 100644 --- a/plugins/Scriver/src/msgoptions.cpp +++ b/plugins/Scriver/src/msgoptions.cpp @@ -964,13 +964,13 @@ static void RebuildList(HWND hwndDlg, HANDLE hItemNew, HANDLE hItemUnknown) if (hItemUnknown && DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_TYPINGUNKNOWN, SRMSGDEFSET_TYPINGUNKNOWN)) {
SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETCHECKMARK, (WPARAM) hItemUnknown, 1);
}
- hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ hContact = db_find_first();
do {
hItem = (HANDLE) SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_FINDCONTACT, (WPARAM) hContact, 0);
if (hItem && DBGetContactSettingByte(hContact, SRMMMOD, SRMSGSET_TYPING, defType)) {
SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETCHECKMARK, (WPARAM) hItem, 1);
}
- } while ((hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0)));
+ } while ((hContact = db_find_next(hContact)));
}
static void SaveList(HWND hwndDlg, HANDLE hItemNew, HANDLE hItemUnknown)
@@ -983,13 +983,13 @@ static void SaveList(HWND hwndDlg, HANDLE hItemNew, HANDLE hItemUnknown) if (hItemUnknown) {
DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_TYPINGUNKNOWN, (BYTE)(SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_GETCHECKMARK, (WPARAM) hItemUnknown, 0) ? 1 : 0));
}
- hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ hContact = db_find_first();
do {
hItem = (HANDLE) SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_FINDCONTACT, (WPARAM) hContact, 0);
if (hItem) {
DBWriteContactSettingByte(hContact, SRMMMOD, SRMSGSET_TYPING, (BYTE)(SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_GETCHECKMARK, (WPARAM) hItem, 0) ? 1 : 0));
}
- } while ((hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0)));
+ } while ((hContact = db_find_next(hContact)));
}
static INT_PTR CALLBACK DlgProcTypeOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
diff --git a/plugins/Scriver/src/msgs.cpp b/plugins/Scriver/src/msgs.cpp index 0971cfa0eb..972ea864ca 100644 --- a/plugins/Scriver/src/msgs.cpp +++ b/plugins/Scriver/src/msgs.cpp @@ -318,7 +318,7 @@ static void RestoreUnreadMessageAlerts(void) cle.flags = CLEF_TCHAR;
cle.ptszTooltip = toolTip;
- hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ hContact = db_find_first();
while (hContact) {
hDbEvent = (HANDLE) CallService(MS_DB_EVENT_FINDFIRSTUNREAD, (WPARAM) hContact, 0);
while (hDbEvent) {
@@ -347,7 +347,7 @@ static void RestoreUnreadMessageAlerts(void) }
hDbEvent = (HANDLE) CallService(MS_DB_EVENT_FINDNEXT, (WPARAM) hDbEvent, 0);
}
- hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0);
+ hContact = db_find_next(hContact);
}
}
diff --git a/plugins/SecureIM/src/crypt_icons.cpp b/plugins/SecureIM/src/crypt_icons.cpp index 6c5984c345..34263addc8 100644 --- a/plugins/SecureIM/src/crypt_icons.cpp +++ b/plugins/SecureIM/src/crypt_icons.cpp @@ -128,21 +128,21 @@ void RefreshContactListIcons(void) { HANDLE hContact;
// CallService(MS_CLUI_LISTBEGINREBUILD,0,0);
if ( !g_hCLIcon ) {
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ hContact = db_find_first();
while (hContact) { // ñíà÷àëà âñå âûêëþ÷àåì
ShowStatusIcon(hContact,-1);
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0);
+ hContact = db_find_next(hContact);
}
// ìåíåì ìåñòîïîëîæåíèå èêîíêè
for(int i=0;i<1+MODE_CNT*IEC_CNT;i++) {
g_IEC[i].ColumnType = bADV;
}
}
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ hContact = db_find_first();
while (hContact) { // è ñíîâà çàæèãàåì èêîíêó
if ( isSecureProtocol(hContact))
ShowStatusIcon(hContact);
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0);
+ hContact = db_find_next(hContact);
}
// CallService(MS_CLUI_LISTENDREBUILD,0,0);
}
diff --git a/plugins/SecureIM/src/crypt_lists.cpp b/plugins/SecureIM/src/crypt_lists.cpp index 7b1225d2a2..177d5756e6 100644 --- a/plugins/SecureIM/src/crypt_lists.cpp +++ b/plugins/SecureIM/src/crypt_lists.cpp @@ -135,10 +135,10 @@ void loadContactList() { freeContactList();
loadSupportedProtocols();
- HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ HANDLE hContact = db_find_first();
while (hContact) {
addContact(hContact);
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0);
+ hContact = db_find_next(hContact);
}
}
diff --git a/plugins/SecureIM/src/options.cpp b/plugins/SecureIM/src/options.cpp index 171fcc28cb..6e698a7dae 100644 --- a/plugins/SecureIM/src/options.cpp +++ b/plugins/SecureIM/src/options.cpp @@ -1148,7 +1148,7 @@ void RefreshGeneralDlg(HWND hDlg, BOOL iInit) { LVITEM lvi; memset(&lvi,0,sizeof(lvi));
lvi.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_PARAM;
- HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ HANDLE hContact = db_find_first();
char tmp[NAMSIZE];
while (hContact) {
@@ -1178,7 +1178,7 @@ void RefreshGeneralDlg(HWND hDlg, BOOL iInit) { else setListViewPUB(hLV, itemNum, hasKey(ptr));
setListViewIcon(hLV, itemNum, ptr);
}
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0);
+ hContact = db_find_next(hContact);
}
ListView_Sort(hLV,(LPARAM)0);
}
@@ -1252,7 +1252,7 @@ void RefreshPGPDlg(HWND hDlg, BOOL iInit) { LVITEM lvi; memset(&lvi,0,sizeof(lvi));
lvi.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_PARAM;
- HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ HANDLE hContact = db_find_first();
char tmp[NAMSIZE];
while (hContact) {
@@ -1276,7 +1276,7 @@ void RefreshPGPDlg(HWND hDlg, BOOL iInit) { LV_SetItemTextA(hLV, itemNum, 2, (szKeyID)?szKeyID:Translate(sim221));
SAFE_FREE(szKeyID);
}
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0);
+ hContact = db_find_next(hContact);
}
ListView_Sort(hLV,(LPARAM)0x10);
}
@@ -1322,7 +1322,7 @@ void RefreshGPGDlg(HWND hDlg, BOOL iInit) { LVITEM lvi; memset(&lvi,0,sizeof(lvi));
lvi.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_PARAM;
- HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ HANDLE hContact = db_find_first();
char tmp[NAMSIZE];
while (hContact) {
@@ -1351,7 +1351,7 @@ void RefreshGPGDlg(HWND hDlg, BOOL iInit) { LV_SetItemTextA(hLV, itemNum, 3, (ptr->tgpgMode)?Translate(sim228):Translate(sim229));
SAFE_FREE(szKeyID);
}
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0);
+ hContact = db_find_next(hContact);
}
ListView_Sort(hLV,(LPARAM)0x20);
}
@@ -1387,7 +1387,7 @@ void ResetGeneralDlg(HWND hDlg) { LVITEM lvi; memset(&lvi,0,sizeof(lvi));
lvi.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_PARAM;
- HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ HANDLE hContact = db_find_first();
char tmp[NAMSIZE];
while (hContact) {
@@ -1417,7 +1417,7 @@ void ResetGeneralDlg(HWND hDlg) { else setListViewPUB(hLV, itemNum, 0);
setListViewIcon(hLV, itemNum, ptr);
}
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0);
+ hContact = db_find_next(hContact);
}
}
diff --git a/plugins/SeenPlugin/src/missed.cpp b/plugins/SeenPlugin/src/missed.cpp index 179dd8ee4d..bb1568a88b 100644 --- a/plugins/SeenPlugin/src/missed.cpp +++ b/plugins/SeenPlugin/src/missed.cpp @@ -67,11 +67,11 @@ int ResetMissed(void) {
HANDLE hcontact=NULL;
- hcontact=(HANDLE)CallService(MS_DB_CONTACT_FINDFIRST,0,0);
+ hcontact=db_find_first();
while(hcontact!=NULL)
{
DBWriteContactSettingByte(hcontact,S_MOD,"Missed",0);
- hcontact=(HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hcontact,0);
+ hcontact = db_find_next(hcontact);
}
ZeroMemory(&mcs,sizeof(mcs));
@@ -86,7 +86,7 @@ int CheckIfOnline(void) // char *szProto;
// WORD status;
- hcontact=(HANDLE)CallService(MS_DB_CONTACT_FINDFIRST,0,0);
+ hcontact=db_find_first();
while(hcontact!=NULL)
{
/* szProto=(char *)CallService(MS_PROTO_GETCONTACTBASEPROTO,(WPARAM)hcontact,0);
@@ -96,7 +96,7 @@ int CheckIfOnline(void) if(CallService(MS_CLIST_GETCONTACTICON,(WPARAM)hcontact,0)!=ICON_OFFLINE)
DBWriteContactSettingByte(hcontact,S_MOD,"Missed",2);
- hcontact=(HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hcontact,0);
+ hcontact = db_find_next(hcontact);
}
return 0;
diff --git a/plugins/SeenPlugin/src/utils.cpp b/plugins/SeenPlugin/src/utils.cpp index d297f37689..5d64f0e7a9 100644 --- a/plugins/SeenPlugin/src/utils.cpp +++ b/plugins/SeenPlugin/src/utils.cpp @@ -713,7 +713,7 @@ static DWORD __stdcall cleanThread(logthread_info* infoParam) {
Sleep(10000); // I hope in 10 secons all logged-in contacts will be listed
- HANDLE hcontact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST,0,0);
+ HANDLE hcontact = db_find_first();
while(hcontact != NULL) {
char *contactProto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO,(WPARAM)hcontact,0);
if (contactProto) {
@@ -728,7 +728,7 @@ static DWORD __stdcall cleanThread(logthread_info* infoParam) }
}
}
- hcontact=(HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hcontact,0);
+ hcontact = db_find_next(hcontact);
}
char *str = (char *)malloc(MAXMODULELABELLENGTH+9);
@@ -825,6 +825,7 @@ WCHAR *any_to_IdleNotidleUnknown(HANDLE hContact, const char *module_name, const buff[bufflen - 1] = 0;
return buff;
}
+
WCHAR *any_to_Idle(HANDLE hContact, const char *module_name, const char *setting_name, WCHAR *buff, int bufflen) {
if(isDbZero(hContact, module_name, setting_name)==0) { //DB setting is NOT zero and exists
buff[0] = L'/';
@@ -833,46 +834,3 @@ WCHAR *any_to_Idle(HANDLE hContact, const char *module_name, const char *setting buff[bufflen - 1] = 0;
return buff;
}
-
-
-/*int GetInfoAck(WPARAM wparam,LPARAM lparam)
-{
- ACKDATA *ack;
- DWORD dwsetting=0;
-
- ack=(ACKDATA *)lparam;
-
- if(ack->type!=ACKTYPE_GETINFO || ack->hContact==NULL) return 0;
- if (((int)ack->hProcess-1)!=(int)ack->lParam) return 0;
-
- dwsetting=DBGetContactSettingDword(ack->hContact,ack->szModule,"IP",0);
- if(dwsetting)
- DBWriteContactSettingDword(ack->hContact,S_MOD,"IP",dwsetting);
-
- dwsetting=DBGetContactSettingDword(ack->hContact,ack->szModule,"RealIP",0);
- if(dwsetting)
- DBWriteContactSettingDword(ack->hContact,S_MOD,"RealIP",dwsetting);
-
- return 0;
-}*/
-
-
-
-/*void SetOffline(void)
-{
- HANDLE hcontact=NULL;
- char * szProto;
-
- hcontact=(HANDLE)CallService(MS_DB_CONTACT_FINDFIRST,0,0);
- while(hcontact!=NULL)
- {
- szProto=(char *)CallService(MS_PROTO_GETCONTACTBASEPROTO,(WPARAM)hcontact,0);
- if (szProto != NULL && IsWatchedProtocol(szProto)) {
- DBWriteContactSettingByte(hcontact,S_MOD,"Offline",1);
- }
- hcontact=(HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hcontact,0);
- }
-}*/
-
-
-
diff --git a/plugins/Sessions/Src/Main.cpp b/plugins/Sessions/Src/Main.cpp index 23636235ae..2aaa3384fb 100644 --- a/plugins/Sessions/Src/Main.cpp +++ b/plugins/Sessions/Src/Main.cpp @@ -226,8 +226,8 @@ INT_PTR CALLBACK SaveSessionDlgProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lpar szUserSessionName[lenght+1]='\0';
if(IsDlgButtonChecked(hdlg,IDC_SELCONTACTS)&&bSC)
{
- HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
- for (i=0; hContact; hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0))
+ HANDLE hContact = db_find_first();
+ for (i=0; hContact; hContact = db_find_next(hContact))
{
BYTE res =(BYTE)SendMessage(hClistControl, CLM_GETCHECKMARK, SendMessage(hClistControl, CLM_FINDCONTACT, (WPARAM)hContact, 0), 0);
if (res)
@@ -471,8 +471,8 @@ int SaveSessionHandles(WPARAM wparam,LPARAM lparam) if(session_list[0]!=0)
{
- 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))
{
if ((k=CheckForDuplicate(session_list,(DWORD)hContact))!=-1
&&!(g_bExclHidden&&!CheckContactVisibility(hContact)))
@@ -621,8 +621,8 @@ int LoadSession(WPARAM wparam,LPARAM lparam) if(session_list_recovered[0]&&lparam==256&&mode==0)
memcpy(session_list_t,session_list_recovered,SIZEOF(session_list_t));
else
- for (hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0); hContact;
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0))
+ for (hContact = db_find_first(); hContact;
+ hContact = db_find_next(hContact))
{
if(LoadContactsFromMask(hContact,mode,lparam))
{
@@ -691,8 +691,8 @@ int DelUserDefSession(int ses_count) char szSessionName[256]={0};
TCHAR *szSessionNameBuf=NULL;
- for (hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0); hContact;
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0))
+ for (hContact = db_find_first(); hContact;
+ hContact = db_find_next(hContact))
{
RemoveSessionMark(hContact,1,ses_count);
SetInSessionOrder(hContact,1,ses_count,0);
@@ -738,8 +738,8 @@ int DeleteAutoSession(int ses_count) TCHAR *szSessionNameBuf=NULL;
- for (hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0); hContact;
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0))
+ for (hContact = db_find_first(); hContact;
+ hContact = db_find_next(hContact))
{
RemoveSessionMark(hContact,0,ses_count);
SetInSessionOrder(hContact,0,ses_count,0);
@@ -913,8 +913,8 @@ static int PluginInit(WPARAM wparam,LPARAM lparam) HANDLE hContact;
ZeroMemory(session_list_recovered,255);
- for (hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0); hContact;
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0))
+ for (hContact = db_find_first(); hContact;
+ hContact = db_find_next(hContact))
{
if(DBGetContactSettingByte(hContact, __INTERNAL_NAME, "wasInLastSession", 0))
session_list_recovered[i++]=(DWORD)hContact;
diff --git a/plugins/Sessions/Src/Options.cpp b/plugins/Sessions/Src/Options.cpp index 4502f2f863..c9c9c9eeba 100644 --- a/plugins/Sessions/Src/Options.cpp +++ b/plugins/Sessions/Src/Options.cpp @@ -51,8 +51,8 @@ int OpLoadSessionContacts(WPARAM wparam,LPARAM lparam) int i=0;
ZeroMemory(session_list_t,SIZEOF(session_list_t));
- for (hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0); hContact;
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0))
+ for (hContact = db_find_first(); hContact;
+ hContact = db_find_next(hContact))
{
if(LoadContactsFromMask(hContact,1,lparam))
{
@@ -300,8 +300,8 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam) if (((LPNMHDR)lparam)->idFrom ==IDC_EMCLIST)
{
int iSelection = (int)((NMCLISTCONTROL *)lparam)->hItem;
- HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
- for ( ; hContact; hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0))
+ HANDLE hContact = db_find_first();
+ for ( ; hContact; hContact = db_find_next(hContact))
if (SendDlgItemMessage(hdlg, IDC_EMCLIST, CLM_FINDCONTACT, (WPARAM)hContact, 0) == iSelection)
break;
if (hContact)
@@ -350,9 +350,9 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam) else
{
int i;
- HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ HANDLE hContact = db_find_first();
- for ( ; hContact; hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0))
+ for ( ; hContact; hContact = db_find_next(hContact))
SendMessage(hOpClistControl, CLM_SETCHECKMARK, (WPARAM)hContact,0);
for (i=0 ; session_list_t[i]>0; i++)
{
@@ -407,8 +407,8 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam) case IDC_SAVE:
{
int i;
- HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
- for (i=0 ; hContact;hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0))
+ HANDLE hContact = db_find_first();
+ for (i=0 ; hContact;hContact = db_find_next(hContact))
{
BYTE res =(BYTE)SendMessage(GetDlgItem(hdlg,IDC_EMCLIST), CLM_GETCHECKMARK,
SendMessage(GetDlgItem(hdlg,IDC_EMCLIST), CLM_FINDCONTACT, (WPARAM)hContact, 0), 0);
diff --git a/plugins/SimpleStatusMsg/src/main.cpp b/plugins/SimpleStatusMsg/src/main.cpp index acd9fc9060..35a618008f 100644 --- a/plugins/SimpleStatusMsg/src/main.cpp +++ b/plugins/SimpleStatusMsg/src/main.cpp @@ -1897,7 +1897,7 @@ static int OnICQStatusMsgRequest(WPARAM wParam, LPARAM lParam, LPARAM lMirParam) char *szProto;
BOOL bContactFound = FALSE;
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ hContact = db_find_first();
while (hContact)
{
szProto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0);
@@ -1906,7 +1906,7 @@ static int OnICQStatusMsgRequest(WPARAM wParam, LPARAM lParam, LPARAM lMirParam) bContactFound = TRUE;
break;
}
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0);
+ hContact = db_find_next(hContact);
}
if (!bContactFound)
return 0;
diff --git a/plugins/SmileyAdd/src/smileys.cpp b/plugins/SmileyAdd/src/smileys.cpp index 2cc8039052..bc085120e5 100644 --- a/plugins/SmileyAdd/src/smileys.cpp +++ b/plugins/SmileyAdd/src/smileys.cpp @@ -902,7 +902,7 @@ void SmileyCategoryListType::DeleteAccountAsCategory(PROTOACCOUNT *acc) {
bkstring tname(A2T_SM(acc->szModuleName));
- HANDLE hContact = (HANDLE)CallService( MS_DB_CONTACT_FINDFIRST, 0, 0);
+ HANDLE hContact = db_find_first();
while (hContact != NULL)
{
char* proto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0);
@@ -916,7 +916,7 @@ void SmileyCategoryListType::DeleteAccountAsCategory(PROTOACCOUNT *acc) if (found) return;
}
}
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0);
+ hContact = db_find_next(hContact);
}
for (int i = 0; i < m_SmileyCategories.getCount(); i++)
@@ -1000,11 +1000,11 @@ void SmileyCategoryListType::AddAllProtocolsAsCategory(void) for (int i = 0; i < protoCount; i++)
AddAccountAsCategory(accList[i], defaultFile);
- HANDLE hContact = (HANDLE)CallService( MS_DB_CONTACT_FINDFIRST, 0, 0);
+ HANDLE hContact = db_find_first();
while (hContact != NULL)
{
AddContactTransportAsCategory(hContact, defaultFile);
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0);
+ hContact = db_find_next(hContact);
}
bkstring cats;
diff --git a/plugins/StopSpamMod/src/utilities.cpp b/plugins/StopSpamMod/src/utilities.cpp index 6d60d22106..ae1d8ab939 100755 --- a/plugins/StopSpamMod/src/utilities.cpp +++ b/plugins/StopSpamMod/src/utilities.cpp @@ -113,7 +113,7 @@ void RemoveExcludedUsers() { HANDLE hContact; hContact_entry *first, *plist, *tmp; - hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0); + hContact = db_find_first(); first = new hContact_entry; plist = first; plist->hContact = INVALID_HANDLE_VALUE; @@ -127,7 +127,7 @@ void RemoveExcludedUsers() plist = plist->next; plist->hContact = INVALID_HANDLE_VALUE; } - }while(hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hContact, 0)); + }while(hContact = db_find_next(hContact)); plist = first; while(plist->hContact != INVALID_HANDLE_VALUE) @@ -154,7 +154,7 @@ void RemoveTemporaryUsers() { HANDLE hContact; hContact_entry *first, *plist, *tmp; - hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0); + hContact = db_find_first(); first = new hContact_entry; plist = first; plist->hContact = INVALID_HANDLE_VALUE; @@ -170,7 +170,7 @@ void RemoveTemporaryUsers() plist = plist->next; plist->hContact = INVALID_HANDLE_VALUE; } - }while(hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hContact, 0)); + }while(hContact = db_find_next(hContact)); plist = first; while(plist->hContact != INVALID_HANDLE_VALUE) @@ -407,7 +407,7 @@ void CleanProtocolTmpThread(std::string proto) boost::this_thread::sleep(boost::posix_time::seconds(2)); } std::list<HANDLE> contacts; - 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)) { char *proto_tmp = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0); if(proto_tmp) @@ -437,7 +437,7 @@ void CleanProtocolExclThread(std::string proto) boost::this_thread::sleep(boost::posix_time::seconds(2)); } std::list<HANDLE> contacts; - 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)) { char *proto_tmp = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0); if(proto_tmp) diff --git a/plugins/StopSpamPlus/src/services.cpp b/plugins/StopSpamPlus/src/services.cpp index ff19540a63..bc54f5485d 100644 --- a/plugins/StopSpamPlus/src/services.cpp +++ b/plugins/StopSpamPlus/src/services.cpp @@ -22,9 +22,9 @@ INT_PTR IsContactPassed(WPARAM wParam, LPARAM /*lParam*/) INT_PTR RemoveTempContacts(WPARAM wParam,LPARAM lParam)
{
- HANDLE hContact = (HANDLE)CallService( MS_DB_CONTACT_FINDFIRST, 0, 0 );
+ HANDLE hContact = db_find_first();
while ( hContact ) {
- HANDLE hNext = (HANDLE)CallService( MS_DB_CONTACT_FINDNEXT, ( WPARAM )hContact, 0 );
+ HANDLE hNext = db_find_next(hContact);
DBVARIANT dbv = { 0 };
if ( DBGetContactSettingTString( hContact, "CList", "Group", &dbv ))
diff --git a/plugins/TabSRMM/chat/clist.cpp b/plugins/TabSRMM/chat/clist.cpp index c210294575..a3c5b75d24 100644 --- a/plugins/TabSRMM/chat/clist.cpp +++ b/plugins/TabSRMM/chat/clist.cpp @@ -119,7 +119,7 @@ BOOL CList_SetAllOffline(BOOL bHide, const char *pszModule) HANDLE hContact;
char* szProto;
- 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 (MM_FindModule(szProto)) {
@@ -132,7 +132,7 @@ BOOL CList_SetAllOffline(BOOL bHide, const char *pszModule) }
}
- hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0);
+ hContact = db_find_next(hContact);
}
return TRUE;
}
@@ -303,7 +303,7 @@ BOOL CList_AddEvent(HANDLE hContact, HICON Icon, HANDLE event, int type, const T HANDLE CList_FindRoom(const char* pszModule, const TCHAR* pszRoom)
{
- 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 && !lstrcmpiA(szProto, pszModule)) {
@@ -319,7 +319,7 @@ HANDLE CList_FindRoom(const char* pszModule, const TCHAR* pszRoom) }
}
- hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0);
+ hContact = db_find_next(hContact);
}
return 0;
}
diff --git a/plugins/TabSRMM/src/container.cpp b/plugins/TabSRMM/src/container.cpp index a359a1379e..afe5c85fd6 100644 --- a/plugins/TabSRMM/src/container.cpp +++ b/plugins/TabSRMM/src/container.cpp @@ -2476,7 +2476,7 @@ void TSAPI DeleteContainer(int iIndex) { TCHAR *wszContainerName = dbv.ptszVal;
M->WriteTString(NULL, szKey, szIndex, _T("**free**"));
- hhContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ hhContact = db_find_first();
while (hhContact) {
DBVARIANT dbv_c;
if (!M->GetTString(hhContact, SRMSGMOD_T, szSubKey, &dbv_c)) {
@@ -2485,7 +2485,7 @@ void TSAPI DeleteContainer(int iIndex) { DBDeleteContactSetting(hhContact, SRMSGMOD_T, "containerW");
DBFreeVariant(&dbv_c);
}
- hhContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hhContact, 0);
+ hhContact = db_find_next(hhContact);
}
_snprintf(szSetting, CONTAINER_NAMELEN + 15, "%s%d_Flags", szSettingP, iIndex);
DBDeleteContactSetting(NULL, SRMSGMOD_T, szSetting);
@@ -2518,7 +2518,7 @@ void TSAPI RenameContainer(int iIndex, const TCHAR *szNew) { if (lstrlen(szNew) != 0)
M->WriteTString(NULL, szKey, szIndex, szNew);
}
- hhContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ hhContact = db_find_first();
while (hhContact) {
DBVARIANT dbv_c;
if (!M->GetTString(hhContact, SRMSGMOD_T, szSubKey, &dbv_c)) {
@@ -2530,7 +2530,7 @@ void TSAPI RenameContainer(int iIndex, const TCHAR *szNew) { }
DBFreeVariant(&dbv_c);
}
- hhContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hhContact, 0);
+ hhContact = db_find_next(hhContact);
}
DBFreeVariant(&dbv);
}
diff --git a/plugins/TabSRMM/src/globals.cpp b/plugins/TabSRMM/src/globals.cpp index 07c5819064..548068794d 100644 --- a/plugins/TabSRMM/src/globals.cpp +++ b/plugins/TabSRMM/src/globals.cpp @@ -612,10 +612,10 @@ int CGlobals::PreshutdownSendRecv(WPARAM wParam, LPARAM lParam) ::SendMessage(pFirstContainer->hwnd, WM_CLOSE, 0, 1);
}
- hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ hContact = db_find_first();
while (hContact) {
M->WriteDword(hContact, SRMSGMOD_T, "messagecount", 0);
- hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0);
+ hContact = db_find_next(hContact);
}
for (i=0; i < SERVICE_LAST; i++) {
@@ -722,7 +722,7 @@ void CGlobals::RestoreUnreadMessageAlerts(void) cle.pszService = "SRMsg/ReadMessage";
cle.flags = CLEF_TCHAR;
- hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ hContact = db_find_first();
while (hContact) {
if (M->GetDword(hContact, "SendLater", "count", 0))
@@ -746,7 +746,7 @@ void CGlobals::RestoreUnreadMessageAlerts(void) }
hDbEvent = (HANDLE) CallService(MS_DB_EVENT_FINDNEXT, (WPARAM) hDbEvent, 0);
}
- hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0);
+ hContact = db_find_next(hContact);
}
}
diff --git a/plugins/TabSRMM/src/msgoptions.cpp b/plugins/TabSRMM/src/msgoptions.cpp index 8617a138d7..ceb8d2fa33 100644 --- a/plugins/TabSRMM/src/msgoptions.cpp +++ b/plugins/TabSRMM/src/msgoptions.cpp @@ -865,13 +865,13 @@ static void RebuildList(HWND hwndDlg, HANDLE hItemNew, HANDLE hItemUnknown) if (hItemUnknown && M->GetByte(SRMSGMOD, SRMSGSET_TYPINGUNKNOWN, SRMSGDEFSET_TYPINGUNKNOWN)) {
SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETCHECKMARK, (WPARAM) hItemUnknown, 1);
}
- hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ hContact = db_find_first();
do {
hItem = (HANDLE) SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_FINDCONTACT, (WPARAM) hContact, 0);
if (hItem && M->GetByte(hContact, SRMSGMOD, SRMSGSET_TYPING, defType)) {
SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETCHECKMARK, (WPARAM) hItem, 1);
}
- } while (hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0));
+ } while (hContact = db_find_next(hContact));
}
static void SaveList(HWND hwndDlg, HANDLE hItemNew, HANDLE hItemUnknown)
@@ -884,13 +884,13 @@ static void SaveList(HWND hwndDlg, HANDLE hItemNew, HANDLE hItemUnknown) if (hItemUnknown) {
M->WriteByte(SRMSGMOD, SRMSGSET_TYPINGUNKNOWN, (BYTE)(SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_GETCHECKMARK, (WPARAM) hItemUnknown, 0) ? 1 : 0));
}
- hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ hContact = db_find_first();
do {
hItem = (HANDLE) SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_FINDCONTACT, (WPARAM) hContact, 0);
if (hItem) {
DBWriteContactSettingByte(hContact, SRMSGMOD, SRMSGSET_TYPING, (BYTE)(SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_GETCHECKMARK, (WPARAM) hItem, 0) ? 1 : 0));
}
- } while (hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0));
+ } while (hContact = db_find_next(hContact));
}
static INT_PTR CALLBACK DlgProcTypeOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
diff --git a/plugins/TabSRMM/src/sendqueue.cpp b/plugins/TabSRMM/src/sendqueue.cpp index 8dffa1f622..a00b5a9445 100644 --- a/plugins/TabSRMM/src/sendqueue.cpp +++ b/plugins/TabSRMM/src/sendqueue.cpp @@ -385,7 +385,7 @@ int SendQueue::sendQueued(TWindowData *dat, const int iEntry) int iMinLength = 0;
CContactCache* c = 0;
- hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ hContact = db_find_first();
m_jobs[iEntry].hOwner = dat->hContact;
m_jobs[iEntry].iStatus = SQ_INPROGRESS;
@@ -400,7 +400,7 @@ int SendQueue::sendQueued(TWindowData *dat, const int iEntry) if (c)
iMinLength = (iMinLength == 0 ? c->getMaxMessageLength() : min(c->getMaxMessageLength(), iMinLength));
}
- } while (hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0));
+ } while (hContact = db_find_next(hContact));
if (iSendLength >= iMinLength) {
TCHAR tszError[256];
@@ -411,14 +411,14 @@ int SendQueue::sendQueued(TWindowData *dat, const int iEntry) return 0;
}
- hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ hContact = db_find_first();
do {
hItem = (HANDLE) SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_FINDCONTACT, (WPARAM) hContact, 0);
if (hItem && SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_GETCHECKMARK, (WPARAM) hItem, 0)) {
doSendLater(iEntry, 0, hContact, false);
iJobs++;
}
- } while (hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0));
+ } while (hContact = db_find_next(hContact));
sendQueue->clearJob(iEntry);
if (iJobs)
diff --git a/plugins/TabSRMM/src/templates.cpp b/plugins/TabSRMM/src/templates.cpp index 8924f58013..d71a99dc60 100644 --- a/plugins/TabSRMM/src/templates.cpp +++ b/plugins/TabSRMM/src/templates.cpp @@ -163,10 +163,10 @@ INT_PTR CALLBACK DlgProcTemplateEditor(HWND hwndDlg, UINT msg, WPARAM wParam, LP SendDlgItemMessage(hwndDlg, IDC_PREVIEW, EM_SETEDITSTYLE, SES_EXTENDBACKCOLOR, SES_EXTENDBACKCOLOR);
SendDlgItemMessage(hwndDlg, IDC_PREVIEW, EM_EXLIMITTEXT, 0, 0x80000000);
- dat->hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ dat->hContact = db_find_first();
dat->szProto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)dat->hContact, 0);
while(dat->szProto == 0 && dat->hContact != 0) {
- dat->hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)dat->hContact, 0);
+ dat->hContact = db_find_next(dat->hContact);
dat->szProto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)dat->hContact, 0);
}
dat->dwFlags = dat->pContainer->theme.dwFlags;
diff --git a/plugins/TabSRMM/src/trayicon.cpp b/plugins/TabSRMM/src/trayicon.cpp index b7a7aa4dc4..9da43b2472 100644 --- a/plugins/TabSRMM/src/trayicon.cpp +++ b/plugins/TabSRMM/src/trayicon.cpp @@ -339,7 +339,7 @@ void TSAPI LoadFavoritesAndRecent() RCENTRY *recentEntries, rceTemp;
DWORD dwRecent;
int iIndex = 0, i, j;
- HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ HANDLE hContact = db_find_first();
recentEntries = new RCENTRY[nen_options.wMaxRecent + 1];
if (recentEntries != NULL) {
while (hContact != 0) {
@@ -349,7 +349,7 @@ void TSAPI LoadFavoritesAndRecent() recentEntries[iIndex].dwTimestamp = dwRecent;
recentEntries[iIndex++].hContact = hContact;
}
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0);
+ hContact = db_find_next(hContact);
}
if (iIndex == 0) {
free(recentEntries);
diff --git a/plugins/TabSRMM/src/typingnotify.cpp b/plugins/TabSRMM/src/typingnotify.cpp index 1d2fcd573e..adfdbfee5c 100644 --- a/plugins/TabSRMM/src/typingnotify.cpp +++ b/plugins/TabSRMM/src/typingnotify.cpp @@ -283,7 +283,7 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA char *szProto = NULL;
int i, notyping;
- HANDLE hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ HANDLE hContact = db_find_first();
if (!PopupService)
break;
@@ -292,7 +292,7 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA szProto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0);
if (szProto != NULL)
break;
- hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0);
+ hContact = db_find_next(hContact);
}
for (i=0; i < 2; i++) {
diff --git a/plugins/TipperYM/src/options.cpp b/plugins/TipperYM/src/options.cpp index b106d76fac..0dfb831bc9 100644 --- a/plugins/TipperYM/src/options.cpp +++ b/plugins/TipperYM/src/options.cpp @@ -2104,14 +2104,14 @@ INT_PTR CALLBACK DlgProcFavouriteContacts(HWND hwndDlg, UINT msg, WPARAM wParam, SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETLEFTMARGIN, 2, 0);
HANDLE hContact, hItem;
- 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);
if (hItem && DBGetContactSettingByte(hContact, MODULE, "FavouriteContact", 0))
SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETCHECKMARK, (WPARAM)hItem, 1);
- hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0);
+ hContact = db_find_next(hContact);
}
CheckDlgButton(hwndDlg, IDC_CHK_HIDEOFFLINE, opt.iFavoriteContFlags & FAVCONT_HIDE_OFFLINE);
@@ -2129,7 +2129,7 @@ INT_PTR CALLBACK DlgProcFavouriteContacts(HWND hwndDlg, UINT msg, WPARAM wParam, BYTE isChecked;
int count = 0;
- 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);
@@ -2140,7 +2140,7 @@ INT_PTR CALLBACK DlgProcFavouriteContacts(HWND hwndDlg, UINT msg, WPARAM wParam, if (isChecked) count++;
}
- hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0);
+ hContact = db_find_next(hContact);
}
DBWriteContactSettingDword(0, MODULE, "FavouriteContactsCount", count);
diff --git a/plugins/TipperYM/src/popwin.cpp b/plugins/TipperYM/src/popwin.cpp index 964069ce2d..bf673f2da3 100644 --- a/plugins/TipperYM/src/popwin.cpp +++ b/plugins/TipperYM/src/popwin.cpp @@ -1769,7 +1769,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa if (dwItems & TRAYTIP_NUMCONTACTS)
{
int iCount = 0, iCountOnline = 0;
- HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ HANDLE hContact = db_find_first();
while (hContact)
{
char *proto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0);
@@ -1779,7 +1779,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa iCountOnline++;
iCount++;
}
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0);
+ hContact = db_find_next(hContact);
}
mir_sntprintf(buff, 64, _T("(%d/%d)"), iCountOnline, iCount);
}
@@ -1927,7 +1927,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa bool bTitlePainted = false;
int iCount = 0, iCountOnline = 0;
- HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ HANDLE hContact = db_find_first();
while (hContact)
{
if (DBGetContactSettingByte(hContact, MODULE, "FavouriteContact", 0))
@@ -1968,7 +1968,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa }
}
}
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0);
+ hContact = db_find_next(hContact);
}
int index = pwd->iRowCount - 1;
diff --git a/plugins/TipperYM/src/subst.cpp b/plugins/TipperYM/src/subst.cpp index 1d8c8837d9..83d2408d74 100644 --- a/plugins/TipperYM/src/subst.cpp +++ b/plugins/TipperYM/src/subst.cpp @@ -915,11 +915,11 @@ TCHAR *GetProtoExtraStatusMessage(char *szProto) if (ServiceExists(MS_VARS_FORMATSTRING))
{
- HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ HANDLE hContact = db_find_first();
char *proto = ( char* )CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0);
while(!proto)
{
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0);
+ hContact = db_find_next(hContact);
if (hContact)
{
proto = ( char* )CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0);
diff --git a/plugins/TooltipNotify/src/TooltipNotify.cpp b/plugins/TooltipNotify/src/TooltipNotify.cpp index ab80715591..0029da7b93 100644 --- a/plugins/TooltipNotify/src/TooltipNotify.cpp +++ b/plugins/TooltipNotify/src/TooltipNotify.cpp @@ -821,7 +821,7 @@ void CTooltipNotify::LoadList(HWND hwndDlg, HANDLE hItemNew, HANDLE hItemUnknown SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETCHECKMARK, (WPARAM) hItemUnknown, 1);
}
- HANDLE hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ HANDLE hContact = db_find_first();
do
{
HANDLE hItem = (HANDLE) SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_FINDCONTACT, (WPARAM) hContact, 0);
@@ -830,7 +830,7 @@ void CTooltipNotify::LoadList(HWND hwndDlg, HANDLE hItemNew, HANDLE hItemUnknown SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETCHECKMARK, (WPARAM) hItem, 1);
}
}
- while (hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0));
+ while (hContact = db_find_next(hContact));
}
void CTooltipNotify::SaveList(HWND hwndDlg, HANDLE hItemNew, HANDLE hItemUnknown)
@@ -844,7 +844,7 @@ void CTooltipNotify::SaveList(HWND hwndDlg, HANDLE hItemNew, HANDLE hItemUnknown m_sOptions.bIgnoreUnknown = (BYTE) (SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_GETCHECKMARK, (WPARAM) hItemUnknown, 0) ? 0 : 1);
}
- HANDLE hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ HANDLE hContact = db_find_first();
do
{
HANDLE hItem = (HANDLE) SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_FINDCONTACT, (WPARAM) hContact, 0);
@@ -854,7 +854,7 @@ void CTooltipNotify::SaveList(HWND hwndDlg, HANDLE hItemNew, HANDLE hItemUnknown DBWriteContactSettingByte(hContact, s_szModuleName, CONTACT_IGNORE_TTNOTIFY, bChecked ? 0 : 1);
}
}
- while (hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0));
+ while (hContact = db_find_next(hContact));
}
diff --git a/plugins/UserInfoEx/src/mir_db.cpp b/plugins/UserInfoEx/src/mir_db.cpp index 005495939c..c65d9dc951 100644 --- a/plugins/UserInfoEx/src/mir_db.cpp +++ b/plugins/UserInfoEx/src/mir_db.cpp @@ -150,7 +150,7 @@ INT_PTR GetCount() **/
HANDLE FindFirst()
{
- return (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ return db_find_first();
}
/**
@@ -161,7 +161,7 @@ HANDLE FindFirst() **/
HANDLE FindNext(HANDLE hContact)
{
- return (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0);
+ return db_find_next(hContact);
}
/**
diff --git a/plugins/Variables/src/contact.cpp b/plugins/Variables/src/contact.cpp index 9e2f08c83e..bdc4b9af60 100644 --- a/plugins/Variables/src/contact.cpp +++ b/plugins/Variables/src/contact.cpp @@ -276,14 +276,14 @@ int getContactFromString( CONTACTSINFO* ci ) LeaveCriticalSection(&csContactCache);
/* contact was not in cache, do a search */
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ hContact = db_find_first();
while (hContact != NULL) {
szFind = NULL;
bMatch = FALSE;
ZeroMemory(&dbv, sizeof(DBVARIANT));
szProto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0);
if (szProto == NULL) {
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hContact, 0);
+ hContact = db_find_next(hContact);
continue;
}
// <proto:id> (exact)
@@ -406,7 +406,7 @@ int getContactFromString( CONTACTSINFO* ci ) ci->hContacts[count] = hContact;
count += 1;
}
- hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hContact,0);
+ hContact=db_find_next(hContact);
}
if (count == 1) { /* cache the found result */
diff --git a/plugins/Variables/src/parse_miranda.cpp b/plugins/Variables/src/parse_miranda.cpp index 926f7fb67b..f5492eea77 100644 --- a/plugins/Variables/src/parse_miranda.cpp +++ b/plugins/Variables/src/parse_miranda.cpp @@ -554,7 +554,7 @@ static HANDLE findDbEvent(HANDLE hContact, HANDLE hDbEvent, int flags) hMatchEvent = hSearchEvent = hSearchContact = NULL;
matchTimestamp = priorTimestamp = 0;
if (flags & DBE_FIRST) {
- hSearchContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ hSearchContact = db_find_first();
do {
hSearchEvent = findDbEvent(hSearchContact, NULL, flags);
dbe.cbBlob = 0;
@@ -564,12 +564,12 @@ static HANDLE findDbEvent(HANDLE hContact, HANDLE hDbEvent, int flags) matchTimestamp = dbe.timestamp;
}
}
- hSearchContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hSearchContact, 0);
+ hSearchContact = db_find_next(hSearchContact);
} while (hSearchContact);
hDbEvent = hMatchEvent;
}
else if (flags&DBE_LAST) {
- hSearchContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ hSearchContact = db_find_first();
do {
hSearchEvent = findDbEvent(hSearchContact, NULL, flags);
dbe.cbBlob = 0;
@@ -579,7 +579,7 @@ static HANDLE findDbEvent(HANDLE hContact, HANDLE hDbEvent, int flags) matchTimestamp = dbe.timestamp;
}
}
- hSearchContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hSearchContact, 0);
+ hSearchContact = db_find_next(hSearchContact);
} while (hSearchContact);
hDbEvent = hMatchEvent;
}
@@ -587,7 +587,7 @@ static HANDLE findDbEvent(HANDLE hContact, HANDLE hDbEvent, int flags) dbe.cbBlob = 0;
if (!CallService(MS_DB_EVENT_GET, (WPARAM)hDbEvent, (LPARAM)&dbe)) {
priorTimestamp = dbe.timestamp;
- hSearchContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ hSearchContact = db_find_first();
do {
hSearchEvent = findDbEvent(hSearchContact, hDbEvent, flags);
dbe.cbBlob = 0;
@@ -597,7 +597,7 @@ static HANDLE findDbEvent(HANDLE hContact, HANDLE hDbEvent, int flags) matchTimestamp = dbe.timestamp;
}
}
- hSearchContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hSearchContact, 0);
+ hSearchContact = db_find_next(hSearchContact);
} while (hSearchContact);
hDbEvent = hMatchEvent;
}
@@ -605,7 +605,7 @@ static HANDLE findDbEvent(HANDLE hContact, HANDLE hDbEvent, int flags) else if (flags&DBE_PREV) {
if (!CallService(MS_DB_EVENT_GET, (WPARAM)hDbEvent, (LPARAM)&dbe)) {
priorTimestamp = dbe.timestamp;
- hSearchContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ hSearchContact = db_find_first();
do {
hSearchEvent = findDbEvent(hSearchContact, hDbEvent, flags);
dbe.cbBlob = 0;
@@ -615,7 +615,7 @@ static HANDLE findDbEvent(HANDLE hContact, HANDLE hDbEvent, int flags) matchTimestamp = dbe.timestamp;
}
}
- hSearchContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hSearchContact, 0);
+ hSearchContact = db_find_next(hSearchContact);
} while (hSearchContact);
hDbEvent = hMatchEvent;
}
diff --git a/plugins/WhenWasIt/src/dlg_handlers.cpp b/plugins/WhenWasIt/src/dlg_handlers.cpp index 37160995e2..db617c4d4f 100644 --- a/plugins/WhenWasIt/src/dlg_handlers.cpp +++ b/plugins/WhenWasIt/src/dlg_handlers.cpp @@ -325,7 +325,7 @@ INT_PTR CALLBACK DlgProcOptions(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPara case IDC_PREVIEW:
{
- HANDLE hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ HANDLE hContact = db_find_first();
int dtb, age;
dtb = rand() % 11; //0..10
age = rand() % 50 + 1; //1..50
@@ -902,7 +902,7 @@ void SetBirthdaysCount(HWND hWnd) int LoadBirthdays(HWND hWnd, int bShowAll)
{
- HANDLE hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ HANDLE hContact = db_find_first();
HWND hList = GetDlgItem(hWnd, IDC_BIRTHDAYS_LIST);
//int bShowCurrentAge = DBGetContactSettingByte(NULL, ModuleName, "ShowCurrentAge", 0);
@@ -913,7 +913,7 @@ int LoadBirthdays(HWND hWnd, int bShowAll) {
count = UpdateBirthdayEntry(hList, hContact, count, bShowAll, commonData.cShowAgeMode, 1);
- hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0);
+ hContact = db_find_next(hContact);
}
SetBirthdaysCount(hWnd);
diff --git a/plugins/WhenWasIt/src/notifiers.cpp b/plugins/WhenWasIt/src/notifiers.cpp index 102511cfaa..5b1e569ea2 100644 --- a/plugins/WhenWasIt/src/notifiers.cpp +++ b/plugins/WhenWasIt/src/notifiers.cpp @@ -329,7 +329,7 @@ int RefreshContactListIcons(HANDLE hContact) //called with oldClistIcon != -1 from dlg_handlers whtn the extra icon slot changes.
int RefreshAllContactListIcons(int oldClistIcon)
{
- HANDLE hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ HANDLE hContact = db_find_first();
while (hContact != NULL)
{
if (oldClistIcon != -1)
@@ -337,7 +337,7 @@ int RefreshAllContactListIcons(int oldClistIcon) ClearClistIcon(hContact, oldClistIcon);
}
RefreshContactListIcons(hContact); //will change bBirthdayFound if needed
- hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0);
+ hContact = db_find_next(hContact);
}
return 0;
}
\ No newline at end of file diff --git a/plugins/WhenWasIt/src/services.cpp b/plugins/WhenWasIt/src/services.cpp index adc06de7b5..7fc5d22d52 100644 --- a/plugins/WhenWasIt/src/services.cpp +++ b/plugins/WhenWasIt/src/services.cpp @@ -221,12 +221,12 @@ DWORD WINAPI RefreshUserDetailsWorkerThread(LPVOID param) //PUAddPopUp(&pd);
ShowPopupMessage(TranslateT("WhenWasIt"), TranslateT("Starting to refresh user details"), hiRefreshUserDetails);
int delay = DBGetContactSettingWord(NULL, ModuleName, "UpdateDelay", REFRESH_DETAILS_DELAY);
- HANDLE hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ HANDLE hContact = db_find_first();
int res;
while (hContact != NULL)
{
res = CallContactService(hContact, PSS_GETINFO, 0, 0);
- hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0);
+ hContact = db_find_next(hContact);
if (hContact)
{
Sleep(delay); //sleep for a few seconds between requests
@@ -391,7 +391,7 @@ int DoExport(TCHAR *fileName) _ftprintf(fout, _T("%c%s"), _T(COMMENT_CHAR), _T("This file was exported with a Unicode version of WhenWasIt. Please only use a Unicode version of the plugin to import the birthdays.\n"));
- HANDLE hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ HANDLE hContact = db_find_first();
int year, month, day;
TCHAR *szHandle;
char szProto[256];
@@ -413,7 +413,7 @@ int DoExport(TCHAR *fileName) if (szHandle) free(szHandle);
}
- hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0);
+ hContact = db_find_next(hContact);
}
fclose(fout);
diff --git a/plugins/WhenWasIt/src/utils.cpp b/plugins/WhenWasIt/src/utils.cpp index 6bfbcd326e..96a86ee8be 100644 --- a/plugins/WhenWasIt/src/utils.cpp +++ b/plugins/WhenWasIt/src/utils.cpp @@ -281,7 +281,7 @@ TCHAR *GetContactID(HANDLE hContact, char *szProto) #pragma warning (disable: 4312)
HANDLE GetContactFromID(TCHAR *szID, char *szProto)
{
- HANDLE hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ HANDLE hContact = db_find_first();
TCHAR *szHandle;
char cProtocol[256];
@@ -300,7 +300,7 @@ HANDLE GetContactFromID(TCHAR *szID, char *szProto) {
break;
}
- hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0);
+ hContact = db_find_next(hContact);
}
return hContact;
}
diff --git a/plugins/YAPP/src/options.cpp b/plugins/YAPP/src/options.cpp index c6b9e05110..fe231b18b2 100644 --- a/plugins/YAPP/src/options.cpp +++ b/plugins/YAPP/src/options.cpp @@ -102,7 +102,7 @@ void ShowExamplePopups() { pd.ptzText = TranslateT("Thequickbrownfoxjumpedoverthelazydog.");
ShowPopup(pd);
- HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ HANDLE hContact = db_find_first();
while(hContact) {
if (options.av_layout != PAV_NONE && ServiceExists(MS_AV_DRAWAVATAR)) {
AVATARCACHEENTRY *ace = (AVATARCACHEENTRY *)CallService(MS_AV_GETAVATARBITMAP, (WPARAM)hContact, 0);
@@ -114,7 +114,7 @@ void ShowExamplePopups() { }
}
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0);
+ hContact = db_find_next(hContact);
}
}
diff --git a/plugins/YAPP/src/yapp_history_dlg.cpp b/plugins/YAPP/src/yapp_history_dlg.cpp index 534af1fe0c..89bf9604a6 100644 --- a/plugins/YAPP/src/yapp_history_dlg.cpp +++ b/plugins/YAPP/src/yapp_history_dlg.cpp @@ -358,7 +358,7 @@ void AddEventsCustomControl(HWND hWnd, int renderer, TCHAR *filter, SIG_MATCHESF ieEvent.hwnd = pwData->hIEView;
ieEvent.codepage = CP_ACP;
ieEvent.iType = IEE_LOG_MEM_EVENTS;
- ieEvent.hContact = NULL;//(HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0); IEVIEW needs a contact handle !!
+ ieEvent.hContact = NULL;//db_find_first(); IEVIEW needs a contact handle !!
IEVIEWEVENTDATA *eventData = NULL;
IEVIEWEVENTDATA *cED = NULL;
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;
diff --git a/src/core/stdchat/src/clist.cpp b/src/core/stdchat/src/clist.cpp index aa17d09d6c..e3f3e2ed61 100644 --- a/src/core/stdchat/src/clist.cpp +++ b/src/core/stdchat/src/clist.cpp @@ -104,7 +104,7 @@ BOOL CList_SetAllOffline(BOOL bHide, const char *pszModule) HANDLE hContact;
char* szProto;
- 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 ( MM_FindModule( szProto )) {
@@ -114,7 +114,7 @@ BOOL CList_SetAllOffline(BOOL bHide, const char *pszModule) DBWriteContactSettingWord(hContact, szProto,"ApparentMode",(LPARAM)(WORD) 0);
DBWriteContactSettingWord(hContact, szProto, "Status", ID_STATUS_OFFLINE);
} } }
- hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0);
+ hContact = db_find_next(hContact);
}
return TRUE;
}
@@ -294,7 +294,7 @@ BOOL CList_AddEvent(HANDLE hContact, HICON hIcon, HANDLE hEvent, int type, TCHAR HANDLE CList_FindRoom ( const char* pszModule, const TCHAR* pszRoom)
{
- 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 && !lstrcmpiA( szProto, pszModule )) {
@@ -308,7 +308,7 @@ HANDLE CList_FindRoom ( const char* pszModule, const TCHAR* pszRoom) DBFreeVariant(&dbv);
} } }
- hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0);
+ hContact = db_find_next(hContact);
}
return 0;
}
diff --git a/src/core/stdfile/file.cpp b/src/core/stdfile/file.cpp index 228c04c9d6..5fa7d5ae22 100644 --- a/src/core/stdfile/file.cpp +++ b/src/core/stdfile/file.cpp @@ -292,7 +292,7 @@ static void RemoveUnreadFileEvents(void) HANDLE hDbEvent, hContact;
dbei.cbSize = sizeof(dbei);
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ hContact = db_find_first();
while (hContact) {
hDbEvent = (HANDLE)CallService(MS_DB_EVENT_FINDFIRSTUNREAD, (WPARAM)hContact, 0);
while (hDbEvent) {
@@ -302,7 +302,7 @@ static void RemoveUnreadFileEvents(void) CallService(MS_DB_EVENT_MARKREAD, (WPARAM)hContact, (LPARAM)hDbEvent);
hDbEvent = (HANDLE)CallService(MS_DB_EVENT_FINDNEXT, (WPARAM)hDbEvent, 0);
}
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0);
+ hContact = db_find_next(hContact);
}
}
diff --git a/src/core/stdmsg/src/msgoptions.cpp b/src/core/stdmsg/src/msgoptions.cpp index 04c676f790..028e7983a2 100644 --- a/src/core/stdmsg/src/msgoptions.cpp +++ b/src/core/stdmsg/src/msgoptions.cpp @@ -453,13 +453,13 @@ static void RebuildList(HWND hwndDlg, HANDLE hItemNew, HANDLE hItemUnknown) if (hItemUnknown && db_get_b(NULL, SRMMMOD, SRMSGSET_TYPINGUNKNOWN, SRMSGDEFSET_TYPINGUNKNOWN)) {
SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETCHECKMARK, (WPARAM) hItemUnknown, 1);
}
- hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ hContact = db_find_first();
do {
hItem = (HANDLE) SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_FINDCONTACT, (WPARAM) hContact, 0);
if (hItem && db_get_b(hContact, SRMMMOD, SRMSGSET_TYPING, defType)) {
SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETCHECKMARK, (WPARAM) hItem, 1);
}
- } while (hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0));
+ } while (hContact = db_find_next(hContact));
}
static void SaveList(HWND hwndDlg, HANDLE hItemNew, HANDLE hItemUnknown)
@@ -472,13 +472,13 @@ static void SaveList(HWND hwndDlg, HANDLE hItemNew, HANDLE hItemUnknown) if (hItemUnknown) {
DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_TYPINGUNKNOWN, (BYTE) (SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_GETCHECKMARK, (WPARAM) hItemUnknown, 0) ? 1 : 0));
}
- hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ hContact = db_find_first();
do {
hItem = (HANDLE) SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_FINDCONTACT, (WPARAM) hContact, 0);
if (hItem) {
DBWriteContactSettingByte(hContact, SRMMMOD, SRMSGSET_TYPING, (BYTE) (SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_GETCHECKMARK, (WPARAM) hItem, 0) ? 1 : 0));
}
- } while (hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0));
+ } while (hContact = db_find_next(hContact));
}
static INT_PTR CALLBACK DlgProcTypeOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
diff --git a/src/core/stdmsg/src/msgs.cpp b/src/core/stdmsg/src/msgs.cpp index 7eb1f25ab0..4ecb53e31f 100644 --- a/src/core/stdmsg/src/msgs.cpp +++ b/src/core/stdmsg/src/msgs.cpp @@ -258,7 +258,7 @@ static void RestoreUnreadMessageAlerts(void) cle.flags = CLEF_TCHAR;
cle.ptszTooltip = toolTip;
- hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ hContact = db_find_first();
while (hContact)
{
hDbEvent = (HANDLE) CallService(MS_DB_EVENT_FINDFIRSTUNREAD, (WPARAM) hContact, 0);
@@ -296,7 +296,7 @@ static void RestoreUnreadMessageAlerts(void) }
hDbEvent = (HANDLE) CallService(MS_DB_EVENT_FINDNEXT, (WPARAM) hDbEvent, 0);
}
- hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0);
+ hContact = db_find_next(hContact);
}
}
diff --git a/src/core/stdurl/url.cpp b/src/core/stdurl/url.cpp index 618de1c55f..0245468725 100644 --- a/src/core/stdurl/url.cpp +++ b/src/core/stdurl/url.cpp @@ -82,7 +82,7 @@ static void RestoreUnreadUrlAlerts(void) cle.hIcon = LoadSkinIcon(SKINICON_EVENT_URL);
cle.pszService = "SRUrl/ReadUrl";
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ hContact = db_find_first();
while (hContact) {
hDbEvent = (HANDLE)CallService(MS_DB_EVENT_FINDFIRSTUNREAD, (WPARAM)hContact, 0);
while (hDbEvent) {
@@ -98,7 +98,7 @@ static void RestoreUnreadUrlAlerts(void) }
hDbEvent = (HANDLE)CallService(MS_DB_EVENT_FINDNEXT, (WPARAM)hDbEvent, 0);
}
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0);
+ hContact = db_find_next(hContact);
}
}
diff --git a/src/modules/clist/clcitems.cpp b/src/modules/clist/clcitems.cpp index 4ef4118104..0b343f19ca 100644 --- a/src/modules/clist/clcitems.cpp +++ b/src/modules/clist/clcitems.cpp @@ -106,13 +106,13 @@ struct ClcGroup* fnAddGroup(HWND hwnd, struct ClcData *dat, const TCHAR *szName, group->totalMembers = 0;
if (flags != (DWORD) - 1 && pNextField == NULL && calcTotalMembers) {
DWORD style = GetWindowLongPtr(hwnd, GWL_STYLE);
- HANDLE hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ HANDLE hContact = db_find_first();
while (hContact) {
ClcCacheEntryBase* cache = cli.pfnGetCacheEntry(hContact);
if ( !lstrcmp(cache->tszGroup, szName) && (style & CLS_SHOWHIDDEN || !cache->bIsHidden))
group->totalMembers++;
- hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0);
+ hContact = db_find_next(hContact);
}
}
}
@@ -381,7 +381,7 @@ void fnRebuildEntireList(HWND hwnd, struct ClcData *dat) }
}
- hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ hContact = db_find_first();
while (hContact) {
if (style & CLS_SHOWHIDDEN || !db_get_b(hContact, "CList", "Hidden", 0)) {
if (DBGetContactSettingTString(hContact, "CList", "Group", &dbv))
@@ -414,7 +414,7 @@ void fnRebuildEntireList(HWND hwnd, struct ClcData *dat) else cli.pfnAddContactToGroup(dat, group, hContact);
}
}
- hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0);
+ hContact = db_find_next(hContact);
}
if (style & CLS_HIDEEMPTYGROUPS) {
diff --git a/src/modules/clist/clistmod.cpp b/src/modules/clist/clistmod.cpp index 2f1cbfbfd0..2bc691ca94 100644 --- a/src/modules/clist/clistmod.cpp +++ b/src/modules/clist/clistmod.cpp @@ -146,13 +146,13 @@ static int ProtocolAck(WPARAM, LPARAM lParam) if ((int) ack->hProcess < ID_STATUS_ONLINE && ack->lParam >= ID_STATUS_ONLINE) {
DWORD caps = (DWORD)CallProtoServiceInt(NULL,ack->szModule, PS_GETCAPS, PFLAGNUM_1, 0);
if (caps & PF1_SERVERCLIST) {
- 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, ack->szModule))
if (db_get_b(hContact, "CList", "Delete", 0))
CallService(MS_DB_CONTACT_DELETE, (WPARAM) hContact, 0);
- hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0);
+ hContact = db_find_next(hContact);
}
}
}
@@ -552,9 +552,9 @@ void UnloadContactListModule() return;
//remove transitory contacts
- HANDLE hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ HANDLE hContact = db_find_first();
while (hContact != NULL) {
- HANDLE hNext = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0);
+ HANDLE hNext = db_find_next(hContact);
if (db_get_b(hContact, "CList", "NotOnList", 0))
CallService(MS_DB_CONTACT_DELETE, (WPARAM) hContact, 0);
hContact = hNext;
diff --git a/src/modules/clist/contact.cpp b/src/modules/clist/contact.cpp index 932efb03fc..dd5afb8094 100644 --- a/src/modules/clist/contact.cpp +++ b/src/modules/clist/contact.cpp @@ -79,12 +79,12 @@ void fnLoadContactTree(void) }
hideOffline = db_get_b(NULL, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT);
- hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ hContact = db_find_first();
while (hContact != NULL) {
status = GetContactStatus(hContact);
if (( !hideOffline || status != ID_STATUS_OFFLINE) && !db_get_b(hContact, "CList", "Hidden", 0))
cli.pfnChangeContactIcon(hContact, cli.pfnIconFromStatusMode((char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hContact, 0), status, hContact), 1);
- hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0);
+ hContact = db_find_next(hContact);
}
sortByStatus = db_get_b(NULL, "CList", "SortByStatus", SETTING_SORTBYSTATUS_DEFAULT);
sortByProto = db_get_b(NULL, "CList", "SortByProto", SETTING_SORTBYPROTO_DEFAULT);
diff --git a/src/modules/clist/groups.cpp b/src/modules/clist/groups.cpp index 931a06d36e..1cfc8b7a9d 100644 --- a/src/modules/clist/groups.cpp +++ b/src/modules/clist/groups.cpp @@ -183,9 +183,9 @@ static INT_PTR DeleteGroup(WPARAM wParam, LPARAM) CLISTGROUPCHANGE grpChg = { sizeof(CLISTGROUPCHANGE), NULL, NULL };
- for (hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ for (hContact = db_find_first();
hContact;
- hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0))
+ hContact = db_find_next(hContact))
{
if (DBGetContactSettingTString(hContact, "CList", "Group", &dbv))
continue;
@@ -273,7 +273,7 @@ static int RenameGroupWithMove(int groupId, const TCHAR *szName, int move) DBWriteContactSettingTString(NULL, "CListGroups", idstr, str);
//must rename setting in all child contacts too
- hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ hContact = db_find_first();
do {
ClcCacheEntryBase* cache = cli.pfnGetCacheEntry(hContact);
if ( !lstrcmp(cache->tszGroup, oldName)) {
@@ -283,7 +283,7 @@ static int RenameGroupWithMove(int groupId, const TCHAR *szName, int move) cli.pfnCheckCacheItem(cache);
}
}
- while ((hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0)) != NULL);
+ while ((hContact = db_find_next(hContact)) != NULL);
//rename subgroups
{
diff --git a/src/modules/ignore/ignore.cpp b/src/modules/ignore/ignore.cpp index 2b5176394d..715c7897da 100644 --- a/src/modules/ignore/ignore.cpp +++ b/src/modules/ignore/ignore.cpp @@ -166,7 +166,7 @@ static void SaveItemMask(HWND hwndList, HANDLE hContact, HANDLE hItem, const cha static void SetAllContactIcons(HWND hwndList)
{
- HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ HANDLE hContact = db_find_first();
do {
HANDLE hItem = (HANDLE)SendMessage(hwndList, CLM_FINDCONTACT, (WPARAM)hContact, 0);
if (hItem && SendMessage(hwndList, CLM_GETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(IGNOREEVENT_MAX, 0)) == 0xFF) {
@@ -182,7 +182,7 @@ static void SetAllContactIcons(HWND hwndList) SendMessage(hwndList, CLM_SETCHECKMARK, (WPARAM)hItem, 1);
}
}
- while (hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0));
+ while (hContact = db_find_next(hContact));
}
static INT_PTR CALLBACK DlgProcIgnoreOpts(HWND hwndDlg, UINT msg, WPARAM, LPARAM lParam)
@@ -302,7 +302,7 @@ static INT_PTR CALLBACK DlgProcIgnoreOpts(HWND hwndDlg, UINT msg, WPARAM, LPARAM switch (((LPNMHDR)lParam)->code) {
case PSN_APPLY:
{
- HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ HANDLE hContact = db_find_first();
do {
HANDLE hItem = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_FINDCONTACT, (WPARAM)hContact, 0);
if (hItem) SaveItemMask( GetDlgItem(hwndDlg, IDC_LIST), hContact, hItem, "Mask1");
@@ -311,7 +311,7 @@ static INT_PTR CALLBACK DlgProcIgnoreOpts(HWND hwndDlg, UINT msg, WPARAM, LPARAM else
DBWriteContactSettingByte(hContact, "CList", "Hidden", 1);
}
- while (hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0));
+ while (hContact = db_find_next(hContact));
SaveItemMask( GetDlgItem(hwndDlg, IDC_LIST), NULL, hItemAll, "Default1");
SaveItemMask( GetDlgItem(hwndDlg, IDC_LIST), NULL, hItemUnknown, "Mask1");
}
diff --git a/src/modules/protocols/protoaccs.cpp b/src/modules/protocols/protoaccs.cpp index eef0ef61a4..2f0a4d29c5 100644 --- a/src/modules/protocols/protoaccs.cpp +++ b/src/modules/protocols/protoaccs.cpp @@ -555,10 +555,10 @@ void EraseAccount(const char* pszModuleName) dbcgs.szSetting = "p";
// remove protocol contacts first
- HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ HANDLE hContact = db_find_first();
while (hContact != NULL) {
HANDLE h1 = hContact;
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)h1, 0);
+ hContact = db_find_next(h1);
dbv.type = DBVT_ASCIIZ;
dbv.pszVal = szProtoName;
diff --git a/src/modules/visibility/visibility.cpp b/src/modules/visibility/visibility.cpp index 751a02d3cc..9a09bc9bed 100644 --- a/src/modules/visibility/visibility.cpp +++ b/src/modules/visibility/visibility.cpp @@ -104,7 +104,7 @@ static void SetAllContactIcons(HWND hwndList) DWORD flags;
WORD status;
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ hContact = db_find_first();
do {
hItem = (HANDLE)SendMessage(hwndList, CLM_FINDCONTACT, (WPARAM)hContact, 0);
if (hItem) {
@@ -123,7 +123,7 @@ static void SetAllContactIcons(HWND hwndList) SendMessage(hwndList, CLM_SETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(1, status == ID_STATUS_OFFLINE?2:0));
}
}
- } while (hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0));
+ } while (hContact = db_find_next(hContact));
}
static INT_PTR CALLBACK DlgProcVisibilityOpts(HWND hwndDlg, UINT msg, WPARAM, LPARAM lParam)
@@ -242,7 +242,7 @@ static INT_PTR CALLBACK DlgProcVisibilityOpts(HWND hwndDlg, UINT msg, WPARAM, LP { HANDLE hContact, hItem;
int set, i, iImage;
- hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
+ hContact = db_find_first();
do {
hItem = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_FINDCONTACT, (WPARAM)hContact, 0);
if (hItem) {
@@ -257,7 +257,7 @@ static INT_PTR CALLBACK DlgProcVisibilityOpts(HWND hwndDlg, UINT msg, WPARAM, LP }
if ( !set) CallContactService(hContact, PSS_SETAPPARENTMODE, 0, 0);
}
- } while (hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0));
+ } while (hContact = db_find_next(hContact));
return TRUE;
}
}
|