예제 #1
0
        private void OnBobConnect(object sender, ClientEnterView e)
        {
            if (!awaitingConnect)
            {
                return;
            }

            Log.Write(Log.Level.Debug, "BC user entered with GrId {0}", e.ServerGroups);
            if (e.ServerGroups.ToIntArray().Contains(bobControllerData.bobGroupId))
            {
                Log.Write(Log.Level.Debug, "BC user with correct UID found");
                bobClient = Generator.ActivateResponse <ClientData>();
                {
                    bobClient.ChannelId  = e.TargetChannelId;
                    bobClient.DatabaseId = e.DatabaseId;
                    bobClient.ClientId   = e.ClientId;
                    bobClient.NickName   = e.NickName;
                    bobClient.ClientType = e.ClientType;
                }
                isRunning       = true;
                awaitingConnect = false;
                Log.Write(Log.Level.Debug, "BC bob is now officially running");
                SendQueue();
            }
        }
예제 #2
0
        private static async Task WelcomeMessage(TeamSpeakClient tsClient, ClientEnterView client)
        {
            await tsClient.SendMessage($"Welcome {client.NickName}!", MessageTarget.Private, client.Id);

            await tsClient.SendMessage($"Today is {DateTime.Today.ToString(CultureInfo.CurrentCulture)}!", MessageTarget.Private, client.Id);

            await tsClient.SendMessage($"Your UID is {client.Uid}.", MessageTarget.Private, client.Id);

            await tsClient.SendMessage("Have a nice day!", MessageTarget.Private, client.Id);
        }
예제 #3
0
 private static TalkPowerRequest?TalkPowerCevFun(ClientEnterView msg)
 {
     if (msg.TalkPowerRequestTime != Tools.UnixTimeStart)
     {
         return new TalkPowerRequest()
                {
                    Time = msg.TalkPowerRequestTime, Message = msg.TalkPowerRequestMessage ?? ""
                }
     }
     ;
     return(null);
 }
예제 #4
0
        public void UpdateClientEnterView(ClientEnterView msg)
        {
            var obj = new Client();

            obj.Channel          = msg.TargetChannelId;
            obj.AwayMessage      = AwayFun(msg);
            obj.TalkPowerRequest = TalkPowerFun(msg);
            obj.OptionalData     = null;
            obj.ConnectionData   = null;
            { var tmp = BadgesFun(msg); if (tmp != null)
              {
                  obj.Badges.AddRange(tmp);
              }
            }
            obj.DatabaseId                       = msg.DatabaseId;
            obj.Name                             = msg.Name;
            obj.ClientType                       = msg.ClientType;
            obj.Uid                              = msg.Uid;
            obj.AvatarHash                       = msg.AvatarHash;
            obj.Description                      = msg.Description;
            obj.IconId                           = msg.IconId;
            obj.InputMuted                       = msg.InputMuted;
            obj.OutputMuted                      = msg.OutputMuted;
            obj.OutputOnlyMuted                  = msg.OutputOnlyMuted;
            obj.InputHardwareEnabled             = msg.InputHardwareEnabled;
            obj.OutputHardwareEnabled            = msg.OutputHardwareEnabled;
            obj.Metadata                         = msg.Metadata;
            obj.IsRecording                      = msg.IsRecording;
            obj.ChannelGroup                     = msg.ChannelGroup;
            obj.InheritedChannelGroupFromChannel = msg.InheritedChannelGroupFromChannel;
            { var tmp = msg.ServerGroups; if (tmp != null)
              {
                  obj.ServerGroups.AddRange(tmp);
              }
            }
            obj.TalkPower                  = msg.TalkPower;
            obj.TalkPowerGranted           = msg.TalkPowerGranted;
            obj.IsPrioritySpeaker          = msg.IsPrioritySpeaker;
            obj.UnreadMessages             = msg.UnreadMessages;
            obj.PhoneticName               = msg.PhoneticName;
            obj.NeededServerqueryViewPower = msg.NeededServerqueryViewPower;
            obj.IsChannelCommander         = msg.IsChannelCommander;
            obj.CountryCode                = msg.CountryCode;
            SetClient(obj, msg.ClientId);
        }
예제 #5
0
		private void ExtendedClientEnterView(object sender, ClientEnterView eventArgs)
		{
			clientbufferOutdated = true;
			OnClientConnect?.Invoke(sender, eventArgs);
		}
예제 #6
0
 private static ClientType ClientTypeCevFun(ClientEnterView msg) => msg.ClientType;
예제 #7
0
 private static string AwayCevFun(ClientEnterView msg) => AwayFun(msg.IsAway, msg.AwayMessage);
예제 #8
0
        // Manual post event functions

        partial void PostClientEnterView(ClientEnterView msg) => SetOwnChannelSubscribed(msg.ClientId);
