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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
|
#include "common.h"
WORD CSkypeProto::GetContactStatus(MCONTACT hContact)
{
return getWord(hContact, "Status", ID_STATUS_OFFLINE);
}
void CSkypeProto::SetContactStatus(MCONTACT hContact, WORD status)
{
WORD oldStatus = GetContactStatus(hContact);
if (oldStatus != status)
{
setWord(hContact, "Status", status);
}
}
void CSkypeProto::SetAllContactsStatus(WORD status)
{
for (MCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName))
{
SetContactStatus(hContact, status);
}
}
MCONTACT CSkypeProto::GetContactFromAuthEvent(MEVENT hEvent)
{
DWORD body[3];
DBEVENTINFO dbei = { sizeof(DBEVENTINFO) };
dbei.cbBlob = sizeof(DWORD) * 2;
dbei.pBlob = (PBYTE)&body;
if (db_event_get(hEvent, &dbei))
return INVALID_CONTACT_ID;
if (dbei.eventType != EVENTTYPE_AUTHREQUEST)
return INVALID_CONTACT_ID;
if (strcmp(dbei.szModule, m_szModuleName) != 0)
return INVALID_CONTACT_ID;
return DbGetAuthEventContact(&dbei);
}
MCONTACT CSkypeProto::GetContact(const char *login)
{
MCONTACT hContact = NULL;
for (hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName))
{
ptrA contactLogin(getStringA(hContact, SKYPE_SETTINGS_ID));
if (mir_strcmpi(login, contactLogin) == 0)
{
break;
}
}
return hContact;
}
MCONTACT CSkypeProto::AddContact(const char *login, bool isTemporary)
{
MCONTACT hContact = GetContact(login);
if (!hContact)
{
hContact = (MCONTACT)CallService(MS_DB_CONTACT_ADD, 0, 0);
CallService(MS_PROTO_ADDTOCONTACT, hContact, (LPARAM)m_szModuleName);
setString(hContact, SKYPE_SETTINGS_ID, login);
DBVARIANT dbv;
if (!getTString(SKYPE_SETTINGS_GROUP, &dbv))
{
db_set_ts(hContact, "CList", "Group", dbv.ptszVal);
db_free(&dbv);
}
setByte(hContact, "Auth", 1);
setByte(hContact, "Grant", 1);
if (isTemporary)
{
db_set_b(hContact, "CList", "NotOnList", 1);
}
}
return hContact;
}
void CSkypeProto::LoadFriendList(void*)
{
}
INT_PTR CSkypeProto::OnRequestAuth(WPARAM hContact, LPARAM lParam)
{
return 0;
}
INT_PTR CSkypeProto::OnGrantAuth(WPARAM hContact, LPARAM)
{
return 0;
}
int CSkypeProto::OnContactDeleted(MCONTACT hContact, LPARAM)
{
return 0;
}
|