Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

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. }