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.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. @file:Suppress("ArrayInDataClass")
  2. package com.dmdirc.ktirc.events
  3. import com.dmdirc.ktirc.model.Capability
  4. import com.dmdirc.ktirc.model.ServerFeatureMap
  5. import com.dmdirc.ktirc.model.User
  6. sealed class IrcEvent
  7. /** Raised when the server initially welcomes us to the IRC network. */
  8. data class ServerWelcome(val localNick: String) : IrcEvent()
  9. /** Raised when the features supported by the server have changed. This may occur numerous times. */
  10. data class ServerFeaturesUpdated(val serverFeatures: ServerFeatureMap) : IrcEvent()
  11. /** Raised when the connection to the server has been established, configuration information has been received, etc. */
  12. // TODO: Implement
  13. object ServerConnected : IrcEvent()
  14. /** Raised whenever a PING is received from the server. */
  15. data class PingReceived(val nonce: ByteArray) : IrcEvent()
  16. /** Raised when a user joins a channel. */
  17. data class ChannelJoined(val user: User, val channel: String) : IrcEvent()
  18. /** Raised when a user leaves a channel. */
  19. data class ChannelParted(val user: User, val channel: String, val reason: String = "") : IrcEvent()
  20. /** Raised when a batch of the channel's member list has been received. More batches may follow. */
  21. data class ChannelNamesReceived(val channel: String, val names: List<String>) : IrcEvent()
  22. /** Raised when the entirety of the channel's member list has been received. */
  23. data class ChannelNamesFinished(val channel: String) : IrcEvent()
  24. /** Raised when a message is received. */
  25. data class MessageReceived(val user: User, val target: String, val message: String) : IrcEvent()
  26. /** Raised when a user quits. */
  27. data class UserQuit(val user: User, val reason: String = "") : IrcEvent()
  28. /** Raised when available server capabilities are received. More batches may follow. */
  29. data class ServerCapabilitiesReceived(val capabilities: Map<Capability, String>): IrcEvent()
  30. /** Raised when our requested capabilities are acknowledged. More batches may follow. */
  31. data class ServerCapabilitiesAcknowledged(val capabilities: Map<Capability, String>): IrcEvent()
  32. /** Raised when the server has finished sending us capabilities. */
  33. object ServerCapabilitiesFinished : IrcEvent()