Exemple #1
0
 internal void OnUserJoinedChannel(ChannelUserEventArgs e)
 {
     if (UserJoinedChannel != null)
     {
         UserJoinedChannel(this, e);
     }
 }
Exemple #2
0
        public void Bot_UserIsTyping(object sender, ChannelUserEventArgs e)
        {
            if (Bannedusers.Contains(("<@" + e.User.Id + ">").Replace("<!@", "<@").Replace("<@!", "<@")))
            {
                try
                {
                    var logChannel = e.User.Server.GetChannel(OutroChannelId);
                    logChannel.SendMessage($"{e.User.Mention} has been auto kicked from the magical Ember of Dreams (Gaming Community) Server.");
                }
                catch
                {
                    Console.WriteLine("You should install an outro channel with the \".setoutro\" command");
                }
                e.User.Kick();
            }

            else if (UsersToKick.Contains(("<@" + e.User.Id + ">").Replace("<!@", "<@").Replace("<@!", "<@")))
            {
                try
                {
                    var logChannel = e.User.Server.GetChannel(OutroChannelId);
                    logChannel.SendMessage($"{e.User.Mention} has been auto kicked from the magical Ember of Dreams (Gaming Community) Server.");
                }
                catch
                {
                    Console.WriteLine("You should install an outro channel with the \".setoutro\" command");
                }
                e.User.Kick();
                UsersToKick.Remove(("<@" + e.User.Id + ">").Replace("<!@", "<@").Replace("<@!", "<@"));
                Setwarnings(userId, 0, true);
            }
        }
Exemple #3
0
 protected internal virtual void OnUserPartedChannel(ChannelUserEventArgs e)
 {
     if (UserPartedChannel != null)
     {
         UserPartedChannel(this, e);
     }
 }
Exemple #4
0
 void _conn_Channels_UserParted(object sender, ChannelUserEventArgs e)
 {
     _dispatcher.BeginInvoke((Action) delegate
     {
         var buff = (ChannelViewModel)_buffers.SingleOrDefault(b => b.Name == e.Channel.Name);
         buff.Users.Remove(e.User);
     });
 }
Exemple #5
0
 void _conn_Channels_UserParted(object sender, ChannelUserEventArgs e)
 {
     _dispatcher.BeginInvoke((Action)delegate
     {
         var buff = (ChannelViewModel)_buffers.SingleOrDefault(b => b.Name == e.Channel.Name);
         buff.Users.Remove(e.User);
     });
 }
Exemple #6
0
 private void UserPartedChannel(object sender, ChannelUserEventArgs args)
 {
     if (args.User.Nick != this.Nick)
     {
         Logger.Log(string.Format("{0} has left {1}", args.User.Nick, args.Channel.Name));
         Logger.WriteChannelLog(args.User.Nick, "has left the channel", args.Channel.Name);
         ModuleHandler.OnUserLeave(args.User.Nick, args.Channel.Name);
     }
 }
Exemple #7
0
 /// <summary>
 /// Invoked when a user joins the IRC channel.
 /// Calls a nick registration check on the user.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void OnUserJoined(object sender, ChannelUserEventArgs e)
 {
     if (e.User.Nick == Config.NickName)
     {
         OnLocalUserJoinedChannel(sender, e);
         return;
     }
     // Perform WhoIs query to determine registration status on user.
     UserRegCheck(e.User.Nick);
 }
Exemple #8
0
 protected internal virtual void OnUserPartedChannel(ChannelUserEventArgs e)
 {
     try
     {
         UserPartedChannel(this, e);
     }
     catch (Exception err)
     {
         UnhandledException(this, new UnhandledExceptionEventArgs(err, false));
     }
 }
Exemple #9
0
        private void Client_UserJoinedChannel(object sender, ChannelUserEventArgs e)
        {
            Task.Factory.StartNew(delegate
            {
                var client = (IrcClient)sender;

                if (OnJoin != null)
                {
                    OnJoin(e.User.Nick, TokenManager.GetToken(new MessageSource(client, e.Channel.Name)));
                }
            });
        }
