You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

InternalMessageBuilders.kt 1.1KB

12345678910111213141516171819202122232425
  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: Collection<String>) =
  9. send("CAP", "REQ", capabilities.joinToString(" "))
  10. /** Sends the connection password to the server. */
  11. internal fun IrcClient.sendPassword(password: String) = send("PASS", password)
  12. /** Sends a response to a PING event. */
  13. internal fun IrcClient.sendPong(nonce: ByteArray) = send("PONG", String(nonce))
  14. /** Sends a message to register a user with the server. */
  15. internal fun IrcClient.sendUser(userName: String, realName: String) = send("USER", userName, "0", "*", realName)
  16. /** Starts an authentication request. */
  17. internal fun IrcClient.sendAuthenticationMessage(data: String = "+") = send("AUTHENTICATE", data)