Skip to content

Commit ea0e587

Browse files
committed
Added 3 new notifications: notifychannelpasswordchanged, notifychannelcreated and notifychanneldeleted
1 parent 09f875d commit ea0e587

7 files changed

Lines changed: 190 additions & 1 deletion

File tree

TS3QueryLib.Core.Framework/TS3QueryLib.Core.Framework.csproj

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,12 @@
323323
<Compile Include="..\TS3QueryLib.Core.Silverlight\Server\Entities\VirtualServerModification.cs">
324324
<Link>Server\Entities\VirtualServerModification.cs</Link>
325325
</Compile>
326+
<Compile Include="..\TS3QueryLib.Core.Silverlight\Server\Notification\EventArgs\ChannelCreatedEventArgs.cs">
327+
<Link>Server\Notification\EventArgs\ChannelCreatedEventArgs.cs</Link>
328+
</Compile>
329+
<Compile Include="..\TS3QueryLib.Core.Silverlight\Server\Notification\EventArgs\ChannelDeletedEventArgs.cs">
330+
<Link>Server\Notification\EventArgs\ChannelDeletedEventArgs.cs</Link>
331+
</Compile>
326332
<Compile Include="..\TS3QueryLib.Core.Silverlight\Server\Notification\EventArgs\ChannelDescriptionChangedEventArgs.cs">
327333
<Link>Server\Notification\EventArgs\ChannelDescriptionChangedEventArgs.cs</Link>
328334
</Compile>
@@ -332,6 +338,9 @@
332338
<Compile Include="..\TS3QueryLib.Core.Silverlight\Server\Notification\EventArgs\ChannelMovedEventArgs.cs">
333339
<Link>Server\Notification\EventArgs\ChannelMovedEventArgs.cs</Link>
334340
</Compile>
341+
<Compile Include="..\TS3QueryLib.Core.Silverlight\Server\Notification\EventArgs\ChannelPasswordChangedEventArgs.cs">
342+
<Link>Server\Notification\EventArgs\ChannelPasswordChangedEventArgs.cs</Link>
343+
</Compile>
335344
<Compile Include="..\TS3QueryLib.Core.Silverlight\Server\Notification\EventArgs\ClientBanEventArgs.cs">
336345
<Link>Server\Notification\EventArgs\ClientBanEventArgs.cs</Link>
337346
</Compile>
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
using System;
2+
using TS3QueryLib.Core.CommandHandling;
3+
using TS3QueryLib.Core.Common;
4+
5+
namespace TS3QueryLib.Core.Server.Notification.EventArgs
6+
{
7+
public class ChannelCreatedEventArgs : System.EventArgs, IDump
8+
{
9+
#region Properties
10+
11+
public int? ChannelId { get; protected set; }
12+
public int? ParentId { get; protected set; }
13+
public string Name { get; protected set; }
14+
public string Topic { get; protected set; }
15+
public string NamePhonetic { get; protected set; }
16+
public int? Codec { get; protected set; }
17+
public int? CodecQuality { get; protected set; }
18+
public int? Order { get; protected set; }
19+
public int? FlagPassword { get; protected set; }
20+
public int? FlagSemiPermanent { get; protected set; }
21+
public int? DeleteDelay { get; protected set; }
22+
public int? FlagPermanent { get; protected set; }
23+
public int? FlagDefault { get; protected set; }
24+
public int? CodecIsUnencrypted { get; protected set; }
25+
public int? NeededTalkPower { get; protected set; }
26+
public int? MaxClients { get; protected set; }
27+
public int? MaxFamilyClients { get; protected set; }
28+
public int? FlagMaxClientsUnlimited { get; protected set; }
29+
public int? FlagMaxFamilyClientsUnlimited { get; protected set; }
30+
public int? FlagMaxFamilyClientsInherited { get; protected set; }
31+
public int? InvokerId { get; protected set; }
32+
public string InvokerName { get; protected set; }
33+
public string InvokerUniqueId { get; protected set; }
34+
35+
#endregion
36+
37+
#region Constructors
38+
39+
40+
public ChannelCreatedEventArgs(CommandParameterGroupList commandParameterGroupList)
41+
{
42+
if (commandParameterGroupList == null)
43+
throw new ArgumentNullException(nameof(commandParameterGroupList));
44+
45+
ChannelId = commandParameterGroupList.GetParameterValue<int?>("cid");
46+
ParentId = commandParameterGroupList.GetParameterValue<int?>("cpid");
47+
Name = commandParameterGroupList.GetParameterValue<string>("channel_name");
48+
Topic = commandParameterGroupList.GetParameterValue<string>("channel_topic");
49+
NamePhonetic = commandParameterGroupList.GetParameterValue<string>("channel_name_phonetic");
50+
Codec = commandParameterGroupList.GetParameterValue<int?>("channel_codec");
51+
CodecQuality = commandParameterGroupList.GetParameterValue<int?>("channel_codec_quality");
52+
FlagPermanent = commandParameterGroupList.GetParameterValue<int?>("channel_flag_permanent");
53+
FlagDefault = commandParameterGroupList.GetParameterValue<int?>("channel_flag_default");
54+
NeededTalkPower = commandParameterGroupList.GetParameterValue<int?>("channel_needed_talk_power");
55+
Order = commandParameterGroupList.GetParameterValue<int?>("channel_order");
56+
CodecIsUnencrypted = commandParameterGroupList.GetParameterValue<int?>("channel_codec_is_unencrypted");
57+
FlagMaxFamilyClientsUnlimited = commandParameterGroupList.GetParameterValue<int?>("channel_flag_maxfamilyclients_unlimited");
58+
FlagMaxFamilyClientsInherited = commandParameterGroupList.GetParameterValue<int?>("channel_flag_maxfamilyclients_inherited");
59+
InvokerId = commandParameterGroupList.GetParameterValue<int?>("invokerid");
60+
InvokerName = commandParameterGroupList.GetParameterValue<string>("invokername");
61+
InvokerUniqueId = commandParameterGroupList.GetParameterValue<string>("invokeruid");
62+
DeleteDelay = commandParameterGroupList.GetParameterValue<int?>("channel_delete_delay");
63+
FlagPassword = commandParameterGroupList.GetParameterValue<int?>("channel_flag_password");
64+
FlagPermanent = commandParameterGroupList.GetParameterValue<int?>("channel_flag_permanent");
65+
FlagSemiPermanent = commandParameterGroupList.GetParameterValue<int?>("channel_flag_semi_permanent");
66+
MaxClients = commandParameterGroupList.GetParameterValue<int?>("channel_maxclients");
67+
MaxFamilyClients = commandParameterGroupList.GetParameterValue<int?>("channel_maxfamilyclients");
68+
FlagMaxClientsUnlimited = commandParameterGroupList.GetParameterValue<int?>("channel_flag_maxclients_unlimited");
69+
}
70+
71+
#endregion
72+
}
73+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
using System;
2+
using TS3QueryLib.Core.CommandHandling;
3+
using TS3QueryLib.Core.Common;
4+
5+
namespace TS3QueryLib.Core.Server.Notification.EventArgs
6+
{
7+
public class ChannelDeletedEventArgs : System.EventArgs, IDump
8+
{
9+
#region Properties
10+
11+
public int? ChannelId { get; protected set; }
12+
public int? InvokerId { get; protected set; }
13+
public string InvokerName { get; protected set; }
14+
15+
#endregion
16+
17+
#region Constructors
18+
19+
20+
public ChannelDeletedEventArgs(CommandParameterGroupList commandParameterGroupList)
21+
{
22+
if (commandParameterGroupList == null)
23+
throw new ArgumentNullException(nameof(commandParameterGroupList));
24+
25+
ChannelId = commandParameterGroupList.GetParameterValue<int?>("cid");
26+
InvokerId = commandParameterGroupList.GetParameterValue<int?>("invokerid");
27+
InvokerName = commandParameterGroupList.GetParameterValue<string>("invokername");
28+
}
29+
30+
#endregion
31+
}
32+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
using System;
2+
using TS3QueryLib.Core.CommandHandling;
3+
using TS3QueryLib.Core.Common;
4+
5+
namespace TS3QueryLib.Core.Server.Notification.EventArgs
6+
{
7+
public class ChannelPasswordChangedEventArgs : System.EventArgs, IDump
8+
{
9+
#region Properties
10+
11+
public uint? ChannelId { get; protected set; }
12+
13+
#endregion
14+
15+
#region Constructors
16+
17+
public ChannelPasswordChangedEventArgs(CommandParameterGroupList commandParameterGroupList)
18+
{
19+
if (commandParameterGroupList == null)
20+
throw new ArgumentNullException(nameof(commandParameterGroupList));
21+
22+
ChannelId = commandParameterGroupList.GetParameterValue<uint>("cid");
23+
}
24+
25+
#endregion
26+
}
27+
}

TS3QueryLib.Core.Silverlight/Server/Notification/Notifications.cs

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,25 @@ public class Notifications : NotificationsBase
7575
public event EventHandler<ChannelMovedEventArgs> ChannelMoved;
7676

7777
/// <summary>
78-
/// Raised, when the description of a channelw as raised
78+
/// Raised, when the description of a channel has changed
7979
/// </summary>
8080
public event EventHandler<ChannelDescriptionChangedEventArgs> ChannelDescriptionChanged;
8181

82+
/// <summary>
83+
/// Raised, when the password of a channel has changed
84+
/// </summary>
85+
public event EventHandler<ChannelPasswordChangedEventArgs> ChannelPasswordChanged;
86+
87+
/// <summary>
88+
/// Raised, when a channel was created
89+
/// </summary>
90+
public event EventHandler<ChannelCreatedEventArgs> ChannelCreated;
91+
92+
/// <summary>
93+
/// Raised, when a channel was deleted
94+
/// </summary>
95+
public event EventHandler<ChannelDeletedEventArgs> ChannelDeleted;
96+
8297
/// <summary>
8398
/// Raised, when a unknown notification was received
8499
/// </summary>
@@ -109,6 +124,9 @@ protected override Dictionary<string, Action<CommandParameterGroupList>> GetNoti
109124
{ "notifychanneledited", HandleChannelEdited },
110125
{ "notifychannelmoved", HandleChannelMoved },
111126
{ "notifychanneldescriptionchanged", HandleChannelDescriptionChanged },
127+
{ "notifychannelpasswordchanged", HandleChannelPasswordChanged },
128+
{ "notifychannelcreated", HandleChannelCreated },
129+
{ "notifychanneldeleted", HandleChannelDeleted },
112130
{ "*", HandleUnknownNotificationReceived },
113131
};
114132
}
@@ -219,6 +237,24 @@ private void HandleChannelDescriptionChanged(CommandParameterGroupList parameter
219237
ThreadPool.QueueUserWorkItem(x => ChannelDescriptionChanged(this, new ChannelDescriptionChangedEventArgs(parameterGroupList)), null);
220238
}
221239

