選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

AsyncResponseHandler.kt 692B

123456789101112131415161718192021
  1. package com.dmdirc.ktirc.events.handlers
  2. import com.dmdirc.ktirc.IrcClient
  3. import com.dmdirc.ktirc.events.IrcEvent
  4. import kotlinx.coroutines.CoroutineScope
  5. import kotlinx.coroutines.GlobalScope
  6. import kotlinx.coroutines.launch
  7. internal class AsyncResponseHandler(private val scope: CoroutineScope = GlobalScope) : EventHandler {
  8. override fun processEvent(client: IrcClient, event: IrcEvent) {
  9. client.serverState.asyncResponseState.pendingResponses.values
  10. .filter { it.second(event) }
  11. .forEach {
  12. scope.launch {
  13. it.first.send(event)
  14. }
  15. }
  16. }
  17. }