Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

123456789101112131415161718
  1. package com.dmdirc.ktirc.util
  2. import com.dmdirc.ktirc.IrcClient
  3. import com.dmdirc.ktirc.sasl.toBase64
  4. import java.time.ZoneOffset
  5. internal var generateLabel: (IrcClient) -> String = ::defaultGenerateLabel
  6. internal fun defaultGenerateLabel(ircClient: IrcClient): String {
  7. val time = currentTimeProvider().toEpochSecond(ZoneOffset.UTC)
  8. val counter = ircClient.serverState.asyncResponseState.labelCounter.incrementAndGet()
  9. return ByteArray(6) {
  10. when {
  11. it < 3 -> (time shr it and 0xff).toByte()
  12. else -> (counter shr (it - 3) and 0xff).toByte()
  13. }
  14. }.toBase64()
  15. }