mirror of
https://github.com/JustArchiNET/ArchiSteamFarm.git
synced 2025-12-22 09:18:37 +00:00
Handle new notifications for comments
This commit is contained in:
@@ -70,6 +70,10 @@ namespace ArchiSteamFarm {
|
|||||||
LastPacketReceived = DateTime.UtcNow;
|
LastPacketReceived = DateTime.UtcNow;
|
||||||
|
|
||||||
switch (packetMsg.MsgType) {
|
switch (packetMsg.MsgType) {
|
||||||
|
case EMsg.ClientCommentNotifications:
|
||||||
|
HandleCommentNotifications(packetMsg);
|
||||||
|
|
||||||
|
break;
|
||||||
case EMsg.ClientItemAnnouncements:
|
case EMsg.ClientItemAnnouncements:
|
||||||
HandleItemAnnouncements(packetMsg);
|
HandleItemAnnouncements(packetMsg);
|
||||||
|
|
||||||
@@ -629,6 +633,17 @@ namespace ArchiSteamFarm {
|
|||||||
Client.Send(request);
|
Client.Send(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void HandleCommentNotifications(IPacketMsg packetMsg) {
|
||||||
|
if (packetMsg == null) {
|
||||||
|
ArchiLogger.LogNullError(nameof(packetMsg));
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ClientMsgProtobuf<CMsgClientCommentNotifications> response = new ClientMsgProtobuf<CMsgClientCommentNotifications>(packetMsg);
|
||||||
|
Client.PostCallback(new UserNotificationsCallback(packetMsg.TargetJobID, response.Body));
|
||||||
|
}
|
||||||
|
|
||||||
private void HandleItemAnnouncements(IPacketMsg packetMsg) {
|
private void HandleItemAnnouncements(IPacketMsg packetMsg) {
|
||||||
if (packetMsg == null) {
|
if (packetMsg == null) {
|
||||||
ArchiLogger.LogNullError(nameof(packetMsg));
|
ArchiLogger.LogNullError(nameof(packetMsg));
|
||||||
@@ -837,6 +852,15 @@ namespace ArchiSteamFarm {
|
|||||||
Notifications = new Dictionary<EUserNotification, uint>(1) { { EUserNotification.Items, msg.count_new_items } };
|
Notifications = new Dictionary<EUserNotification, uint>(1) { { EUserNotification.Items, msg.count_new_items } };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal UserNotificationsCallback([JetBrains.Annotations.NotNull] JobID jobID, [JetBrains.Annotations.NotNull] CMsgClientCommentNotifications msg) {
|
||||||
|
if ((jobID == null) || (msg == null)) {
|
||||||
|
throw new ArgumentNullException(nameof(jobID) + " || " + nameof(msg));
|
||||||
|
}
|
||||||
|
|
||||||
|
JobID = jobID;
|
||||||
|
Notifications = new Dictionary<EUserNotification, uint>(1) { { EUserNotification.Comments, msg.count_new_comments + msg.count_new_comments_owner + msg.count_new_comments_subscriptions } };
|
||||||
|
}
|
||||||
|
|
||||||
[PublicAPI]
|
[PublicAPI]
|
||||||
public enum EUserNotification : byte {
|
public enum EUserNotification : byte {
|
||||||
Unknown,
|
Unknown,
|
||||||
|
|||||||
Reference in New Issue
Block a user