Ejemplo n.º 1
0
 public UserJoinEventArgs(Channel chan, ChannelUser user, JoinReceivedEventArgs baseArgs)
     : base(baseArgs.BaseLine)
 {
     channel = chan;
     this.user = user;
 }
Ejemplo n.º 2
0
 void Client_JoinReceived(Object sender, JoinReceivedEventArgs e)
 {
     if (e.User == (UserInfo)this) channels.Add(e.ChannelName);
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Handles received joins and add the user to channels, if it has joined a new one.
 /// </summary>
 /// <param name="sender">The client what raised the event.</param>
 /// <param name="e">The event arguments.</param>
 private void Client_JoinReceived(object sender, JoinReceivedEventArgs e)
 {
     if (e.User.Equals(this))
     {
         channels.Add(e.ChannelName);
     }
 }
Ejemplo n.º 4
0
 public Channel(JoinReceivedEventArgs baseArgs)
 {
     ClientValue = baseArgs.Client;
     NameValue = baseArgs.ChannelName;
     PrepareChannel();
     PrepareJoining();
 }
Ejemplo n.º 5
0
 void Client_JoinReceived(Object sender, JoinReceivedEventArgs e)
 {
     if (Disposed) return;
     if (e.ChannelName != Name) return;
     if (Status == ChannelStates.NotIn)
     {
         if (e.User.NickName != Client.MyUserInfo.NickName) return;
         PrepareJoining();
     }
     else if (Status == ChannelStates.In)
     {
         ChannelUser newUser = new ChannelUser(this, e.User.NickName);
         NickListValue.Add(newUser);
         if (UserJoin != null) UserJoin(this, new UserJoinEventArgs(this, newUser, e));
     }
 }
Ejemplo n.º 6
0
        /// <summary>
        /// Handles a line received from server.
        /// </summary>
        private void HandleLine(LineReceivedEventArgs e)
        {
            if (e.Line.IsNumeric)
            {
                if (NumericReceived != null) NumericReceived(this, new NumericReceivedEventArgs(e.Line));
                switch (e.Line.Numeric)
                {
                    case 1: // Parse the Server Info
                        currentNick = e.Line.Parameters[0];
                        networkName = e.Line.Parameters[1].Split(' ')[3];
                        myUserInfo = new UserInfo(e.Line.Parameters[1].Split(' ')[6], this);
                        break;

                    case 3: // Parse Welcome-Message
                        loggedIn = true;
                        if (Login != null)
                            Login(this, new LoginEventArgs(NetworkName, CurrentNick, this));
                        break;

                    case 376: // End of MOTD message
                        loggedIn = true;
                        if (Login != null)
                            Login(this, new LoginEventArgs(NetworkName, CurrentNick, this));
                        break;
                }
            }
            else
            {
                e.Handled = true;
                switch (e.Line.Command)
                {
                    case "PING": // Handle the Ping here
                        PingReceivedEventArgs pingArgs = new PingReceivedEventArgs(e.Line);
                        if (PingReceived != null)
                            PingReceived(this, pingArgs);
                        if (!pingArgs.Handled)
                            if (e.Line.Parameters.Length > 0)
                                SendLine("PONG :" + e.Line.Parameters[0]);
                            else
                                SendLine("PONG");
                        break;

                    case "JOIN": //Parse Join-Message
                        JoinReceivedEventArgs joinArgs = new JoinReceivedEventArgs(e.Line);
                        if (JoinReceived != null)
                            JoinReceived(this, joinArgs);
                        break;

                    case "PART": //Parse Part-Message
                        PartReceivedEventArgs partArgs = new PartReceivedEventArgs(e.Line);
                        if (PartReceived != null)
                            PartReceived(this, partArgs);
                        break;

                    case "QUIT": //Parse Quit-Message
                        QuitReceivedEventArgs quitArgs = new QuitReceivedEventArgs(e.Line);
                        if (QuitReceived != null)
                            QuitReceived(this, quitArgs);
                        break;

                    case "NICK": //Parse Nick-Message
                        if(e.Line.Client.ToString() == this.ToString())
                            this.currentNick = e.Line.Parameters[0];

                        NickChangeReceivedEventArgs nickChangeArgs = new NickChangeReceivedEventArgs(e.Line);
                        if (NickChangeReceived != null)
                            NickChangeReceived(this, nickChangeArgs);
                        break;

                    case "MODE": //Parse Mode-Message
                        ModeReceivedEventArgs modeArgs = new ModeReceivedEventArgs(e.Line);
                        if (ModeReceived != null)
                            ModeReceived(this, modeArgs);
                        break;

                    case "NOTICE": //Parse Notice-Message
                        NoticeReceivedEventArgs noticeArgs = new NoticeReceivedEventArgs(e.Line);
                        if (NoticeReceived != null)
                            NoticeReceived(this, noticeArgs);
                        break;

                    case "PRIVMSG": //Parse Private-Message
                        PrivateMessageReceivedEventArgs privmsgArgs = new PrivateMessageReceivedEventArgs(e.Line);
                        if (PrivateMessageReceived != null)
                            PrivateMessageReceived(this, privmsgArgs);
                        break;

                    case "KICK": //Parse Kick-Message
                        KickReceivedEventArgs kickArgs = new KickReceivedEventArgs(e.Line);
                        if (KickReceived != null)
                            KickReceived(this, kickArgs);
                        break;

                    default:
                        e.Handled = false;
                        break;
                }
            }
        }
Ejemplo n.º 7
0
 /// <summary>
 /// Initializes a new instance of the UserJoinEventArgs class.
 /// </summary>
 /// <param name="user">The user that joined.</param>
 /// <param name="baseArgs">The event args for the base join event.</param>
 public UserJoinEventArgs(ChannelUser user, JoinReceivedEventArgs baseArgs)
     : base(baseArgs.Line)
 {
     this.user = user;
 }