1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
|
#include "skype_proto.h"
int CSkypeProto::countriesCount;
CountryListEntry* CSkypeProto::countryList;
int CSkypeProto::GetCountryIdByName(const char* countryName)
{
for (int i = 0; i < CSkypeProto::countriesCount; i++)
{
const char* country = CSkypeProto::countryList[i].szName;
if (strcmp(CSkypeProto::countryList[i].szName, countryName) == 0)
return CSkypeProto::countryList[i].id;
}
return 0;
}
char* CSkypeProto::GetCountryNameById(int countryId)
{
return (char*)::CallService(MS_UTILS_GETCOUNTRYBYNUMBER, (WPARAM)countryId, NULL);
}
int CSkypeProto::CompareProtos(const CSkypeProto *p1, const CSkypeProto *p2)
{
return wcscmp(p1->m_tszUserName, p2->m_tszUserName);
}
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::CreateEvent(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);
}
int CSkypeProto::SendBroadcast(HANDLE hContact, int type, int result, HANDLE hProcess, LPARAM lParam)
{
ACKDATA ack = {0};
ack.cbSize = sizeof(ACKDATA);
ack.szModule = this->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);
}
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);
}
|