# Sending IRC commands.

## Functions

int | irc_send_raw (irc_session_t *session, const char *format,...)
| Sends raw data to the IRC server.
int | irc_cmd_quit (irc_session_t *session, const char *reason)
| Sends QUIT command to the IRC server.
int | irc_cmd_join (irc_session_t *session, const char *channel, const char *key)
| Joins the new IRC channel.
int | irc_cmd_msg (irc_session_t *session, const char *nch, const char *text)
| Sends the message to the nick or to the channel.
int | irc_cmd_me (irc_session_t *session, const char *nch, const char *text)
| Sends the /me (CTCP ACTION) message to the nick or to the channel.
int | irc_cmd_notice (irc_session_t *session, const char *nch, const char *text)
| Sends the notice to the nick or to the channel.
int | irc_cmd_kick (irc_session_t *session, const char *nick, const char *channel, const char *reason)
| Kick some lazy ass out of channel.

## Function Documentation

int irc_cmd_join | ( | irc_session_t * | session,
|  | const char * | channel,
|  | const char * | key
| ) |

Joins the new IRC channel.

Parameters:

  | session | An initiated and connected session.
  | channel | A channel name to join to. Must not be NULL.
  | key | Channel password. May be NULL.

Returns:
  Return code 0 means success. Other value means error, the error code may be obtained through irc_errno(). Any error, generated by the IRC server, is available through event_numeric.

This function is used to JOIN the IRC channel. If the channel is not exist, it will be automatically created by the IRC server. Note that to JOIN the password-protected channel, you must know the password, and specify it in the key argument.

int irc_cmd_kick | ( | irc_session_t * | session,
|  | const char * | nick,
|  | const char * | channel,
|  | const char * | reason
| ) |

Kick some lazy ass out of channel.

Parameters:

  | session | An initiated and connected session.
  | nick | A nick to kick. Must not be NULL.
  | channel | A channel to kick this nick out of. Must not be NULL.
  | reason | A reason to kick. May be NULL.

Returns:
  Return code 0 means success. Other value means error, the error code may be obtained through irc_errno(). Any error, generated by the IRC server, is available through ::event_numeric.

This function is used to kick a person out of channel. Note that you must be a channel operator to kick anyone.

See also:
  event_numeric

int irc_cmd_me | ( | irc_session_t * | session,
|  | const char * | nch,
|  | const char * | text
| ) |

Sends the /me (CTCP ACTION) message to the nick or to the channel.

Parameters:

  | session | An initiated and connected session.
  | nch | A target nick or channel. Must not be NULL.
  | text | Action message text. Must not be NULL.

Returns:
  Return code 0 means success. Other value means error, the error code may be obtained through irc_errno(). Any error, generated by the IRC server, is available through event_numeric.

This function is used to send the /me message to channel or private. As for irc_cmd_msg, the target is determined by nch argument.

See also:
  irc_cmd_msg

irc_cmd_msg | ( | irc_session_t * | session,
|  | const char * | nch,
|  | const char * | text
| ) |

Sends the message to the nick or to the channel.

Parameters:

  | session | An initiated and connected session.
  | nch | A target nick or channel. Must not be NULL.
  | text | Message text. Must not be NULL.

Returns:
  Return code 0 means success. Other value means error, the error code may be obtained through irc_errno(). Any error, generated by the IRC server, is available through event_numeric.

This function is used to send the channel or private messages. The target is determined by nch argument: if it describes nick, this will be a private message, if a channel name - public (channel) message. Note that depending on channel modes, you may be required to join the channel to send the channel messages.

int irc_cmd_notice | ( | irc_session_t * | session,
|  | const char * | nch,
|  | const char * | text
| ) |

Sends the notice to the nick or to the channel.

Parameters:

  | session | An initiated and connected session.
  | nch | A target nick or channel. Must not be NULL.
  | text | Notice text. Must not be NULL.

Returns:
  Return code 0 means success. Other value means error, the error code may be obtained through irc_errno(). Any error, generated by the IRC server, is available through event_numeric.

This function is used to send the channel or private notices. The target is determined by nch argument: if it describes nick, this will be a private message, if a channel name - public (channel) message. Note that depending on channel modes, you may be required to join the channel to send the channel notices.

The only difference between message and notice is that, according to RFC 1459, you must not automatically reply to NOTICE messages.

See also:
  irc_cmd_msg

int irc_cmd_quit | ( | irc_session_t * | session,
|  | const char * | reason
| ) |

Sends QUIT command to the IRC server.

Parameters:

  | session | An initiated and connected session.
  | reason | A reason to quit. May be NULL.

Returns:
  Return code 0 means success. Other value means error, the error code may be obtained through irc_errno(). Any error, generated by the IRC server, is available through event_numeric.

This function sends the QUIT command to the IRC server. This command forces the IRC server to close the IRC connection, and terminate the session.

int irc_send_raw | ( | irc_session_t * | session,
|  | const char * | format,
|  |  | ...
| ) |

Sends raw data to the IRC server.

Parameters:

  | session | An initiated and connected session.
  | format | A printf-formatted string, followed by function args.

Returns:
  Return code 0 means success. Other value means error, the error code may be obtained through irc_errno(). Any error, generated by the IRC server, is available through event_numeric.

This function sends the raw data as-is to the IRC server. Use it to generate a server command, which is not (yet) provided by libirc directly.