# CTCP requests and replies.

## Functions

int | irc_cmd_ctcp_request (irc_session_t *session, const char *nick, const char *request)
| Generates a CTCP request.
int | irc_cmd_ctcp_reply (irc_session_t *session, const char *nick, const char *reply)
| Generates a reply to the CTCP request.

## Function Documentation

int irc_cmd_ctcp_reply | ( | irc_session_t * | session,
|  | const char * | nick,
|  | const char * | reply |
| ) |  |  |

Generates a reply to the CTCP request.

Parameters:

  | session | An initiated and connected session.
  | nick | A target nick to send request to. Must not be NULL.
  | reply | A reply string. 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 irc_callbacks_t::event_numeric.

This function is used to send a reply to the CTCP request, generated by irc_callbacks_t::event_ctcp_req. Note that you will not receive this event unless you specify your own handler as `event_ctcp_req` callback during the IRC session initialization.

Possible error responces for this command from the RFC1459:

- LIBIRC_RFC_ERR_NORECIPIENT
- LIBIRC_RFC_ERR_NOTEXTTOSEND
- LIBIRC_RFC_ERR_CANNOTSENDTOCHAN
- LIBIRC_RFC_ERR_NOTONCHANNEL
- LIBIRC_RFC_ERR_NOTOPLEVEL
- LIBIRC_RFC_ERR_WILDTOPLEVEL
- LIBIRC_RFC_ERR_TOOMANYTARGETS
- LIBIRC_RFC_ERR_NOSUCHNICK

int irc_cmd_ctcp_request | ( | irc_session_t * | session,
|  | const char * | nick,
|  | const char * | request |
| ) |  |  |

Generates a CTCP request.

Parameters:

  | session | An initiated and connected session.
  | nick | A target nick to send request to. Must not be NULL.
  | request | A request string. 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 irc_callbacks_t::event_numeric.

This function is used to send a CTCP request. There are four CTCP requests supported by Mirc: VERSION - get the client software name and version FINGER - get the client username, host and real name. PING - get the client delay. TIME - get the client local time.

A reply to the CTCP request will be sent by the irc_callbacks_t::event_ctcp_rep callback; be sure to define it.

Possible error responces for this command from the RFC1459:

- LIBIRC_RFC_ERR_NORECIPIENT
- LIBIRC_RFC_ERR_NOTEXTTOSEND
- LIBIRC_RFC_ERR_CANNOTSENDTOCHAN
- LIBIRC_RFC_ERR_NOTONCHANNEL
- LIBIRC_RFC_ERR_NOTOPLEVEL
- LIBIRC_RFC_ERR_WILDTOPLEVEL
- LIBIRC_RFC_ERR_TOOMANYTARGETS
- LIBIRC_RFC_ERR_NOSUCHNICK

See also:
  irc_callbacks_t::event_ctcp_rep irc_callbacks_t::event_numeric