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.

ChannelStateHandler.kt 720B

12345678910111213141516171819202122232425
  1. package com.dmdirc.ktirc.events
  2. import com.dmdirc.ktirc.IrcClient
  3. import com.dmdirc.ktirc.model.ChannelState
  4. import com.dmdirc.ktirc.util.logger
  5. class ChannelStateHandler : EventHandler {
  6. private val log by logger()
  7. override suspend fun processEvent(client: IrcClient, event: IrcEvent) {
  8. when (event) {
  9. is ChannelJoined -> handleJoin(client, event)
  10. }
  11. }
  12. private fun handleJoin(client: IrcClient, event: ChannelJoined) {
  13. if (client.isLocalUser(event.user)) {
  14. log.info { "Joined new channel: ${event.channel}" }
  15. client.channelState += ChannelState(event.channel)
  16. }
  17. // TODO: Add user to channel
  18. }
  19. }