From 89c883cf565ac91bf21d1711f7c3972fb6281bf7 Mon Sep 17 00:00:00 2001 From: Alexander Lantsev Date: Thu, 27 Sep 2012 17:23:10 +0000 Subject: -- added proto caps - added service function (creating and hoking services, events, threads) - some minir issues and code review git-svn-id: http://svn.miranda-ng.org/main/trunk@1687 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/Skype/src/skype_utils.cpp | 57 ++++++++++++++++++++++++++++++++++--- 1 file changed, 53 insertions(+), 4 deletions(-) (limited to 'protocols/Skype/src/skype_utils.cpp') diff --git a/protocols/Skype/src/skype_utils.cpp b/protocols/Skype/src/skype_utils.cpp index 1f218dfc08..66529fb097 100644 --- a/protocols/Skype/src/skype_utils.cpp +++ b/protocols/Skype/src/skype_utils.cpp @@ -12,15 +12,64 @@ void CSkypeProto::Log(const char* fmt, ...) CallService(MS_NETLIB_LOG, (WPARAM)this->hNetlibUser, (LPARAM)msg); } +void CSkypeProto::CreateService(const char* szService, SkypeServiceFunc serviceProc) +{ + char moduleName[MAXMODULELABELLENGTH]; + + mir_snprintf(moduleName, sizeof(moduleName), "%s%s", this->m_szModuleName, szService); + CreateServiceFunctionObj(moduleName, (MIRANDASERVICEOBJ)*(void**)&serviceProc, this); +} + +void CSkypeProto::CreateServiceParam(const char* szService, SkypeServiceFunc serviceProc, LPARAM lParam) +{ + char moduleName[MAXMODULELABELLENGTH]; + + mir_snprintf(moduleName, sizeof(moduleName), "%s%s", this->m_szModuleName, szService); + CreateServiceFunctionObjParam(moduleName, (MIRANDASERVICEOBJPARAM)*(void**)&serviceProc, this, lParam); +} + +HANDLE CSkypeProto::CreateHookableEvent(const char* szService) +{ + char moduleName[MAXMODULELABELLENGTH]; + + mir_snprintf(moduleName, sizeof(moduleName), "%s%s", this->m_szModuleName, szService); + return CreateHookableEvent(moduleName); +} + void CSkypeProto::HookEvent(const char* szEvent, SkypeEventFunc handler) { HookEventObj(szEvent, (MIRANDAHOOKOBJ)*( void**)&handler, this); } -void CSkypeProto::CreateService(const char* szService, SkypeServiceFunc serviceProc) +int CSkypeProto::SendBroadcast(HANDLE hContact, int type, int result, HANDLE hProcess, LPARAM lParam) { - char temp[MAX_PATH*2]; + ACKDATA ack = {0}; + ack.cbSize = sizeof(ACKDATA); + ack.szModule = m_szModuleName; + ack.hContact = hContact; + ack.type = type; + ack.result = result; + ack.hProcess = hProcess; + ack.lParam = lParam; + return CallService(MS_PROTO_BROADCASTACK, 0, (LPARAM)&ack); +} - mir_snprintf(temp, sizeof(temp), "%s%s", this->m_szModuleName, szService); - CreateServiceFunctionObj(temp, (MIRANDASERVICEOBJ)*(void**)&serviceProc, this); +void CSkypeProto::ForkThread(SkypeThreadFunc pFunc, void *param) +{ + UINT threadID; + CloseHandle((HANDLE)mir_forkthreadowner( + (pThreadFuncOwner)*(void**)&pFunc, + this, + param, + &threadID)); +} + +HANDLE CSkypeProto::ForkThreadEx(SkypeThreadFunc pFunc, void *param, UINT* threadID) +{ + UINT lthreadID; + return (HANDLE)mir_forkthreadowner( + (pThreadFuncOwner)*(void**)&pFunc, + this, + param, + threadID ? threadID : <hreadID); } \ No newline at end of file -- cgit v1.2.3