summaryrefslogtreecommitdiff
path: root/protocols/Steam/src/steam_contacts.cpp
diff options
context:
space:
mode:
authorAlexander Lantsev <aunsane@gmail.com>2014-05-02 22:22:41 +0000
committerAlexander Lantsev <aunsane@gmail.com>2014-05-02 22:22:41 +0000
commit70436074ae8f66a092d0212fb8b99b94d0fd03a6 (patch)
tree694fd4a013fd9b81e393bc0cf2d83b51920e009c /protocols/Steam/src/steam_contacts.cpp
parent9b111dc84cd76cdbdb3f820237d3de0b1555deb1 (diff)
Steam: improved contact management
git-svn-id: http://svn.miranda-ng.org/main/trunk@9108 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Steam/src/steam_contacts.cpp')
-rw-r--r--protocols/Steam/src/steam_contacts.cpp31
1 files changed, 29 insertions, 2 deletions
diff --git a/protocols/Steam/src/steam_contacts.cpp b/protocols/Steam/src/steam_contacts.cpp
index 2f3018a873..aaccb3bf75 100644
--- a/protocols/Steam/src/steam_contacts.cpp
+++ b/protocols/Steam/src/steam_contacts.cpp
@@ -181,7 +181,7 @@ void CSteamProto::UpdateContactsThread(void *arg)
}
}
-MCONTACT CSteamProto::AddContact(const char *steamId)
+MCONTACT CSteamProto::AddContact(const char *steamId, bool isTemporary)
{
MCONTACT hContact = this->FindContact(steamId);
if (!hContact)
@@ -195,6 +195,13 @@ MCONTACT CSteamProto::AddContact(const char *steamId)
// update info
//UpdateContact(hContact, contact);
+ if (isTemporary)
+ {
+ setByte(hContact, "Auth", 1);
+ //setByte(hContact, "Grant", 1);
+ db_set_b(hContact, "CList", "NotOnList", 1);
+ }
+
// move to default group
DBVARIANT dbv;
if (!getWString("DefaultGroup", &dbv))
@@ -216,6 +223,9 @@ void CSteamProto::RaiseAuthRequestThread(void *arg)
ptrA token(getStringA("TokenSecret"));
ptrA steamId(getStringA(hContact, "SteamID"));
+ //setByte(hContact, "Auth", 1);
+ setByte(hContact, "Grant", 1);
+
SteamWebApi::FriendApi::Summaries summaries;
debugLogA("CSteamProto::RaiseAuthRequestThread: call SteamWebApi::FriendApi::LoadSummaries");
SteamWebApi::FriendApi::LoadSummaries(m_hNetlibUser, token, steamId, &summaries);
@@ -275,6 +285,7 @@ void CSteamProto::AuthAllowThread(void *arg)
{
delSetting(hContact, "Auth");
delSetting(hContact, "Grant");
+ db_unset(hContact, "CList", "NotOnList");
/*SteamWebApi::FriendApi::Summaries summaries;
debugLogA("CSteamProto::AuthAllowThread: call SteamWebApi::FriendApi::LoadSummaries");
@@ -305,6 +316,22 @@ void CSteamProto::AuthDenyThread(void *arg)
void CSteamProto::AddContactThread(void *arg)
{
+ MCONTACT hContact = (MCONTACT)arg;
+ if (!hContact)
+ return;
+
+ ptrA token(getStringA("TokenSecret"));
+ ptrA sessionId(getStringA("SessionID"));
+ ptrA steamId(getStringA("SteamID"));
+ ptrA who(getStringA(hContact, "SteamID"));
+
+ //db_unset(hContact, "CList", "NotOnList");
+
+ SteamWebApi::FriendListApi::Result result;
+ debugLogA("CSteamProto::AddContactThread: call SteamWebApi::FriendListApi::AddFriend");
+ SteamWebApi::FriendListApi::AddFriend(m_hNetlibUser, token, sessionId, steamId, who, &result);
+
+ ProtoBroadcastAck(hContact, ACKTYPE_AUTHREQ, result.IsSuccess() ? ACKRESULT_SUCCESS : ACKRESULT_FAILED, (HANDLE)hContact, NULL);
}
void CSteamProto::RemoveContactThread(void *arg)
@@ -355,7 +382,7 @@ void CSteamProto::LoadContactListThread(void*)
{
MCONTACT hContact = FindContact(steamId);
if (!hContact)
- hContact = AddContact(steamId);
+ hContact = AddContact(steamId, true);
RaiseAuthRequestThread((void*)hContact);
}