pplx::task<http::http_response> RealSteamDataConnection::ChatLogin() { std::string strPostData = FormatStr(STEAM_CHAT_LOGIN_POST_DATA_FMT_SZ, GetAccessToken(), GetUMQID()); http::client::http_client client(STEAM_POST_OAUTH_CHAT_LOGON_URI); http::http_request request = CreateHttpPostRequest(strPostData); return client.request(request); }
pplx::task<http::http_response> RealSteamDataConnection::GetFriendsList(const wchar_t *pwzSteamID) { std::wstring wstUri = FormatWstr(STEAM_GET_OAUTH_FRIENDS_LIST_URI_FMT, GetAccessToken(), pwzSteamID); http::client::http_client client(wstUri); http::http_request request(http::methods::GET); SetSteamAPIHeaders(request.headers()); return client.request(request); }
pplx::task<http::http_response> RealSteamDataConnection::GetUsersData(const wchar_t * pwzSteamIds) { std::wstring wstUri = FormatWstr(SteamAPI::STEAM_GET_OAUTH_SUMARRIES_URI_FMT, GetAccessToken(), pwzSteamIds); http::client::http_client client(wstUri); http::http_request request(http::methods::GET); SetSteamAPIHeaders(request.headers()); return client.request(request); }
pplx::task<http::http_response> RealSteamDataConnection::SendUserMessage(const wchar_t *pwzSteamID, const wchar_t * pwzMessage) { std::string strPostData; const char szSendMessageType[] = "saytext"; strPostData = FormatStr(STEAM_CHAT_SEND_MESSAGE_POST_DATA_FMT_SZ, GetAccessToken(), GetUMQID(), szSendMessageType, UrlEncodeString(pwzMessage).c_str(), pwzSteamID); http::client::http_client client(STEAM_POST_OAUTH_SEND_MESSAGE_URI); http::http_request request = CreateHttpPostRequest(strPostData); return client.request(request); }
pplx::task<http::http_response> RealSteamDataConnection::GetMessages(int baseMessage, const wchar_t * pwzSteamID, bool fSecure) { std::string strPostData; if (fSecure) strPostData = FormatStr(STEAM_CHAT_POLL_POST_DATA_FMT_SZ, GetAccessToken(), pwzSteamID, GetUMQID(), baseMessage); else strPostData = FormatStr(STEAM_CHAT_POLLSTATUS_POST_DATA_FMT_SZ, pwzSteamID, GetUMQID(), baseMessage); http::client::http_client client(fSecure ? STEAM_POST_OAUTH_POLL_URI : STEAM_POST_OAUTH_POLLSTATUS_URI); http::http_request request = CreateHttpPostRequest(strPostData); return client.request(request); }
bool Oauth::Step2(wchar_t* veri){ SetVerifier(veri); /* PairData pd; GetHeader(&pd); wstring head; head.append(pd.key).append(TEXT(":")).append(pd.data); HINTERNET hSession,hConnect,hRequest; hSession=WinHttpOpen(TEXT("WinHttp /6.1"), WINHTTP_ACCESS_TYPE_NO_PROXY, WINHTTP_NO_PROXY_NAME, WINHTTP_NO_PROXY_BYPASS,NULL); hConnect=WinHttpConnect(hSession,TEXT("twitter.com"),INTERNET_DEFAULT_HTTPS_PORT,NULL); hRequest=WinHttpOpenRequest( hConnect,TEXT("POST"), TEXT("/oauth/access_token"), NULL, WINHTTP_NO_REFERER, WINHTTP_DEFAULT_ACCEPT_TYPES, WINHTTP_FLAG_SECURE); WinHttpSendRequest(hRequest,head.c_str(),head.size(),WINHTTP_NO_REQUEST_DATA,NULL,NULL,NULL); WinHttpReceiveResponse(hRequest,NULL); DWORD dwStatusCode = 0; DWORD statusCodeSize = sizeof(DWORD); ::WinHttpQueryHeaders( hRequest, WINHTTP_QUERY_STATUS_CODE | WINHTTP_QUERY_FLAG_NUMBER, WINHTTP_HEADER_NAME_BY_INDEX, &dwStatusCode, &statusCodeSize, WINHTTP_NO_HEADER_INDEX); char buf[50000]; WinHttpReadData(hRequest,buf,50000,NULL);*/ return GetAccessToken(); }
void get_access_token_button_clicked(GtkButton *button, gpointer userdata) { GetAccessToken(); system("firefox result.html 2>/dev/null &"); }