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.

MessageBuilders.kt 1.3KB

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