# IRC commands: sending messages/notices.

## Functions

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.

## Function Documentation

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 irc_callbacks_t::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.

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

On success there is NOTHING generated. However, a LIBIRC_RFC_RPL_AWAY reply can be also generated.

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 irc_callbacks_t::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.

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

On success there is NOTHING generated.

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 irc_callbacks_t::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.

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

On success there is NOTHING generated. On notices sent to target nick, a LIBIRC_RFC_RPL_AWAY reply may be generated.

See also:
  irc_cmd_msg