Initial commit

This commit is contained in:
Craftplacer
2020-01-02 17:07:28 +01:00
parent 9f5f78e443
commit 7b71e56817
3 changed files with 37 additions and 0 deletions

View File

@ -36,6 +36,11 @@ namespace osu.Game.Online.Chat
/// </summary>
public readonly SortedList<Message> Messages = new SortedList<Message>(Comparer<Message>.Default);
/// <summary>
/// Contains all the messages that weren't read by the user.
/// </summary>
public IEnumerable<Message> UnreadMessages => Messages.Where(m => LastReadId < m.Id);
/// <summary>
/// Contains all the messages that are still pending for submission to the server.
/// </summary>
@ -75,6 +80,9 @@ namespace osu.Game.Online.Chat
[JsonProperty(@"last_message_id")]
public long? LastMessageId;
[JsonProperty(@"last_read_id")]
public long? LastReadId;
/// <summary>
/// Signalles if the current user joined this channel or not. Defaults to false.
/// </summary>

View File

@ -445,6 +445,14 @@ namespace osu.Game.Online.Chat
return tcs.Task;
}
public void MarkChannelAsRead(Message message)
{
var channel = JoinedChannels.First(c => c.Id == message.ChannelId);
var req = new MarkChannelAsReadRequest(channel, message);
req.Success += () => channel.LastReadId = message.Id;
api.Queue(req);
}
[BackgroundDependencyLoader]
private void load(IAPIProvider api)
{