Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

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