diff options
author | George Hazan <george.hazan@gmail.com> | 2013-07-08 18:56:00 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-07-08 18:56:00 +0000 |
commit | c181af64bab27eb50e684c64c0a3caa49f8bbe39 (patch) | |
tree | 2361b449d0ab242d5de0d8d432a5791c92f42301 | |
parent | 6dde588a8a294406cb044dd0bce1c82232285efc (diff) |
protocol helpers, beginning
git-svn-id: http://svn.miranda-ng.org/main/trunk@5285 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r-- | bin10/lib/mir_core.lib | bin | 37366 -> 37816 bytes | |||
-rw-r--r-- | bin10/lib/mir_core64.lib | bin | 34090 -> 34498 bytes | |||
-rw-r--r-- | bin11/lib/mir_core.lib | bin | 37366 -> 37816 bytes | |||
-rw-r--r-- | bin11/lib/mir_core64.lib | bin | 34090 -> 34498 bytes | |||
-rw-r--r-- | include/m_core.h | 6 | ||||
-rw-r--r-- | include/m_protoint.h | 13 | ||||
-rw-r--r-- | protocols/Skype/src/skype_transfers.cpp | 2 | ||||
-rw-r--r-- | src/mir_core/mir_core.def | 2 | ||||
-rw-r--r-- | src/mir_core/protos.cpp | 19 | ||||
-rw-r--r-- | src/modules/protocols/protocols.cpp | 25 |
10 files changed, 28 insertions, 39 deletions
diff --git a/bin10/lib/mir_core.lib b/bin10/lib/mir_core.lib Binary files differindex 6b27834f54..8393ea9f71 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 1f0ef023be..4c3efeee52 100644 --- a/bin10/lib/mir_core64.lib +++ b/bin10/lib/mir_core64.lib diff --git a/bin11/lib/mir_core.lib b/bin11/lib/mir_core.lib Binary files differindex cd69121b36..db7baf3c24 100644 --- a/bin11/lib/mir_core.lib +++ b/bin11/lib/mir_core.lib diff --git a/bin11/lib/mir_core64.lib b/bin11/lib/mir_core64.lib Binary files differindex 33bd0bb49c..210f725cfb 100644 --- a/bin11/lib/mir_core64.lib +++ b/bin11/lib/mir_core64.lib diff --git a/include/m_core.h b/include/m_core.h index f4cb21587d..4467168395 100644 --- a/include/m_core.h +++ b/include/m_core.h @@ -599,6 +599,12 @@ MIR_CORE_DLL(INT_PTR) ProtoCallService(const char *szModule, const char *szServi MIR_CORE_DLL(int) ProtoServiceExists(const char *szModule, const char *szService);
MIR_CORE_DLL(INT_PTR) ProtoBroadcastAck(const char *szModule, HANDLE hContact, int type, int result, HANDLE hProcess, LPARAM lParam);
+// Call it in the very beginning of your proto's constructor
+MIR_CORE_DLL(void) ProtoConstructor(struct PROTO_INTERFACE *pThis, const char *pszModuleName, const TCHAR *ptszUserName);
+
+// Call it in the very end of your proto's destructor
+MIR_CORE_DLL(void) ProtoDestructor(struct PROTO_INTERFACE *pThis);
+
///////////////////////////////////////////////////////////////////////////////
// sha1 functions
diff --git a/include/m_protoint.h b/include/m_protoint.h index 9849bbe320..ac700dfbad 100644 --- a/include/m_protoint.h +++ b/include/m_protoint.h @@ -106,17 +106,4 @@ struct PROTO_INTERFACE : public MZeroedObject virtual int __cdecl OnEvent(PROTOEVENTTYPE iEventType, WPARAM wParam, LPARAM lParam) = 0;
};
-// Call it in the very beginning of your proto's constructor
-__forceinline void ProtoConstructor(PROTO_INTERFACE *pThis, LPCSTR pszModuleName, LPCTSTR ptszUserName)
-{
- CallService("Proto/Constructor", (WPARAM)pThis, (LPARAM)pszModuleName);
- pThis->m_tszUserName = mir_tstrdup(ptszUserName);
-}
-
-// Call it in the very end of your proto's destructor
-__forceinline void ProtoDestructor(PROTO_INTERFACE *pThis)
-{
- CallService("Proto/Destructor", (WPARAM)pThis, 0);
-}
-
#endif // M_PROTOINT_H__
diff --git a/protocols/Skype/src/skype_transfers.cpp b/protocols/Skype/src/skype_transfers.cpp index 90d1440f4c..222ee0ecf7 100644 --- a/protocols/Skype/src/skype_transfers.cpp +++ b/protocols/Skype/src/skype_transfers.cpp @@ -144,7 +144,7 @@ void CSkypeProto::OnFileEvent(const ConversationRef &conversation, const Message PROTORECVFILET pre = {0};
pre.flags = PREF_TCHAR;
- pre.fileCount = transfers.size();
+ pre.fileCount = (int)transfers.size();
pre.timestamp = timestamp;
pre.tszDescription = L"";
pre.ptszFiles = files;
diff --git a/src/mir_core/mir_core.def b/src/mir_core/mir_core.def index 1b3fbd6df1..0e4103229a 100644 --- a/src/mir_core/mir_core.def +++ b/src/mir_core/mir_core.def @@ -166,3 +166,5 @@ ProtoBroadcastAck @163 ProtoCallService @164
db_set_resident @165
db_set @166
+ProtoConstructor @167
+ProtoDestructor @168
diff --git a/src/mir_core/protos.cpp b/src/mir_core/protos.cpp index 6f2309e412..291b7a0fa4 100644 --- a/src/mir_core/protos.cpp +++ b/src/mir_core/protos.cpp @@ -24,6 +24,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "commonheaders.h"
#include <m_protomod.h>
+#include <m_protoint.h>
+#include <m_skin.h>
static HANDLE hAckEvent;
@@ -81,3 +83,20 @@ MIR_CORE_DLL(int) ProtoServiceExists(const char *szModule, const char *szService strncat_s(str,szService,strlen(szService));
return ServiceExists(str);
}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
+MIR_CORE_DLL(void) ProtoConstructor(PROTO_INTERFACE *pThis, LPCSTR pszModuleName, LPCTSTR ptszUserName)
+{
+ pThis->m_iVersion = 2;
+ pThis->m_iStatus = pThis->m_iDesiredStatus = ID_STATUS_OFFLINE;
+ pThis->m_szModuleName = mir_strdup(pszModuleName);
+ pThis->m_hProtoIcon = (HANDLE)CallService("Skin2/Icons/IsManaged", (WPARAM)LoadSkinnedProtoIcon(pszModuleName, ID_STATUS_ONLINE), 0);
+ pThis->m_tszUserName = mir_tstrdup(ptszUserName);
+}
+
+MIR_CORE_DLL(void) ProtoDestructor(PROTO_INTERFACE *pThis)
+{
+ mir_free(pThis->m_szModuleName);
+ mir_free(pThis->m_tszUserName);
+}
diff --git a/src/modules/protocols/protocols.cpp b/src/modules/protocols/protocols.cpp index 426bf039fb..14abba9059 100644 --- a/src/modules/protocols/protocols.cpp +++ b/src/modules/protocols/protocols.cpp @@ -622,28 +622,6 @@ INT_PTR CallProtoServiceInt(HANDLE hContact, const char *szModule, const char *s /////////////////////////////////////////////////////////////////////////////////////////
-static INT_PTR srvProtoConstructor(WPARAM wParam, LPARAM lParam)
-{
- PROTO_INTERFACE *ppi = (PROTO_INTERFACE*)wParam;
- LPCSTR szProtoName = (LPCSTR)lParam;
-
- ppi->m_iVersion = 2;
- ppi->m_iStatus = ppi->m_iDesiredStatus = ID_STATUS_OFFLINE;
- ppi->m_szModuleName = mir_strdup(szProtoName);
- ppi->m_hProtoIcon = (HANDLE)CallService(MS_SKIN2_ISMANAGEDICON, (WPARAM)LoadSkinnedProtoIcon(szProtoName, ID_STATUS_ONLINE), 0);
- return 0;
-}
-
-static INT_PTR srvProtoDestructor(WPARAM wParam, LPARAM)
-{
- PROTO_INTERFACE *ppi = (PROTO_INTERFACE*)wParam;
- mir_free(ppi->m_szModuleName);
- mir_free(ppi->m_tszUserName);
- return 0;
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-
static void InsertServiceListItem(int id, const char* szName)
{
TServiceListItem* p = (TServiceListItem*)mir_alloc(sizeof(TServiceListItem));
@@ -724,9 +702,6 @@ int LoadProtocolsModule(void) CreateServiceFunction(MS_PROTO_ENUMACCOUNTS, Proto_EnumAccounts);
CreateServiceFunction(MS_PROTO_GETACCOUNT, srvProto_GetAccount);
- CreateServiceFunction("Proto/Constructor", srvProtoConstructor);
- CreateServiceFunction("Proto/Destructor", srvProtoDestructor);
-
CreateServiceFunction(MS_PROTO_ISACCOUNTENABLED, srvProto_IsAccountEnabled);
CreateServiceFunction(MS_PROTO_ISACCOUNTLOCKED, srvProto_IsAccountLocked);
|