您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

Events.kt 4.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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 a connection to the server is being established. */
  9. class ServerConnecting(time: LocalDateTime) : IrcEvent(time)
  10. /** Raised when the connection to the server has been established. The server will not be ready for use yet. */
  11. class ServerConnected(time: LocalDateTime) : IrcEvent(time)
  12. /** Raised when the connection to the server has ended. */
  13. class ServerDisconnected(time: LocalDateTime) : IrcEvent(time)
  14. /** Raised when the server is ready for use. */
  15. class ServerReady(time: LocalDateTime) : IrcEvent(time)
  16. /** Raised when the server initially welcomes us to the IRC network. */
  17. class ServerWelcome(time: LocalDateTime, val server: String, val localNick: String) : IrcEvent(time)
  18. /** Raised when the features supported by the server have changed. This may occur numerous times. */
  19. class ServerFeaturesUpdated(time: LocalDateTime, val serverFeatures: ServerFeatureMap) : IrcEvent(time)
  20. /** Raised whenever a PING is received from the server. */
  21. class PingReceived(time: LocalDateTime, val nonce: ByteArray) : IrcEvent(time)
  22. /** Raised when a user joins a channel. */
  23. class ChannelJoined(time: LocalDateTime, val user: User, val channel: String) : IrcEvent(time)
  24. /** Raised when a user leaves a channel. */
  25. class ChannelParted(time: LocalDateTime, val user: User, val channel: String, val reason: String = "") : IrcEvent(time)
  26. /** Raised when a user quits, and is in a channel. */
  27. class ChannelQuit(time: LocalDateTime, val user: User, val channel: String, val reason: String = "") : IrcEvent(time)
  28. /** Raised when a batch of the channel's member list has been received. More batches may follow. */
  29. class ChannelNamesReceived(time: LocalDateTime, val channel: String, val names: List<String>) : IrcEvent(time)
  30. /** Raised when the entirety of the channel's member list has been received. */
  31. class ChannelNamesFinished(time: LocalDateTime, val channel: String) : IrcEvent(time)
  32. /** Raised when a message is received. */
  33. class MessageReceived(time: LocalDateTime, val user: User, val target: String, val message: String) : IrcEvent(time)
  34. /** Raised when an action is received. */
  35. class ActionReceived(time: LocalDateTime, val user: User, val target: String, val action: String) : IrcEvent(time)
  36. /** Raised when a CTCP is received. */
  37. class CtcpReceived(time: LocalDateTime, val user: User, val target: String, val type: String, val content: String) : IrcEvent(time)
  38. /** Raised when a user quits. */
  39. class UserQuit(time: LocalDateTime, val user: User, val reason: String = "") : IrcEvent(time)
  40. /**
  41. * Raised when a user's account changes (i.e., they auth'd or deauth'd with services).
  42. *
  43. * This event is only raised if the server supports the `account-notify` capability.
  44. */
  45. class UserAccountChanged(time: LocalDateTime, val user: User, val newAccount: String?): IrcEvent(time)
  46. /** Raised when available server capabilities are received. More batches may follow. */
  47. class ServerCapabilitiesReceived(time: LocalDateTime, val capabilities: Map<Capability, String>) : IrcEvent(time)
  48. /** Raised when our requested capabilities are acknowledged. More batches may follow. */
  49. class ServerCapabilitiesAcknowledged(time: LocalDateTime, val capabilities: Map<Capability, String>) : IrcEvent(time)
  50. /** Raised when the server has finished sending us capabilities. */
  51. class ServerCapabilitiesFinished(time: LocalDateTime) : IrcEvent(time)
  52. /** Raised when a Message Of the Day has completed. */
  53. class MotdFinished(time: LocalDateTime, val missing: Boolean = false): IrcEvent(time)
  54. /**
  55. * Raised when a mode change occurs.
  56. *
  57. * If [discovered] is true then the event is in response to the server providing the full set of modes on the target,
  58. * and the given modes are thus exhaustive. Otherwise, the modes are a sequence of changes to apply to the existing
  59. * state.
  60. */
  61. class ModeChanged(time: LocalDateTime, val target: String, val modes: String, val arguments: Array<String>, val discovered: Boolean = false): IrcEvent(time)