diff options
-rw-r--r-- | bin10/lib/mir_core.lib | bin | 29718 -> 30134 bytes | |||
-rw-r--r-- | bin10/lib/mir_core64.lib | bin | 27144 -> 27522 bytes | |||
-rw-r--r-- | include/delphi/m_core.inc | 9 | ||||
-rw-r--r-- | include/m_core.h | 3 | ||||
-rw-r--r-- | src/mir_core/db.cpp | 51 | ||||
-rw-r--r-- | src/mir_core/mir_core.def | 3 |
6 files changed, 46 insertions, 20 deletions
diff --git a/bin10/lib/mir_core.lib b/bin10/lib/mir_core.lib Binary files differindex a9496214cf..9d1e620651 100644 --- a/bin10/lib/mir_core.lib +++ b/bin10/lib/mir_core.lib diff --git a/bin10/lib/mir_core64.lib b/bin10/lib/mir_core64.lib Binary files differindex c89a23eefe..a70910901d 100644 --- a/bin10/lib/mir_core64.lib +++ b/bin10/lib/mir_core64.lib diff --git a/include/delphi/m_core.inc b/include/delphi/m_core.inc index 6424d47ebb..2f9401e63d 100644 --- a/include/delphi/m_core.inc +++ b/include/delphi/m_core.inc @@ -80,6 +80,11 @@ function db_free(dbv:PDBVARIANT):int_ptr; stdcall; function db_unset(hContact:THANDLE; const szModule:pAnsiChar; const szSetting:pAnsiChar):int_ptr; stdcall;
external CoreDLL name 'db_unset';
+function db_find_first(const szModule:pAnsiChar=nil):THANDLE; stdcall;
+ external CoreDLL name 'db_find_first';
+function db_find_next(hContact:THANDLE; const szModule:pAnsiChar=nil):THANDLE; stdcall;
+ external CoreDLL name 'db_find_next';
+
function db_get_b(hContact:THANDLE; const szModule:pAnsiChar; const szSetting:pAnsiChar; errorValue:int):int; stdcall;
external CoreDLL name 'db_get_b';
function db_get_w(hContact:THANDLE; const szModule:pAnsiChar; const szSetting:pAnsiChar; errorValue:int):int; stdcall;
@@ -286,9 +291,9 @@ function mir_hash(const key:pointer; len:uint):uint; stdcall; type
TFSortFunc = function (para1:pointer; para2:pointer):int;cdecl;
{
-// Assumes first 32 bit value of the data is the numeric key
+// Assumes first 32 bit value of the data is the numeric key
// and uses it to perform sort/search operations, this results
-// in much better performance as no compare function calls needed
+// in much better performance as no compare function calls needed
// Incredibly useful for Hash Tables
}
const
diff --git a/include/m_core.h b/include/m_core.h index e617b0ca98..0deec3269b 100644 --- a/include/m_core.h +++ b/include/m_core.h @@ -87,6 +87,9 @@ typedef struct { MIR_CORE_DLL(INT_PTR) db_free(DBVARIANT *dbv);
MIR_CORE_DLL(INT_PTR) db_unset(HANDLE hContact, const char *szModule, const char *szSetting);
+MIR_CORE_DLL(HANDLE) db_find_first(const char *szProto = NULL);
+MIR_CORE_DLL(HANDLE) db_find_next(HANDLE hContact, const char *szProto = NULL);
+
MIR_CORE_DLL(int) db_get_b(HANDLE hContact, const char *szModule, const char *szSetting, int errorValue);
MIR_CORE_DLL(int) db_get_w(HANDLE hContact, const char *szModule, const char *szSetting, int errorValue);
MIR_CORE_DLL(DWORD) db_get_dw(HANDLE hContact, const char *szModule, const char *szSetting, DWORD errorValue);
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
|