From dfe7b03fcc10bfacd7527af83b6d2891329be18a Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Mon, 26 Dec 2022 16:19:42 -0600 Subject: add MessageDirection --- src/slskd/Messaging/Types/MessageDirection.cs | 25 +++++++++++++++++++++++++ src/slskd/Messaging/Types/PrivateMessage.cs | 10 ++++++++-- 2 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 src/slskd/Messaging/Types/MessageDirection.cs (limited to 'src') diff --git a/src/slskd/Messaging/Types/MessageDirection.cs b/src/slskd/Messaging/Types/MessageDirection.cs new file mode 100644 index 00000000..18fedf5d --- /dev/null +++ b/src/slskd/Messaging/Types/MessageDirection.cs @@ -0,0 +1,25 @@ +// +// Copyright (c) slskd Team. All rights reserved. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published +// by the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see https://www.gnu.org/licenses/. +// + +namespace slskd.Messaging +{ + public enum MessageDirection + { + In = 0, + Out = 1, + } +} diff --git a/src/slskd/Messaging/Types/PrivateMessage.cs b/src/slskd/Messaging/Types/PrivateMessage.cs index 236632aa..fbaa43a0 100644 --- a/src/slskd/Messaging/Types/PrivateMessage.cs +++ b/src/slskd/Messaging/Types/PrivateMessage.cs @@ -30,6 +30,11 @@ namespace slskd.Messaging /// public bool Acknowledged { get; set; } = false; + /// + /// Gets or sets the message direction. + /// + public MessageDirection Direction { get; set; } + /// /// The unique message id, used to acknowledge receipt. /// @@ -43,7 +48,7 @@ namespace slskd.Messaging /// /// A value indicating whether the message was replayed. /// - public bool Replayed { get; set; } + public bool Replayed { get; set; } = false; /// /// The UTC timestamp of the message. @@ -51,7 +56,7 @@ namespace slskd.Messaging public DateTime Timestamp { get; set; } = DateTime.UtcNow; /// - /// The username of the user who sent the message. + /// The username of the remote user. /// public string Username { get; set; } @@ -65,6 +70,7 @@ namespace slskd.Messaging Message = eventArgs.Message, Acknowledged = false, Replayed = eventArgs.Replayed, + Direction = MessageDirection.In, }; } } -- cgit v1.2.3