diff options
25 files changed, 1701 insertions, 298 deletions
diff --git a/protocols/Steam/Steam.vcxproj b/protocols/Steam/Steam.vcxproj index 0f2fac75bd..9d59b43add 100644 --- a/protocols/Steam/Steam.vcxproj +++ b/protocols/Steam/Steam.vcxproj @@ -72,10 +72,8 @@      <ClInclude Include="src\api\history.h" />
      <ClInclude Include="src\api\message.h" />
      <ClInclude Include="src\api\pending.h" />
 -    <ClInclude Include="src\api\rsa_key.h" />
      <ClInclude Include="src\api\search.h" />
      <ClInclude Include="src\api\session.h" />
 -    <ClInclude Include="src\http_request.h" />
      <ClInclude Include="src\proto.h" />
      <ClInclude Include="src\protobuf-c\enums.pb-c.h" />
      <ClInclude Include="src\protobuf-c\protobuf-c.h" />
 diff --git a/protocols/Steam/Steam.vcxproj.filters b/protocols/Steam/Steam.vcxproj.filters index 250f162311..1f4fba821d 100644 --- a/protocols/Steam/Steam.vcxproj.filters +++ b/protocols/Steam/Steam.vcxproj.filters @@ -80,9 +80,6 @@      </ClCompile>
    </ItemGroup>
    <ItemGroup>
 -    <ClInclude Include="src\http_request.h">
 -      <Filter>Header Files</Filter>
 -    </ClInclude>
      <ClInclude Include="src\resource.h">
        <Filter>Header Files</Filter>
      </ClInclude>
 @@ -125,9 +122,6 @@      <ClInclude Include="src\api\pending.h">
        <Filter>Header Files\api</Filter>
      </ClInclude>
 -    <ClInclude Include="src\api\rsa_key.h">
 -      <Filter>Header Files\api</Filter>
 -    </ClInclude>
      <ClInclude Include="src\api\search.h">
        <Filter>Header Files\api</Filter>
      </ClInclude>
 diff --git a/protocols/Steam/src/api/app_info.h b/protocols/Steam/src/api/app_info.h index d2ef0df532..cf54e52adf 100644 --- a/protocols/Steam/src/api/app_info.h +++ b/protocols/Steam/src/api/app_info.h @@ -1,9 +1,8 @@  #ifndef _STEAM_REQUEST_APP_INFO_H_  #define _STEAM_REQUEST_APP_INFO_H_ -class GetAppInfoRequest : public HttpRequest +struct GetAppInfoRequest : public HttpRequest  { -public:  	GetAppInfoRequest(const char *token, const char *appIds) :  		HttpRequest(REQUEST_GET, "/ISteamGameOAuth/GetAppInfo/v0001")  	{ diff --git a/protocols/Steam/src/api/avatar.h b/protocols/Steam/src/api/avatar.h index 28e573d9d1..4140583ead 100644 --- a/protocols/Steam/src/api/avatar.h +++ b/protocols/Steam/src/api/avatar.h @@ -1,9 +1,8 @@  #ifndef _STEAM_REQUEST_AVATAR_H_
  #define _STEAM_REQUEST_AVATAR_H_
 -class GetAvatarRequest : public HttpRequest
 +struct GetAvatarRequest : public HttpRequest
  {
 -public:
  	GetAvatarRequest(const char *url) :
  		HttpRequest(REQUEST_GET, url)
  	{
 diff --git a/protocols/Steam/src/api/captcha.h b/protocols/Steam/src/api/captcha.h index a4bacb59f7..a9c017a5a8 100644 --- a/protocols/Steam/src/api/captcha.h +++ b/protocols/Steam/src/api/captcha.h @@ -1,9 +1,8 @@  #ifndef _STEAM_REQUEST_CAPTCHA_H_
  #define _STEAM_REQUEST_CAPTCHA_H_
 -class GetCaptchaRequest : public HttpRequest
 +struct GetCaptchaRequest : public HttpRequest
  {
 -public:
  	GetCaptchaRequest(const char *captchaId) :
  		HttpRequest(REQUEST_GET, STEAM_WEB_URL "/public/captcha.php")
  	{
 diff --git a/protocols/Steam/src/api/friend.h b/protocols/Steam/src/api/friend.h index a86c2c98e4..31d5b185a6 100644 --- a/protocols/Steam/src/api/friend.h +++ b/protocols/Steam/src/api/friend.h @@ -1,13 +1,12 @@  #ifndef _STEAM_REQUEST_FRIEND_H_
  #define _STEAM_REQUEST_FRIEND_H_
 -class GetUserSummariesRequest : public HttpRequest
 +struct GetUserSummariesRequest : public HttpRequest
  {
 -public:
 -	GetUserSummariesRequest(CSteamProto *ppro, const char *steamIds) :
 +	GetUserSummariesRequest(const char *pszAccessToken, const char *steamIds) :
  		HttpRequest(REQUEST_GET, "/ISteamUserOAuth/GetUserSummaries/v0002")
  	{
 -		this << CHAR_PARAM("access_token", ppro->getMStringA("TokenSecret")) << CHAR_PARAM("steamids", steamIds);
 +		this << CHAR_PARAM("access_token", pszAccessToken) << CHAR_PARAM("steamids", steamIds);
  	}
  	//{
 diff --git a/protocols/Steam/src/api/friend_list.h b/protocols/Steam/src/api/friend_list.h index 857ec9ec0c..8c9d26a91a 100644 --- a/protocols/Steam/src/api/friend_list.h +++ b/protocols/Steam/src/api/friend_list.h @@ -1,9 +1,8 @@  #ifndef _STEAM_REQUEST_FRIEND_LIST_H_
  #define _STEAM_REQUEST_FRIEND_LIST_H_
 -class GetFriendListRequest : public HttpRequest
 +struct GetFriendListRequest : public HttpRequest
  {
 -public:
  	GetFriendListRequest(const char *token, int64_t steamId, const char *relationship) :
  		HttpRequest(REQUEST_GET, "/ISteamUserOAuth/GetFriendList/v0001")
  	{
 @@ -11,14 +10,13 @@ public:  	}
  };
 -class AddFriendRequest : public HttpRequest
 +struct AddFriendRequest : public HttpRequest
  {
 -public:
 -	AddFriendRequest(const char *token, const char *sessionId, const char *steamId, const char *who) :
 +	AddFriendRequest(const char *token, const char *sessionId, int64_t steamId, const char *who) :
  		HttpRequest(REQUEST_POST, STEAM_WEB_URL "/actions/AddFriendAjax")
  	{
  		char login[MAX_PATH];
 -		mir_snprintf(login, "%s||oauth:%s", steamId, token);
 +		mir_snprintf(login, "%lld||oauth:%s", steamId, token);
  		char cookie[MAX_PATH];
  		mir_snprintf(cookie, "steamLogin=%s;sessionid=%s;mobileClientVersion=1291812;forceMobile=1;mobileClient=ios", login, sessionId);
 @@ -29,14 +27,13 @@ public:  	}
  };
 -class BlockFriendRequest : public HttpRequest
 +struct BlockFriendRequest : public HttpRequest
  {
 -public:
 -	BlockFriendRequest(const char *token, const char *sessionId, const char *steamId, const char *who) :
 +	BlockFriendRequest(const char *token, const char *sessionId, int64_t steamId, const char *who) :
  		HttpRequest(REQUEST_POST, STEAM_WEB_URL "/actions/BlockUserAjax")
  	{
  		char login[MAX_PATH];
 -		mir_snprintf(login, "%s||oauth:%s", steamId, token);
 +		mir_snprintf(login, "%lld||oauth:%s", steamId, token);
  		char cookie[MAX_PATH];
  		mir_snprintf(cookie, "steamLogin=%s;sessionid=%s;mobileClientVersion=1291812;forceMobile=1;mobileClient=ios", login, sessionId);
 @@ -47,14 +44,13 @@ public:  	}
  };
 -class UnblockFriendRequest : public HttpRequest
 +struct UnblockFriendRequest : public HttpRequest
  {
 -public:
 -	UnblockFriendRequest(const char *token, const char *sessionId, const char *steamId, const char *who) :
 +	UnblockFriendRequest(const char *token, const char *sessionId, int64_t steamId, const char *who) :
  		HttpRequest(REQUEST_POST, STEAM_WEB_URL "/actions/BlockUserAjax")
  	{
  		char login[MAX_PATH];
 -		mir_snprintf(login, "%s||oauth:%s", steamId, token);
 +		mir_snprintf(login, "%lld||oauth:%s", steamId, token);
  		char cookie[MAX_PATH];
  		mir_snprintf(cookie, "steamLogin=%s;sessionid=%s;mobileClientVersion=1291812;forceMobile=1;mobileClient=ios", login, sessionId);
 @@ -65,14 +61,13 @@ public:  	}
  };
 -class RemoveFriendRequest : public HttpRequest
 +struct RemoveFriendRequest : public HttpRequest
  {
 -public:
 -	RemoveFriendRequest(const char *token, const char *sessionId, const char *steamId, const char *who) :
 +	RemoveFriendRequest(const char *token, const char *sessionId, int64_t steamId, const char *who) :
  		HttpRequest(REQUEST_POST, STEAM_WEB_URL "/actions/RemoveFriendAjax")
  	{
  		char login[MAX_PATH];
 -		mir_snprintf(login, "%s||oauth:%s", steamId, token);
 +		mir_snprintf(login, "%lld||oauth:%s", steamId, token);
  		char cookie[MAX_PATH];
  		mir_snprintf(cookie, "steamLogin=%s;sessionid=%s;mobileClientVersion=1291812;forceMobile=1;mobileClient=ios", login, sessionId);
 diff --git a/protocols/Steam/src/api/history.h b/protocols/Steam/src/api/history.h index fbc09abed6..29086b6f46 100644 --- a/protocols/Steam/src/api/history.h +++ b/protocols/Steam/src/api/history.h @@ -1,13 +1,12 @@  #ifndef _STEAM_REQUEST_HISTORY_H_  #define _STEAM_REQUEST_HISTORY_H_ -class GetConversationsRequest : public HttpRequest +struct GetConversationsRequest : public HttpRequest  { -public: -	GetConversationsRequest(CSteamProto *ppro) : +	GetConversationsRequest(const char *token) :  		HttpRequest(REQUEST_GET, "/IFriendMessagesService/GetActiveMessageSessions/v0001")  	{ -		this << CHAR_PARAM("access_token", ppro->getMStringA("TokenSecret")); +		this << CHAR_PARAM("access_token", token);  	}  	//{ @@ -26,15 +25,14 @@ public:  	//}  }; -class GetHistoryMessagesRequest : public HttpRequest +struct GetHistoryMessagesRequest : public HttpRequest  { -public: -	GetHistoryMessagesRequest(const char *token, const char *steamId, const char *who, time_t since) : +	GetHistoryMessagesRequest(const char *token, int64_t steamId, const char *who, time_t since) :  		HttpRequest(REQUEST_GET, "/IFriendMessagesService/GetRecentMessages/v0001")  	{  		this  			<< CHAR_PARAM("access_token", token) -			<< CHAR_PARAM("steamid1", steamId) +			<< INT64_PARAM("steamid1", steamId)  			<< CHAR_PARAM("steamid2", who)  			// Steam somehow doesn't respect too precise start time parameter, so we better request older time and then do own filtering again  			<< INT64_PARAM("rtime32_start_time", since - 1500); diff --git a/protocols/Steam/src/api/message.h b/protocols/Steam/src/api/message.h index 934bdc875e..5f41876a15 100644 --- a/protocols/Steam/src/api/message.h +++ b/protocols/Steam/src/api/message.h @@ -1,32 +1,22 @@  #ifndef _STEAM_REQUEST_MESSAGE_H_
  #define _STEAM_REQUEST_MESSAGE_H_
 -class SendMessageRequest : public HttpRequest
 +struct SendMessageRequest : public HttpRequest
  {
 -public:
  	SendMessageRequest(const char *token, const char *umqId, const char *steamId, const char *text) :
  		HttpRequest(REQUEST_POST, "/ISteamWebUserPresenceOAuth/Message/v0001")
  	{
 -		this
 -			<< CHAR_PARAM("access_token", token)
 -			<< CHAR_PARAM("umqid", umqId)
 -			<< CHAR_PARAM("steamid_dst", steamId)
 -			<< CHAR_PARAM("type", "saytext")
 -			<< CHAR_PARAM("text", text);
 +		this << CHAR_PARAM("access_token", token) << CHAR_PARAM("umqid", umqId) << CHAR_PARAM("steamid_dst", steamId) 
 +			<< CHAR_PARAM("type", "saytext") << CHAR_PARAM("text", text);
  	}
  };
 -class SendTypingRequest : public HttpRequest
 +struct SendTypingRequest : public HttpRequest
  {
 -public:
  	SendTypingRequest(const char *token, const char *umqId, const char *steamId) :
  		HttpRequest(REQUEST_POST, "/ISteamWebUserPresenceOAuth/Message/v0001")
  	{
 -		this
 -			<< CHAR_PARAM("access_token", token)
 -			<< CHAR_PARAM("umqid", umqId)
 -			<< CHAR_PARAM("steamid_dst", steamId)
 -			<< CHAR_PARAM("type", "typing");
 +		this << CHAR_PARAM("access_token", token) << CHAR_PARAM("umqid", umqId) << CHAR_PARAM("steamid_dst", steamId) << CHAR_PARAM("type", "typing");
  	}
  };
 diff --git a/protocols/Steam/src/api/pending.h b/protocols/Steam/src/api/pending.h index b8e8e6e15f..bcac0170cc 100644 --- a/protocols/Steam/src/api/pending.h +++ b/protocols/Steam/src/api/pending.h @@ -1,13 +1,12 @@  #ifndef _STEAM_REQUEST_PENDING_H_
  #define _STEAM_REQUEST_PENDING_H_
 -class ApprovePendingRequest : public HttpRequest
 +struct ApprovePendingRequest : public HttpRequest
  {
 -public:
 -	ApprovePendingRequest(const char *token, const char *sessionId, const char *steamId, const char *who) :
 +	ApprovePendingRequest(const char *token, const char *sessionId, int64_t steamId, const char *who) :
  		HttpRequest(REQUEST_POST, "")
  	{
 -		m_szUrl.Format(STEAM_WEB_URL "/profiles/%s/home_process", steamId);
 +		m_szUrl.Format(STEAM_WEB_URL "/profiles/%lld/home_process", steamId);
  		char cookie[MAX_PATH];
  		mir_snprintf(cookie, "steamLogin=%s||oauth:%s;sessionid=%s;mobileClientVersion=1291812;forceMobile=1;mobileClient=ios",
 @@ -15,24 +14,17 @@ public:  		AddHeader("Cookie", cookie);
 -		this
 -			<< CHAR_PARAM("sessionID", sessionId)
 -			<< CHAR_PARAM("id", who)
 -			<< CHAR_PARAM("perform", "accept")
 -			<< CHAR_PARAM("action", "approvePending")
 -			<< CHAR_PARAM("itype", "friend")
 -			<< INT_PARAM("json", 1)
 -			<< INT_PARAM("xml", 0);
 +		this << CHAR_PARAM("sessionID", sessionId) << CHAR_PARAM("id", who) << CHAR_PARAM("perform", "accept") 
 +			<< CHAR_PARAM("action", "approvePending") << CHAR_PARAM("itype", "friend") << INT_PARAM("json", 1) << INT_PARAM("xml", 0);
  	}
  };
 -class IgnorePendingRequest : public HttpRequest
 +struct IgnorePendingRequest : public HttpRequest
  {
 -public:
 -	IgnorePendingRequest(const char *token, const char *sessionId, const char *steamId, const char *who) :
 +	IgnorePendingRequest(const char *token, const char *sessionId, int64_t steamId, const char *who) :
  		HttpRequest(REQUEST_POST, "")
  	{
 -		m_szUrl.Format(STEAM_WEB_URL "/profiles/%s/home_process", steamId);
 +		m_szUrl.Format(STEAM_WEB_URL "/profiles/%lld/home_process", steamId);
  		char cookie[MAX_PATH];
  		mir_snprintf(cookie, "steamLogin=%s||oauth:%s;sessionid=%s;mobileClientVersion=1291812;forceMobile=1;mobileClient=ios",
 @@ -40,24 +32,17 @@ public:  		AddHeader("Cookie", cookie);
 -		this
 -			<< CHAR_PARAM("sessionID", sessionId)
 -			<< CHAR_PARAM("id", who)
 -			<< CHAR_PARAM("perform", "ignore")
 -			<< CHAR_PARAM("action", "approvePending")
 -			<< CHAR_PARAM("itype", "friend")
 -			<< INT_PARAM("json", 1)
 -			<< INT_PARAM("xml", 0);
 +		this << CHAR_PARAM("sessionID", sessionId) << CHAR_PARAM("id", who) << CHAR_PARAM("perform", "ignore") 
 +			<< CHAR_PARAM("action", "approvePending") << CHAR_PARAM("itype", "friend") << INT_PARAM("json", 1) << INT_PARAM("xml", 0);
  	}
  };
 -class BlockPendingRequest : public HttpRequest
 +struct BlockPendingRequest : public HttpRequest
  {
 -public:
 -	BlockPendingRequest(const char *token, const char *sessionId, const char *steamId, const char *who) :
 +	BlockPendingRequest(const char *token, const char *sessionId, int64_t steamId, const char *who) :
  		HttpRequest(REQUEST_POST, "")
  	{
 -		m_szUrl.Format(STEAM_WEB_URL "/profiles/%s/home_process", steamId);
 +		m_szUrl.Format(STEAM_WEB_URL "/profiles/%lld/home_process", steamId);
  		char cookie[MAX_PATH];
  		mir_snprintf(cookie, "steamLogin=%s||oauth:%s;sessionid=%s;mobileClientVersion=1291812;forceMobile=1;mobileClient=ios",
 @@ -65,14 +50,8 @@ public:  		AddHeader("Cookie", cookie);
 -		this
 -			<< CHAR_PARAM("sessionID", sessionId)
 -			<< CHAR_PARAM("id", who)
 -			<< CHAR_PARAM("perform", "block")
 -			<< CHAR_PARAM("action", "approvePending")
 -			<< CHAR_PARAM("itype", "friend")
 -			<< INT_PARAM("json", 1)
 -			<< INT_PARAM("xml", 0);
 +		this << CHAR_PARAM("sessionID", sessionId) << CHAR_PARAM("id", who) << CHAR_PARAM("perform", "block")
 +			<< CHAR_PARAM("action", "approvePending") << CHAR_PARAM("itype", "friend") << INT_PARAM("json", 1) << INT_PARAM("xml", 0);
  	}
  };
 diff --git a/protocols/Steam/src/api/rsa_key.h b/protocols/Steam/src/api/rsa_key.h deleted file mode 100644 index 48c76e3e6d..0000000000 --- a/protocols/Steam/src/api/rsa_key.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef _STEAM_REQUEST_RSA_KEY_H_
 -#define _STEAM_REQUEST_RSA_KEY_H_
 -
 -class GetRsaKeyRequest : public HttpRequest
 -{
 -public:
 -	GetRsaKeyRequest(const char *username) :
 -		HttpRequest(REQUEST_POST, STEAM_WEB_URL "/mobilelogin/getrsakey/")
 -	{
 -		flags = NLHRF_HTTP11 | NLHRF_SSL | NLHRF_NODUMP;
 -
 -		this
 -			<< CHAR_PARAM("username", username)
 -			<< INT64_PARAM("donotcache", now());
 -	}
 -};
 -
 -#endif //_STEAM_REQUEST_RSA_KEY_H_
 diff --git a/protocols/Steam/src/api/search.h b/protocols/Steam/src/api/search.h index d72d140dc5..64ff7e828f 100644 --- a/protocols/Steam/src/api/search.h +++ b/protocols/Steam/src/api/search.h @@ -1,19 +1,13 @@  #ifndef _STEAM_REQUEST_SEARCH_H_
  #define _STEAM_REQUEST_SEARCH_H_
 -class SearchRequest : public HttpRequest
 +struct SearchRequest : public HttpRequest
  {
 -public:
  	SearchRequest(const char *token, const char *text, int offset = 0, int count = 30) :
  		HttpRequest(REQUEST_GET, "/ISteamUserOAuth/Search/v0001")
  	{
 -		this
 -			<< CHAR_PARAM("access_token", token)
 -			<< CHAR_PARAM("keywords", text)
 -			<< INT_PARAM("offset", offset)
 -			<< INT_PARAM("count", count)
 -			<< CHAR_PARAM("targets", "users")
 -			<< CHAR_PARAM("fields", "all");
 +		this << CHAR_PARAM("access_token", token) << CHAR_PARAM("keywords", text) << INT_PARAM("offset", offset)
 +			<< INT_PARAM("count", count) << CHAR_PARAM("targets", "users") << CHAR_PARAM("fields", "all");
  	}
  	//{
 diff --git a/protocols/Steam/src/http_request.h b/protocols/Steam/src/http_request.h deleted file mode 100644 index ac988a804a..0000000000 --- a/protocols/Steam/src/http_request.h +++ /dev/null @@ -1,56 +0,0 @@ -#ifndef _HTTP_REQUEST_H_ -#define _HTTP_REQUEST_H_ - -#define STEAM_USER_AGENT "Valve/Steam HTTP Client 1.0" - -class HttpResponse -{ -	MHttpResponse *m_response; - -public: -	HttpResponse(MHttpResponse *response) : -		m_response(response) -	{ -	} - -	~HttpResponse() -	{ -		delete m_response; -	} - -	bool operator!() const -	{ -		return !m_response || m_response->body.IsEmpty(); -	} - -	operator bool() const -	{ -		return m_response && !m_response->body.IsEmpty(); -	} - -	bool IsSuccess() const -	{ -		return m_response && -			m_response->resultCode >= HTTP_CODE_OK && -			m_response->resultCode <= HTTP_CODE_MULTI_STATUS; -	} - -	char* data() const -	{ -		return (m_response) ? m_response->body.GetBuffer() : nullptr; -	} - -	unsigned length() const -	{ -		return (m_response) ? m_response->body.GetLength() : 0; -	} - -	int GetStatusCode() const -	{ -		if (m_response) -			return m_response->resultCode; -		return 500; -	} -}; - -#endif //_HTTP_REQUEST_H_
\ No newline at end of file diff --git a/protocols/Steam/src/protobuf-c/steammessages_auth.steamclient.proto b/protocols/Steam/src/protobuf-c/steammessages_auth.steamclient.proto index f39bf9125a..6cd1e467a2 100644 --- a/protocols/Steam/src/protobuf-c/steammessages_auth.steamclient.proto +++ b/protocols/Steam/src/protobuf-c/steammessages_auth.steamclient.proto @@ -28,12 +28,20 @@ enum EAuthSessionSecurityHistory {  	k_EAuthSessionSecurityHistory_NoPriorHistory = 2;  } +enum ETokenRenewalType { +	k_ETokenRenewalType_None = 0; +	k_ETokenRenewalType_Allow = 1; +} +  enum EAuthTokenRevokeAction {  	k_EAuthTokenRevokeLogout = 0;  	k_EAuthTokenRevokePermanent = 1;  	k_EAuthTokenRevokeReplaced = 2;  	k_EAuthTokenRevokeSupport = 3;  	k_EAuthTokenRevokeConsume = 4; +	k_EAuthTokenRevokeNonRememberedLogout = 5; +	k_EAuthTokenRevokeNonRememberedPermanent = 6; +	k_EAuthTokenRevokeAutomatic = 7;  }  enum EAuthTokenState { @@ -62,6 +70,8 @@ message CAuthentication_DeviceDetails {  	optional .EAuthTokenPlatformType platform_type = 2 [default = k_EAuthTokenPlatformType_Unknown, (description) = "EAuthTokenPlatformType, claimed, of device"];  	optional int32 os_type = 3 [(description) = "EOSType, claimed, of authorized device"];  	optional uint32 gaming_device_type = 4 [(description) = "EGamingDeviceType, claimed, of authorized device for steam client-type devices"]; +	optional uint32 client_count = 5 [(description) = "For desktop clients, quantized number of users in history"]; +	optional bytes machine_id = 6 [(description) = "Additional device context"];  }  message CAuthentication_BeginAuthSessionViaQR_Request { @@ -173,10 +183,12 @@ message CAuthentication_UpdateAuthSessionWithSteamGuardCode_Response {  message CAuthentication_AccessToken_GenerateForApp_Request {  	optional string refresh_token = 1;  	optional fixed64 steamid = 2; +	optional .ETokenRenewalType renewal_type = 3 [default = k_ETokenRenewalType_None];  }  message CAuthentication_AccessToken_GenerateForApp_Response {  	optional string access_token = 1; +	optional string refresh_token = 2;  }  message CAuthentication_RefreshToken_Enumerate_Request { @@ -228,6 +240,14 @@ message CAuthentication_MigrateMobileSession_Response {  	optional string access_token = 2;  } +message CAuthentication_Token_Revoke_Request { +	optional string token = 1; +	optional .EAuthTokenRevokeAction revoke_action = 2 [default = k_EAuthTokenRevokePermanent, (description) = "Select between logout and logout-and-forget-machine"]; +} + +message CAuthentication_Token_Revoke_Response { +} +  message CAuthentication_RefreshToken_Revoke_Request {  	optional fixed64 token_id = 1;  	optional fixed64 steamid = 2 [(description) = "Token holder if an admin action on behalf of another user"]; @@ -373,6 +393,10 @@ service Authentication {  		option (method_description) = "Migrates a WG token to an access and refresh token using a signature generated with the user's 2FA secret";  	} +	rpc RevokeToken (.CAuthentication_Token_Revoke_Request) returns (.CAuthentication_Token_Revoke_Response) { +		option (method_description) = "Revoke a single token immediately, making it unable to renew or generate new access tokens"; +	} +  	rpc RevokeRefreshToken (.CAuthentication_RefreshToken_Revoke_Request) returns (.CAuthentication_RefreshToken_Revoke_Response) {  		option (method_description) = "Mark the given refresh token as revoked";  	} diff --git a/protocols/Steam/src/protobuf-c/steammessages_chat.steamclient.proto b/protocols/Steam/src/protobuf-c/steammessages_chat.steamclient.proto new file mode 100644 index 0000000000..150367ebe6 --- /dev/null +++ b/protocols/Steam/src/protobuf-c/steammessages_chat.steamclient.proto @@ -0,0 +1,1281 @@ +import "steammessages_base.proto"; +import "steammessages_unified_base.steamclient.proto"; +import "steammessages_clientserver_friends.proto"; + +option cc_generic_services = true; + +enum EChatRoomJoinState { +	k_EChatRoomJoinState_Default = 0; +	k_EChatRoomJoinState_None = 1; +	k_EChatRoomJoinState_Joined = 2; +	k_EChatRoomJoinState_TestInvalid = 99; +} + +enum EChatRoomGroupRank { +	k_EChatRoomGroupRank_Default = 0; +	k_EChatRoomGroupRank_Viewer = 10; +	k_EChatRoomGroupRank_Guest = 15; +	k_EChatRoomGroupRank_Member = 20; +	k_EChatRoomGroupRank_Moderator = 30; +	k_EChatRoomGroupRank_Officer = 40; +	k_EChatRoomGroupRank_Owner = 50; +	k_EChatRoomGroupRank_TestInvalid = 99; +} + +enum EChatRoomNotificationLevel { +	k_EChatroomNotificationLevel_Invalid = 0; +	k_EChatroomNotificationLevel_None = 1; +	k_EChatroomNotificationLevel_MentionMe = 2; +	k_EChatroomNotificationLevel_MentionAll = 3; +	k_EChatroomNotificationLevel_AllMessages = 4; +} + +enum EChatRoomServerMessage { +	k_EChatRoomServerMsg_Invalid = 0; +	k_EChatRoomServerMsg_RenameChatRoom = 1; +	k_EChatRoomServerMsg_Joined = 2; +	k_EChatRoomServerMsg_Parted = 3; +	k_EChatRoomServerMsg_Kicked = 4; +	k_EChatRoomServerMsg_Invited = 5; +	k_EChatRoomServerMsg_InviteDismissed = 8; +	k_EChatRoomServerMsg_ChatRoomTaglineChanged = 9; +	k_EChatRoomServerMsg_ChatRoomAvatarChanged = 10; +	k_EChatRoomServerMsg_AppCustom = 11; +} + +enum EChatRoomMessageReactionType { +	k_EChatRoomMessageReactionType_Invalid = 0; +	k_EChatRoomMessageReactionType_Emoticon = 1; +	k_EChatRoomMessageReactionType_Sticker = 2; +} + +enum EChatRoomMemberStateChange { +	k_EChatRoomMemberStateChange_Invalid = 0; +	k_EChatRoomMemberStateChange_Joined = 1; +	k_EChatRoomMemberStateChange_Parted = 2; +	k_EChatRoomMemberStateChange_Kicked = 3; +	k_EChatRoomMemberStateChange_Invited = 4; +	k_EChatRoomMemberStateChange_RankChanged = 7; +	k_EChatRoomMemberStateChange_InviteDismissed = 8; +	k_EChatRoomMemberStateChange_Muted = 9; +	k_EChatRoomMemberStateChange_Banned = 10; +	k_EChatRoomMemberStateChange_RolesChanged = 12; +} + +message CChat_RequestFriendPersonaStates_Request { +} + +message CChat_RequestFriendPersonaStates_Response { +} + +message CChatRoom_CreateChatRoomGroup_Request { +	optional fixed64 steamid_partner = 1; +	optional fixed64 steamid_invited = 2; +	optional string name = 3; +	repeated fixed64 steamid_invitees = 4; +	optional uint32 watching_broadcast_accountid = 6; +	optional uint64 watching_broadcast_channel_id = 7; +} + +message CChatRole { +	optional uint64 role_id = 1; +	optional string name = 2; +	optional uint32 ordinal = 3; +} + +message CChatRoleActions { +	optional uint64 role_id = 1; +	optional bool can_create_rename_delete_channel = 2; +	optional bool can_kick = 3; +	optional bool can_ban = 4; +	optional bool can_invite = 5; +	optional bool can_change_tagline_avatar_name = 6; +	optional bool can_chat = 7; +	optional bool can_view_history = 8; +	optional bool can_change_group_roles = 9; +	optional bool can_change_user_roles = 10; +	optional bool can_mention_all = 11; +	optional bool can_set_watching_broadcast = 12; +} + +message CChatPartyBeacon { +	optional uint32 app_id = 1; +	optional fixed64 steamid_owner = 2; +	optional fixed64 beacon_id = 3; +	optional string game_metadata = 4; +} + +message CChatRoomGroupHeaderState { +	optional uint64 chat_group_id = 1; +	optional string chat_name = 2; +	optional uint32 clanid = 13; +	optional uint32 accountid_owner = 14; +	optional uint32 appid = 21; +	optional string tagline = 15; +	optional bytes avatar_sha = 16; +	optional uint64 default_role_id = 17; +	repeated .CChatRole roles = 18; +	repeated .CChatRoleActions role_actions = 19; +	optional uint32 watching_broadcast_accountid = 20; +	repeated .CChatPartyBeacon party_beacons = 22; +	optional uint64 watching_broadcast_channel_id = 23; +	optional uint64 active_minigame_id = 24; +	optional string avatar_ugc_url = 25; +	optional bool disabled = 26; +} + +message CChatRoomMember { +	optional uint32 accountid = 1; +	optional .EChatRoomJoinState state = 3 [default = k_EChatRoomJoinState_Default]; +	optional .EChatRoomGroupRank rank = 4 [default = k_EChatRoomGroupRank_Default]; +	optional uint32 time_kick_expire = 6; +	repeated uint64 role_ids = 7; +} + +message CChatRoomState { +	optional uint64 chat_id = 1; +	optional string chat_name = 2; +	optional bool voice_allowed = 3; +	repeated uint32 members_in_voice = 4; +	optional uint32 time_last_message = 5; +	optional uint32 sort_order = 6; +	optional string last_message = 7; +	optional uint32 accountid_last_message = 8; +} + +message CChatRoomGroupState { +	optional .CChatRoomGroupHeaderState header_state = 1; +	repeated .CChatRoomMember members = 2; +	optional uint64 default_chat_id = 4; +	repeated .CChatRoomState chat_rooms = 5; +	repeated .CChatRoomMember kicked = 7; +} + +message CUserChatRoomState { +	optional uint64 chat_id = 1; +	optional uint32 time_joined = 2; +	optional uint32 time_last_ack = 3; +	optional .EChatRoomNotificationLevel desktop_notification_level = 4 [default = k_EChatroomNotificationLevel_Invalid]; +	optional .EChatRoomNotificationLevel mobile_notification_level = 5 [default = k_EChatroomNotificationLevel_Invalid]; +	optional uint32 time_last_mention = 6; +	optional bool unread_indicator_muted = 7 [default = false]; +	optional uint32 time_first_unread = 8; +} + +message CUserChatRoomGroupState { +	optional uint64 chat_group_id = 1; +	optional uint32 time_joined = 2; +	repeated .CUserChatRoomState user_chat_room_state = 3; +	optional .EChatRoomNotificationLevel desktop_notification_level = 4 [default = k_EChatroomNotificationLevel_Invalid]; +	optional .EChatRoomNotificationLevel mobile_notification_level = 5 [default = k_EChatroomNotificationLevel_Invalid]; +	optional uint32 time_last_group_ack = 6; +	optional bool unread_indicator_muted = 7 [default = false]; +} + +message CChatRoom_CreateChatRoomGroup_Response { +	optional uint64 chat_group_id = 1; +	optional .CChatRoomGroupState state = 2; +	optional .CUserChatRoomGroupState user_chat_state = 3; +} + +message CChatRoom_SaveChatRoomGroup_Request { +	optional uint64 chat_group_id = 1; +	optional string name = 2; +} + +message CChatRoom_SaveChatRoomGroup_Response { +} + +message CChatRoom_RenameChatRoomGroup_Request { +	optional uint64 chat_group_id = 1; +	optional string name = 2; +} + +message CChatRoom_RenameChatRoomGroup_Response { +	optional string name = 1; +} + +message CChatRoom_SetChatRoomGroupTagline_Request { +	optional uint64 chat_group_id = 1; +	optional string tagline = 2; +} + +message CChatRoom_SetChatRoomGroupTagline_Response { +} + +message CChatRoom_SetChatRoomGroupAvatar_Request { +	optional uint64 chat_group_id = 1; +	optional bytes avatar_sha = 2; +} + +message CChatRoom_SetChatRoomGroupAvatar_Response { +} + +message CChatRoom_SetChatRoomGroupWatchingBroadcast_Request { +	optional uint64 chat_group_id = 1; +	optional uint32 watching_broadcast_accountid = 2; +	optional uint64 watching_broadcast_channel_id = 3; +} + +message CChatRoom_SetChatRoomGroupWatchingBroadcast_Response { +} + +message CChatRoom_JoinMiniGameForChatRoomGroup_Request { +	optional uint64 chat_group_id = 1; +	optional uint64 chat_id = 2; +} + +message CChatRoom_JoinMiniGameForChatRoomGroup_Response { +	optional uint64 minigame_id = 1; +} + +message CChatRoom_EndMiniGameForChatRoomGroup_Request { +	optional uint64 chat_group_id = 1; +	optional uint64 chat_id = 2; +	optional uint64 minigame_id = 3; +} + +message CChatRoom_EndMiniGameForChatRoomGroup_Response { +} + +message CChatRoom_MuteUser_Request { +	optional uint64 chat_group_id = 1; +	optional fixed64 steamid = 2; +	optional int32 expiration = 3; +} + +message CChatRoom_MuteUser_Response { +} + +message CChatRoom_KickUser_Request { +	optional uint64 chat_group_id = 1; +	optional fixed64 steamid = 2; +	optional int32 expiration = 3; +} + +message CChatRoom_KickUser_Response { +} + +message CChatRoom_SetUserBanState_Request { +	optional uint64 chat_group_id = 1; +	optional fixed64 steamid = 2; +	optional bool ban_state = 3; +} + +message CChatRoom_SetUserBanState_Response { +} + +message CChatRoom_RevokeInvite_Request { +	optional uint64 chat_group_id = 1; +	optional fixed64 steamid = 2; +} + +message CChatRoom_RevokeInvite_Response { +} + +message CChatRoom_CreateRole_Request { +	optional uint64 chat_group_id = 1; +	optional string name = 2; +} + +message CChatRoom_CreateRole_Response { +	optional .CChatRoleActions actions = 2; +} + +message CChatRoom_GetRoles_Request { +	optional uint64 chat_group_id = 1; +} + +message CChatRoom_GetRoles_Response { +	repeated .CChatRole roles = 1; +} + +message CChatRoom_RenameRole_Request { +	optional uint64 chat_group_id = 1; +	optional uint64 role_id = 2; +	optional string name = 3; +} + +message CChatRoom_RenameRole_Response { +} + +message CChatRoom_ReorderRole_Request { +	optional uint64 chat_group_id = 1; +	optional uint64 role_id = 2; +	optional uint32 ordinal = 3; +} + +message CChatRoom_ReorderRole_Response { +} + +message CChatRoom_DeleteRole_Request { +	optional uint64 chat_group_id = 1; +	optional uint64 role_id = 2; +} + +message CChatRoom_DeleteRole_Response { +} + +message CChatRoom_GetRoleActions_Request { +	optional uint64 chat_group_id = 1; +	optional uint64 role_id = 2; +} + +message CChatRoom_GetRoleActions_Response { +	repeated .CChatRoleActions actions = 1; +} + +message CChatRoom_ReplaceRoleActions_Request { +	optional uint64 chat_group_id = 1; +	optional uint64 role_id = 2; +	optional .CChatRoleActions actions = 4; +} + +message CChatRoom_ReplaceRoleActions_Response { +} + +message CChatRoom_AddRoleToUser_Request { +	optional uint64 chat_group_id = 1; +	optional uint64 role_id = 3; +	optional fixed64 steamid = 4; +} + +message CChatRoom_AddRoleToUser_Response { +} + +message CChatRoom_GetRolesForUser_Request { +	optional uint64 chat_group_id = 1; +	optional fixed64 steamid = 3; +} + +message CChatRoom_GetRolesForUser_Response { +	repeated uint64 role_ids = 1; +} + +message CChatRoom_DeleteRoleFromUser_Request { +	optional uint64 chat_group_id = 1; +	optional uint64 role_id = 3; +	optional fixed64 steamid = 4; +} + +message CChatRoom_DeleteRoleFromUser_Response { +} + +message CChatRoom_JoinChatRoomGroup_Request { +	optional uint64 chat_group_id = 1; +	optional string invite_code = 2; +	optional uint64 chat_id = 3; +} + +message CChatRoom_JoinChatRoomGroup_Response { +	optional .CChatRoomGroupState state = 1; +	optional .CUserChatRoomGroupState user_chat_state = 3; +	optional uint64 join_chat_id = 4; +	optional uint32 time_expire = 5; +} + +message CChatRoom_InviteFriendToChatRoomGroup_Request { +	optional uint64 chat_group_id = 1; +	optional fixed64 steamid = 2; +	optional uint64 chat_id = 3; +	optional bool skip_friendsui_check = 4; +} + +message CChatRoom_InviteFriendToChatRoomGroup_Response { +} + +message CChatRoom_LeaveChatRoomGroup_Request { +	optional uint64 chat_group_id = 1; +} + +message CChatRoom_LeaveChatRoomGroup_Response { +} + +message CChatRoom_CreateChatRoom_Request { +	optional uint64 chat_group_id = 1; +	optional string name = 2; +	optional bool allow_voice = 3; +} + +message CChatRoom_CreateChatRoom_Response { +	optional .CChatRoomState chat_room = 1; +} + +message CChatRoom_DeleteChatRoom_Request { +	optional uint64 chat_group_id = 1; +	optional uint64 chat_id = 2; +} + +message CChatRoom_DeleteChatRoom_Response { +} + +message CChatRoom_RenameChatRoom_Request { +	optional uint64 chat_group_id = 1; +	optional uint64 chat_id = 2; +	optional string name = 3; +} + +message CChatRoom_RenameChatRoom_Response { +} + +message CChatRoom_ReorderChatRoom_Request { +	optional uint64 chat_group_id = 1; +	optional uint64 chat_id = 2; +	optional uint64 move_after_chat_id = 3; +} + +message CChatRoom_ReorderChatRoom_Response { +} + +message CChatRoom_SendChatMessage_Request { +	optional uint64 chat_group_id = 1; +	optional uint64 chat_id = 2; +	optional string message = 3; +	optional bool echo_to_sender = 4; +} + +message CChatRoom_SendChatMessage_Response { +	optional string modified_message = 1; +	optional uint32 server_timestamp = 2; +	optional uint32 ordinal = 3; +	optional string message_without_bb_code = 4; +} + +message CChatRoom_JoinVoiceChat_Request { +	optional uint64 chat_group_id = 1; +	optional uint64 chat_id = 2; +} + +message CChatRoom_JoinVoiceChat_Response { +	optional uint64 voice_chatid = 1; +} + +message CChatRoom_LeaveVoiceChat_Request { +	optional uint64 chat_group_id = 1; +	optional uint64 chat_id = 2; +} + +message CChatRoom_LeaveVoiceChat_Response { +} + +message CChatRoom_GetMessageHistory_Request { +	optional uint64 chat_group_id = 1; +	optional uint64 chat_id = 2; +	optional uint32 last_time = 3; +	optional uint32 last_ordinal = 4; +	optional uint32 start_time = 5; +	optional uint32 start_ordinal = 6; +	optional uint32 max_count = 7; +} + +message ServerMessage { +	optional .EChatRoomServerMessage message = 1 [default = k_EChatRoomServerMsg_Invalid]; +	optional string string_param = 2; +	optional uint32 accountid_param = 3; +} + +message CChatRoom_GetMessageHistory_Response { +	message ChatMessage { +		message MessageReaction { +			optional .EChatRoomMessageReactionType reaction_type = 1 [default = k_EChatRoomMessageReactionType_Invalid]; +			optional string reaction = 2; +			optional uint32 num_reactors = 3; +			optional bool has_user_reacted = 4; +		} + +		optional uint32 sender = 1; +		optional uint32 server_timestamp = 2; +		optional string message = 3; +		optional uint32 ordinal = 4; +		optional .ServerMessage server_message = 5; +		optional bool deleted = 6; +		repeated .CChatRoom_GetMessageHistory_Response.ChatMessage.MessageReaction reactions = 7; +	} + +	repeated .CChatRoom_GetMessageHistory_Response.ChatMessage messages = 1; +	optional bool more_available = 4; +} + +message CChatRoom_GetMyChatRoomGroups_Request { +} + +message CChatRoom_GetChatRoomGroupSummary_Response { +	optional uint64 chat_group_id = 1; +	optional string chat_group_name = 2; +	optional uint32 active_member_count = 3; +	optional uint32 active_voice_member_count = 4; +	optional uint64 default_chat_id = 5; +	repeated .CChatRoomState chat_rooms = 6; +	optional uint32 clanid = 7; +	optional string chat_group_tagline = 8; +	optional uint32 accountid_owner = 9; +	repeated uint32 top_members = 10; +	optional bytes chat_group_avatar_sha = 11; +	optional .EChatRoomGroupRank rank = 12 [default = k_EChatRoomGroupRank_Default]; +	optional uint64 default_role_id = 13; +	repeated uint64 role_ids = 14; +	repeated .CChatRoleActions role_actions = 15; +	optional uint32 watching_broadcast_accountid = 16; +	optional uint32 appid = 17; +	repeated .CChatPartyBeacon party_beacons = 18; +	optional uint64 watching_broadcast_channel_id = 19; +	optional uint64 active_minigame_id = 20; +	optional string avatar_ugc_url = 21; +	optional bool disabled = 22; +} + +message CChatRoomSummaryPair { +	optional .CUserChatRoomGroupState user_chat_group_state = 1; +	optional .CChatRoom_GetChatRoomGroupSummary_Response group_summary = 2; +} + +message CChatRoom_GetMyChatRoomGroups_Response { +	repeated .CChatRoomSummaryPair chat_room_groups = 1; +} + +message CChatRoom_GetChatRoomGroupState_Request { +	optional uint64 chat_group_id = 1; +} + +message CChatRoom_GetChatRoomGroupState_Response { +	optional .CChatRoomGroupState state = 1; +} + +message CChatRoom_GetChatRoomGroupSummary_Request { +	optional uint64 chat_group_id = 1; +} + +message CChatRoom_SetAppChatRoomGroupForceActive_Request { +	optional uint64 chat_group_id = 1; +	optional uint32 requesting_app_id = 2; +} + +message CChatRoom_SetAppChatRoomGroupForceActive_Response { +	optional uint32 result = 1; +	repeated uint32 accounts_in_channel = 2; +} + +message CChatRoom_SetAppChatRoomGroupStopForceActive_Notification { +	optional uint64 chat_group_id = 1; +	optional uint32 requesting_app_id = 2; +} + +message CChatRoom_AckChatMessage_Notification { +	optional uint64 chat_group_id = 1; +	optional uint64 chat_id = 2; +	optional uint32 timestamp = 3; +} + +message CChatRoom_CreateInviteLink_Request { +	optional uint64 chat_group_id = 1; +	optional uint32 seconds_valid = 2; +	optional uint64 chat_id = 3; +} + +message CChatRoom_CreateInviteLink_Response { +	optional string invite_code = 1; +	optional uint32 seconds_valid = 2; +} + +message CChatRoom_GetInviteLinkInfo_Request { +	optional string invite_code = 1; +} + +message CChatRoom_GetInviteLinkInfo_Response { +	optional fixed64 steamid_sender = 3; +	optional uint32 time_expires = 4; +	optional uint64 chat_id = 6; +	optional .CChatRoom_GetChatRoomGroupSummary_Response group_summary = 8; +	optional .CUserChatRoomGroupState user_chat_group_state = 9; +	optional uint32 time_kick_expire = 10; +	optional bool banned = 11; +} + +message CChatRoom_GetInviteInfo_Request { +	optional fixed64 steamid_invitee = 1; +	optional uint64 chat_group_id = 2; +	optional uint64 chat_id = 3; +	optional string invite_code = 4; +} + +message CChatRoom_GetInviteInfo_Response { +	optional .CChatRoom_GetChatRoomGroupSummary_Response group_summary = 1; +	optional uint32 time_kick_expire = 2; +	optional bool banned = 3; +} + +message CChatRoom_GetInviteLinksForGroup_Request { +	optional uint64 chat_group_id = 1; +} + +message CChatRoom_GetInviteLinksForGroup_Response { +	message LinkInfo { +		optional string invite_code = 1; +		optional fixed64 steamid_creator = 2; +		optional uint32 time_expires = 3; +		optional uint64 chat_id = 4; +	} + +	repeated .CChatRoom_GetInviteLinksForGroup_Response.LinkInfo invite_links = 1; +} + +message CChatRoom_GetBanList_Request { +	optional uint64 chat_group_id = 1; +} + +message CChatRoom_GetBanList_Response { +	message BanInfo { +		optional uint32 accountid = 1; +		optional uint32 accountid_actor = 2; +		optional uint32 time_banned = 3; +		optional string ban_reason = 4; +	} + +	repeated .CChatRoom_GetBanList_Response.BanInfo bans = 1; +} + +message CChatRoom_GetInviteList_Request { +	optional uint64 chat_group_id = 1; +} + +message CChatRoomGroupInvite { +	optional uint32 accountid = 1; +	optional uint32 accountid_actor = 2; +	optional uint32 time_invited = 3; +} + +message CChatRoom_GetInviteList_Response { +	repeated .CChatRoomGroupInvite invites = 1; +} + +message CChatRoom_DeleteInviteLink_Request { +	optional uint64 chat_group_id = 1; +	optional string invite_code = 2; +} + +message CChatRoom_DeleteInviteLink_Response { +} + +message CChatRoom_SetSessionActiveChatRoomGroups_Request { +	repeated uint64 chat_group_ids = 1; +	repeated uint64 chat_groups_data_requested = 2; +	optional int32 virtualize_members_threshold = 3 [(description) = "If a chat room has more members than this threshold, we will opt in to a virtualized list"]; +} + +message CChatRoom_SetSessionActiveChatRoomGroups_Response { +	repeated .CChatRoomGroupState chat_states = 1; +	repeated uint64 virtualize_members_chat_group_ids = 2; +} + +message CChatRoom_SetUserChatGroupPreferences_Request { +	message ChatGroupPreferences { +		optional .EChatRoomNotificationLevel desktop_notification_level = 1 [default = k_EChatroomNotificationLevel_Invalid]; +		optional .EChatRoomNotificationLevel mobile_notification_level = 2 [default = k_EChatroomNotificationLevel_Invalid]; +		optional bool unread_indicator_muted = 3; +	} + +	message ChatRoomPreferences { +		optional uint64 chat_id = 1; +		optional .EChatRoomNotificationLevel desktop_notification_level = 2 [default = k_EChatroomNotificationLevel_Invalid]; +		optional .EChatRoomNotificationLevel mobile_notification_level = 3 [default = k_EChatroomNotificationLevel_Invalid]; +		optional bool unread_indicator_muted = 4; +	} + +	optional uint64 chat_group_id = 1; +	optional .CChatRoom_SetUserChatGroupPreferences_Request.ChatGroupPreferences chat_group_preferences = 2; +	repeated .CChatRoom_SetUserChatGroupPreferences_Request.ChatRoomPreferences chat_room_preferences = 3; +} + +message CChatRoom_SetUserChatGroupPreferences_Response { +} + +message CChatRoom_DeleteChatMessages_Request { +	message Message { +		optional uint32 server_timestamp = 1; +		optional uint32 ordinal = 2; +	} + +	optional uint64 chat_group_id = 1; +	optional uint64 chat_id = 2; +	repeated .CChatRoom_DeleteChatMessages_Request.Message messages = 3; +} + +message CChatRoom_DeleteChatMessages_Response { +} + +message CChatRoom_UpdateMemberListView_Notification { +	optional uint64 chat_group_id = 1; +	optional uint64 view_id = 2 [(description) = "Client-generated ID.  Should send the same value on all requests for the same view"]; +	optional int32 start = 3; +	optional int32 end = 4; +	optional int32 client_changenumber = 5 [(description) = "Any updates from this call on will have this changenumber present.  Can be used to guarantee in-order updates."]; +	optional bool delete_view = 6 [(description) = "Indicates this view has been deleted."]; +	repeated int32 persona_subscribe_accountids = 7; +	repeated int32 persona_unsubscribe_accountids = 8; +} + +message CChatRoom_SearchMembers_Request { +	optional uint64 chat_group_id = 1; +	optional uint64 search_id = 2 [(description) = "Client-supplied id.  For find-as-you-type searches, as search narrows the server will not return persona states previously returned for a given searchid."]; +	optional string search_text = 3; +	optional int32 max_results = 4; +} + +message CChatRoom_SearchMembers_Response { +	message MemberMatch { +		optional int32 accountid = 1; +		optional .CMsgClientPersonaState.Friend persona = 2; +	} + +	repeated .CChatRoom_SearchMembers_Response.MemberMatch matching_members = 1; +	optional uint32 status_flags = 2; +} + +message CChatRoom_UpdateMessageReaction_Request { +	optional uint64 chat_group_id = 1; +	optional uint64 chat_id = 2; +	optional uint32 server_timestamp = 3; +	optional uint32 ordinal = 4; +	optional .EChatRoomMessageReactionType reaction_type = 5 [default = k_EChatRoomMessageReactionType_Invalid]; +	optional string reaction = 6; +	optional bool is_add = 7; +} + +message CChatRoom_UpdateMessageReaction_Response { +	optional uint32 num_reactors = 1; +} + +message CChatRoom_GetMessageReactionReactors_Request { +	optional uint64 chat_group_id = 1; +	optional uint64 chat_id = 2; +	optional uint32 server_timestamp = 3; +	optional uint32 ordinal = 4; +	optional .EChatRoomMessageReactionType reaction_type = 5 [default = k_EChatRoomMessageReactionType_Invalid]; +	optional string reaction = 6; +	optional uint32 limit = 7; +} + +message CChatRoom_GetMessageReactionReactors_Response { +	repeated uint32 reactors = 1; +} + +message CClanChatRooms_GetClanChatRoomInfo_Request { +	optional fixed64 steamid = 1; +	optional bool autocreate = 2 [default = true, (description) = "Create a default chat room if none has been created before."]; +} + +message CClanChatRooms_GetClanChatRoomInfo_Response { +	optional .CChatRoom_GetChatRoomGroupSummary_Response chat_group_summary = 1; +} + +message CClanChatRooms_SetClanChatRoomPrivate_Request { +	optional fixed64 steamid = 1; +	optional bool chat_room_private = 2; +} + +message CClanChatRooms_SetClanChatRoomPrivate_Response { +	optional bool chat_room_private = 1; +} + +message CChatMentions { +	optional bool mention_all = 1; +	optional bool mention_here = 2; +	repeated uint32 mention_accountids = 3; +} + +message CChatRoom_IncomingChatMessage_Notification { +	optional uint64 chat_group_id = 1; +	optional uint64 chat_id = 2; +	optional fixed64 steamid_sender = 3; +	optional string message = 4; +	optional uint32 timestamp = 5; +	optional .CChatMentions mentions = 6; +	optional uint32 ordinal = 7; +	optional .ServerMessage server_message = 8; +	optional string message_no_bbcode = 9; +	optional string chat_name = 10 [(description) = "A name to use for the chat, intended for notifications"]; +} + +message CChatRoom_ChatMessageModified_Notification { +	message ChatMessage { +		optional uint32 server_timestamp = 1; +		optional uint32 ordinal = 2; +		optional bool deleted = 3; +	} + +	optional uint64 chat_group_id = 1; +	optional uint64 chat_id = 2; +	repeated .CChatRoom_ChatMessageModified_Notification.ChatMessage messages = 3; +} + +message CChatRoom_MemberStateChange_Notification { +	optional uint64 chat_group_id = 1; +	optional .CChatRoomMember member = 2; +	optional .EChatRoomMemberStateChange change = 3 [default = k_EChatRoomMemberStateChange_Invalid]; +} + +message CChatRoom_ChatRoomHeaderState_Notification { +	optional .CChatRoomGroupHeaderState header_state = 1; +} + +message CChatRoom_ChatRoomGroupRoomsChange_Notification { +	optional uint64 chat_group_id = 1; +	optional uint64 default_chat_id = 2; +	repeated .CChatRoomState chat_rooms = 3; +} + +message CChatRoom_NotifyShouldRejoinChatRoomVoiceChat_Notification { +	optional uint64 chat_id = 1; +	optional uint64 chat_group_id = 2; +} + +message ChatRoomClient_NotifyChatGroupUserStateChanged_Notification { +	optional uint64 chat_group_id = 1; +	optional .CUserChatRoomGroupState user_chat_group_state = 2; +	optional .CChatRoom_GetChatRoomGroupSummary_Response group_summary = 3; +	optional .EChatRoomMemberStateChange user_action = 4 [default = k_EChatRoomMemberStateChange_Invalid]; +} + +message ChatRoomClient_NotifyChatRoomDisconnect_Notification { +	repeated uint64 chat_group_ids = 1; +} + +message CChatRoomMemberListView { +	optional int32 start = 3; +	optional int32 end = 4; +	optional int32 total_count = 5; +	optional int32 client_changenumber = 6 [(description) = "Value sent by the client on the last UpdateMemberListView call. "]; +	optional int32 server_changenumber = 7 [(description) = "Value incremented by the server on each MemberListViewUpdated call. "]; +} + +message CChatRoomMemberSummaryCounts { +	optional int32 ingame = 1; +	optional int32 online = 2; +	optional int32 offline = 3; +} + +message CChatRoomClient_MemberListViewUpdated_Notification { +	message MemberListViewEntry { +		optional int32 rank = 1; +		optional uint32 accountid = 2; +		optional .CMsgClientPersonaState.Friend persona = 3; +	} + +	optional uint64 chat_group_id = 1; +	optional uint64 view_id = 2 [(description) = "Thew view_id supplied when the client created the view. "]; +	optional .CChatRoomMemberListView view = 3; +	repeated .CChatRoomClient_MemberListViewUpdated_Notification.MemberListViewEntry members = 4; +	optional uint32 status_flags = 5; +	optional .CChatRoomMemberSummaryCounts member_summary = 6; +	repeated .CMsgClientPersonaState.Friend subscribed_personas = 7; +} + +message CChatRoom_MessageReaction_Notification { +	optional uint64 chat_group_id = 1; +	optional uint64 chat_id = 2; +	optional uint32 server_timestamp = 3; +	optional uint32 ordinal = 4; +	optional fixed64 reactor = 5; +	optional .EChatRoomMessageReactionType reaction_type = 6 [default = k_EChatRoomMessageReactionType_Invalid]; +	optional string reaction = 7; +	optional bool is_add = 8; +} + +message CChatUsability_ClientUsabilityMetrics_Notification { +	message Settings { +		optional bool notifications_show_ingame = 1; +		optional bool notifications_show_online = 2; +		optional bool notifications_show_message = 3; +		optional bool notifications_events_and_announcements = 4; +		optional bool sounds_play_ingame = 5; +		optional bool sounds_play_online = 6; +		optional bool sounds_play_message = 7; +		optional bool sounds_events_and_announcements = 8; +		optional bool always_new_chat_window = 9; +		optional bool force_alphabetic_friend_sorting = 10; +		optional int32 chat_flash_mode = 11; +		optional bool remember_open_chats = 12; +		optional bool compact_quick_access = 13; +		optional bool compact_friends_list = 14; +		optional bool notifications_show_chat_room_notification = 15; +		optional bool sounds_play_chat_room_notification = 16; +		optional bool hide_offline_friends_in_tag_groups = 17; +		optional bool hide_categorized_friends = 18; +		optional bool categorize_in_game_friends_by_game = 19; +		optional int32 chat_font_size = 20; +		optional bool use24hour_clock = 21; +		optional bool do_not_disturb_mode = 22; +		optional bool disable_embed_inlining = 23; +		optional bool sign_into_friends = 24; +		optional bool animated_avatars = 25; +	} + +	message VoiceSettings { +		optional float voice_input_gain = 1; +		optional float voice_output_gain = 2; +		optional int32 noise_gate_level = 3; +		optional bool voice_use_echo_cancellation = 4; +		optional bool voice_use_noise_cancellation = 5; +		optional bool voice_use_auto_gain_control = 6; +		optional bool selected_non_default_mic = 7; +		optional bool selected_non_default_output = 8; +		optional bool push_to_talk_enabled = 9; +		optional bool push_to_mute_enabled = 10; +		optional bool play_ptt_sounds = 11; +	} + +	message UIState { +		message CategoryCollapseState { +			optional bool in_game_collapsed = 1; +			optional bool online_collapsed = 2; +			optional bool offline_collapsed = 3; +			optional int32 game_groups_collapsed = 4; +			optional int32 categories_collapsed = 5; +		} + +		optional int32 friends_list_height = 1; +		optional int32 friends_list_width = 2; +		optional bool friends_list_docked = 3; +		optional bool friends_list_collapsed = 4; +		optional int32 friends_list_group_chats_height = 5; +		optional bool friends_list_visible = 6; +		optional int32 chat_popups_opened = 7; +		optional int32 group_chat_tabs_opened = 8; +		optional int32 friend_chat_tabs_opened = 9; +		optional int32 chat_window_width = 10; +		optional int32 chat_window_height = 11; +		optional .CChatUsability_ClientUsabilityMetrics_Notification.UIState.CategoryCollapseState category_collapse = 12; +		optional int32 group_chat_left_col_collapsed = 13; +		optional int32 group_chat_right_col_collapsed = 14; +		optional bool in_one_on_one_voice_chat = 15; +		optional bool in_group_voice_chat = 16; +	} + +	message Metrics { +		optional int32 friends_count = 1; +		optional int32 friends_category_count = 2; +		optional int32 friends_categorized_count = 3; +		optional int32 friends_online_count = 4; +		optional int32 friends_in_game_count = 5; +		optional int32 friends_in_game_singleton_count = 6; +		optional int32 game_group_count = 7; +		optional int32 friends_favorite_count = 8; +		optional int32 group_chat_count = 9; +		optional int32 group_chat_favorite_count = 10; +	} + +	optional uint32 metrics_run_id = 1; +	optional uint32 client_build = 2; +	optional uint32 metrics_version = 3; +	optional bool in_web = 4; +	optional .CChatUsability_ClientUsabilityMetrics_Notification.Settings settings = 10; +	optional .CChatUsability_ClientUsabilityMetrics_Notification.VoiceSettings voice_settings = 11; +	optional .CChatUsability_ClientUsabilityMetrics_Notification.UIState ui_state = 12; +	optional .CChatUsability_ClientUsabilityMetrics_Notification.Metrics metrics = 13; +} + +message CChatUsability_RequestClientUsabilityMetrics_Notification { +	optional uint32 metrics_run_id = 1; +} + +service Chat { +	option (service_description) = "Chat-related services"; + +	rpc RequestFriendPersonaStates (.CChat_RequestFriendPersonaStates_Request) returns (.CChat_RequestFriendPersonaStates_Response) { +		option (method_description) = "Request to be notified of online friend persona state information.  Responses sent via CMsgClientPersonaState."; +	} +} + +service ChatRoom { +	option (service_description) = "Service for joining, managing, and using multi-user chat rooms"; + +	rpc CreateChatRoomGroup (.CChatRoom_CreateChatRoomGroup_Request) returns (.CChatRoom_CreateChatRoomGroup_Response) { +		option (method_description) = "Create's a chat group that can contain other chat rooms"; +	} + +	rpc SaveChatRoomGroup (.CChatRoom_SaveChatRoomGroup_Request) returns (.CChatRoom_SaveChatRoomGroup_Response) { +		option (method_description) = "Saves's a chat group"; +	} + +	rpc RenameChatRoomGroup (.CChatRoom_RenameChatRoomGroup_Request) returns (.CChatRoom_RenameChatRoomGroup_Response) { +		option (method_description) = "Rename a chat room group"; +	} + +	rpc SetChatRoomGroupTagline (.CChatRoom_SetChatRoomGroupTagline_Request) returns (.CChatRoom_SetChatRoomGroupTagline_Response) { +		option (method_description) = "Set tagline for a chat room group"; +	} + +	rpc SetChatRoomGroupAvatar (.CChatRoom_SetChatRoomGroupAvatar_Request) returns (.CChatRoom_SetChatRoomGroupAvatar_Response) { +		option (method_description) = "Set avatar SHA for a chat room group"; +	} + +	rpc SetChatRoomGroupWatchingBroadcast (.CChatRoom_SetChatRoomGroupWatchingBroadcast_Request) returns (.CChatRoom_SetChatRoomGroupWatchingBroadcast_Response) { +		option (method_description) = "Sets a broadcast that the chat room group is watching"; +	} + +	rpc JoinMiniGameForChatRoomGroup (.CChatRoom_JoinMiniGameForChatRoomGroup_Request) returns (.CChatRoom_JoinMiniGameForChatRoomGroup_Response) { +		option (method_description) = "Joins the minigame for the chat room group or starts a new one (Winter 2019 sale party game)"; +	} + +	rpc EndMiniGameForChatRoomGroup (.CChatRoom_EndMiniGameForChatRoomGroup_Request) returns (.CChatRoom_EndMiniGameForChatRoomGroup_Response) { +		option (method_description) = "Ends the minigame in the chat room group"; +	} + +	rpc MuteUserInGroup (.CChatRoom_MuteUser_Request) returns (.CChatRoom_MuteUser_Response) { +		option (method_description) = "Mute user in group"; +	} + +	rpc KickUserFromGroup (.CChatRoom_KickUser_Request) returns (.CChatRoom_KickUser_Response) { +		option (method_description) = "Kick user from group"; +	} + +	rpc SetUserBanState (.CChatRoom_SetUserBanState_Request) returns (.CChatRoom_SetUserBanState_Response) { +		option (method_description) = "Ban/unban user from group"; +	} + +	rpc RevokeInviteToGroup (.CChatRoom_RevokeInvite_Request) returns (.CChatRoom_RevokeInvite_Response) { +		option (method_description) = "Revoke a direct invitation of a user"; +	} + +	rpc CreateRole (.CChatRoom_CreateRole_Request) returns (.CChatRoom_CreateRole_Response) { +		option (method_description) = "Create role for goup"; +	} + +	rpc GetRoles (.CChatRoom_GetRoles_Request) returns (.CChatRoom_GetRoles_Response) { +		option (method_description) = "Get all roles in group"; +	} + +	rpc RenameRole (.CChatRoom_RenameRole_Request) returns (.CChatRoom_RenameRole_Response) { +		option (method_description) = "Rename role for goup"; +	} + +	rpc ReorderRole (.CChatRoom_ReorderRole_Request) returns (.CChatRoom_ReorderRole_Response) { +		option (method_description) = "Reorder role with a goup"; +	} + +	rpc DeleteRole (.CChatRoom_DeleteRole_Request) returns (.CChatRoom_DeleteRole_Response) { +		option (method_description) = "Delete role from group"; +	} + +	rpc GetRoleActions (.CChatRoom_GetRoleActions_Request) returns (.CChatRoom_GetRoleActions_Response) { +		option (method_description) = "Get all defined roles and actions in group"; +	} + +	rpc ReplaceRoleActions (.CChatRoom_ReplaceRoleActions_Request) returns (.CChatRoom_ReplaceRoleActions_Response) { +		option (method_description) = "Replace role actions in group"; +	} + +	rpc AddRoleToUser (.CChatRoom_AddRoleToUser_Request) returns (.CChatRoom_AddRoleToUser_Response) { +		option (method_description) = "Add role to user in group"; +	} + +	rpc GetRolesForUser (.CChatRoom_GetRolesForUser_Request) returns (.CChatRoom_GetRolesForUser_Response) { +		option (method_description) = "Get all roles assigned to user in group"; +	} + +	rpc DeleteRoleFromUser (.CChatRoom_DeleteRoleFromUser_Request) returns (.CChatRoom_DeleteRoleFromUser_Response) { +		option (method_description) = "Delete role from user in group"; +	} + +	rpc JoinChatRoomGroup (.CChatRoom_JoinChatRoomGroup_Request) returns (.CChatRoom_JoinChatRoomGroup_Response) { +		option (method_description) = "Join a multi-user chat room"; +	} + +	rpc InviteFriendToChatRoomGroup (.CChatRoom_InviteFriendToChatRoomGroup_Request) returns (.CChatRoom_InviteFriendToChatRoomGroup_Response) { +		option (method_description) = "Invite a friend to a multi-user chat room"; +	} + +	rpc LeaveChatRoomGroup (.CChatRoom_LeaveChatRoomGroup_Request) returns (.CChatRoom_LeaveChatRoomGroup_Response) { +		option (method_description) = "Leaves a chat room group and all related chats"; +	} + +	rpc CreateChatRoom (.CChatRoom_CreateChatRoom_Request) returns (.CChatRoom_CreateChatRoom_Response) { +		option (method_description) = "Creates a chat room inside a chat room group"; +	} + +	rpc DeleteChatRoom (.CChatRoom_DeleteChatRoom_Request) returns (.CChatRoom_DeleteChatRoom_Response) { +		option (method_description) = "Deletes a chat room inside a chat room group"; +	} + +	rpc RenameChatRoom (.CChatRoom_RenameChatRoom_Request) returns (.CChatRoom_RenameChatRoom_Response) { +		option (method_description) = "Renames a chat room inside a chat room group"; +	} + +	rpc ReorderChatRoom (.CChatRoom_ReorderChatRoom_Request) returns (.CChatRoom_ReorderChatRoom_Response) { +		option (method_description) = "Reorders a chat room inside a chat room group"; +	} + +	rpc SendChatMessage (.CChatRoom_SendChatMessage_Request) returns (.CChatRoom_SendChatMessage_Response) { +		option (method_description) = "Send a chat message to a multi-user chat room"; +	} + +	rpc JoinVoiceChat (.CChatRoom_JoinVoiceChat_Request) returns (.CChatRoom_JoinVoiceChat_Response) { +		option (method_description) = "Join the voice chat in a multi-room chat (should already be in the chat room)"; +	} + +	rpc LeaveVoiceChat (.CChatRoom_LeaveVoiceChat_Request) returns (.CChatRoom_LeaveVoiceChat_Response) { +		option (method_description) = "Leave the voice chat in a multi-room chat"; +	} + +	rpc GetMessageHistory (.CChatRoom_GetMessageHistory_Request) returns (.CChatRoom_GetMessageHistory_Response) { +		option (method_description) = "Get the history of messages in a chat room.  You must currently be a member of the chat room."; +	} + +	rpc GetMyChatRoomGroups (.CChatRoom_GetMyChatRoomGroups_Request) returns (.CChatRoom_GetMyChatRoomGroups_Response) { +		option (method_description) = "Get a list of our chat rooms"; +	} + +	rpc GetChatRoomGroupState (.CChatRoom_GetChatRoomGroupState_Request) returns (.CChatRoom_GetChatRoomGroupState_Response) { +		option (method_description) = "Get information about a single chat room"; +	} + +	rpc GetChatRoomGroupSummary (.CChatRoom_GetChatRoomGroupSummary_Request) returns (.CChatRoom_GetChatRoomGroupSummary_Response) { +		option (method_description) = "Get basic information about a chat room group"; +	} + +	rpc SetAppChatRoomGroupForceActive (.CChatRoom_SetAppChatRoomGroupForceActive_Request) returns (.CChatRoom_SetAppChatRoomGroupForceActive_Response) { +		option (method_description) = "Force a group chat to be considered active on the server for this user"; +	} + +	rpc SetAppChatRoomGroupStopForceActive (.CChatRoom_SetAppChatRoomGroupStopForceActive_Notification) returns (.NoResponse) { +		option (method_description) = "If a group chat is forced active (see SetAppChatRoomGroupForceActive), decrement the force count"; +	} + +	rpc AckChatMessage (.CChatRoom_AckChatMessage_Notification) returns (.NoResponse) { +		option (method_description) = "Acknowledge that we have seen the most recent chat message in a chat"; +	} + +	rpc CreateInviteLink (.CChatRoom_CreateInviteLink_Request) returns (.CChatRoom_CreateInviteLink_Response) { +		option (method_description) = "Creates a chatroom invite link"; +	} + +	rpc GetInviteLinkInfo (.CChatRoom_GetInviteLinkInfo_Request) returns (.CChatRoom_GetInviteLinkInfo_Response) { +		option (method_description) = "Returns chat room info about provided link"; +	} + +	rpc GetInviteInfo (.CChatRoom_GetInviteInfo_Request) returns (.CChatRoom_GetInviteInfo_Response) { +		option (method_description) = "Returns chat room info about any invite involving the sender and passed group id"; +	} + +	rpc GetInviteLinksForGroup (.CChatRoom_GetInviteLinksForGroup_Request) returns (.CChatRoom_GetInviteLinksForGroup_Response) { +		option (method_description) = "Returns all invite links for the specified group"; +	} + +	rpc GetBanList (.CChatRoom_GetBanList_Request) returns (.CChatRoom_GetBanList_Response) { +		option (method_description) = "Gets a list of users who have been banned from a chat room"; +	} + +	rpc GetInviteList (.CChatRoom_GetInviteList_Request) returns (.CChatRoom_GetInviteList_Response) { +		option (method_description) = "Gets a list of users who have been invited to a chat room"; +	} + +	rpc DeleteInviteLink (.CChatRoom_DeleteInviteLink_Request) returns (.CChatRoom_DeleteInviteLink_Response) { +		option (method_description) = "Deletes specified invite link"; +	} + +	rpc SetSessionActiveChatRoomGroups (.CChatRoom_SetSessionActiveChatRoomGroups_Request) returns (.CChatRoom_SetSessionActiveChatRoomGroups_Response) { +		option (method_description) = "Set which chat rooms we are using in the active session"; +	} + +	rpc SetUserChatGroupPreferences (.CChatRoom_SetUserChatGroupPreferences_Request) returns (.CChatRoom_SetUserChatGroupPreferences_Response) { +		option (method_description) = "Set preferences around chat notifications for a group"; +	} + +	rpc DeleteChatMessages (.CChatRoom_DeleteChatMessages_Request) returns (.CChatRoom_DeleteChatMessages_Response) { +		option (method_description) = "Deletes specified chat messages"; +	} + +	rpc UpdateMemberListView (.CChatRoom_UpdateMemberListView_Notification) returns (.NoResponse) { +		option (method_description) = "A client is indicating it has an active view into the members list."; +	} + +	rpc SearchMembers (.CChatRoom_SearchMembers_Request) returns (.CChatRoom_SearchMembers_Response) { +		option (method_description) = "Search chat room members by name."; +	} + +	rpc UpdateMessageReaction (.CChatRoom_UpdateMessageReaction_Request) returns (.CChatRoom_UpdateMessageReaction_Response) { +		option (method_description) = "Adds/removes a reaction to/from a chat room message"; +	} + +	rpc GetMessageReactionReactors (.CChatRoom_GetMessageReactionReactors_Request) returns (.CChatRoom_GetMessageReactionReactors_Response) { +		option (method_description) = "Fetches a list of reactors for a specified reaction"; +	} +} + +service ClanChatRooms { +	option (service_description) = "Methods for getting clan chat information"; + +	rpc GetClanChatRoomInfo (.CClanChatRooms_GetClanChatRoomInfo_Request) returns (.CClanChatRooms_GetClanChatRoomInfo_Response) { +		option (method_description) = "Get a list of chat rooms for a clan, optionally creating a new one"; +	} + +	rpc SetClanChatRoomPrivate (.CClanChatRooms_SetClanChatRoomPrivate_Request) returns (.CClanChatRooms_SetClanChatRoomPrivate_Response) { +		option (method_description) = "Set a clan chat room to be members only (or public)"; +	} +} + +service ChatRoomClient { +	option (service_description) = "Client notifications for chat events"; +	option (service_execution_site) = k_EProtoExecutionSiteSteamClient; + +	rpc NotifyIncomingChatMessage (.CChatRoom_IncomingChatMessage_Notification) returns (.NoResponse) { +		option (method_description) = "New chat message for a chat room"; +	} + +	rpc NotifyChatMessageModified (.CChatRoom_ChatMessageModified_Notification) returns (.NoResponse) { +		option (method_description) = "An existing chat message has been modified on the backend"; +	} + +	rpc NotifyMemberStateChange (.CChatRoom_MemberStateChange_Notification) returns (.NoResponse) { +		option (method_description) = "A chat room member's state has changed (join/part/permissions)"; +	} + +	rpc NotifyChatRoomHeaderStateChange (.CChatRoom_ChatRoomHeaderState_Notification) returns (.NoResponse) { +		option (method_description) = "Chat Room header / metadata has changed"; +	} + +	rpc NotifyChatRoomGroupRoomsChange (.CChatRoom_ChatRoomGroupRoomsChange_Notification) returns (.NoResponse) { +		option (method_description) = "Something about a chatroom group changed (created, deleted, etc.)"; +	} + +	rpc NotifyShouldRejoinChatRoomVoiceChat (.CChatRoom_NotifyShouldRejoinChatRoomVoiceChat_Notification) returns (.NoResponse) { +		option (method_description) = "Voice chat was recreated or dropped on the backend and client needs to rejoin to remain in chat."; +	} + +	rpc NotifyChatGroupUserStateChanged (.ChatRoomClient_NotifyChatGroupUserStateChanged_Notification) returns (.NoResponse) { +		option (method_description) = "User chat group state (preferences, ack state, etc) have changed."; +	} + +	rpc NotifyAckChatMessageEcho (.CChatRoom_AckChatMessage_Notification) returns (.NoResponse) { +		option (method_description) = "A session acked an unread message, echo to other sessions."; +	} + +	rpc NotifyChatRoomDisconnect (.ChatRoomClient_NotifyChatRoomDisconnect_Notification) returns (.NoResponse) { +		option (method_description) = "The ChatRoom server hosting the chat rooms has reconnected to the user's Chat server (may have restarted), client should refresh state."; +	} + +	rpc NotifyMemberListViewUpdated (.CChatRoomClient_MemberListViewUpdated_Notification) returns (.NoResponse) { +		option (method_description) = "The list of members for a chat room with virtualized member list has changed on the server (or client requested)"; +	} + +	rpc NotifyMessageReaction (.CChatRoom_MessageReaction_Notification) returns (.NoResponse) { +		option (method_description) = "New message reaction"; +	} +} + +service ChatUsability { +	option (service_description) = "Client notifications for chat events"; + +	rpc NotifyClientUsabilityMetrics (.CChatUsability_ClientUsabilityMetrics_Notification) returns (.NoResponse) { +		option (method_description) = "Incoming metrics from the client"; +	} +} + +service ChatUsabilityClient { +	option (service_description) = "Client notifications for chat usability"; +	option (service_execution_site) = k_EProtoExecutionSiteSteamClient; + +	rpc NotifyRequestClientUsabilityMetrics (.CChatUsability_RequestClientUsabilityMetrics_Notification) returns (.NoResponse) { +		option (method_description) = "Request client send usability metrics"; +	} +} diff --git a/protocols/Steam/src/protobuf-c/steammessages_clientserver_friends.proto b/protocols/Steam/src/protobuf-c/steammessages_clientserver_friends.proto new file mode 100644 index 0000000000..62c70e10c3 --- /dev/null +++ b/protocols/Steam/src/protobuf-c/steammessages_clientserver_friends.proto @@ -0,0 +1,260 @@ +import "steammessages_base.proto"; + +option optimize_for = SPEED; +option cc_generic_services = false; + +message CMsgClientFriendMsg { +	optional fixed64 steamid = 1; +	optional int32 chat_entry_type = 2; +	optional bytes message = 3; +	optional fixed32 rtime32_server_timestamp = 4; +	optional bool echo_to_sender = 5; +} + +message CMsgClientFriendMsgIncoming { +	optional fixed64 steamid_from = 1; +	optional int32 chat_entry_type = 2; +	optional bool from_limited_account = 3; +	optional bytes message = 4; +	optional fixed32 rtime32_server_timestamp = 5; +} + +message CMsgClientAddFriend { +	optional fixed64 steamid_to_add = 1; +	optional string accountname_or_email_to_add = 2; +} + +message CMsgClientAddFriendResponse { +	optional int32 eresult = 1 [default = 2]; +	optional fixed64 steam_id_added = 2; +	optional string persona_name_added = 3; +} + +message CMsgClientRemoveFriend { +	optional fixed64 friendid = 1; +} + +message CMsgClientHideFriend { +	optional fixed64 friendid = 1; +	optional bool hide = 2; +} + +message CMsgClientFriendsList { +	message Friend { +		optional fixed64 ulfriendid = 1; +		optional uint32 efriendrelationship = 2; +	} + +	optional bool bincremental = 1; +	repeated .CMsgClientFriendsList.Friend friends = 2; +	optional uint32 max_friend_count = 3; +	optional uint32 active_friend_count = 4; +	optional bool friends_limit_hit = 5; +} + +message CMsgClientFriendsGroupsList { +	message FriendGroup { +		optional int32 nGroupID = 1; +		optional string strGroupName = 2; +	} + +	message FriendGroupsMembership { +		optional fixed64 ulSteamID = 1; +		optional int32 nGroupID = 2; +	} + +	optional bool bremoval = 1; +	optional bool bincremental = 2; +	repeated .CMsgClientFriendsGroupsList.FriendGroup friendGroups = 3; +	repeated .CMsgClientFriendsGroupsList.FriendGroupsMembership memberships = 4; +} + +message CMsgClientPlayerNicknameList { +	message PlayerNickname { +		optional fixed64 steamid = 1; +		optional string nickname = 3; +	} + +	optional bool removal = 1; +	optional bool incremental = 2; +	repeated .CMsgClientPlayerNicknameList.PlayerNickname nicknames = 3; +} + +message CMsgClientSetPlayerNickname { +	optional fixed64 steamid = 1; +	optional string nickname = 2; +} + +message CMsgClientSetPlayerNicknameResponse { +	optional uint32 eresult = 1; +} + +message CMsgClientRequestFriendData { +	optional uint32 persona_state_requested = 1; +	repeated fixed64 friends = 2; +} + +message CMsgClientChangeStatus { +	optional uint32 persona_state = 1; +	optional string player_name = 2; +	optional bool is_auto_generated_name = 3; +	optional bool high_priority = 4; +	optional bool persona_set_by_user = 5; +	optional uint32 persona_state_flags = 6 [default = 0]; +	optional bool need_persona_response = 7; +	optional bool is_client_idle = 8; +} + +message CMsgPersonaChangeResponse { +	optional uint32 result = 1; +	optional string player_name = 2; +} + +message CMsgClientPersonaState { +	message Friend { +		message ClanData { +			optional uint32 ogg_app_id = 1; +			optional uint64 chat_group_id = 2; +		} + +		message KV { +			optional string key = 1; +			optional string value = 2; +		} + +		optional fixed64 friendid = 1; +		optional uint32 persona_state = 2; +		optional uint32 game_played_app_id = 3; +		optional uint32 game_server_ip = 4; +		optional uint32 game_server_port = 5; +		optional uint32 persona_state_flags = 6; +		optional uint32 online_session_instances = 7; +		optional bool persona_set_by_user = 10; +		optional string player_name = 15; +		optional uint32 query_port = 20; +		optional fixed64 steamid_source = 25; +		optional bytes avatar_hash = 31; +		optional uint32 last_logoff = 45; +		optional uint32 last_logon = 46; +		optional uint32 last_seen_online = 47; +		optional uint32 clan_rank = 50; +		optional string game_name = 55; +		optional fixed64 gameid = 56; +		optional bytes game_data_blob = 60; +		optional .CMsgClientPersonaState.Friend.ClanData clan_data = 64; +		optional string clan_tag = 65; +		repeated .CMsgClientPersonaState.Friend.KV rich_presence = 71; +		optional fixed64 broadcast_id = 72; +		optional fixed64 game_lobby_id = 73; +		optional uint32 watching_broadcast_accountid = 74; +		optional uint32 watching_broadcast_appid = 75; +		optional uint32 watching_broadcast_viewers = 76; +		optional string watching_broadcast_title = 77; +		optional bool is_community_banned = 78; +		optional bool player_name_pending_review = 79; +		optional bool avatar_pending_review = 80; +	} + +	optional uint32 status_flags = 1; +	repeated .CMsgClientPersonaState.Friend friends = 2; +} + +message CMsgClientFriendProfileInfo { +	optional fixed64 steamid_friend = 1; +} + +message CMsgClientFriendProfileInfoResponse { +	optional int32 eresult = 1 [default = 2]; +	optional fixed64 steamid_friend = 2; +	optional uint32 time_created = 3; +	optional string real_name = 4; +	optional string city_name = 5; +	optional string state_name = 6; +	optional string country_name = 7; +	optional string headline = 8; +	optional string summary = 9; +} + +message CMsgClientCreateFriendsGroup { +	optional fixed64 steamid = 1; +	optional string groupname = 2; +	repeated fixed64 steamid_friends = 3; +} + +message CMsgClientCreateFriendsGroupResponse { +	optional uint32 eresult = 1; +	optional int32 groupid = 2; +} + +message CMsgClientDeleteFriendsGroup { +	optional fixed64 steamid = 1; +	optional int32 groupid = 2; +} + +message CMsgClientDeleteFriendsGroupResponse { +	optional uint32 eresult = 1; +} + +message CMsgClientManageFriendsGroup { +	optional int32 groupid = 1; +	optional string groupname = 2; +	repeated fixed64 steamid_friends_added = 3; +	repeated fixed64 steamid_friends_removed = 4; +} + +message CMsgClientManageFriendsGroupResponse { +	optional uint32 eresult = 1; +} + +message CMsgClientAddFriendToGroup { +	optional int32 groupid = 1; +	optional fixed64 steamiduser = 2; +} + +message CMsgClientAddFriendToGroupResponse { +	optional uint32 eresult = 1; +} + +message CMsgClientRemoveFriendFromGroup { +	optional int32 groupid = 1; +	optional fixed64 steamiduser = 2; +} + +message CMsgClientRemoveFriendFromGroupResponse { +	optional uint32 eresult = 1; +} + +message CMsgClientGetEmoticonList { +} + +message CMsgClientEmoticonList { +	message Emoticon { +		optional string name = 1; +		optional int32 count = 2; +		optional uint32 time_last_used = 3; +		optional uint32 use_count = 4; +		optional uint32 time_received = 5; +		optional uint32 appid = 6; +	} + +	message Sticker { +		optional string name = 1; +		optional int32 count = 2; +		optional uint32 time_received = 3; +		optional uint32 appid = 4; +		optional uint32 time_last_used = 5; +		optional uint32 use_count = 6; +	} + +	message Effect { +		optional string name = 1; +		optional int32 count = 2; +		optional uint32 time_received = 3; +		optional bool infinite_use = 4; +		optional uint32 appid = 5; +	} + +	repeated .CMsgClientEmoticonList.Emoticon emoticons = 1; +	repeated .CMsgClientEmoticonList.Sticker stickers = 2; +	repeated .CMsgClientEmoticonList.Effect effects = 3; +} diff --git a/protocols/Steam/src/stdafx.h b/protocols/Steam/src/stdafx.h index c25e13d337..368e3e5bf6 100644 --- a/protocols/Steam/src/stdafx.h +++ b/protocols/Steam/src/stdafx.h @@ -67,7 +67,6 @@ extern HANDLE hExtraXStatus;  #define now() time(0)
  #include "steam_dialogs.h"
 -#include "http_request.h"
  #include "api/enums.h"
  #include "steam_proto.h"
 @@ -80,7 +79,6 @@ extern HANDLE hExtraXStatus;  #include "api/history.h"
  #include "api/message.h"
  #include "api/pending.h"
 -#include "api/rsa_key.h"
  #include "api/search.h"
  #include "api/session.h"
 diff --git a/protocols/Steam/src/steam_contacts.cpp b/protocols/Steam/src/steam_contacts.cpp index 8f0d7e3306..aee8c56574 100644 --- a/protocols/Steam/src/steam_contacts.cpp +++ b/protocols/Steam/src/steam_contacts.cpp @@ -207,10 +207,8 @@ void CSteamProto::UpdateContactDetails(MCONTACT hContact, const JSONNode &data)  		setString(hContact, "ServerID", serverID.c_str());  		CMStringW message(gameInfo); -		if (gameId && message.IsEmpty()) { -			ptrA token(getStringA("TokenSecret")); -			SendRequest(new GetAppInfoRequest(token, appId.c_str()), &CSteamProto::OnGotAppInfo, (void*)hContact); -		} +		if (gameId && message.IsEmpty()) +			SendRequest(new GetAppInfoRequest(m_szAccessToken, appId.c_str()), &CSteamProto::OnGotAppInfo, (void*)hContact);  		else {  			if (!gameId)  				message.Append(TranslateT(" (Non-Steam)")); @@ -294,7 +292,7 @@ void CSteamProto::ContactIsAskingAuth(MCONTACT hContact)  	// create auth request event  	ptrA steamId(getUStringA(hContact, DBKEY_STEAM_ID)); -	SendRequest(new GetUserSummariesRequest(this, steamId), &CSteamProto::OnGotUserSummaries); +	SendRequest(new GetUserSummariesRequest(m_szAccessToken, steamId), &CSteamProto::OnGotUserSummaries);  	ptrA nickName(getUStringA(hContact, "Nick"));  	if (nickName == nullptr) @@ -444,10 +442,10 @@ void CSteamProto::OnGotFriendList(const JSONNode &root, void *)  	friendsMap.clear();  	if (!steamIds.empty()) -		SendRequest(new GetUserSummariesRequest(this, steamIds.c_str()), &CSteamProto::OnGotUserSummaries); +		SendRequest(new GetUserSummariesRequest(m_szAccessToken, steamIds.c_str()), &CSteamProto::OnGotUserSummaries);  	// Load last conversations -	SendRequest(new GetConversationsRequest(this), &CSteamProto::OnGotConversations); +	SendRequest(new GetConversationsRequest(m_szAccessToken), &CSteamProto::OnGotConversations);  }  void CSteamProto::OnGotBlockList(const JSONNode &root, void *) @@ -476,13 +474,13 @@ void CSteamProto::OnGotUserSummaries(const JSONNode &root, void *)  	}  } -void CSteamProto::OnGotAvatar(const HttpResponse &response, void *arg) +void CSteamProto::OnGotAvatar(const MHttpResponse &response, void *arg)  {  	PROTO_AVATAR_INFORMATION ai = { 0 };  	ai.hContact = (UINT_PTR)arg;  	GetDbAvatarInfo(ai); -	if (!response.IsSuccess()) { +	if (response.resultCode != 200) {  		ptrA steamId(getStringA(ai.hContact, DBKEY_STEAM_ID));  		debugLogA(__FUNCTION__ ": failed to get avatar %s", steamId.get()); @@ -493,7 +491,7 @@ void CSteamProto::OnGotAvatar(const HttpResponse &response, void *arg)  	FILE *file = _wfopen(ai.filename, L"wb");  	if (file) { -		fwrite(response.data(), sizeof(char), response.length(), file); +		fwrite(response.body, sizeof(char), response.body.GetLength(), file);  		fclose(file);  		if (ai.hContact) @@ -503,12 +501,11 @@ void CSteamProto::OnGotAvatar(const HttpResponse &response, void *arg)  	}  } -void CSteamProto::OnFriendAdded(const HttpResponse &response, void *arg) +void CSteamProto::OnFriendAdded(const MHttpResponse &response, void *arg)  {  	SendAuthParam *param = (SendAuthParam *)arg; -	if (!response.IsSuccess() || mir_strcmp(response.data(), "true")) { - +	if (response.resultCode != 200 || mir_strcmp(response.body, "true")) {  		ptrW steamId(getWStringA(param->hContact, DBKEY_STEAM_ID));  		ptrW who(getWStringA(param->hContact, "Nick"));  		if (!who) @@ -517,7 +514,7 @@ void CSteamProto::OnFriendAdded(const HttpResponse &response, void *arg)  		wchar_t message[MAX_PATH];  		mir_snwprintf(message, L"Error adding friend %s", who.get()); -		JSONNode root = JSONNode::parse(response.data()); +		JSONNode root = JSONNode::parse(response.body);  		if (root) {  			int success = root["success"].as_int();  			if (success == 1) { @@ -566,11 +563,11 @@ void CSteamProto::OnFriendAdded(const HttpResponse &response, void *arg)  	ProtoBroadcastAck(param->hContact, ACKTYPE_AUTHREQ, ACKRESULT_SUCCESS, param->hAuth, 0);  } -void CSteamProto::OnFriendBlocked(const HttpResponse &response, void *arg) +void CSteamProto::OnFriendBlocked(const MHttpResponse &response, void *arg)  {  	ptrA steamId((char *)arg); -	if (!response.IsSuccess() || mir_strcmp(response.data(), "true")) { +	if (response.resultCode != 200 || mir_strcmp(response.body, "true")) {  		debugLogA(__FUNCTION__ ": failed to ignore friend %s", (char *)steamId);  		return;  	} @@ -580,11 +577,11 @@ void CSteamProto::OnFriendBlocked(const HttpResponse &response, void *arg)  		ContactIsBlocked(hContact);  } -void CSteamProto::OnFriendUnblocked(const HttpResponse &response, void *arg) +void CSteamProto::OnFriendUnblocked(const MHttpResponse &response, void *arg)  {  	ptrA steamId((char *)arg); -	if (!response.IsSuccess() || mir_strcmp(response.data(), "true")) { +	if (response.resultCode != 200 || mir_strcmp(response.body, "true")) {  		debugLogA(__FUNCTION__ ": failed to unignore friend %s", (char *)steamId);  		return;  	} @@ -594,11 +591,11 @@ void CSteamProto::OnFriendUnblocked(const HttpResponse &response, void *arg)  		ContactIsUnblocked(hContact);  } -void CSteamProto::OnFriendRemoved(const HttpResponse &response, void *arg) +void CSteamProto::OnFriendRemoved(const MHttpResponse &response, void *arg)  {  	ptrA steamId((char *)arg); -	if (!response.IsSuccess() || mir_strcmp(response.data(), "true")) { +	if (response.resultCode != 200 || mir_strcmp(response.body, "true")) {  		debugLogA(__FUNCTION__ ": failed to remove friend %s", (char *)steamId);  		return;  	} @@ -650,17 +647,17 @@ void CSteamProto::OnPendingIgnoreded(const JSONNode &root, void *arg)  	}  } -void CSteamProto::OnSearchResults(const HttpResponse &response, void *arg) +void CSteamProto::OnSearchResults(const MHttpResponse &response, void *arg)  {  	HANDLE searchType = (HANDLE)arg; -	if (!response.IsSuccess()) { +	if (response.resultCode != 200) {  		ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_FAILED, searchType, 0);  		debugLogA(__FUNCTION__ ": failed to get summaries");  		return;  	} -	JSONNode root = JSONNode::parse(response.data()); +	JSONNode root = JSONNode::parse(response.body);  	if (root.isnull()) {  		ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_FAILED, searchType, 0);  		debugLogA(__FUNCTION__ ": no data"); @@ -700,15 +697,15 @@ void CSteamProto::OnSearchResults(const HttpResponse &response, void *arg)  	ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, searchType, 0);  } -void CSteamProto::OnSearchByNameStarted(const HttpResponse &response, void *arg) +void CSteamProto::OnSearchByNameStarted(const MHttpResponse &response, void *arg)  { -	if (!response.IsSuccess()) { +	if (response.resultCode != 200) {  		ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_FAILED, (HANDLE)arg, 0);  		debugLogA(__FUNCTION__ ": failed to get results");  		return;  	} -	JSONNode root = JSONNode::parse(response.data()); +	JSONNode root = JSONNode::parse(response.body);  	if (root.isnull()) {  		ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_FAILED, (HANDLE)arg, 0);  		debugLogA(__FUNCTION__ ": no data"); @@ -734,5 +731,5 @@ void CSteamProto::OnSearchByNameStarted(const HttpResponse &response, void *arg)  	// remove trailing ","  	steamIds.pop_back(); -	SendRequest(new GetUserSummariesRequest(this, steamIds.c_str()), &CSteamProto::OnSearchResults, (HANDLE)arg); +	SendRequest(new GetUserSummariesRequest(m_szAccessToken, steamIds.c_str()), &CSteamProto::OnSearchResults, (HANDLE)arg);  } diff --git a/protocols/Steam/src/steam_history.cpp b/protocols/Steam/src/steam_history.cpp index a57f59a9e3..c56105988e 100644 --- a/protocols/Steam/src/steam_history.cpp +++ b/protocols/Steam/src/steam_history.cpp @@ -20,11 +20,8 @@ void CSteamProto::OnGotConversations(const JSONNode &root, void *)  			continue;  		time_t lastMessageTS = _wtoi64(session["last_message"].as_mstring()); -		if (lastMessageTS > storedMessageTS) { -			ptrA token(getStringA("TokenSecret")); -			ptrA steamId(getStringA(DBKEY_STEAM_ID)); -			SendRequest(new GetHistoryMessagesRequest(token, steamId, who, storedMessageTS), &CSteamProto::OnGotHistoryMessages, (void*)hContact); -		} +		if (lastMessageTS > storedMessageTS) +			SendRequest(new GetHistoryMessagesRequest(m_szAccessToken, m_iSteamId, who, storedMessageTS), &CSteamProto::OnGotHistoryMessages, (void*)hContact);  	}  } diff --git a/protocols/Steam/src/steam_login.cpp b/protocols/Steam/src/steam_login.cpp index 543831e894..c21d6d783c 100644 --- a/protocols/Steam/src/steam_login.cpp +++ b/protocols/Steam/src/steam_login.cpp @@ -67,8 +67,11 @@ void CSteamProto::Login()  	m_szAccessToken = getMStringA(DBKEY_ACCESS_TOKEN);  	m_szRefreshToken = getMStringA(DBKEY_REFRESH_TOKEN); -	if (!m_szAccessToken.IsEmpty() && !m_szRefreshToken.IsEmpty()) +	if (!m_szAccessToken.IsEmpty() && !m_szRefreshToken.IsEmpty()) { +		m_iSteamId = GetId(DBKEY_STEAM_ID); +		m_iClientId = GetId(DBKEY_CLIENT_ID);  		OnLoggedIn(); +	}  	else {  		CAuthenticationGetPasswordRSAPublicKeyRequest request;  		request.account_name = username.get(); diff --git a/protocols/Steam/src/steam_menus.cpp b/protocols/Steam/src/steam_menus.cpp index 6ed3f211fa..44862a52a8 100644 --- a/protocols/Steam/src/steam_menus.cpp +++ b/protocols/Steam/src/steam_menus.cpp @@ -18,31 +18,25 @@ INT_PTR CSteamProto::AuthRequestCommand(WPARAM hContact, LPARAM)  INT_PTR CSteamProto::AuthRevokeCommand(WPARAM hContact, LPARAM)
  {
 -	ptrA token(getStringA("TokenSecret"));
  	ptrA sessionId(getStringA("SessionID"));
 -	ptrA steamId(getStringA(DBKEY_STEAM_ID));
  	char *who = getStringA(hContact, DBKEY_STEAM_ID);
 -	SendRequest(new RemoveFriendRequest(token, sessionId, steamId, who), &CSteamProto::OnFriendRemoved, who);
 +	SendRequest(new RemoveFriendRequest(m_szAccessToken, sessionId, m_iSteamId, who), &CSteamProto::OnFriendRemoved, who);
  	return 0;
  }
  int CSteamProto::BlockCommand(WPARAM hContact, LPARAM)
  {
 -	ptrA token(getStringA("TokenSecret"));
  	ptrA sessionId(getStringA("SessionID"));
 -	ptrA steamId(getStringA(DBKEY_STEAM_ID));
  	char *who = getStringA(hContact, DBKEY_STEAM_ID);
 -	SendRequest(new BlockFriendRequest(token, sessionId, steamId, who), &CSteamProto::OnFriendBlocked, who);
 +	SendRequest(new BlockFriendRequest(m_szAccessToken, sessionId, m_iSteamId, who), &CSteamProto::OnFriendBlocked, who);
  	return 0;
  }
  int CSteamProto::UnblockCommand(WPARAM hContact, LPARAM)
  {
 -	ptrA token(getStringA("TokenSecret"));
  	ptrA sessionId(getStringA("SessionID"));
 -	ptrA steamId(getStringA(DBKEY_STEAM_ID));
  	char *who = getStringA(hContact, DBKEY_STEAM_ID);
 -	SendRequest(new UnblockFriendRequest(token, sessionId, steamId, who), &CSteamProto::OnFriendUnblocked, who);
 +	SendRequest(new UnblockFriendRequest(m_szAccessToken, sessionId, m_iSteamId, who), &CSteamProto::OnFriendUnblocked, who);
  	return 0;
  }
 @@ -57,9 +51,7 @@ int CSteamProto::JoinToGameCommand(WPARAM hContact, LPARAM)  INT_PTR CSteamProto::OpenBlockListCommand(WPARAM, LPARAM)
  {
 -	ptrA token(getStringA("TokenSecret"));
 -	ptrA steamId(getStringA(DBKEY_STEAM_ID));
 -	SendRequest(new GetFriendListRequest(token, steamId, "ignoredfriend"), &CSteamProto::OnGotBlockList);
 +	SendRequest(new GetFriendListRequest(m_szAccessToken, m_iSteamId, "ignoredfriend"), &CSteamProto::OnGotBlockList);
  	return 0;
  }
 diff --git a/protocols/Steam/src/steam_messages.cpp b/protocols/Steam/src/steam_messages.cpp index 42c70d6471..ba4f60271f 100644 --- a/protocols/Steam/src/steam_messages.cpp +++ b/protocols/Steam/src/steam_messages.cpp @@ -14,14 +14,12 @@ int CSteamProto::OnSendMessage(MCONTACT hContact, const char *message)  	param->hContact = hContact;
  	param->hMessage = (HANDLE)hMessage;
 -	ptrA token(getStringA("TokenSecret"));
 -	ptrA umqid(getStringA("UMQID"));
  	ptrA steamId(getStringA(hContact, DBKEY_STEAM_ID));
 -	SendRequest(new SendMessageRequest(token, umqid, steamId, message), &CSteamProto::OnMessageSent, param);
 +	SendRequest(new SendMessageRequest(m_szAccessToken, m_szUmqId, steamId, message), &CSteamProto::OnMessageSent, param);
  	return hMessage;
  }
 -void CSteamProto::OnMessageSent(const HttpResponse &response, void *arg)
 +void CSteamProto::OnMessageSent(const MHttpResponse &response, void *arg)
  {
  	SendMessageParam *param = (SendMessageParam *)arg;
 @@ -29,16 +27,14 @@ void CSteamProto::OnMessageSent(const HttpResponse &response, void *arg)  	ptrW steamId(getWStringA(param->hContact, DBKEY_STEAM_ID));
  	time_t timestamp = NULL;
 -	if (response) {
 -		JSONNode root = JSONNode::parse(response.data());
 -		const JSONNode &node = root["error"];
 -		if (node)
 -			error = node.as_string();
 +	JSONNode root = JSONNode::parse(response.body);
 +	const JSONNode &node = root["error"];
 +	if (node)
 +		error = node.as_string();
 -		timestamp = atol(root["utc_timestamp"].as_string().c_str());
 -		if (timestamp > getDword(param->hContact, DB_KEY_LASTMSGTS))
 -			setDword(param->hContact, DB_KEY_LASTMSGTS, timestamp);
 -	}
 +	timestamp = atol(root["utc_timestamp"].as_string().c_str());
 +	if (timestamp > getDword(param->hContact, DB_KEY_LASTMSGTS))
 +		setDword(param->hContact, DB_KEY_LASTMSGTS, timestamp);
  	if (mir_strcmpi(error.c_str(), "OK") != 0) {
  		debugLogA(__FUNCTION__ ": failed to send message for %s (%s)", steamId.get(), error.c_str());
 @@ -77,9 +73,7 @@ int CSteamProto::UserIsTyping(MCONTACT hContact, int type)  	if (type == PROTOTYPE_SELFTYPING_OFF)
  		return 0;
 -	ptrA token(getStringA("TokenSecret"));
 -	ptrA umqid(getStringA("UMQID"));
  	ptrA steamId(getStringA(hContact, DBKEY_STEAM_ID));
 -	SendRequest(new SendTypingRequest(token, umqid, steamId));
 +	SendRequest(new SendTypingRequest(m_szAccessToken, m_szUmqId, steamId));
  	return 0;
  }
 diff --git a/protocols/Steam/src/steam_proto.cpp b/protocols/Steam/src/steam_proto.cpp index c6c0e3ddf9..27c65aee33 100644 --- a/protocols/Steam/src/steam_proto.cpp +++ b/protocols/Steam/src/steam_proto.cpp @@ -124,16 +124,10 @@ int CSteamProto::Authorize(MEVENT hDbEvent)  		if (hContact == INVALID_CONTACT_ID)
  			return 1;
 -		ptrA token(getStringA("TokenSecret"));
  		ptrA sessionId(getStringA("SessionID"));
 -		ptrA steamId(getStringA(DBKEY_STEAM_ID));
  		char *who = getStringA(hContact, DBKEY_STEAM_ID);
 -		SendRequest(
 -			new ApprovePendingRequest(token, sessionId, steamId, who),
 -			&CSteamProto::OnPendingApproved,
 -			who);
 -
 +		SendRequest(new ApprovePendingRequest(m_szAccessToken, sessionId, m_iSteamId, who), &CSteamProto::OnPendingApproved, who);
  		return 0;
  	}
 @@ -154,16 +148,9 @@ int CSteamProto::AuthDeny(MEVENT hDbEvent, const wchar_t*)  		if (hContact == INVALID_CONTACT_ID)
  			return 1;
 -		ptrA token(getStringA("TokenSecret"));
  		ptrA sessionId(getStringA("SessionID"));
 -		ptrA steamId(getStringA(DBKEY_STEAM_ID));
  		char *who = getStringA(hContact, DBKEY_STEAM_ID);
 -
 -		SendRequest(
 -			new IgnorePendingRequest(token, sessionId, steamId, who),
 -			&CSteamProto::OnPendingIgnoreded,
 -			who);
 -
 +		SendRequest(new IgnorePendingRequest(m_szAccessToken, sessionId, m_iSteamId, who), &CSteamProto::OnPendingIgnoreded, who);
  		return 0;
  	}
 @@ -179,16 +166,9 @@ int CSteamProto::AuthRequest(MCONTACT hContact, const wchar_t*)  		param->hContact = hContact;
  		param->hAuth = (HANDLE)hAuth;
 -		ptrA token(getStringA("TokenSecret"));
  		ptrA sessionId(getStringA("SessionID"));
 -		ptrA steamId(getStringA(DBKEY_STEAM_ID));
  		ptrA who(getStringA(hContact, DBKEY_STEAM_ID));
 -
 -		SendRequest(
 -			new AddFriendRequest(token, sessionId, steamId, who),
 -			&CSteamProto::OnFriendAdded,
 -			param);
 -
 +		SendRequest(new AddFriendRequest(m_szAccessToken, sessionId, m_iSteamId, who), &CSteamProto::OnFriendAdded, param);
  		return hAuth;
  	}
 @@ -219,7 +199,7 @@ HANDLE CSteamProto::SearchBasic(const wchar_t* id)  		return nullptr;
  	ptrA steamId(mir_u2a(id));
 -	SendRequest(new GetUserSummariesRequest(this, steamId), &CSteamProto::OnSearchResults, (HANDLE)STEAM_SEARCH_BYID);
 +	SendRequest(new GetUserSummariesRequest(m_szAccessToken, steamId), &CSteamProto::OnSearchResults, (HANDLE)STEAM_SEARCH_BYID);
  	return (HANDLE)STEAM_SEARCH_BYID;
  }
 @@ -233,11 +213,10 @@ HANDLE CSteamProto::SearchByName(const wchar_t *nick, const wchar_t *firstName,  	wchar_t keywordsT[200];
  	mir_snwprintf(keywordsT, L"%s %s %s", nick, firstName, lastName);
 -	ptrA token(getStringA("TokenSecret"));
  	ptrA keywords(mir_utf8encodeW(rtrimw(keywordsT)));
  	SendRequest(
 -		new SearchRequest(token, keywords),
 +		new SearchRequest(m_szAccessToken, keywords),
  		&CSteamProto::OnSearchByNameStarted,
  		(HANDLE)STEAM_SEARCH_BYNAME);
 @@ -336,11 +315,9 @@ bool CSteamProto::OnContactDeleted(MCONTACT hContact, uint32_t)  {
  	// remove only authorized contacts
  	if (!getByte(hContact, "Auth", 0)) {
 -		ptrA token(getStringA("TokenSecret"));
  		ptrA sessionId(getStringA("SessionID"));
 -		ptrA steamId(getStringA(DBKEY_STEAM_ID));
  		char *who = getStringA(hContact, DBKEY_STEAM_ID);
 -		SendRequest(new RemoveFriendRequest(token, sessionId, steamId, who), &CSteamProto::OnFriendRemoved, (void*)who);
 +		SendRequest(new RemoveFriendRequest(m_szAccessToken, sessionId, m_iSteamId, who), &CSteamProto::OnFriendRemoved, (void*)who);
  	}
  	return true;
  }
 diff --git a/protocols/Steam/src/steam_proto.h b/protocols/Steam/src/steam_proto.h index e49361e92c..5185c86d9c 100644 --- a/protocols/Steam/src/steam_proto.h +++ b/protocols/Steam/src/steam_proto.h @@ -40,7 +40,7 @@ enum  };
  typedef void (CSteamProto::*MsgCallback)(const uint8_t *pBuf, size_t cbLen);
 -typedef void (CSteamProto::*HttpCallback)(const HttpResponse &, void *);
 +typedef void (CSteamProto::*HttpCallback)(const MHttpResponse &, void *);
  typedef void (CSteamProto::*JsonCallback)(const JSONNode &, void *);
  struct HttpRequest : public MTHttpRequest<CSteamProto>
 @@ -103,7 +103,7 @@ class CSteamProto : public PROTO<CSteamProto>     void     SetId(MCONTACT, const char *pszSetting, int64_t id);
  	// polling
 -	CMStringA m_szRefreshToken, m_szAccessToken;
 +	CMStringA m_szRefreshToken, m_szAccessToken, m_szUmqId, m_szChatToken;
  	ULONG hAuthProcess = 1;
  	ULONG hMessageProcess = 1;
  	int m_iPollingInterval;
 @@ -180,24 +180,24 @@ class CSteamProto : public PROTO<CSteamProto>  	void OnGotFriendList(const JSONNode &root, void *);
  	void OnGotBlockList(const JSONNode &root, void *);
  	void OnGotUserSummaries(const JSONNode &root, void *);
 -	void OnGotAvatar(const HttpResponse &response, void *arg);
 +	void OnGotAvatar(const MHttpResponse &response, void *arg);
 -	void OnFriendAdded(const HttpResponse &response, void *arg);
 -	void OnFriendBlocked(const HttpResponse &response, void *arg);
 -	void OnFriendUnblocked(const HttpResponse &response, void *arg);
 -	void OnFriendRemoved(const HttpResponse &response, void *arg);
 +	void OnFriendAdded(const MHttpResponse &response, void *arg);
 +	void OnFriendBlocked(const MHttpResponse &response, void *arg);
 +	void OnFriendUnblocked(const MHttpResponse &response, void *arg);
 +	void OnFriendRemoved(const MHttpResponse &response, void *arg);
  	void OnAuthRequested(const JSONNode &root, void *arg);
  	void OnPendingApproved(const JSONNode &root, void *arg);
  	void OnPendingIgnoreded(const JSONNode &root, void *arg);
 -	void OnSearchResults(const HttpResponse &response, void *arg);
 -	void OnSearchByNameStarted(const HttpResponse &response, void *arg);
 +	void OnSearchResults(const MHttpResponse &response, void *arg);
 +	void OnSearchByNameStarted(const MHttpResponse &response, void *arg);
  	// messages
 -	int OnSendMessage(MCONTACT hContact, const char *message);
 -	void OnMessageSent(const HttpResponse &response, void *arg);
 +	int  OnSendMessage(MCONTACT hContact, const char *message);
 +	void OnMessageSent(const MHttpResponse &response, void *arg);
  	int __cdecl OnPreCreateMessage(WPARAM, LPARAM lParam);
  	// history
 diff --git a/protocols/Steam/src/steam_request.cpp b/protocols/Steam/src/steam_request.cpp index 918e01ca16..47755ab548 100644 --- a/protocols/Steam/src/steam_request.cpp +++ b/protocols/Steam/src/steam_request.cpp @@ -2,37 +2,47 @@  bool CSteamProto::SendRequest(HttpRequest *request)
  {
 -	auto *pResp = Netlib_HttpTransaction(m_hNetlibUser, request->Get());
 -	HttpResponse response(pResp);
 -	delete request;
 -	return response.IsSuccess();
 +	if (auto *pResp = Netlib_HttpTransaction(m_hNetlibUser, request->Get())) {
 +		bool bSuccess = pResp->resultCode == 200;
 +		delete pResp;
 +		return bSuccess;
 +	}
 +	return false;
  }
  bool CSteamProto::SendRequest(HttpRequest *request, HttpCallback callback, void *param)
  {
 -	auto *pResp = Netlib_HttpTransaction(m_hNetlibUser, request->Get());
 -	HttpResponse response(pResp);
 -	if (callback)
 -		(this->*callback)(response, param);
 -	delete request;
 -	return response.IsSuccess();
 +	if (auto *pResp = Netlib_HttpTransaction(m_hNetlibUser, request->Get())) {
 +		bool bSuccess = pResp->resultCode == 200;
 +		if (callback)
 +			(this->*callback)(*pResp, param);
 +		delete request;
 +		delete pResp;
 +		return bSuccess;
 +	}
 +	return false;
  }
  bool CSteamProto::SendRequest(HttpRequest *request, JsonCallback callback, void *param)
  {
 -	auto *pResp = Netlib_HttpTransaction(m_hNetlibUser, request->Get());
 -	HttpResponse response(pResp);
 -	if (callback) {
 -		JSONNode root = JSONNode::parse(response.data());
 -		(this->*callback)(root, param);
 +	if (auto *pResp = Netlib_HttpTransaction(m_hNetlibUser, request->Get())) {
 +		bool bSuccess = pResp->resultCode == 200;
 +		if (callback) {
 +			JSONNode root = JSONNode::parse(pResp->body);
 +			(this->*callback)(root, param);
 +		}
 +		delete request;
 +		delete pResp;
 +		return bSuccess;
  	}
 -	delete request;
 -	return response.IsSuccess();
 +	return false;
  }
  /////////////////////////////////////////////////////////////////////////////////////////
  // HttpRequest
 +#define STEAM_USER_AGENT "Valve/Steam HTTP Client 1.0"
 +
  HttpRequest::HttpRequest(int iRequestType, const char *szUrl)
  {
  	flags = NLHRF_SSL | NLHRF_HTTP11 | NLHRF_REDIRECT | NLHRF_DUMPASTEXT;
  | 
