Example #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SimpleClientEntity"/> class.
 /// </summary>
 /// <param name="client">The client.</param>
 public SimpleClientEntity(ClientListEntry client)
 {
     this.ClientDatabaseId = client.ClientDatabaseId;
     this.ClientId         = client.ClientId;
     this.Nickname         = client.Nickname;
     this.ServerGroups     = new List <uint>(client.ServerGroups);
     this.ChannelId        = client.ChannelId;
     this.Connected        = client.ClientLastConnected;
 }
Example #2
0
 /// <summary>
 /// Gets the away channel by the clients away state.
 /// </summary>
 /// <param name="client">The client.</param>
 /// <param name="settings">The settings.</param>
 /// <returns>the away channel.</returns>
 public static uint?GetAwayChannelByState(this ClientListEntry client, AwaySettings settings)
 {
     if (client.IsAway(settings))
     {
         return(settings.Channel);
     }
     if (client.IsInputMuted(settings))
     {
         return(settings.MuteMicrophoneChannel);
     }
     if (client.IsOutputMuted(settings))
     {
         return(settings.MuteHeadphoneChannel);
     }
     return(null);
 }
Example #3
0
        private static int SortUser(ClientListEntry client1, ClientListEntry client2)
        {
            if (client1.ClientType != client2.ClientType)
            {
                return(client1.ClientType == 1 ? 1 : -1);
            }

            if (client1.ClientTalkPower != client2.ClientTalkPower)
            {
                return((int)client2.ClientTalkPower - (int)client1.ClientTalkPower);
            }

            if (client1.IsClientTalker != client2.IsClientTalker)
            {
                return(client1.IsClientTalker.Value ? 1 : -1);
            }

            if (client1.IsClientInputMuted != client2.IsClientInputMuted)
            {
                return(client1.IsClientInputMuted.Value ? 1 : -1);
            }

            return(string.Compare(client1.Nickname, client2.Nickname));
        }
Example #4
0
 /// <summary>
 /// Determines whether the specified client is idle.
 /// </summary>
 /// <param name="client">The client.</param>
 /// <param name="settings">The settings.</param>
 /// <returns>
 ///   <c>true</c> if the specified client is idle; otherwise, <c>false</c>.
 /// </returns>
 public static bool IsIdle(this ClientListEntry client, IdleSettings settings)
 {
     return(settings.Enabled && settings.Channel > 0 && client.ClientIdleDuration.GetValueOrDefault().TotalMinutes >= settings.IdleTime);
 }
Example #5
0
 /// <summary>
 /// Determines whether [is output muted] [the specified client].
 /// </summary>
 /// <param name="client">The client.</param>
 /// <param name="settings">The settings.</param>
 /// <returns>
 ///   <c>true</c> if [is output muted] [the specified client]; otherwise, <c>false</c>.
 /// </returns>
 public static bool IsOutputMuted(this ClientListEntry client, AwaySettings settings)
 {
     return(settings.Enabled && settings.MuteHeadphoneChannel > 0 && client.IsClientOutputMuted.GetValueOrDefault());
 }
Example #6
0
 /// <summary>
 /// Determines whether the specified client is away.
 /// </summary>
 /// <param name="client">The client.</param>
 /// <param name="settings">The settings.</param>
 /// <returns>
 ///   <c>true</c> if the specified client is away; otherwise, <c>false</c>.
 /// </returns>
 public static bool IsAway(this ClientListEntry client, AwaySettings settings)
 {
     return(settings.Enabled && settings.Channel > 0 && client.IsClientAway.GetValueOrDefault());
 }