You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Events.kt 2.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. package com.dmdirc.ktirc.events
  2. import com.dmdirc.ktirc.model.Capability
  3. import com.dmdirc.ktirc.model.ServerFeatureMap
  4. import com.dmdirc.ktirc.model.User
  5. import java.time.LocalDateTime
  6. /** Base class for all events. */
  7. sealed class IrcEvent(val time: LocalDateTime)
  8. /** Raised when the connection to the server has been established. The server will not be ready for use yet. */
  9. class ServerConnected(time: LocalDateTime) : IrcEvent(time)
  10. /** Raised when the server is ready for use. */
  11. class ServerReady(time: LocalDateTime) : IrcEvent(time)
  12. /** Raised when the server initially welcomes us to the IRC network. */
  13. class ServerWelcome(time: LocalDateTime, val localNick: String) : IrcEvent(time)
  14. /** Raised when the features supported by the server have changed. This may occur numerous times. */
  15. class ServerFeaturesUpdated(time: LocalDateTime, val serverFeatures: ServerFeatureMap) : IrcEvent(time)
  16. /** Raised whenever a PING is received from the server. */
  17. class PingReceived(time: LocalDateTime, val nonce: ByteArray) : IrcEvent(time)
  18. /** Raised when a user joins a channel. */
  19. class ChannelJoined(time: LocalDateTime, val user: User, val channel: String) : IrcEvent(time)
  20. /** Raised when a user leaves a channel. */
  21. class ChannelParted(time: LocalDateTime, val user: User, val channel: String, val reason: String = "") : IrcEvent(time)
  22. /** Raised when a user quits, and is in a channel. */
  23. class ChannelQuit(time: LocalDateTime, val user: User, val channel: String, val reason: String = "") : IrcEvent(time)
  24. /** Raised when a batch of the channel's member list has been received. More batches may follow. */
  25. class ChannelNamesReceived(time: LocalDateTime, val channel: String, val names: List<String>) : IrcEvent(time)
  26. /** Raised when the entirety of the channel's member list has been received. */
  27. class ChannelNamesFinished(time: LocalDateTime, val channel: String) : IrcEvent(time)
  28. /** Raised when a message is received. */
  29. class MessageReceived(time: LocalDateTime, val user: User, val target: String, val message: String) : IrcEvent(time)
  30. /** Raised when a user quits. */
  31. class UserQuit(time: LocalDateTime, val user: User, val reason: String = "") : IrcEvent(time)
  32. /** Raised when available server capabilities are received. More batches may follow. */
  33. class ServerCapabilitiesReceived(time: LocalDateTime, val capabilities: Map<Capability, String>) : IrcEvent(time)
  34. /** Raised when our requested capabilities are acknowledged. More batches may follow. */
  35. class ServerCapabilitiesAcknowledged(time: LocalDateTime, val capabilities: Map<Capability, String>) : IrcEvent(time)
  36. /** Raised when the server has finished sending us capabilities. */
  37. class ServerCapabilitiesFinished(time: LocalDateTime) : IrcEvent(time)