mirror of
https://github.com/osukey/osukey.git
synced 2025-08-05 23:53:51 +09:00
Initial commit
This commit is contained in:
@ -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>
|
||||
|
@ -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)
|
||||
{
|
||||
|
Reference in New Issue
Block a user