Example #1
0
 /// <summary>
 ///     Send a message to the user with the specified channel.
 /// </summary>
 /// <param name="channel"></param>
 /// <param name="username">The user name that we are sending the message to</param>
 protected void SendMessageToUser(IRCChannel channel, string username, string message)
 {
 }
Example #2
0
        /// <summary>
        ///     This is an asynchronous operation -- be aware.
        /// </summary>
        private void Run()
        {
            if (Client == null)
                throw new ArgumentNullException("The client was not instantiated!");

            Client.Connect(m_AddressDestination, (int)Configuration.Port);
            NetworkStream connectionStream = Client.GetStream();

            // Check whether we can write to the network stream.
            if (connectionStream.CanWrite)
            {
                m_Writer = new StreamWriter(connectionStream);
                m_Writer.WriteLine("PASS *");
                m_Writer.Flush();
                m_Writer.WriteLine("NICK {0}",Configuration.Nickname);
                m_Writer.Flush();
                m_Writer.WriteLine("USER {0} 8 * :{1}", Configuration.Username, Configuration.Username);
                m_Writer.Flush();

                OnConnect();

                if (Configuration.Channels != null && Configuration.Channels.Any())
                {
                    foreach (var channel in Configuration.Channels)
                    {
                        m_Writer.WriteLine("JOIN :{0}", channel.ChannelName);
                        m_Writer.Flush();
                    }
                }
            }

            // Check whether we can read from the stream as well
            if (connectionStream.CanRead)
                m_Reader = new StreamReader(connectionStream);

            while (true)
            {
                if (connectionStream.DataAvailable)
                {
                    string line = string.Empty;
                    while ((line = m_Reader.ReadLine()) != null)
                    {
                        // Replace this with some nice regex to validate the response received from the server.
                        if (line.Contains("JOIN"))
                        {
                            IRCChannel channelInstance = new IRCChannel(string.Empty);

                        }

                        OnMessageReceived(line);
                    }
                }
            }
        }
Example #3
0
 protected void SendMessageToChannel(IRCChannel channel, string message)
 {
 }
Example #4
0
 public abstract void OnUserMessageReceived(IRCUser user, IRCChannel channel, string instance);
Example #5
0
 /// <summary>
 ///     
 /// </summary>
 /// <param name="channelInstance"></param>
 public abstract void OnJoinChannel(IRCChannel channelInstance);
Example #6
0
 public override void OnUserMessageReceived(IRCUser user, IRCChannel channel, string instance)
 {
 }
Example #7
0
 public override void OnJoinChannel(IRCChannel channelInstance)
 {
     Logger.LogMessage("Joined channel!");
 }