summaryrefslogtreecommitdiff
path: root/protocols/Steam/src
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/Steam/src')
-rw-r--r--protocols/Steam/src/main.cpp5
-rw-r--r--protocols/Steam/src/protobuf-c/steammessages_notifications.steamclient.pb-c.h8
-rw-r--r--protocols/Steam/src/stdafx.h1
-rw-r--r--protocols/Steam/src/steam_proto.h39
-rw-r--r--protocols/Steam/src/steam_server.cpp15
5 files changed, 43 insertions, 25 deletions
diff --git a/protocols/Steam/src/main.cpp b/protocols/Steam/src/main.cpp
index 9181cc600d..9724c602be 100644
--- a/protocols/Steam/src/main.cpp
+++ b/protocols/Steam/src/main.cpp
@@ -152,6 +152,9 @@ void CMPlugin::InitSteamServices()
services["FriendMessages"] = &friend_messages__descriptor;
services["FriendMessagesClient"] = &friend_messages_client__descriptor;
+ // services from steammessages_notifications.steamclient.proto
+ services["SteamNotificationClient"] = &steam_notification_client__descriptor;
+
// static service handlers
serviceHandlers[PollAuthSessionStatus] = ServiceResponseHandler(&CSteamProto::OnPollSession);
serviceHandlers[GetPasswordRSAPublicKey] = ServiceResponseHandler(&CSteamProto::OnGotRsaKey);
@@ -160,6 +163,8 @@ void CMPlugin::InitSteamServices()
serviceHandlers[FriendSendMessage] = ServiceResponseHandler(&CSteamProto::OnMessageSent);
serviceHandlers[FriendGetActiveSessions] = ServiceResponseHandler(&CSteamProto::OnGotConversations);
+
+ serviceHandlers[NotificationReceived] = ServiceResponseHandler(&CSteamProto::OnGotNotification);
}
int CMPlugin::Load()
diff --git a/protocols/Steam/src/protobuf-c/steammessages_notifications.steamclient.pb-c.h b/protocols/Steam/src/protobuf-c/steammessages_notifications.steamclient.pb-c.h
index e6838858ec..583e617686 100644
--- a/protocols/Steam/src/protobuf-c/steammessages_notifications.steamclient.pb-c.h
+++ b/protocols/Steam/src/protobuf-c/steammessages_notifications.steamclient.pb-c.h
@@ -70,14 +70,6 @@ extern const ProtobufCServiceDescriptor steam_notification_client__descriptor;
extern "C" void message_init_generic(const ProtobufCMessageDescriptor * desc, ProtobufCMessage * message);
-struct ProtobufCppMessage : public ProtobufCMessage
-{
- ProtobufCppMessage(const ProtobufCMessageDescriptor &descr)
- {
- message_init_generic(&descr, this);
- }
-};
-
struct SteamNotificationData : public ProtobufCppMessage
{
SteamNotificationData() :
diff --git a/protocols/Steam/src/stdafx.h b/protocols/Steam/src/stdafx.h
index 5cd6bd1fcf..87d0bbeace 100644
--- a/protocols/Steam/src/stdafx.h
+++ b/protocols/Steam/src/stdafx.h
@@ -44,6 +44,7 @@
#include "protobuf-c/steammessages_clientserver.pb-c.h"
#include "protobuf-c/steammessages_clientserver_login.pb-c.h"
#include "protobuf-c/steammessages_friendmessages.steamclient.pb-c.h"
+#include "protobuf-c/steammessages_notifications.steamclient.pb-c.h"
#include "proto.h"
#define MODULE "Steam"
diff --git a/protocols/Steam/src/steam_proto.h b/protocols/Steam/src/steam_proto.h
index 9bf4a573b8..2d7f1c4b5b 100644
--- a/protocols/Steam/src/steam_proto.h
+++ b/protocols/Steam/src/steam_proto.h
@@ -25,6 +25,8 @@
#define FriendSendMessage "FriendMessages.SendMessage#1"
#define FriendGetActiveSessions "FriendMessages.GetActiveMessageSessions#1"
+#define NotificationReceived "SteamNotificationClient.NotificationsReceived#1"
+
struct SendAuthParam
{
MCONTACT hContact;
@@ -175,6 +177,15 @@ class CSteamProto : public PROTO<CSteamProto>
void DeleteAuthSettings();
void SendConfirmationCode(bool, const char *pszCode);
+ // avatars
+ wchar_t *GetAvatarFilePath(MCONTACT hContact);
+ bool GetDbAvatarInfo(PROTO_AVATAR_INFORMATION &pai);
+ void CheckAvatarChange(MCONTACT hContact, std::string avatarUrl);
+
+ INT_PTR __cdecl GetAvatarInfo(WPARAM, LPARAM);
+ INT_PTR __cdecl GetAvatarCaps(WPARAM, LPARAM);
+ INT_PTR __cdecl GetMyAvatar(WPARAM, LPARAM);
+
// contacts
void SetAllContactStatuses(int status);
void SetContactStatus(MCONTACT hContact, uint16_t status);
@@ -216,16 +227,6 @@ class CSteamProto : public PROTO<CSteamProto>
void OnSearchResults(const MHttpResponse &response, void *arg);
void OnSearchByNameStarted(const MHttpResponse &response, void *arg);
- // messages
- mir_cs m_csOwnMessages;
- OBJLIST<COwnMessage> m_arOwnMessages;
-
- void SendFriendMessage(uint32_t msgId, int64_t steamId, const char *pszMessage);
- void OnMessageSent(const CFriendMessagesSendMessageResponse &reply, const CMsgProtoBufHeader &hdr);
- int __cdecl OnPreCreateMessage(WPARAM, LPARAM lParam);
-
- void SendFriendActiveSessions();
-
// history
void OnGotConversations(const CFriendsMessagesGetActiveMessageSessionsResponse &reply, const CMsgProtoBufHeader &hdr);
void OnGotHistoryMessages(const JSONNode &root, void *);
@@ -248,14 +249,18 @@ class CSteamProto : public PROTO<CSteamProto>
void OnInitStatusMenu();
- // avatars
- wchar_t *GetAvatarFilePath(MCONTACT hContact);
- bool GetDbAvatarInfo(PROTO_AVATAR_INFORMATION &pai);
- void CheckAvatarChange(MCONTACT hContact, std::string avatarUrl);
+ // notifications
+ void OnGotNotification(const CSteamNotificationNotificationsReceivedNotification &reply, const CMsgProtoBufHeader &hdr);
- INT_PTR __cdecl GetAvatarInfo(WPARAM, LPARAM);
- INT_PTR __cdecl GetAvatarCaps(WPARAM, LPARAM);
- INT_PTR __cdecl GetMyAvatar(WPARAM, LPARAM);
+ // messages
+ mir_cs m_csOwnMessages;
+ OBJLIST<COwnMessage> m_arOwnMessages;
+
+ void SendFriendMessage(uint32_t msgId, int64_t steamId, const char *pszMessage);
+ void OnMessageSent(const CFriendMessagesSendMessageResponse &reply, const CMsgProtoBufHeader &hdr);
+ int __cdecl OnPreCreateMessage(WPARAM, LPARAM lParam);
+
+ void SendFriendActiveSessions();
// xstatuses
INT_PTR __cdecl OnGetXStatusEx(WPARAM wParam, LPARAM lParam);
diff --git a/protocols/Steam/src/steam_server.cpp b/protocols/Steam/src/steam_server.cpp
index 4528ccecfe..f7330dbc49 100644
--- a/protocols/Steam/src/steam_server.cpp
+++ b/protocols/Steam/src/steam_server.cpp
@@ -66,6 +66,21 @@ void CSteamProto::OnMessageSent(const CFriendMessagesSendMessageResponse &reply,
/////////////////////////////////////////////////////////////////////////////////////////
+void CSteamProto::OnGotNotification(const CSteamNotificationNotificationsReceivedNotification &reply, const CMsgProtoBufHeader &hdr)
+{
+ if (hdr.eresult != 1)
+ return;
+
+ debugLogA("got %d notifications", reply.n_notifications);
+
+ for (int i = 0; i < reply.n_notifications; i++) {
+ auto *N = reply.notifications[i];
+ debugLogA("notification type %d: %s", N->notification_type, N->body_data);
+ }
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
void CSteamProto::SendFriendActiveSessions()
{
CFriendsMessagesGetActiveMessageSessionsRequest request;