mirror of
https://github.com/osukey/osukey.git
synced 2025-05-15 02:27:33 +09:00
Refactors
This commit is contained in:
parent
396a5b3cd0
commit
c4769f6802
@ -1,17 +0,0 @@
|
|||||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
||||||
|
|
||||||
namespace osu.Game.Online.API.Requests
|
|
||||||
{
|
|
||||||
public class GetPrivateMessagesRequest : APIMessagesRequest
|
|
||||||
{
|
|
||||||
private long? since;
|
|
||||||
|
|
||||||
public GetPrivateMessagesRequest(long? sinceId = null)
|
|
||||||
: base(sinceId)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override string Target => @"chat/messages/private";
|
|
||||||
}
|
|
||||||
}
|
|
@ -66,8 +66,7 @@ namespace osu.Game.Online.Chat
|
|||||||
if (name == null)
|
if (name == null)
|
||||||
throw new ArgumentNullException(nameof(name));
|
throw new ArgumentNullException(nameof(name));
|
||||||
|
|
||||||
CurrentChannel.Value = AvailableChannels.FirstOrDefault(c => c.Name == name)
|
CurrentChannel.Value = AvailableChannels.FirstOrDefault(c => c.Name == name) ?? throw new ChannelNotFoundException(name);
|
||||||
?? throw new ChannelNotFoundException(name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -83,11 +82,7 @@ namespace osu.Game.Online.Chat
|
|||||||
?? new Channel { Name = user.Username, Users = { user } };
|
?? new Channel { Name = user.Username, Users = { user } };
|
||||||
}
|
}
|
||||||
|
|
||||||
private void currentChannelChanged(Channel channel)
|
private void currentChannelChanged(Channel channel) => JoinChannel(channel);
|
||||||
{
|
|
||||||
JoinChannel(channel);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Ensure we run post actions in sequence, once at a time.
|
/// Ensure we run post actions in sequence, once at a time.
|
||||||
@ -258,7 +253,7 @@ namespace osu.Game.Online.Chat
|
|||||||
fetchInitialMsgReq.Success += messages =>
|
fetchInitialMsgReq.Success += messages =>
|
||||||
{
|
{
|
||||||
handleChannelMessages(messages);
|
handleChannelMessages(messages);
|
||||||
channel.MessagesLoaded = true; // this will mark the channel as having received messages even if tehre were none.
|
channel.MessagesLoaded = true; // this will mark the channel as having received messages even if there were none.
|
||||||
};
|
};
|
||||||
|
|
||||||
api.Queue(fetchInitialMsgReq);
|
api.Queue(fetchInitialMsgReq);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user