summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/m_core.h36
-rw-r--r--include/m_protoint.h102
2 files changed, 66 insertions, 72 deletions
diff --git a/include/m_core.h b/include/m_core.h
index 3167bc514b..b99bbbafb1 100644
--- a/include/m_core.h
+++ b/include/m_core.h
@@ -619,44 +619,8 @@ MIR_CORE_DLL(void) ProtoCreateService(struct PROTO_INTERFACE *pThis, const cha
typedef INT_PTR (__cdecl PROTO_INTERFACE::*ProtoServiceFuncParam)(WPARAM, LPARAM, LPARAM);
MIR_CORE_DLL(void) ProtoCreateServiceParam(struct PROTO_INTERFACE *pThis, const char* szService, ProtoServiceFuncParam, LPARAM);
-
-MIR_CORE_DLL(bool) ProtoGetBool0(struct PROTO_INTERFACE *pThis, const char* name, bool defaultValue);
-MIR_CORE_DLL(bool) ProtoGetBool(struct PROTO_INTERFACE *pThis, HANDLE hContact, const char* name, bool defaultValue);
#endif
-MIR_CORE_DLL(int) ProtoGetByte0(struct PROTO_INTERFACE *pThis, const char* name, BYTE defaultValue);
-MIR_CORE_DLL(int) ProtoGetByte(struct PROTO_INTERFACE *pThis, HANDLE hContact, const char* name, BYTE defaultValue);
-
-MIR_CORE_DLL(DWORD) ProtoGetDword0(struct PROTO_INTERFACE *pThis, const char* name, DWORD defaultValue);
-MIR_CORE_DLL(DWORD) ProtoGetDword(struct PROTO_INTERFACE *pThis, HANDLE hContact, const char* name, DWORD defaultValue);
-
-MIR_CORE_DLL(int) ProtoGetString0(struct PROTO_INTERFACE *pThis, const char* name, DBVARIANT* result);
-MIR_CORE_DLL(int) ProtoGetString(struct PROTO_INTERFACE *pThis, HANDLE hContact, const char* name, DBVARIANT* result);
-
-MIR_CORE_DLL(int) ProtoGetTString0(struct PROTO_INTERFACE *pThis, const char* name, DBVARIANT* result);
-MIR_CORE_DLL(int) ProtoGetTString(struct PROTO_INTERFACE *pThis, HANDLE hContact, const char* name, DBVARIANT* result);
-
-MIR_CORE_DLL(WORD) ProtoGetWord0(struct PROTO_INTERFACE *pThis, const char* name, WORD defaultValue);
-MIR_CORE_DLL(WORD) ProtoGetWord(struct PROTO_INTERFACE *pThis, HANDLE hContact, const char* name, WORD defaultValue);
-
-MIR_CORE_DLL(char*) ProtoGetStringA0(struct PROTO_INTERFACE *pThis, const char* setting);
-MIR_CORE_DLL(char*) ProtoGetStringA(struct PROTO_INTERFACE *pThis, HANDLE hContact, const char* setting);
-
-MIR_CORE_DLL(void) ProtoSetByte0(struct PROTO_INTERFACE *pThis, const char* name, BYTE value);
-MIR_CORE_DLL(void) ProtoSetByte(struct PROTO_INTERFACE *pThis, HANDLE hContact, const char* name, BYTE value);
-
-MIR_CORE_DLL(void) ProtoSetWord0(struct PROTO_INTERFACE *pThis, const char* name, WORD value);
-MIR_CORE_DLL(void) ProtoSetWord(struct PROTO_INTERFACE *pThis, HANDLE hContact, const char* name, WORD value);
-
-MIR_CORE_DLL(void) ProtoSetDword0(struct PROTO_INTERFACE *pThis, const char* name, DWORD value);
-MIR_CORE_DLL(void) ProtoSetDword(struct PROTO_INTERFACE *pThis, HANDLE hContact, const char* name, DWORD value);
-
-MIR_CORE_DLL(void) ProtoSetString0(struct PROTO_INTERFACE *pThis, const char* name, const char* value);
-MIR_CORE_DLL(void) ProtoSetString(struct PROTO_INTERFACE *pThis, HANDLE hContact, const char* name, const char* value);
-
-MIR_CORE_DLL(void) ProtoSetTString0(struct PROTO_INTERFACE *pThis, const char* name, const TCHAR* value);
-MIR_CORE_DLL(void) ProtoSetTString(struct PROTO_INTERFACE *pThis, HANDLE hContact, const char* name, const TCHAR* value);
-
///////////////////////////////////////////////////////////////////////////////
// sha1 functions
diff --git a/include/m_protoint.h b/include/m_protoint.h
index 1905f85a18..69aa6339b4 100644
--- a/include/m_protoint.h
+++ b/include/m_protoint.h
@@ -57,48 +57,78 @@ struct PROTO_INTERFACE : public MZeroedObject
//////////////////////////////////////////////////////////////////////////////////////
// Helpers
- __forceinline INT_PTR ProtoBroadcastAck(HANDLE hContact, int type, int hResult, HANDLE hProcess, LPARAM lParam)
- { return ::ProtoBroadcastAck(m_szModuleName, hContact, type, hResult, hProcess, lParam); }
+ __forceinline INT_PTR ProtoBroadcastAck(HANDLE hContact, int type, int hResult, HANDLE hProcess, LPARAM lParam) {
+ return ::ProtoBroadcastAck(m_szModuleName, hContact, type, hResult, hProcess, lParam); }
__forceinline INT_PTR delSetting(const char *name) { return db_unset(NULL, m_szModuleName, name); }
__forceinline INT_PTR delSetting(HANDLE hContact, const char *name) { return db_unset(hContact, m_szModuleName, name); }
- __forceinline bool getBool(const char *name, bool defaultValue) { return ProtoGetBool0(this, name, defaultValue); }
- __forceinline bool getBool(HANDLE hContact, const char *name, bool defaultValue) { return ProtoGetBool(this, hContact, name, defaultValue); }
- __forceinline bool isChatRoom(HANDLE hContact) { return getBool(hContact, "ChatRoom", false); }
-
- __forceinline int getByte(const char *name, BYTE defaultValue) { return ProtoGetByte0(this, name, defaultValue); }
- __forceinline int getByte(HANDLE hContact, const char *name, BYTE defaultValue) { return ProtoGetByte(this, hContact, name, defaultValue); }
-
- __forceinline int getWord(const char *name, WORD defaultValue) { return ProtoGetWord0(this, name, defaultValue); }
- __forceinline int getWord(HANDLE hContact, const char *name, WORD defaultValue) { return ProtoGetWord(this, hContact, name, defaultValue); }
-
- __forceinline DWORD getDword(const char *name, DWORD defaultValue) { return ProtoGetDword0(this, name, defaultValue); }
- __forceinline DWORD getDword(HANDLE hContact, const char *name, DWORD defaultValue) { return ProtoGetDword(this, hContact, name, defaultValue); }
-
- __forceinline int getString(const char *name, DBVARIANT *result) { return ProtoGetString0(this, name, result); }
- __forceinline int getString(HANDLE hContact, const char *name, DBVARIANT *result) { return ProtoGetString(this, hContact, name, result); }
-
- __forceinline int getTString(const char *name, DBVARIANT *result) { return ProtoGetTString0(this, name, result); }
- __forceinline int getTString(HANDLE hContact, const char *name, DBVARIANT *result) { return ProtoGetTString(this, hContact, name, result); }
+ __forceinline bool getBool(const char *name, bool defaultValue) {
+ return db_get_b(NULL, m_szModuleName, name, defaultValue) != 0; }
+ __forceinline bool getBool(HANDLE hContact, const char *name, bool defaultValue) {
+ return db_get_b(hContact, m_szModuleName, name, defaultValue) != 0; }
- __forceinline char* getStringA(const char *name) { return ProtoGetStringA0(this, name); }
- __forceinline char* getStringA(HANDLE hContact, const char *name) { return ProtoGetStringA(this, hContact, name); }
-
- __forceinline void setByte(const char *name, BYTE value) { ProtoSetByte0(this, name, value); }
- __forceinline void setByte(HANDLE hContact, const char *name, BYTE value) { ProtoSetByte(this, hContact, name, value); }
-
- __forceinline void setWord(const char *name, WORD value) { ProtoSetWord0(this, name, value); }
- __forceinline void setWord(HANDLE hContact, const char *name, WORD value) { ProtoSetWord(this, hContact, name, value); }
-
- __forceinline void setDword(const char *name, DWORD value) { ProtoSetDword0(this, name, value); }
- __forceinline void setDword(HANDLE hContact, const char *name, DWORD value) { ProtoSetDword(this, hContact, name, value); }
-
- __forceinline void setString(const char *name, const char* value) { ProtoSetString0(this, name, value); }
- __forceinline void setString(HANDLE hContact, const char *name, const char* value) { ProtoSetString(this, hContact, name, value); }
+ __forceinline bool isChatRoom(HANDLE hContact) { return getBool(hContact, "ChatRoom", false); }
- __forceinline void setTString(const char *name, const TCHAR* value) { ProtoSetTString0(this, name, value); }
- __forceinline void setTString(HANDLE hContact, const char *name, const TCHAR* value) { ProtoSetTString(this, hContact, name, value); }
+ __forceinline int getByte(const char *name, BYTE defaultValue) {
+ return db_get_b(NULL, m_szModuleName, name, defaultValue); }
+ __forceinline int getByte(HANDLE hContact, const char *name, BYTE defaultValue) {
+ return db_get_b(hContact, m_szModuleName, name, defaultValue); }
+
+ __forceinline int getWord(const char *name, WORD defaultValue) {
+ return db_get_w(NULL, m_szModuleName, name, defaultValue); }
+ __forceinline int getWord(HANDLE hContact, const char *name, WORD defaultValue) {
+ return db_get_w(hContact, m_szModuleName, name, defaultValue); }
+
+ __forceinline DWORD getDword(const char *name, DWORD defaultValue) {
+ return db_get_dw(NULL, m_szModuleName, name, defaultValue); }
+ __forceinline DWORD getDword(HANDLE hContact, const char *name, DWORD defaultValue) {
+ return db_get_dw(hContact, m_szModuleName, name, defaultValue); }
+
+ __forceinline INT_PTR getString(const char *name, DBVARIANT *result) {
+ return db_get_s(NULL, m_szModuleName, name, result); }
+ __forceinline INT_PTR getString(HANDLE hContact, const char *name, DBVARIANT *result) {
+ return db_get_s(hContact, m_szModuleName, name, result); }
+
+ __forceinline INT_PTR getWString(const char *name, DBVARIANT *result) {
+ return db_get_ws(NULL, m_szModuleName, name, result); }
+ __forceinline INT_PTR getWString(HANDLE hContact, const char *name, DBVARIANT *result) {
+ return db_get_ws(hContact, m_szModuleName, name, result); }
+
+ __forceinline char* getStringA(const char *name) {
+ return db_get_sa(NULL, m_szModuleName, name); }
+ __forceinline char* getStringA(HANDLE hContact, const char *name) {
+ return db_get_sa(hContact, m_szModuleName, name); }
+
+ __forceinline WCHAR* getWStringA(const char *name) {
+ return db_get_wsa(NULL, m_szModuleName, name); }
+ __forceinline WCHAR* getWStringA(HANDLE hContact, const char *name) {
+ return db_get_wsa(hContact, m_szModuleName, name); }
+
+ __forceinline void setByte(const char *name, BYTE value) { db_set_b(NULL, m_szModuleName, name, value); }
+ __forceinline void setByte(HANDLE hContact, const char *name, BYTE value) { db_set_b(hContact, m_szModuleName, name, value); }
+
+ __forceinline void setWord(const char *name, WORD value) { db_set_w(NULL, m_szModuleName, name, value); }
+ __forceinline void setWord(HANDLE hContact, const char *name, WORD value) { db_set_w(hContact, m_szModuleName, name, value); }
+
+ __forceinline void setDword(const char *name, DWORD value) { db_set_dw(NULL, m_szModuleName, name, value); }
+ __forceinline void setDword(HANDLE hContact, const char *name, DWORD value) { db_set_dw(hContact, m_szModuleName, name, value); }
+
+ __forceinline void setString(const char *name, const char* value) { db_set_s(NULL, m_szModuleName, name, value); }
+ __forceinline void setString(HANDLE hContact, const char *name, const char* value) { db_set_s(hContact, m_szModuleName, name, value); }
+
+ __forceinline void setWString(const char *name, const WCHAR* value) { db_set_ws(NULL, m_szModuleName, name, value); }
+ __forceinline void setWString(HANDLE hContact, const char *name, const WCHAR* value) { db_set_ws(hContact, m_szModuleName, name, value); }
+
+ #if defined(_UNICODE)
+ #define getTString getWString
+ #define getTStringA getWStringA
+ #define setTString setWString
+ #else
+ #define getTString getString
+ #define getTStringA getStringA
+ #define setTString setString
+ #endif
//////////////////////////////////////////////////////////////////////////////////////
// Virtual functions