Skip to content

Commit

Permalink
(fix) Channels and Users didn't have all their info upon creation and…
Browse files Browse the repository at this point in the history
… needed an update.
  • Loading branch information
Meetsch committed Feb 25, 2020
1 parent 99fae54 commit e7a2c7c
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 45 deletions.
77 changes: 35 additions & 42 deletions MumbleSharp/BasicMumbleProtocol.cs
Original file line number Diff line number Diff line change
Expand Up @@ -195,23 +195,19 @@ public virtual void ChannelState(ChannelState channelState)
Position = channelState.Position
};
},
(i, c) =>
{
//Update existing channel in the dictionary
if (channelState.ShouldSerializeName())
c.Name = channelState.Name;
if (channelState.ShouldSerializeParent())
c.Parent = channelState.Parent;
if (channelState.ShouldSerializeTemporary())
c.Temporary = channelState.Temporary;
if (channelState.ShouldSerializeDescription())
c.Description = channelState.Description;
if (channelState.ShouldSerializePosition())
c.Position = channelState.Position;

return c;
}
);
(i, c) => c);

//Update channel in the dictionary
if (channelState.ShouldSerializeName())
channel.Name = channelState.Name;
if (channelState.ShouldSerializeParent())
channel.Parent = channelState.Parent;
if (channelState.ShouldSerializeTemporary())
channel.Temporary = channelState.Temporary;
if (channelState.ShouldSerializeDescription())
channel.Description = channelState.Description;
if (channelState.ShouldSerializePosition())
channel.Position = channelState.Position;

if (channel.Id == 0)
RootChannel = channel;
Expand Down Expand Up @@ -280,31 +276,28 @@ public virtual void UserState(UserState userState)
//Add new user to the dictionary
added = true;
return new User(this, userState.Session, _audioSampleRate, _audioSampleBits, _audioSampleChannels);
}, (i, u) =>
{
//Update existing user in the dictionary
if (userState.ShouldSerializeSelfDeaf())
u.SelfDeaf = userState.SelfDeaf;
if (userState.ShouldSerializeSelfMute())
u.SelfMuted = userState.SelfMute;
if (userState.ShouldSerializeMute())
u.Muted = userState.Mute;
if (userState.ShouldSerializeDeaf())
u.Deaf = userState.Deaf;
if (userState.ShouldSerializeSuppress())
u.Suppress = userState.Suppress;
if (userState.ShouldSerializeName())
u.Name = userState.Name;
if (userState.ShouldSerializeComment())
u.Comment = userState.Comment;

if (userState.ShouldSerializeChannelId())
u.Channel = ChannelDictionary[userState.ChannelId];
else if (u.Channel == null)
u.Channel = RootChannel;

return u;
});
}, (i, u) => u);

//Update user in the dictionary
if (userState.ShouldSerializeSelfDeaf())
user.SelfDeaf = userState.SelfDeaf;
if (userState.ShouldSerializeSelfMute())
user.SelfMuted = userState.SelfMute;
if (userState.ShouldSerializeMute())
user.Muted = userState.Mute;
if (userState.ShouldSerializeDeaf())
user.Deaf = userState.Deaf;
if (userState.ShouldSerializeSuppress())
user.Suppress = userState.Suppress;
if (userState.ShouldSerializeName())
user.Name = userState.Name;
if (userState.ShouldSerializeComment())
user.Comment = userState.Comment;

if (userState.ShouldSerializeChannelId())
user.Channel = ChannelDictionary[userState.ChannelId];
else if (user.Channel == null)
user.Channel = RootChannel;

//if (added)
UserJoined(user);
Expand Down
4 changes: 2 additions & 2 deletions MumbleSharp/MumbleSharp.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
<version>$version$</version>
<title>$title$</title>
<!-- Authors contain text that appears directly on the gallery -->
<authors>martindevans, Meetsch, SteelPhase, GeorchW, zackclearlaunch, IGamemaker, kluchrj, aloisdg</authors>
<authors>martindevans, Meetsch, and Contributors</authors>
<!--
Owners are typically nuget.org identities that allow gallery
users to easily find other packages by the same owners.
-->
<owners>martindevans, Meetsch, aloisdg</owners>
<owners>martindevans, Meetsch</owners>
<!-- License and project URLs provide links for the gallery -->
<licenseUrl>https://raw.githubusercontent.com/martindevans/MumbleSharp/master/LICENSE</licenseUrl>
<projectUrl>https://github.com/martindevans/MumbleSharp</projectUrl>
Expand Down
2 changes: 1 addition & 1 deletion MumbleSharp/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.1.0.0")]
[assembly: AssemblyVersion("1.1.1.0")]

[assembly: InternalsVisibleTo("MumbleSharpTest")]

0 comments on commit e7a2c7c

Please sign in to comment.