/// <summary> /// Dispatches the right events for the line. /// </summary> /// <param name="line">The line.</param> private void dispatchEventsFor(string line) { if (Messages.Message.IsCorrectFormat(line)) { //Tryed to order them by how often they appear. if (Messages.Server.PrivateMessage.IsCorrectFormat(line)) { var privateMessage = new Messages.Server.PrivateMessage(line); onPrivateMessage(privateMessage); onMessage(privateMessage); } else if (Messages.Server.NumericalMessage.IsCorrectFormat(line)) { var numericalMessage = new Messages.Server.NumericalMessage(line); onNumericalMessage(numericalMessage); onMessage(numericalMessage); } else if (Messages.Server.Notice.IsCorrectFormat(line)) { var notice = new Messages.Server.Notice(line); onNotice(notice); onMessage(notice); } else if (Messages.Server.NickMessage.IsCorrectFormat(line)) { var nickMessage = new Messages.Server.NickMessage(line); onNickMessage(nickMessage); onMessage(nickMessage); } else if (Messages.Server.JoinMessage.IsCorrectFormat(line)) { var joinMessage = new Messages.Server.JoinMessage(line); onJoinMessage(joinMessage); onMessage(joinMessage); } else if (Messages.Server.PartMessage.IsCorrectFormat(line)) { var partMessage = new Messages.Server.PartMessage(line); onPartMessage(partMessage); onMessage(partMessage); } else if (Messages.Server.QuitMessage.IsCorrectFormat(line)) { var quitMessage = new Messages.Server.QuitMessage(line); onQuitMessage(quitMessage); onMessage(quitMessage); } } }
public void QuitMessageParses() { var message = ":Banane9 QUIT :Bye cruel world!"; Assert.IsTrue(QuitMessage.IsCorrectFormat(message)); var quitMessage = new QuitMessage(message); Assert.AreEqual<string>("Banane9", quitMessage.User); Assert.AreEqual<string>("Bye cruel world!", quitMessage.Message); }
/// <summary> /// Fires the QuitMessage event. /// </summary> /// <param name="quitMessage">The quit message.</param> protected void onQuitMessage(QuitMessage quitMessage) { if (QuitMessage != null) QuitMessage(this, quitMessage); }
private void client_QuitMessage(Client sender, QuitMessage quitMessage) { }