コード例 #1
0
ファイル: ServerFactory.cs プロジェクト: chton/YellingBrd
        public static List<Server> GetServers()
        {
            List<Server> newList = new List<Server>();
            Server s = new Server();
            s.Name = "WiNA";
            s.Address = "wina.ugent.be";
            s.Ident = "TangBot";
            s.MyNick = "YellingBird";
            s.MyDescription = "I'm AWESOME";
            s.Port = 6667;
            s.Channels = new List<Channel>();

            Channel c = new Channel();
            c.CName = "zeus";
            c.CFullName = "#zeus";
            c.CServer = s;
               // s.Channels.Add(c);

            c = new Channel();
            c.CName = "YellingBird";
            c.CFullName = "#YellingBird";
            c.CServer = s;
            s.Channels.Add( c );

            newList.Add( s );
            return newList;
        }
コード例 #2
0
ファイル: RouletteMod.cs プロジェクト: chton/YellingBrd
 private void KickUser( string message , User us , Channel chan )
 {
     Message msg = new Message();
     msg.Line = message;
     msg.MChannel = chan;
     msg.MType = MessageType.Kick;
     msg.MUser = us;
     msg.MServer = LastMessage.MServer;
     Reply( msg );
 }
コード例 #3
0
ファイル: PreProcessor.cs プロジェクト: chton/YellingBrd
        public bool Send( Message msg )
        {
            if ( msg.MServer == null || msg.MChannel == null )
            {
                string builtMessage = msg.Line;
                msg.MServer = new Server();
                //return ConnManager.Instance.Send( msg.MServer , builtMessage );
                return false;
            }
            else if ( msg.MType == MessageType.Message )
            {
                string builtMessage = "PRIVMSG " + msg.MChannel.CFullName + " :" + msg.Line;
                return ConnManager.Instance.Send( msg.MServer , builtMessage );
            }
            else if ( msg.MType == MessageType.Action )
            {
                string builtMessage = "PRIVMSG " + msg.MChannel.CFullName + " :" + "\u0001" + "ACTION " + msg.Line + "\u0001";
                return ConnManager.Instance.Send( msg.MServer , builtMessage );
            }
            else if ( msg.MType == MessageType.Join )
            {
                string builtMessage = "JOIN " + msg.Line;
                Channel c = new Channel();
                c.CFullName = msg.Line;
                c.CName = msg.Line.Replace( "#" , "" );
                c.CServer = msg.MServer;
                msg.MServer.Channels.Add( c );
                return ConnManager.Instance.Send( msg.MServer , builtMessage );
            }
            else if ( msg.MType == MessageType.Part )
            {
                string builtMessage = "PART " + msg.MChannel.CFullName;
                msg.MServer.Channels.Remove( msg.MChannel );
                return ConnManager.Instance.Send( msg.MServer , builtMessage );
            }
            else if ( msg.MType == MessageType.Quit )
            {
                string builtMessage = "QUIT :" + msg.Line;
                //ConnManager.Instance.Sockets.Remove( msg.MServer );
                return ConnManager.Instance.Send( msg.MServer , builtMessage );

            }
            else if ( msg.MType == MessageType.Kick )
            {
                string builtMessage = "KICK " + msg.MChannel.CFullName + " " + msg.MUser.Nick + " :" + msg.Line;
                return ConnManager.Instance.Send( msg.MServer , builtMessage );
            }
            else return false;
        }
コード例 #4
0
 public UnknownChannelException( Server server , Channel channel )
     : base()
 {
     this.server = server;
     this.channel = channel;
 }
コード例 #5
0
ファイル: PostProcessor.cs プロジェクト: chton/YellingBrd
 private void BuildUserList( string right , Server server , Channel channel )
 {
     string[] rightparts = right.Split( new char[] { ' ' } );
     foreach ( string nick in rightparts )
     {
         string n = nick;
         n = n.Replace( "@" , "" );
         n = n.Replace( "+" , "" );
         n = n.Replace( "&" , "" );
         User result = ( from User y in server.AllUsers where y.Nick.Equals( n ) select y ).FirstOrDefault();
         if ( result == null )
         {
             result = new User();
             result.Nick = n;
             result.UServer = server;
             server.AllUsers.Add( result );
         }
         if ( !channel.CUsers.Contains( result ) )
         {
             channel.CUsers.Add( result );
         }
         if ( result.Ident == null )
         {
             ConnManager.Instance.Send( server , "WHOIS " + n );
         }
     }
 }