diff --git a/MumbleSharp/Model/User.cs b/MumbleSharp/Model/User.cs index ac41b0f..12ab188 100644 --- a/MumbleSharp/Model/User.cs +++ b/MumbleSharp/Model/User.cs @@ -13,6 +13,9 @@ public class User private readonly IMumbleProtocol _owner; public UInt32 Id { get; private set; } + public UInt32 ChannelId { get; set; } + public string Name { get; set; } + public string Comment { get; set; } public bool Deaf { get; set; } public bool Muted { get; set; } public bool SelfDeaf { get; set; } @@ -35,9 +38,6 @@ public Channel Channel } } - public string Name { get; set; } - public string Comment { get; set; } - private readonly CodecSet _codecs = new CodecSet(); public User(IMumbleProtocol owner, uint id) @@ -80,26 +80,24 @@ public void Move(Channel channel) if (_channel == channel) return; - UserState userstate = new UserState(); - userstate.Actor = Id; - userstate.ChannelId = channel.Id; + this.ChannelId = channel.Id; - _owner.Connection.SendControl(PacketType.UserState, userstate); + SendUserState(); } /// - /// Send the user state (including channel, selfmute, selfdeaf) + /// Send user state (including channel, selfmute, selfdeaf) /// public void SendUserState() { - UserState userstate = new UserState(); - userstate.Actor = this.Id; - userstate.Session = _owner.LocalUser.Id; - userstate.ChannelId = this.Channel.Id; - userstate.SelfMute = this.SelfMuted; - userstate.SelfDeaf = this.SelfDeaf; - - _owner.Connection.SendControl(PacketType.UserState, userstate); + _owner.Connection.SendControl(PacketType.UserState, new UserState() + { + Actor = this.Id, + Session = _owner.LocalUser.Id, + ChannelId = this.ChannelId, + SelfMute = this.SelfMuted, + SelfDeaf = this.SelfDeaf, + }); } protected internal IVoiceCodec GetCodec(SpeechCodecs codec)