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
|
#include "skype_proto.h"
HANDLE CSkypeProto::AddDataBaseEvent(HANDLE hContact, WORD type, DWORD time, DWORD flags, DWORD cbBlob, PBYTE pBlob)
{
DBEVENTINFO dbei = {0};
dbei.cbSize = sizeof(dbei);
dbei.szModule = this->m_szModuleName;
dbei.timestamp = time;
dbei.flags = flags;
dbei.eventType = type;
dbei.cbBlob = cbBlob;
dbei.pBlob = pBlob;
return (HANDLE)CallService(MS_DB_EVENT_ADD, (WPARAM)hContact, (LPARAM)&dbei);
}
void CSkypeProto::RaiseAuthRequestEvent(
DWORD timestamp,
const char* sid,
const char* nick,
const char* firstName,
const char* lastName,
const char* reason)
{
PROTORECVEVENT pre = {0};
CCSDATA ccs = {0};
ccs.szProtoService = PSR_AUTH;
ccs.hContact = this->AddContactBySid(::mir_a2u(sid), ::mir_a2u(nick));
ccs.wParam = 0;
ccs.lParam = (LPARAM)⪯
pre.timestamp = timestamp;
pre.lParam = (DWORD)
(sizeof(DWORD) * 2) +
::strlen(nick) +
::strlen(firstName) +
::strlen(lastName) +
::strlen(sid) +
::strlen(reason) +
5;
/*blob is: 0(DWORD), hContact(DWORD), nick(ASCIIZ), firstName(ASCIIZ), lastName(ASCIIZ), sid(ASCIIZ), reason(ASCIIZ)*/
char *pCurBlob = pre.szMessage = (char*)::mir_alloc(pre.lParam);
*((PDWORD)pCurBlob) = 0; pCurBlob += sizeof(DWORD);
*((PDWORD)pCurBlob) = (DWORD)ccs.hContact; pCurBlob += sizeof(DWORD);
::strcpy((char*)pCurBlob, nick); pCurBlob += ::strlen(nick) + 1;
::strcpy((char*)pCurBlob, firstName); pCurBlob += ::strlen(firstName) + 1;
::strcpy((char*)pCurBlob, lastName); pCurBlob += ::strlen(lastName) + 1;
::strcpy((char*)pCurBlob, sid); pCurBlob += ::strlen(sid) + 1;
::strcpy((char*)pCurBlob, reason);
::CallService(MS_PROTO_CHAINRECV, 0, (LPARAM)&ccs);
}
void CSkypeProto::RaiseMessageReceivedEvent(
DWORD timestamp,
const char* sid,
const char* nick,
const char* message)
{
PROTORECVEVENT pre = {0};
CCSDATA ccs = {0};
ccs.szProtoService = PSR_MESSAGE;
ccs.hContact = this->AddContactBySid(::mir_a2u(sid), ::mir_a2u(nick));
ccs.wParam = 0;
ccs.lParam = (LPARAM)⪯
pre.flags = PREF_UTF;
pre.timestamp = timestamp;
pre.szMessage = (char *)message;
::CallService(MS_PROTO_CHAINRECV, 0, (LPARAM)&ccs);
}
|