Exemple #10
0
 void _conn_Channels_UserJoined(object sender, ChannelUserEventArgs e)
 {
     _dispatcher.BeginInvoke((Action) delegate
     {
         var buff = (ChannelViewModel)_buffers.SingleOrDefault(b => b.Name == e.Channel.Name);
         IIrcChannelUser[] users = new IIrcChannelUser[buff.Users.Count + 1];
         buff.Users.CopyTo(users, 0);
         users[users.Length - 1] = e.User;
         Array.Sort(users);
         buff.Users.Insert(users.ToList().IndexOf(e.User), e.User);
     });
 }
Exemple #11
0
 void _conn_Channels_UserJoined(object sender, ChannelUserEventArgs e)
 {
     _dispatcher.BeginInvoke((Action)delegate
     {
         var buff = (ChannelViewModel)_buffers.SingleOrDefault(b => b.Name == e.Channel.Name);
         IIrcChannelUser[] users = new IIrcChannelUser[buff.Users.Count + 1];
         buff.Users.CopyTo(users, 0);
         users[users.Length - 1] = e.User;
         Array.Sort(users);
         buff.Users.Insert(users.ToList().IndexOf(e.User), e.User);
     });
 }
        private void Channel_UserAdded(object sender, ChannelUserEventArgs e)
        {
            PlayerInfo pInfo = new PlayerInfo();

            pInfo.Name = e.User.IRCUser.Name;

            Players.Add(pInfo);

            sndJoinSound.Play();

            BroadcastOptions();
            CopyPlayerDataToUI();
        }
Exemple #13
0
        private void GameLoadingChannel_UserAdded(object sender, ChannelUserEventArgs e)
        {
            Channel gameLoadingChannel = (Channel)sender;

            if (e.User.IRCUser.Name == ProgramConstants.PLAYERNAME)
            {
                gameLoadingChannel.UserAdded -= GameLoadingChannel_UserAdded;
                gameLoadingChannel.InvalidPasswordEntered -= GameChannel_InvalidPasswordEntered_LoadedGame;

                gameLoadingLobby.OnJoined();
                isInGameRoom  = true;
                isJoiningGame = false;
            }
        }
Exemple #14
0
        private void CurrentChatChannel_UserGameIndexUpdated(object sender, ChannelUserEventArgs e)
        {
            var ircUser = e.User.IRCUser;
            var item    = lbPlayerList.Items.Find(i => i.Text.StartsWith(ircUser.Name));

            if (ircUser.GameID < 0 || ircUser.GameID >= gameCollection.GameList.Count)
            {
                item.Texture = unknownGameIcon;
            }
            else
            {
                item.Texture = gameCollection.GameList[ircUser.GameID].Texture;
            }
        }
Exemple #15
0
        static void OnUserJoinedVoiceChannel(ChannelUserEventArgs e, SoundBoard soundBoard, SoundManager soundManager, Random random)
        {
            if (e.User.IsBot)
            {
                MyLogger.WriteLine("Bot joined a voice channel. Ignoring...");
                return;
            }
            if (e.Channel.IsAFK())
            {
                MyLogger.WriteLine("User joined an AFK voice channel. Ignoring...");
                return;
            }
            if (soundManager.IsPlaying)
            {
                MyLogger.WriteLine("_soundManager.HasThingsInQueue() is true. Ignoring...");
                return;
            }
            MyLogger.WriteLine(e.User.Name + " joined voice channel: " + e.Channel);
            var list = new[] {
                Tuple.Create("reinhardt", "hello"),
                Tuple.Create("genji", "hello"),
                Tuple.Create("mercy", "hello"),
                Tuple.Create("torbjorn", "hello"),
                Tuple.Create("winston", "hi there"),
                Tuple.Create("suhdude", "#random")
            };
            var i = random.Next(list.Length);
            var x = list[i];

            MyLogger.WriteLine("User joined a voice channel. Sending: " + x.Item1 + " " + x.Item2);
            FileInfo soundFile;

            if (soundBoard.TryGetSoundPath(x.Item1, x.Item2, out soundFile) == false)
            {
                MyLogger.WriteException(new FileNotFoundException("Couldn't Find TrackRequest but should have"));
                return;
            }

            var track = new Track {
                Path  = soundFile.FullName,
                Title = $"{x.Item1}: {x.Item2}"
            };

            var sound = new TrackRequest(track, e.Channel.Server.DefaultChannel, e.Channel)
            {
                TextUpdates = false
            };

            soundManager.EnqueueSound(sound);
        }
        private void Channel_UserAdded(object sender, ChannelUserEventArgs e)
        {
            PlayerInfo pInfo = new PlayerInfo();

            pInfo.Name = e.User.IRCUser.Name;

            Players.Add(pInfo);

            if (sndJoinSound != null)
            {
                AudioMaster.PlaySound(sndJoinSound);
            }

            BroadcastOptions();
            CopyPlayerDataToUI();
        }
