mirror of
https://github.com/osukey/osukey.git
synced 2025-07-16 15:59:58 +09:00
Add constructor to create a PM channel from a User
This commit is contained in:
@ -88,6 +88,17 @@ namespace osu.Game.Online.Chat
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Create a private messaging channel with the specified user.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="user">The user to create the private conversation with.</param>
|
||||||
|
public Channel(User user)
|
||||||
|
{
|
||||||
|
Type = ChannelType.PM;
|
||||||
|
Users.Add(user);
|
||||||
|
Name = user.Username;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Adds the argument message as a local echo. When this local echo is resolved <see cref="PendingMessageResolved"/> will get called.
|
/// Adds the argument message as a local echo. When this local echo is resolved <see cref="PendingMessageResolved"/> will get called.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -79,7 +79,7 @@ namespace osu.Game.Online.Chat
|
|||||||
throw new ArgumentNullException(nameof(user));
|
throw new ArgumentNullException(nameof(user));
|
||||||
|
|
||||||
CurrentChannel.Value = JoinedChannels.FirstOrDefault(c => c.Type == ChannelType.PM && c.Users.Count == 1 && c.Users.Any(u => u.Id == user.Id))
|
CurrentChannel.Value = JoinedChannels.FirstOrDefault(c => c.Type == ChannelType.PM && c.Users.Count == 1 && c.Users.Any(u => u.Id == user.Id))
|
||||||
?? new Channel { Name = user.Username, Users = { user }, Type = ChannelType.PM };
|
?? new Channel(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void currentChannelChanged(Channel channel) => JoinChannel(channel);
|
private void currentChannelChanged(Channel channel) => JoinChannel(channel);
|
||||||
|
Reference in New Issue
Block a user