Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

MessageBuilders.kt 1.4KB

12345678910111213141516171819202122
  1. package com.dmdirc.ktirc.messages
  2. import com.dmdirc.ktirc.IrcClient
  3. /** Sends a message to ask the server to list capabilities. */
  4. internal fun IrcClient.sendCapabilityList() = send("CAP LS 302")
  5. /** Sends a message indicating the end of capability negotiation. */
  6. internal fun IrcClient.sendCapabilityEnd() = send("CAP END")
  7. /** Sends a message requesting the specified caps are enabled. */
  8. internal fun IrcClient.sendCapabilityRequest(capabilities: List<String>) = send("CAP REQ :${capabilities.joinToString(" ")}")
  9. /** Sends a request to join the given channel. */
  10. fun IrcClient.sendJoin(channel: String) = send("JOIN :$channel")
  11. /** Sends a request to change to the given nickname. */
  12. fun IrcClient.sendNickChange(nick: String) = send("NICK :$nick")
  13. /** Sends the connection password to the server. */
  14. internal fun IrcClient.sendPassword(password: String) = send("PASS :$password")
  15. /** Sends a response to a PING event. */
  16. internal fun IrcClient.sendPong(nonce: ByteArray) = send("PONG :${String(nonce)}")
  17. /** Sends a private message to a user or channel. */
  18. fun IrcClient.sendMessage(target: String, message: String) = send("PRIVMSG $target :$message")
  19. /** Sends a message to register a user with the server. */
  20. internal fun IrcClient.sendUser(userName: String, localHostName: String, serverHostName: String, realName: String) = send("USER $userName $localHostName $serverHostName :$realName")