240+
private void HandleChannelPasswordChanged(CommandParameterGroupList parameterGroupList)
241+
{
242+
if (ChannelPasswordChanged != null)
243+
ThreadPool.QueueUserWorkItem(x => ChannelPasswordChanged(this, new ChannelPasswordChangedEventArgs(parameterGroupList)), null);
244+
}
245+
246+
private void HandleChannelCreated(CommandParameterGroupList parameterGroupList)
247+
{
248+
if (ChannelCreated != null)
249+
ThreadPool.QueueUserWorkItem(x => ChannelCreated(this, new ChannelCreatedEventArgs(parameterGroupList)), null);
250+
}
251+
252+
private void HandleChannelDeleted(CommandParameterGroupList parameterGroupList)
253+
{
254+
if (ChannelDeleted != null)
255+
ThreadPool.QueueUserWorkItem(x => ChannelDeleted(this, new ChannelDeletedEventArgs(parameterGroupList)), null);
256+
}
257+
222258
private void HandleUnknownNotificationReceived(CommandParameterGroupList parameterGroupList)
223259
{
224260
if (UnknownNotificationReceived != null)

TS3QueryLib.Core.Silverlight/TS3QueryLib.Core.Silverlight.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,12 @@
131131
<Compile Include="Common\Entities\SpacerInfo.cs" />
132132
<Compile Include="Server\Entities\Token.cs" />
133133
<Compile Include="Server\Entities\VirtualServerModification.cs" />
134+
<Compile Include="Server\Notification\EventArgs\ChannelCreatedEventArgs.cs" />
135+
<Compile Include="Server\Notification\EventArgs\ChannelDeletedEventArgs.cs" />
134136
<Compile Include="Server\Notification\EventArgs\ChannelDescriptionChangedEventArgs.cs" />
135137
<Compile Include="Server\Notification\EventArgs\ChannelEditedEventArgs.cs" />
136138
<Compile Include="Server\Notification\EventArgs\ChannelMovedEventArgs.cs" />
139+
<Compile Include="Server\Notification\EventArgs\ChannelPasswordChangedEventArgs.cs" />
137140
<Compile Include="Server\Notification\EventArgs\ClientBanEventArgs.cs" />
138141
<Compile Include="Server\Notification\EventArgs\ClientConnectionLostEventArgs.cs" />
139142
<Compile Include="Server\Notification\EventArgs\ClientDisconnectEventArgs.cs" />

TS3QueryLib.Core.WP7/TS3QueryLib.Core.WP7.csproj

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,12 @@
357357
<Compile Include="..\TS3QueryLib.Core.Silverlight\Server\Entities\VirtualServerModification.cs">
358358
<Link>Server\Entities\VirtualServerModification.cs</Link>
359359
</Compile>
360+
<Compile Include="..\TS3QueryLib.Core.Silverlight\Server\Notification\EventArgs\ChannelCreatedEventArgs.cs">
361+
<Link>Server\Notification\EventArgs\ChannelCreatedEventArgs.cs</Link>
362+
</Compile>
363+
<Compile Include="..\TS3QueryLib.Core.Silverlight\Server\Notification\EventArgs\ChannelDeletedEventArgs.cs">
364+
<Link>Server\Notification\EventArgs\ChannelDeletedEventArgs.cs</Link>
365+
</Compile>
360366
<Compile Include="..\TS3QueryLib.Core.Silverlight\Server\Notification\EventArgs\ChannelDescriptionChangedEventArgs.cs">
361367
<Link>Server\Notification\EventArgs\ChannelDescriptionChangedEventArgs.cs</Link>
362368
</Compile>
@@ -366,6 +372,9 @@
366372
<Compile Include="..\TS3QueryLib.Core.Silverlight\Server\Notification\EventArgs\ChannelMovedEventArgs.cs">
367373
<Link>Server\Entities\ChannelMovedEventArgs.cs</Link>
368374
</Compile>
375+
<Compile Include="..\TS3QueryLib.Core.Silverlight\Server\Notification\EventArgs\ChannelPasswordChangedEventArgs.cs">
376+
<Link>Server\Notification\EventArgs\ChannelPasswordChangedEventArgs.cs</Link>
377+
</Compile>
369378
<Compile Include="..\TS3QueryLib.Core.Silverlight\Server\Notification\EventArgs\ClientBanEventArgs.cs">
370379
<Link>Server\Notification\EventArgs\ClientBanEventArgs.cs</Link>
371380
</Compile>

0 commit comments

Comments
 (0)