summaryrefslogtreecommitdiff
path: root/protocols/Steam/src/steam_thread.cpp
diff options
context:
space:
mode:
authorAlexander Lantsev <aunsane@gmail.com>2014-04-03 19:45:30 +0000
committerAlexander Lantsev <aunsane@gmail.com>2014-04-03 19:45:30 +0000
commit9149e4c655c6e810ed9cb7a85b8be0eedb201a66 (patch)
tree4bd6238c79eb60cf7502ac47a858c961b35cfc17 /protocols/Steam/src/steam_thread.cpp
parentce6e09d0d0d42580b6d1ad6747ac54d82dc821da (diff)
Steam: first approach of server polling
git-svn-id: http://svn.miranda-ng.org/main/trunk@8843 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Steam/src/steam_thread.cpp')
-rw-r--r--protocols/Steam/src/steam_thread.cpp58
1 files changed, 57 insertions, 1 deletions
diff --git a/protocols/Steam/src/steam_thread.cpp b/protocols/Steam/src/steam_thread.cpp
index 04b631a41c..42b2af3903 100644
--- a/protocols/Steam/src/steam_thread.cpp
+++ b/protocols/Steam/src/steam_thread.cpp
@@ -1,8 +1,64 @@
#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()
{
- Sleep(2000);
+ ptrA steamId(getStringA("SteamID"));
+ ptrA sessionId(getStringA("SessionID"));
+ ptrA messageId(getStringA("MessageID"));
+
+ SteamWebApi::PollApi::Poll poll;
+ SteamWebApi::PollApi::PollStatus(m_hNetlibUser, sessionId, steamId, messageId, &poll);
+
+ if (!poll.IsSuccess())
+ return -1;
+
+ //setString
+
+ for (int i = 0; i < poll.GetItemCount(); i++)
+ {
+ switch (poll[i]->GetType())
+ {
+ case SteamWebApi::PollApi::POOL_TYPE::TYPING:
+ break;
+
+ case SteamWebApi::PollApi::POOL_TYPE::MESSAGE:
+ {
+ const wchar_t *text = ((SteamWebApi::PollApi::Message*)poll[i])->GetText();
+ }
+ break;
+
+ case SteamWebApi::PollApi::POOL_TYPE::STATE:
+ {
+ int status = ((SteamWebApi::PollApi::State*)poll[i])->GetStatus();
+ const wchar_t *nickname = ((SteamWebApi::PollApi::State*)poll[i])->GetNickname();
+ }
+ break;
+ }
+ }
return 0;
}