Пример #1
0
        static void client_PrivateMessage(Client sender, PrivateMessage privateMessage)
        {
            string user = privateMessage.User.Split('!')[0];
            string rcpt = privateMessage.Recipient;
            if (privateMessage.Recipient == sender.Config.Nickname)
            {
                rcpt = user;
            }

            if (privateMessage.Message.StartsWith("."))
            {

                string cmd = privateMessage.Message;
                string msg = "";

                if (privateMessage.Message.Contains(' '))
                {
                    cmd = privateMessage.Message.Substring(0, privateMessage.Message.IndexOf(' '));
                    msg = privateMessage.Message.Substring(cmd.Length + 1, privateMessage.Message.Length - cmd.Length - 1);
                }

                switch (cmd.ToUpper())
                {
                    case ".JOIN":
                        if (msg.Contains(' '))
                        {
                            msg = msg.Split(' ')[0];
                        }
                        sender.Join(msg);
                        break;
                    case ".PART":
                        if (msg.Contains(' '))
                        {
                            sender.Leave(msg.Split(' ')[0]);
                        }
                        else
                        {
                            if (rcpt.StartsWith("#"))
                            {
                                sender.Leave(rcpt);
                            }
                        }
                        break;
                    case ".WAVE":
                        sender.Send(rcpt, "o/");
                        break;

                    case ".SEEN":

                        break;
                }
            }
        }
Пример #2
0
 /// <summary>
 /// Fires the PrivateMessage event.
 /// </summary>
 /// <param name="privateMessage">The private message.</param>
 protected void onPrivateMessage(PrivateMessage privateMessage)
 {
     if (PrivateMessage != null)
         PrivateMessage(this, privateMessage);
 }
Пример #3
0
        public void PrivateMessage()
        {
            string message = ":Banane9 PRIVMSG #banane9 :Hello, channel!";

            Assert.IsTrue(Iris.Irc.ServerMessages.PrivateMessage.IsCorrectFormat(message));

            PrivateMessage privateMessage = new PrivateMessage(message);

            Assert.AreEqual<string>("Banane9", privateMessage.User);
            Assert.AreEqual<string>("#banane9", privateMessage.Recipient);
            Assert.AreEqual<string>("Hello, channel!", privateMessage.Message);
        }
Пример #4
0
 private void client_PrivateMessage(Client sender, PrivateMessage privateMessage)
 {
 }