aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJP Dillingham <jp@dillingham.me>2022-12-26 16:19:42 -0600
committerJP Dillingham <jp@dillingham.me>2022-12-26 16:19:42 -0600
commitdfe7b03fcc10bfacd7527af83b6d2891329be18a (patch)
treeda540a94c4ee4c9aa8340e23fea9f015763ebee6
parent852fd1322bf5910e1e81a576b91b299415e06f06 (diff)
downloadslskd-dfe7b03fcc10bfacd7527af83b6d2891329be18a.tar.gz
add MessageDirection
-rw-r--r--src/slskd/Messaging/Types/MessageDirection.cs25
-rw-r--r--src/slskd/Messaging/Types/PrivateMessage.cs10
2 files changed, 33 insertions, 2 deletions
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 file="MessageDirection.cs" company="slskd Team">
+// 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/.
+// </copyright>
+
+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
@@ -31,6 +31,11 @@ namespace slskd.Messaging
public bool Acknowledged { get; set; } = false;
/// <summary>
+ /// Gets or sets the message direction.
+ /// </summary>
+ public MessageDirection Direction { get; set; }
+
+ /// <summary>
/// The unique message id, used to acknowledge receipt.
/// </summary>
public int Id { get; set; }
@@ -43,7 +48,7 @@ namespace slskd.Messaging
/// <summary>
/// A value indicating whether the message was replayed.
/// </summary>
- public bool Replayed { get; set; }
+ public bool Replayed { get; set; } = false;
/// <summary>
/// The UTC timestamp of the message.
@@ -51,7 +56,7 @@ namespace slskd.Messaging
public DateTime Timestamp { get; set; } = DateTime.UtcNow;
/// <summary>
- /// The username of the user who sent the message.
+ /// The username of the remote user.
/// </summary>
public string Username { get; set; }
@@ -65,6 +70,7 @@ namespace slskd.Messaging
Message = eventArgs.Message,
Acknowledged = false,
Replayed = eventArgs.Replayed,
+ Direction = MessageDirection.In,
};
}
}