예제 #9
0
        public void UpdateClientEnterView(ClientEnterView msg)
        {
            var obj = new Client();

            { var tmpv = msg.TargetChannelId; if (tmpv != null)
              {
                  obj.Channel = (ChannelId)tmpv;
              }
            }
            { var tmpv = AwayCevFun(msg); if (tmpv != null)
              {
                  obj.AwayMessage = (str)tmpv;
              }
            }
            { var tmpv = TalkPowerCevFun(msg); if (tmpv != null)
              {
                  obj.TalkPowerRequest = (TalkPowerRequest)tmpv;
              }
            }
            obj.PermissionHints = null;
            obj.OptionalData    = null;
            obj.ConnectionData  = null;
            { var tmpv = msg.DatabaseId; if (tmpv != null)
              {
                  obj.DatabaseId = (ClientDbId)tmpv;
              }
            }
            { var tmpv = msg.Name; if (tmpv != null)
              {
                  obj.Name = (str)tmpv;
              }
            }
            { var tmpv = msg.ClientType; if (tmpv != null)
              {
                  obj.ClientType = (ClientType)tmpv;
              }
            }
            { var tmpv = msg.Uid; if (tmpv != null)
              {
                  obj.Uid = (Uid)tmpv;
              }
            }
            { var tmpv = msg.AvatarHash; if (tmpv != null)
              {
                  obj.AvatarHash = (str)tmpv;
              }
            }
            { var tmpv = msg.Description; if (tmpv != null)
              {
                  obj.Description = (str)tmpv;
              }
            }
            { var tmpv = msg.IconId; if (tmpv != null)
              {
                  obj.IconId = (IconHash)tmpv;
              }
            }
            { var tmpv = msg.InputMuted; if (tmpv != null)
              {
                  obj.InputMuted = (bool)tmpv;
              }
            }
            { var tmpv = msg.OutputMuted; if (tmpv != null)
              {
                  obj.OutputMuted = (bool)tmpv;
              }
            }
            { var tmpv = msg.OutputOnlyMuted; if (tmpv != null)
              {
                  obj.OutputOnlyMuted = (bool)tmpv;
              }
            }
            { var tmpv = msg.InputHardwareEnabled; if (tmpv != null)
              {
                  obj.InputHardwareEnabled = (bool)tmpv;
              }
            }
            { var tmpv = msg.OutputHardwareEnabled; if (tmpv != null)
              {
                  obj.OutputHardwareEnabled = (bool)tmpv;
              }
            }
            { var tmpv = msg.Metadata; if (tmpv != null)
              {
                  obj.Metadata = (str)tmpv;
              }
            }
            { var tmpv = msg.IsRecording; if (tmpv != null)
              {
                  obj.IsRecording = (bool)tmpv;
              }
            }
            { var tmpv = msg.ChannelGroup; if (tmpv != null)
              {
                  obj.ChannelGroup = (ChannelGroupId)tmpv;
              }
            }
            { var tmpv = msg.InheritedChannelGroupFromChannel; if (tmpv != null)
              {
                  obj.InheritedChannelGroupFromChannel = (ChannelId)tmpv;
              }
            }
            { var tmpa = msg.ServerGroups; if (tmpa != null)
              {
                  obj.ServerGroups.Clear(); obj.ServerGroups.UnionWith(tmpa);
              }
            }
            { var tmpv = msg.TalkPower; if (tmpv != null)
              {
                  obj.TalkPower = (i32)tmpv;
              }
            }
            { var tmpv = msg.TalkPowerGranted; if (tmpv != null)
              {
                  obj.TalkPowerGranted = (bool)tmpv;
              }
            }
            { var tmpv = msg.IsPrioritySpeaker; if (tmpv != null)
              {
                  obj.IsPrioritySpeaker = (bool)tmpv;
              }
            }
            { var tmpv = msg.UnreadMessages; if (tmpv != null)
              {
                  obj.UnreadMessages = (u32)tmpv;
              }
            }
            { var tmpv = msg.PhoneticName; if (tmpv != null)
              {
                  obj.PhoneticName = (str)tmpv;
              }
            }
            { var tmpv = msg.NeededServerqueryViewPower; if (tmpv != null)
              {
                  obj.NeededServerqueryViewPower = (i32)tmpv;
              }
            }
            { var tmpv = msg.IsChannelCommander; if (tmpv != null)
              {
                  obj.IsChannelCommander = (bool)tmpv;
              }
            }
            { var tmpv = msg.CountryCode; if (tmpv != null)
              {
                  obj.CountryCode = (str)tmpv;
              }
            }
            { var tmpv = msg.Badges; if (tmpv != null)
              {
                  obj.Badges = (str)tmpv;
              }
            }
            SetClient(obj, msg.ClientId);
        }
