Messages, notices and CTCP

Contents

irc_cmd_msg

This function is used to send the channel or private messages. The target may be a nick name (in which case this will be a private message) or a channel name, in which case this will be a channel (public) message. Note that depending on channel mode you may be required to join the channel to send the channel messages.
Prototype:

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

Parameters:

session The IRC session which is initiated and connected
nch A target nick OR channel.
text The message text

Return value:
Return code 0 means the command was sent to the IRC server successfully. This does not mean the operation succeed, and the server typically only replies with an error (via event_numeric) if the message was not sent.


irc_cmd_me

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.

Prototype:

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

Parameters:

session The IRC session which is initiated and connected
nch A target nick OR channel.
text The message text

Return value:
Return code 0 means the command was sent to the IRC server successfully. This does not mean the operation succeed, and the server typically only replies with an error (via event_numeric) if the message was not sent.


irc_cmd_notice

This function is used to send the channel or private notices. As for irc_cmd_msg, the target is determined by nch argument. The only difference between message and notice is that, according to RFC 1459, you must not automatically reply to NOTICE messages.

Prototype:

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

Parameters:

session The IRC session which is initiated and connected
nch A target nick OR channel.
text The message text

Return value:
Return code 0 means the command was sent to the IRC server successfully. This does not mean the operation succeed, and the server typically only replies with an error (via event_numeric) if the message was not sent.


irc_cmd_ctcp_request

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 event_ctcp_rep callback; make sure you defined it.

Prototype:

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

Parameters:

session The IRC session which is initiated and connected
nick A target nick to send request to
request The request message

Return value:
Return code 0 means the command was sent to the IRC server successfully. This does not mean the operation succeed, and you need to wait for the appropriate event by watching the event_numeric.


irc_cmd_ctcp_reply

This function is used to respond to the CTCP request received via the event_ctcp_req callback.
Prototype:

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

Parameters:

session The IRC session which is initiated and connected
nick A target nick to send request to
response The response message

Return value:
Return code 0 means the command was sent to the IRC server successfully. This does not mean the operation succeed, and you need to wait for the appropriate event by watching the event_numeric.