diff options
author | George Hazan <george.hazan@gmail.com> | 2025-01-05 22:34:04 +0300 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2025-01-05 22:34:04 +0300 |
commit | 521cc2d8e239cca75e7c565f574e4573cb109429 (patch) | |
tree | a89509b1cdccd6ce5bdbc411ed62949f0be59dc3 /protocols/Steam/src/steam_ws.cpp | |
parent | 3507f4a22af26c47c547012ba5189cee6c59d5fa (diff) |
Steam: basic group chat support
Diffstat (limited to 'protocols/Steam/src/steam_ws.cpp')
-rw-r--r-- | protocols/Steam/src/steam_ws.cpp | 41 |
1 files changed, 36 insertions, 5 deletions
diff --git a/protocols/Steam/src/steam_ws.cpp b/protocols/Steam/src/steam_ws.cpp index 27d244c45c..41acb5efbb 100644 --- a/protocols/Steam/src/steam_ws.cpp +++ b/protocols/Steam/src/steam_ws.cpp @@ -288,16 +288,47 @@ void CSteamProto::WSSendHeader(EMsg msgType, const CMsgProtoBufHeader &hdr, cons m_ws->sendBinary(hdrbuf.data(), hdrbuf.length()); } -int64_t CSteamProto::WSSendService(const char *pszServiceName, const ProtobufCppMessage &msg, bool bAnon) +void CSteamProto::WSSendAnon(const char *pszServiceName, const ProtobufCppMessage &msg) { CMsgProtoBufHeader hdr; hdr.has_client_sessionid = hdr.has_steamid = hdr.has_jobid_source = hdr.has_jobid_target = true; - if (!bAnon) - hdr.steamid = m_iSteamId, hdr.client_sessionid = m_iSessionId; hdr.jobid_source = getRandomInt(); hdr.jobid_target = -1; hdr.target_job_name = (char *)pszServiceName; - WSSendHeader(bAnon ? EMsg::ServiceMethodCallFromClientNonAuthed : EMsg::ServiceMethodCallFromClient, hdr, msg); + WSSendHeader(EMsg::ServiceMethodCallFromClientNonAuthed, hdr, msg); +} + +void CSteamProto::WSSendService(const char *pszServiceName, const ProtobufCppMessage &msg, void *pInfo) +{ + CMsgProtoBufHeader hdr; + hdr.has_client_sessionid = hdr.has_steamid = hdr.has_jobid_source = hdr.has_jobid_target = true; + hdr.steamid = m_iSteamId, hdr.client_sessionid = m_iSessionId; + hdr.jobid_source = getRandomInt(); + hdr.jobid_target = -1; + hdr.target_job_name = (char *)pszServiceName; + + if (pInfo) + SetRequestInfo(hdr.jobid_source, pInfo); - return hdr.jobid_source; + WSSendHeader(EMsg::ServiceMethodCallFromClient, hdr, msg); +} + +///////////////////////////////////////////////////////////////////////////////////////// + +void CSteamProto::SetRequestInfo(uint64_t requestId, void *pInfo) +{ + mir_cslock lck(m_csRequestLock); + m_requestInfo[requestId] = pInfo; +} + +void* CSteamProto::GetRequestInfo(uint64_t requestId) +{ + mir_cslock lck(m_csRequestLock); + auto it = m_requestInfo.find(requestId); + if (it == m_requestInfo.end()) + return nullptr; + + void *pRet = it->second; + m_requestInfo.erase(it); + return pRet; } |