예제 #10
0
        private void ChangeUserLobby(UserTeam userTeam, ClientEnterView clientEnterView = null)
        {
            try
            {
                if (_teamSpeakClient == null || !_teamSpeakClient.Client.IsConnected)
                {
                    _teamSpeakClient = ConnectToTeamspeak().Result;
                }

                if (_channelList == null || _channelList.Count == 0)
                {
                    _channelList = GetChannelList().Result;
                }
                var currentClients = GetClients().Result;
                if (currentClients == null)
                {
                    if (ConfigurationManager.AppSettings["Debug"] == "True")
                    {
                        _eventLog1.WriteEntry($"Failed to retrieve CurrentClients");
                    }
                    return;
                }

                TsUser tsUser;
                if (clientEnterView != null)
                {
                    tsUser = new TsUser
                    {
                        ChannelId = clientEnterView.TargetChannelId,
                        UserId    = clientEnterView.Id,
                        UserName  = clientEnterView.NickName
                    };
                }
                else
                {
                    var user = currentClients.FirstOrDefault(x =>
                                                             string.Equals(x.NickName, userTeam.TsUser, StringComparison.CurrentCultureIgnoreCase));
                    if (user == null)
                    {
                        if (ConfigurationManager.AppSettings["Debug"] == "True")
                        {
                            _eventLog1.WriteEntry($"User: {userTeam.TsUser} not found in ts3");
                        }
                        return;
                    }

                    tsUser = new TsUser
                    {
                        ChannelId = user.ChannelId,
                        UserId    = user.Id,
                        UserName  = user.NickName
                    };
                }

                if (ConfigurationManager.AppSettings["Debug"] == "True")
                {
                    _eventLog1.WriteEntry($"User: {userTeam.TsUser} found in ts3");
                }
                var channel = _channelList.FirstOrDefault(x => x.Name == userTeam.TsChannel);
                if (channel == null)
                {
                    if (ConfigurationManager.AppSettings["Debug"] == "True")
                    {
                        _eventLog1.WriteEntry($"Channel: {userTeam.TsChannel} not found in ts3");
                    }
                    return;
                }
                if (ConfigurationManager.AppSettings["Debug"] == "True")
                {
                    _eventLog1.WriteEntry($"Channel: {userTeam.TsChannel} found in ts3 for user {userTeam.TsUser}");
                }
                if (channel.Id == tsUser.ChannelId)
                {
                    if (ConfigurationManager.AppSettings["Debug"] == "True")
                    {
                        _eventLog1.WriteEntry($"User: {userTeam.TsUser} is already in channel: {channel.Name}");
                    }
                    return;
                }
                if (ConfigurationManager.AppSettings["Debug"] == "True")
                {
                    _eventLog1.WriteEntry($"Change user: {tsUser.UserName} to channel {channel.Name}");
                }
                _teamSpeakClient.MoveClient(tsUser.UserId, channel.Id);
            }
            catch (Exception e)
            {
                _eventLog1.WriteEntry(e.Message, EventLogEntryType.Error);
            }
        }
예제 #11
0
 partial void ProcessEachClientEnterView(ClientEnterView notifies);
예제 #12
0
 private void QueryConnection_OnClientConnect(object sender, ClientEnterView e)
 {
     bot.QueryConnection.SendMessage("hallo", e.ClientId);
 }
예제 #13
0
 private str AwayCevFun(ClientEnterView msg) => default;
예제 #14
0
 partial void PostClientEnterView(ClientEnterView msg);
예제 #15
0
 private void ExtendedClientEnterView(object sender, ClientEnterView eventArgs)
 {
     clientbufferOutdated = true;
     OnClientConnect?.Invoke(sender, eventArgs);
 }
예제 #16
0
		private void OnBobConnect(object sender, ClientEnterView e)
		{
			if (!awaitingConnect) return;

			Log.Write(Log.Level.Debug, "BC user entered with GrId {0}", e.ServerGroups);
			if (e.ServerGroups.ToIntArray().Contains(bobControllerData.bobGroupId))
			{
				Log.Write(Log.Level.Debug, "BC user with correct UID found");
				bobClient = Generator.ActivateResponse<ClientData>();
				{
					bobClient.ChannelId = e.TargetChannelId;
					bobClient.DatabaseId = e.DatabaseId;
					bobClient.ClientId = e.ClientId;
					bobClient.NickName = e.NickName;
					bobClient.ClientType = e.ClientType;
				}
				isRunning = true;
				awaitingConnect = false;
				Log.Write(Log.Level.Debug, "BC bob is now officially running");
				SendQueue();
			}
		}