blob: d1c6d8a3c0f160163ec0867ca77b59990dcda8d6 (
plain)
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
|
#include "common.h"
int SteamToMirandaStatus(int state)
{
switch (state)
{
case 0: //Offline
return ID_STATUS_OFFLINE;
case 2: //Busy
return ID_STATUS_DND;
case 3: //Away
return ID_STATUS_AWAY;
/*case 4: //Snoozing
prim = PURPLE_STATUS_EXTENDED_AWAY;
break;
case 5: //Looking to trade
return "trade";
case 6: //Looking to play
return "play";*/
//case 1: //Online
default:
return ID_STATUS_ONLINE;
}
}
int CSteamProto::PollStatus(const char *sessionId, const char *steamId, UINT32 messageId)
{
SteamWebApi::PollApi::PollResult pollResult;
SteamWebApi::PollApi::PollStatus(m_hNetlibUser, sessionId, steamId, messageId, &pollResult);
if (!pollResult.IsSuccess())
return 0;
for (int i = 0; i < pollResult.GetItemCount(); i++)
{
switch (pollResult[i]->GetType())
{
case SteamWebApi::PollApi::POOL_TYPE::TYPING:
break;
case SteamWebApi::PollApi::POOL_TYPE::MESSAGE:
{
const wchar_t *text = ((SteamWebApi::PollApi::Message*)pollResult[i])->GetText();
}
break;
case SteamWebApi::PollApi::POOL_TYPE::STATE:
{
int status = ((SteamWebApi::PollApi::State*)pollResult[i])->GetStatus();
const wchar_t *nickname = ((SteamWebApi::PollApi::State*)pollResult[i])->GetNickname();
}
break;
}
}
return pollResult.GetMessageId();
}
void CSteamProto::PollingThread(void*)
{
debugLogA("CSteamProto::PollingThread: entering");
ptrA token(getStringA("TokenSecret"));
ptrA sessionId(getStringA("SessionID"));
UINT32 messageId = getDword("MessageID", 0);
while (!m_bTerminated)
{
messageId = PollStatus(token, sessionId, messageId);
if (messageId == 0)
break;
}
if (messageId > 0)
setDword("MessageID", messageId);
m_hPollingThread = NULL;
debugLogA("CSteamProto::PollingThread: leaving");
}
|