summaryrefslogtreecommitdiff
path: root/src/mir_core
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2012-10-10 07:00:35 +0000
committerGeorge Hazan <george.hazan@gmail.com>2012-10-10 07:00:35 +0000
commit2df45c323dff08d54e21f9a99610cb69d2d01075 (patch)
tree0acebd86b976b78c660c550cc71f76e5dcf0a57e /src/mir_core
parent8d831f9b21feb4b203a8209f7ab70d5c533209a3 (diff)
two new db stubs: db_find_first & db_find_next
git-svn-id: http://svn.miranda-ng.org/main/trunk@1855 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/mir_core')
-rw-r--r--src/mir_core/db.cpp51
-rw-r--r--src/mir_core/mir_core.def3
2 files changed, 36 insertions, 18 deletions
diff --git a/src/mir_core/db.cpp b/src/mir_core/db.cpp
index f9a1ba1118..e70701764a 100644
--- a/src/mir_core/db.cpp
+++ b/src/mir_core/db.cpp
@@ -25,6 +25,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
static MIDatabase* currDb = NULL;
+/////////////////////////////////////////////////////////////////////////////////////////
+// getting data
+
MIR_CORE_DLL(int) db_get_b(HANDLE hContact, const char *szModule, const char *szSetting, int errorValue)
{
if (currDb != NULL) {
@@ -76,7 +79,7 @@ MIR_CORE_DLL(DWORD) db_get_dw(HANDLE hContact, const char *szModule, const char
case DBVT_DWORD: return dbv.dVal;
}
}
-
+
return errorValue;
}
@@ -125,22 +128,8 @@ MIR_CORE_DLL(wchar_t*) db_get_wsa(HANDLE hContact, const char *szModule, const c
return str;
}
-MIR_CORE_DLL(INT_PTR) db_free(DBVARIANT *dbv)
-{
- if (currDb == NULL) return 1;
-
- return currDb->FreeVariant(dbv);
-}
-
-MIR_CORE_DLL(INT_PTR) db_unset(HANDLE hContact, const char *szModule, const char *szSetting)
-{
- if (currDb == NULL) return 1;
-
- DBCONTACTGETSETTING cgs;
- cgs.szModule = szModule;
- cgs.szSetting = szSetting;
- return currDb->DeleteContactSetting(hContact, &cgs);
-}
+/////////////////////////////////////////////////////////////////////////////////////////
+// setting data
MIR_CORE_DLL(INT_PTR) db_set_b(HANDLE hContact, const char *szModule, const char *szSetting, BYTE val)
{
@@ -227,6 +216,34 @@ MIR_CORE_DLL(INT_PTR) db_set_blob(HANDLE hContact, const char *szModule, const c
return currDb->WriteContactSetting(hContact, &cws);
}
+/////////////////////////////////////////////////////////////////////////////////////////
+// misc functions
+
+MIR_CORE_DLL(INT_PTR) db_free(DBVARIANT *dbv)
+{
+ return (currDb == NULL) ? 1 : currDb->FreeVariant(dbv);
+}
+
+MIR_CORE_DLL(INT_PTR) db_unset(HANDLE hContact, const char *szModule, const char *szSetting)
+{
+ if (currDb == NULL) return 1;
+
+ DBCONTACTGETSETTING cgs;
+ cgs.szModule = szModule;
+ cgs.szSetting = szSetting;
+ return currDb->DeleteContactSetting(hContact, &cgs);
+}
+
+MIR_CORE_DLL(HANDLE) db_find_first(const char *szProto)
+{
+ return (currDb == NULL) ? NULL : currDb->FindFirstContact(szProto);
+}
+
+MIR_CORE_DLL(HANDLE) db_find_next(HANDLE hContact, const char *szProto)
+{
+ return (currDb == NULL) ? NULL : currDb->FindNextContact(hContact, szProto);
+}
+
extern "C" MIR_CORE_DLL(void) db_setCurrent(MIDatabase* _db)
{
currDb = _db;
diff --git a/src/mir_core/mir_core.def b/src/mir_core/mir_core.def
index 9e4253fc91..df6cce1144 100644
--- a/src/mir_core/mir_core.def
+++ b/src/mir_core/mir_core.def
@@ -132,4 +132,5 @@ CmdLine_Parse @129
Utf8CheckString @130
GetSubscribersCount @131
NotifyFastHook @132
-
+db_find_first @133
+db_find_next @134