IRC commands: other stuff.(3)

NAME
IRC commands: other stuff. -

  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_user_mode (irc_session_t *session, const char *mode)
Views or changes your own user mode.
int irc_cmd_nick (irc_session_t *session, const char *newnick)
Changes your nick.
int irc_cmd_whois (irc_session_t *session, const char *nick)
Queries the information about the nick.

Function Documentation

  int irc_cmd_nick (irc_session_t * session, const char * newnick)

Changes your nick.

Parameters:
    session An initiated and connected session.
    newnick A new nick. 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 change your current nick to another nick. Note that such a change is not always possible; for example you cannot change nick to the existing nick, or (on some servers) to the registered nick.

Possible error responces for this command from the RFC1459:

•   LIBIRC_RFC_ERR_NONICKNAMEGIVEN

•   LIBIRC_RFC_ERR_ERRONEUSNICKNAME

•   LIBIRC_RFC_ERR_NICKNAMEINUSE

•   LIBIRC_RFC_ERR_NICKCOLLISION

  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 irc_callbacks_t::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_cmd_user_mode (irc_session_t * session, const char * mode)

Views or changes your own user mode.

Parameters:
    session An initiated and connected session.
    mode A user mode, described below. If NULL, the user mode is not changed, just the old mode is returned.

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.

The irc_cmd_user_mode() is used to change or view the user modes. Note that, unlike channel modes, not all user modes can be changed. The user mode is returned if the mode is NULL. If the mode is not NULL, the mode for you will be changed, and new mode will be returned.

Like channel mode, user mode is also represended by the letters combination. All the user mode letters are boolean (i.e. could only be set or reset), they are set by adding a plus sign before the letter, and reset by adding a minus sign before the letter.

Here is the list of 'standard' user modes:

•   o - represents an IRC operator status. Could not be set directly (but can be reset though), to set it use the IRC OPER command.

•   i - if set, marks a user as 'invisible' - that is, not seen by lookups if the user is not in a channel.

•   w - if set, marks a user as 'receiving wallops' - special messages generated by IRC operators using WALLOPS command.

•   s - if set, marks a user for receipt of server notices.

•   r - NON-STANDARD MODE. If set, user has been authenticated with NICKSERV IRC service.

•   x - NON-STANDARD MODE. If set, user's real IP is hidden by IRC servers, to prevent scriptkiddies to do nasty things to the user's computer.

Note that the actual list of user modes depends on the IRC server, and can be bigger. If you know the popular user modes, which aren't mentioned here - please contact me at tim@krasnogorsk.ru

Possible error responces for this command from the RFC1459:

•   LIBIRC_RFC_ERR_NEEDMOREPARAMS

•   LIBIRC_RFC_ERR_NOSUCHNICK

•   LIBIRC_RFC_ERR_UNKNOWNMODE

•   LIBIRC_RFC_ERR_USERSDONTMATCH

•   LIBIRC_RFC_ERR_UMODEUNKNOWNFLAG

And the mode information is given using reply code LIBIRC_RFC_RPL_UMODEIS

  int irc_cmd_whois (irc_session_t * session, const char * nick)

Queries the information about the nick.

Parameters:
    session An initiated and connected session.
    nick A nick to query the information abour. Must not be NULL. A comma-separated list of several nicknames may be given.

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 queries various information about the nick: username, real name, the IRC server used, the channels user is in, idle time, away mode and so on.

Possible error responces for this command from the RFC1459:

•   LIBIRC_RFC_ERR_NOSUCHSERVER

•   LIBIRC_RFC_ERR_NOSUCHNICK

•   LIBIRC_RFC_ERR_NONICKNAMEGIVEN

And the information is returned using the following reply codes. The whois query is completed when LIBIRC_RFC_RPL_ENDOFWHOIS message is received.

•   LIBIRC_RFC_RPL_WHOISUSER

•   LIBIRC_RFC_RPL_WHOISCHANNELS

•   LIBIRC_RFC_RPL_WHOISSERVER

•   LIBIRC_RFC_RPL_AWAY

•   LIBIRC_RFC_RPL_WHOISOPERATOR

•   LIBIRC_RFC_RPL_WHOISIDLE

•   LIBIRC_RFC_RPL_ENDOFWHOIS

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