summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-07-09 20:07:53 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-07-09 20:07:53 +0000
commitfa4123ac3897ee03b36776482cee27d7db025a83 (patch)
tree62f17c08bc057ed195e881f21998699ea261a6c8
parent4e5ef4f9ef22c46caf8909adea31f7e832bb6b7c (diff)
protocol database helpers
git-svn-id: http://svn.miranda-ng.org/main/trunk@5301 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--bin10/lib/mir_core.libbin39270 -> 44528 bytes
-rw-r--r--bin10/lib/mir_core64.libbin35812 -> 40498 bytes
-rw-r--r--bin11/lib/mir_core.libbin39270 -> 44528 bytes
-rw-r--r--bin11/lib/mir_core64.libbin35812 -> 40498 bytes
-rw-r--r--include/m_core.h36
-rw-r--r--src/mir_core/mir_core.def24
-rw-r--r--src/mir_core/protos.cpp98
7 files changed, 158 insertions, 0 deletions
diff --git a/bin10/lib/mir_core.lib b/bin10/lib/mir_core.lib
index 5c8c38a530..a9d15b95ce 100644
--- a/bin10/lib/mir_core.lib
+++ b/bin10/lib/mir_core.lib
Binary files differ
diff --git a/bin10/lib/mir_core64.lib b/bin10/lib/mir_core64.lib
index 18f70c1c88..0cfbd1b1a3 100644
--- a/bin10/lib/mir_core64.lib
+++ b/bin10/lib/mir_core64.lib
Binary files differ
diff --git a/bin11/lib/mir_core.lib b/bin11/lib/mir_core.lib
index ec9c957f49..c1288e866a 100644
--- a/bin11/lib/mir_core.lib
+++ b/bin11/lib/mir_core.lib
Binary files differ
diff --git a/bin11/lib/mir_core64.lib b/bin11/lib/mir_core64.lib
index 10a9ea603c..cfb841ed22 100644
--- a/bin11/lib/mir_core64.lib
+++ b/bin11/lib/mir_core64.lib
Binary files differ
diff --git a/include/m_core.h b/include/m_core.h
index 3a8da096cd..e27d20dede 100644
--- a/include/m_core.h
+++ b/include/m_core.h
@@ -621,6 +621,42 @@ typedef INT_PTR (__cdecl PROTO_INTERFACE::*ProtoServiceFuncParam)(WPARAM, LPARAM
MIR_CORE_DLL(void) ProtoCreateServiceParam(PROTO_INTERFACE *pThis, const char* szService, ProtoServiceFuncParam, LPARAM);
#endif
+MIR_CORE_DLL(bool) ProtoGetBool0(PROTO_INTERFACE *pThis, const char* name, bool defaultValue);
+MIR_CORE_DLL(bool) ProtoGetBool(PROTO_INTERFACE *pThis, HANDLE hContact, const char* name, bool defaultValue);
+
+MIR_CORE_DLL(int) ProtoGetByte0(PROTO_INTERFACE *pThis, const char* name, BYTE defaultValue);
+MIR_CORE_DLL(int) ProtoGetByte(PROTO_INTERFACE *pThis, HANDLE hContact, const char* name, BYTE defaultValue);
+
+MIR_CORE_DLL(int) ProtoGetDword0(PROTO_INTERFACE *pThis, const char* name, DWORD defaultValue);
+MIR_CORE_DLL(int) ProtoGetDword(PROTO_INTERFACE *pThis, HANDLE hContact, const char* name, DWORD defaultValue);
+
+MIR_CORE_DLL(int) ProtoGetString0(PROTO_INTERFACE *pThis, const char* name, DBVARIANT* result);
+MIR_CORE_DLL(int) ProtoGetString(PROTO_INTERFACE *pThis, HANDLE hContact, const char* name, DBVARIANT* result);
+
+MIR_CORE_DLL(int) ProtoGetTString0(PROTO_INTERFACE *pThis, const char* name, DBVARIANT* result);
+MIR_CORE_DLL(int) ProtoGetTString(PROTO_INTERFACE *pThis, HANDLE hContact, const char* name, DBVARIANT* result);
+
+MIR_CORE_DLL(WORD) ProtoGetWord0(PROTO_INTERFACE *pThis, const char* name, WORD defaultValue);
+MIR_CORE_DLL(WORD) ProtoGetWord(PROTO_INTERFACE *pThis, HANDLE hContact, const char* name, WORD defaultValue);
+
+MIR_CORE_DLL(char*) ProtoGetStringA0(PROTO_INTERFACE *pThis, const char* setting);
+MIR_CORE_DLL(char*) ProtoGetStringA(PROTO_INTERFACE *pThis, HANDLE hContact, const char* setting);
+
+MIR_CORE_DLL(void) ProtoSetByte0(PROTO_INTERFACE *pThis, const char* name, BYTE value);
+MIR_CORE_DLL(void) ProtoSetByte(PROTO_INTERFACE *pThis, HANDLE hContact, const char* name, BYTE value);
+
+MIR_CORE_DLL(void) ProtoSetWord0(PROTO_INTERFACE *pThis, const char* name, WORD value);
+MIR_CORE_DLL(void) ProtoSetWord(PROTO_INTERFACE *pThis, HANDLE hContact, const char* name, WORD value);
+
+MIR_CORE_DLL(void) ProtoSetDword0(PROTO_INTERFACE *pThis, const char* name, DWORD value);
+MIR_CORE_DLL(void) ProtoSetDword(PROTO_INTERFACE *pThis, HANDLE hContact, const char* name, DWORD value);
+
+MIR_CORE_DLL(void) ProtoSetString0(PROTO_INTERFACE *pThis, const char* name, const char* value);
+MIR_CORE_DLL(void) ProtoSetString(PROTO_INTERFACE *pThis, HANDLE hContact, const char* name, const char* value);
+
+MIR_CORE_DLL(void) ProtoSetTString0(PROTO_INTERFACE *pThis, const char* name, const TCHAR* value);
+MIR_CORE_DLL(void) ProtoSetTString(PROTO_INTERFACE *pThis, HANDLE hContact, const char* name, const TCHAR* value);
+
///////////////////////////////////////////////////////////////////////////////
// sha1 functions
diff --git a/src/mir_core/mir_core.def b/src/mir_core/mir_core.def
index a601d34b0b..35b7af1ad1 100644
--- a/src/mir_core/mir_core.def
+++ b/src/mir_core/mir_core.def
@@ -174,3 +174,27 @@ ProtoHookEvent @171
ProtoCreateHookableEvent @172
ProtoForkThread @173
ProtoForkThreadEx @174
+ProtoGetBool0 @175
+ProtoGetBool @176
+ProtoGetByte0 @177
+ProtoGetByte @178
+ProtoGetDword0 @179
+ProtoGetDword @180
+ProtoGetString0 @181
+ProtoGetString @182
+ProtoGetTString0 @183
+ProtoGetTString @184
+ProtoGetWord0 @185
+ProtoGetWord @186
+ProtoGetStringA0 @187
+ProtoGetStringA @188
+ProtoSetByte0 @189
+ProtoSetByte @190
+ProtoSetWord0 @191
+ProtoSetWord @192
+ProtoSetDword0 @193
+ProtoSetDword @194
+ProtoSetString0 @195
+ProtoSetString @196
+ProtoSetTString0 @197
+ProtoSetTString @198
diff --git a/src/mir_core/protos.cpp b/src/mir_core/protos.cpp
index 098bf280d4..4b9245342b 100644
--- a/src/mir_core/protos.cpp
+++ b/src/mir_core/protos.cpp
@@ -141,3 +141,101 @@ MIR_CORE_DLL(HANDLE) ProtoForkThreadEx(PROTO_INTERFACE *pThis, ProtoThreadFunc p
UINT lthreadID;
return (HANDLE)::mir_forkthreadowner((pThreadFuncOwner) *(void**)&pFunc, pThis, param, threadID ? threadID : &lthreadID);
}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
+MIR_CORE_DLL(bool) ProtoGetBool0(PROTO_INTERFACE *pThis, const char* name, bool defaultValue)
+{ return db_get_b(NULL, pThis->m_szModuleName, name, defaultValue) != 0;
+}
+
+MIR_CORE_DLL(bool) ProtoGetBool(PROTO_INTERFACE *pThis, HANDLE hContact, const char* name, bool defaultValue)
+{ return db_get_b(hContact, pThis->m_szModuleName, name, defaultValue) != 0;
+}
+
+MIR_CORE_DLL(int) ProtoGetByte0(PROTO_INTERFACE *pThis, const char* name, BYTE defaultValue)
+{ return db_get_b(NULL, pThis->m_szModuleName, name, defaultValue);
+}
+
+MIR_CORE_DLL(int) ProtoGetByte(PROTO_INTERFACE *pThis, HANDLE hContact, const char* name, BYTE defaultValue)
+{ return db_get_b(hContact, pThis->m_szModuleName, name, defaultValue);
+}
+
+MIR_CORE_DLL(int) ProtoGetDword0(PROTO_INTERFACE *pThis, const char* name, DWORD defaultValue)
+{ return db_get_dw(NULL, pThis->m_szModuleName, name, defaultValue);
+}
+
+MIR_CORE_DLL(int) ProtoGetDword(PROTO_INTERFACE *pThis, HANDLE hContact, const char* name, DWORD defaultValue)
+{ return db_get_dw(hContact, pThis->m_szModuleName, name, defaultValue);
+}
+
+MIR_CORE_DLL(int) ProtoGetString0(PROTO_INTERFACE *pThis, const char* name, DBVARIANT* result)
+{ return db_get_s(NULL, pThis->m_szModuleName, name, result);
+}
+
+MIR_CORE_DLL(int) ProtoGetString(PROTO_INTERFACE *pThis, HANDLE hContact, const char* name, DBVARIANT* result)
+{ return db_get_s(hContact, pThis->m_szModuleName, name, result);
+}
+
+MIR_CORE_DLL(int) ProtoGetTString0(PROTO_INTERFACE *pThis, const char* name, DBVARIANT* result)
+{ return db_get_ts(NULL, pThis->m_szModuleName, name, result);
+}
+
+MIR_CORE_DLL(int) ProtoGetTString(PROTO_INTERFACE *pThis, HANDLE hContact, const char* name, DBVARIANT* result)
+{ return db_get_ts(hContact, pThis->m_szModuleName, name, result);
+}
+
+MIR_CORE_DLL(WORD) ProtoGetWord0(PROTO_INTERFACE *pThis, const char* name, WORD defaultValue)
+{ return (WORD)db_get_w(NULL, pThis->m_szModuleName, name, defaultValue);
+}
+
+MIR_CORE_DLL(WORD) ProtoGetWord(PROTO_INTERFACE *pThis, HANDLE hContact, const char* name, WORD defaultValue)
+{ return (WORD)db_get_w(hContact, pThis->m_szModuleName, name, defaultValue);
+}
+
+MIR_CORE_DLL(char*) ProtoGetStringA0(PROTO_INTERFACE *pThis, const char* setting)
+{ return db_get_sa(NULL, pThis->m_szModuleName, setting);
+}
+
+MIR_CORE_DLL(char*) ProtoGetStringA(PROTO_INTERFACE *pThis, HANDLE hContact, const char* setting)
+{ return db_get_sa(hContact, pThis->m_szModuleName, setting);
+}
+
+MIR_CORE_DLL(void) ProtoSetByte0(PROTO_INTERFACE *pThis, const char* name, BYTE value)
+{ db_set_b(NULL, pThis->m_szModuleName, name, value);
+}
+
+MIR_CORE_DLL(void) ProtoSetByte(PROTO_INTERFACE *pThis, HANDLE hContact, const char* name, BYTE value)
+{ db_set_b(hContact, pThis->m_szModuleName, name, value);
+}
+
+MIR_CORE_DLL(void) ProtoSetWord0(PROTO_INTERFACE *pThis, const char* name, WORD value)
+{ db_set_w(NULL, pThis->m_szModuleName, name, value);
+}
+
+MIR_CORE_DLL(void) ProtoSetWord(PROTO_INTERFACE *pThis, HANDLE hContact, const char* name, WORD value)
+{ db_set_w(hContact, pThis->m_szModuleName, name, value);
+}
+
+MIR_CORE_DLL(void) ProtoSetDword0(PROTO_INTERFACE *pThis, const char* name, DWORD value)
+{ db_set_dw(NULL, pThis->m_szModuleName, name, value);
+}
+
+MIR_CORE_DLL(void) ProtoSetDword(PROTO_INTERFACE *pThis, HANDLE hContact, const char* name, DWORD value)
+{ db_set_dw(hContact, pThis->m_szModuleName, name, value);
+}
+
+MIR_CORE_DLL(void) ProtoSetString0(PROTO_INTERFACE *pThis, const char* name, const char* value)
+{ db_set_s(NULL, pThis->m_szModuleName, name, value);
+}
+
+MIR_CORE_DLL(void) ProtoSetString(PROTO_INTERFACE *pThis, HANDLE hContact, const char* name, const char* value)
+{ db_set_s(hContact, pThis->m_szModuleName, name, value);
+}
+
+MIR_CORE_DLL(void) ProtoSetTString0(PROTO_INTERFACE *pThis, const char* name, const TCHAR* value)
+{ db_set_ts(NULL, pThis->m_szModuleName, name, value);
+}
+
+MIR_CORE_DLL(void) ProtoSetTString(PROTO_INTERFACE *pThis, HANDLE hContact, const char* name, const TCHAR* value)
+{ db_set_ts(hContact, pThis->m_szModuleName, name, value);
+}