Exemple #17
0
        /// <summary>
        /// Executed when IRC client joined the channel.
        /// Beware: This is executed by a different thread.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void OnLocalUserJoinedChannel(object sender, ChannelUserEventArgs e)
        {
            // save reference to channel
            IrcChannel = e.Channel;

            string ver = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();

            if (Config.SelectedConnectionInfo != null)
            {
                // build the welcome-string
                string welcomestr =
                    "Meridian 59 IRC BOT (" + ver + ") - Player " + Config.SelectedConnectionInfo.Character + " on host " +
                    Config.SelectedConnectionInfo.Host + ":" + Config.SelectedConnectionInfo.Port;

                // try to log the chatmessage to IRC
                SendIRCChannelMessage(welcomestr);
            }
        }
Exemple #18
0
 static async Task OnUserLeftVoiceChannel(ChannelUserEventArgs e, SoundManager soundManager)
 {
     if (e.Channel != soundManager.VoiceChannel)
     {
         return;
     }
     if (e.Channel.Users.Count() > 1)
     {
         return;
     }
     if (soundManager.CurrentlyPlayingTrackRequest.TextUpdates)
     {
         await e.Channel.Server.DefaultChannel.SendMessageEx("sorry i bothered you with my 🎶");
     }
     MyLogger.WriteLine("[Program] OnUserLeftVoiceChannel - Telling SoundManager to stop," +
                        " because we are the last user in channel");
     soundManager.Stop();
 }
Exemple #19
0
 void CurrentSpaceObject_OnChannelCreationCompleted(object sender, ChannelUserEventArgs e)
 {
     try
     {
         if (e.EventId != 0)
         {
             CurrentSpaceChannel = new SpaceChannel()
             {
                 id_channel = e.EventId
             };
             if (OnChannelCreationCompleted != null)
             {
                 OnChannelCreationCompleted(sender, e);
             }
         }
     }
     catch {
     }
 }
Exemple #20
0
 private void UserJoinedChannel(object sender, ChannelUserEventArgs e)
 {
 }
Exemple #21
0
 private void OnUserJoinedChannel(object sender, ChannelUserEventArgs e)
 {
     Logger.Info("User {0} Joined channel {1}", e.User.Hostmask, e.Channel.Name);
 }
Exemple #22
0
 public void OnUserJoinedChannel(object sender, ChannelUserEventArgs e)
 {
     Bot.Instance.Client.SendMessage("Sup, " + e.User, e.Channel.Name);
 }
Exemple #23
0
 /// <summary>
 /// Invoked when a user leaves the IRC channel.
 /// Removes the user from the user registration list.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void OnUserLeft(object sender, ChannelUserEventArgs e)
 {
     RemoveUserRegistration(e.User.Nick);
 }
Exemple #24
0
 protected virtual void OnUserQuit(RemoteServer server, ChannelUserEventArgs args)
 {
     UserQuitEvent?.Invoke(server, args);
 }
Exemple #25
0
 private void Client_UserPartedChannel(object sender, ChannelUserEventArgs e)
 {
 }