Example #1
0
        // Verb events

        private void HandleJoin(object sender, MessageEventArgs ev)
        {
            Debug.Print("Channel.HandleJoin: ev.Message={0}", ev.Message);
            if (!string.IsNullOrEmpty(_name) && !_name.Equals(ev.Message.Target, StringComparison.Ordinal))
            {
                Debug.Print("Channel.HandleJoin: changing name from '{0}' to '{1}'", _name, ev.Message.Target);
                _server.UnregisterChannel(_name);
                Name = ev.Message.Target;
                _server.RegisterChannel(_name, this);
            }

            _protocolHandler.SendToServer("WHO {0}", _name);
        }
Example #2
0
        // Verb events

        private void HandleJoin(object sender, MessageEventArgs ev)
        {
            if (null != Name && !Name.Equals(ev.Message.Target, StringComparison.OrdinalIgnoreCase))
            {
                Debug.Print("Channel.HandleJoin: changing name from '{0}' to '{1}'", Name, ev.Message.Target);
                if (null != Name)
                {
                    _server.UnregisterChannel(Name);
                    Name = null;
                }
                Name = ev.Message.Target;
                if (null != Name)
                {
                    _server.RegisterChannel(Name, this);
                }
            }

            ProtocolHandler.SendToServer("WHO {0}", Name);
        }
Example #3
0
 protected override void HandleNotice(object sender, MessageEventArgs ev)
 {
     Debug.Print("SelfUser.HandleNotice: origin='{0}' target='{1}' args='{2}'", ev.Message.Origin, ev.Message.Target, string.Join("','", ev.Message.Args));
     if (ev.Message.Origin.NickName.Equals("NickServ", StringComparison.OrdinalIgnoreCase))
     {
         if (ev.Message.Args[0].StartsWith("This nickname is registered.", StringComparison.OrdinalIgnoreCase))
         {
             if (string.IsNullOrWhiteSpace(NickServUserName) && string.IsNullOrWhiteSpace(NickServPassword))
             {
                 Debug.Print("SelfUser.HandleNotice: NickServ has requested authentication, but we don't have any to give it. skipping.");
                 return;
             }
             Debug.Print("SelfUser.HandleNotice: authenticating to NickServ. username='******' password='******'", NickServUserName ?? "", NickServPassword ?? "");
             if (string.IsNullOrWhiteSpace(NickServUserName))
             {
                 ProtocolHandler.SendToServer("PRIVMSG NickServ :identify {0}", NickServPassword);
             }
             else
             {
                 ProtocolHandler.SendToServer("PRIVMSG NickServ :identify {0} {1}", NickServUserName, NickServPassword);
             }
         }
     }
 }
Example #4
0
        //
        // Methods
        //

        public void SendUserRegistration( )
        {
            if (null == _protocolHandler)
            {
                throw new InvalidOperationException("Server.ProtocolHandler property must be set before using SendUserRegistration method");
            }

            Debug.Print("Server.SendUserRegistration");

            if (!string.IsNullOrWhiteSpace(ServerPassword))
            {
                _protocolHandler.SendToServer("PASS {0}", ServerPassword);
            }

            var capNego = new CapNegotiator {
                Server = this,
            };

            capNego.Complete += CapNegotiatorComplete;

            _protocolHandler.SaveAndClearHandlers( );
            capNego.RegisterMessages( );
            capNego.Start( );
        }
Example #5
0
 private void HandlePing(object sender, MessageEventArgs ev)
 {
     _protocolHandler.SendToServer("PONG :{0}", string.Join(" ", ev.Message.Args));
 }