./PaxHeaders.14530/libircclient-1.90000644000000000000000000000013212712251642013641 xustar0030 mtime=1462326178.866438743 30 atime=1462326178.858438934 30 ctime=1462326178.866438743 libircclient-1.9/0000755000175000001440000000000012712251642014040 5ustar00timusers00000000000000libircclient-1.9/PaxHeaders.14530/include0000644000000000000000000000013212712251642015127 xustar0030 mtime=1462326178.862438838 30 atime=1462326178.862438838 30 ctime=1462326178.862438838 libircclient-1.9/include/0000755000175000001440000000000012712251642015463 5ustar00timusers00000000000000libircclient-1.9/include/PaxHeaders.14530/libirc_options.h0000644000000000000000000000012411705456044020401 xustar0027 mtime=1326865444.856561 27 atime=1462326178.862438 30 ctime=1462326178.862438838 libircclient-1.9/include/libirc_options.h0000644000175000001440000000425311705456044020663 0ustar00timusers00000000000000/* * Copyright (C) 2004-2012 George Yunaev gyunaev@ulduzsoft.com * * This library is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at your * option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * License for more details. */ #ifndef INCLUDE_IRC_OPTIONS_H #define INCLUDE_IRC_OPTIONS_H #ifndef IN_INCLUDE_LIBIRC_H #error This file should not be included directly, include just libircclient.h #endif /*! * enables additional debug output * \ingroup options */ #define LIBIRC_OPTION_DEBUG (1 << 1) /*! \brief allows to strip origins automatically. * * For every IRC server event, the event origin is sent in standard form: * nick!host\@ircserver, i.e. like tim!home\@irc.freenet.org. Such origins * can not be used in IRC commands, and need to be stripped (i.e. host and * server part should be cut off) before using. This can be done either * explicitly, by calling irc_target_get_nick(), or implicitly for all the * events - by setting this option with irc_option_set(). * \ingroup options */ #define LIBIRC_OPTION_STRIPNICKS (1 << 2) /*! \brief Disables the certificate verification for SSL connections * * By default the SSL connection authenticy is ensured by verifying that the certificate * presented by the server is signed by a known trusted certificate authority. Since those * typically cost money, some IRC servers use the self-signed certificates. They provide the * benefits of the SSL connection but since they are not signed by the Certificate Authority, * their authencity cannot be verified. This option, if set, disables the certificate * verification - the library will accept any certificate presented by the server. * * This option must be set before the irc_connect function is called. * \ingroup options */ #define LIBIRC_OPTION_SSL_NO_VERIFY (1 << 3) #endif /* INCLUDE_IRC_OPTIONS_H */ libircclient-1.9/include/PaxHeaders.14530/libirc_errors.h0000644000000000000000000000012411705476523020226 xustar0027 mtime=1326873939.154689 27 atime=1462326178.862438 30 ctime=1462326178.862438838 libircclient-1.9/include/libirc_errors.h0000644000175000001440000001451111705476523020506 0ustar00timusers00000000000000/* * Copyright (C) 2004-2012 George Yunaev gyunaev@ulduzsoft.com * * This library is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at your * option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * License for more details. */ #ifndef INCLUDE_IRC_ERRORS_H #define INCLUDE_IRC_ERRORS_H #ifndef IN_INCLUDE_LIBIRC_H #error This file should not be included directly, include just libircclient.h #endif /*! brief No error * \ingroup errorcodes */ #define LIBIRC_ERR_OK 0 /*! \brief Invalid argument * * An invalid value was given for one of the arguments to a function. * For example, supplying the NULL value for \a channel argument of * irc_cmd_join() produces LIBIRC_ERR_INVAL error. You should fix the code. * * \ingroup errorcodes */ #define LIBIRC_ERR_INVAL 1 /*! \brief Could not resolve host. * * The host name supplied for irc_connect() function could not be resolved * into valid IP address. Usually means that host name is invalid. * * \ingroup errorcodes */ #define LIBIRC_ERR_RESOLV 2 /*! \brief Could not create socket. * * The new socket could not be created or made non-blocking. Usually means * that the server is out of resources, or (rarely :) a bug in libircclient. * * \ingroup errorcodes */ #define LIBIRC_ERR_SOCKET 3 /*! \brief Could not connect. * * The socket could not connect to the IRC server, or to the destination DCC * part. Usually means that either the IRC server is down or its address is * invalid. For DCC the reason usually is the firewall on your or destination * computer, which refuses DCC transfer. * * \sa irc_run irc_connect * \ingroup errorcodes */ #define LIBIRC_ERR_CONNECT 4 /*! \brief Connection closed by remote peer. * * The IRC connection was closed by the IRC server (which could mean that an * IRC operator just have banned you from the server :)), or the DCC connection * was closed by remote peer - for example, the other side just quits his mIrc. * Usually it is not an error. * * \sa irc_run irc_connect irc_dcc_callback_t * \ingroup errorcodes */ #define LIBIRC_ERR_CLOSED 5 /*! \brief Out of memory * * There are two possible reasons for this error. First is that memory could * not be allocated for libircclient use, and this error usually is fatal. * Second reason is that the command queue (which keeps command ready to be * sent to the IRC server) is full, and could not accept more commands yet. * In this case you should just wait, and repeat the command later. * * \ingroup errorcodes */ #define LIBIRC_ERR_NOMEM 6 /*! \brief Could not accept new connection * * A DCC chat/send connection from the remote peer could not be accepted. * Either the connection was just terminated before it is accepted, or there * is a bug in libircclient. * * \ingroup errorcodes */ #define LIBIRC_ERR_ACCEPT 7 /*! \brief Could not send this * * A \a filename supplied to irc_dcc_sendfile() could not be sent. Either is * is not a file (a directory or a socket, for example), or it is not readable. * * * \sa LIBIRC_ERR_OPENFILE * \ingroup errorcodes */ #define LIBIRC_ERR_NODCCSEND 9 /*! \brief Could not read DCC file or socket * * Either a DCC file could not be read (for example, was truncated during * sending), or a DCC socket returns a read error, which usually means that * the network connection is terminated. * * \ingroup errorcodes */ #define LIBIRC_ERR_READ 10 /*! \brief Could not write DCC file or socket * * Either a DCC file could not be written (for example, there is no free space * on disk), or a DCC socket returns a write error, which usually means that * the network connection is terminated. * * \ingroup errorcodes */ #define LIBIRC_ERR_WRITE 11 /*! \brief Invalid state * * The function is called when it is not allowed to be called. For example, * irc_cmd_join() was called before the connection to IRC server succeed, and * ::event_connect is called. * * \ingroup errorcodes */ #define LIBIRC_ERR_STATE 12 /*! \brief Operation timed out * * The DCC request is timed out. * There is a timer for each DCC request, which tracks connecting, accepting * and non-accepted/declined DCC requests. For every request this timer * is currently 60 seconds. If the DCC request was not connected, accepted * or declined during this time, it will be terminated with this error. * * \ingroup errorcodes */ #define LIBIRC_ERR_TIMEOUT 13 /*! \brief Could not open file for DCC send * * The file specified in irc_dcc_sendfile() could not be opened. * * \ingroup errorcodes */ #define LIBIRC_ERR_OPENFILE 14 /*! \brief IRC server connection terminated * * The connection to the IRC server was terminated - possibly, by network * error. Try to irc_connect() again. * * \ingroup errorcodes */ #define LIBIRC_ERR_TERMINATED 15 /*! \brief IPv6 not supported * * The function which requires IPv6 support was called, but the IPv6 support was not compiled * into the application * * \ingroup errorcodes */ #define LIBIRC_ERR_NOIPV6 16 /*! \brief SSL not supported * * The SSL connection was required but the library was not compiled with SSL support * * \ingroup errorcodes */ #define LIBIRC_ERR_SSL_NOT_SUPPORTED 17 /*! \brief SSL initialization failed * * The SSL connection was required but the library was not compiled with SSL support * * \ingroup errorcodes */ #define LIBIRC_ERR_SSL_INIT_FAILED 18 /*! \brief SSL connection failed * * SSL handshare failed when attempting to connect to the server. Typically this means you're trying * to use SSL but attempting to connect to a non-SSL port. * \ingroup errorcodes */ #define LIBIRC_ERR_CONNECT_SSL_FAILED 19 /*! \brief SSL certificate verify failed * * The server is using the self-signed certificate. Use LIBIRC_OPTION_SSL_NO_VERIFY option to connect to it. * \ingroup errorcodes */ #define LIBIRC_ERR_SSL_CERT_VERIFY_FAILED 20 // Internal max error value count. // If you added more errors, add them to errors.c too! #define LIBIRC_ERR_MAX 21 #endif /* INCLUDE_IRC_ERRORS_H */ libircclient-1.9/include/PaxHeaders.14530/libircclient.h0000644000000000000000000000012412712240244020015 xustar0027 mtime=1462321316.177328 27 atime=1462326178.862438 30 ctime=1462326178.862438838 libircclient-1.9/include/libircclient.h0000644000175000001440000016712412712240244020306 0ustar00timusers00000000000000/* * Copyright (C) 2004-2012 George Yunaev gyunaev@ulduzsoft.com * * This library is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at your * option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * License for more details. */ /*! * \file libircclient.h * \author George Yunaev * \version 1.9 * \date 01.2012 * \brief This file defines all prototypes and functions to use libircclient. * * libircclient is a small but powerful library, which implements client-server IRC * protocol. It is designed to be small, fast, portable and compatible to RFC * standards, and most IRC clients. libircclient features include: * - Full multi-threading support. * - Single threads handles all the IRC processing. * - Support for single-threaded applications, and socket-based applications, * which use select() * - Synchronous and asynchronous interfaces. * - CTCP support with optional build-in reply code. * - Flexible DCC support, including both DCC chat, and DCC file transfer. * - Can both initiate and react to initiated DCC. * - Can accept or decline DCC sessions asynchronously. * - Plain C interface and implementation (possible to use from C++ code, * obviously) * - Compatible with RFC 1459 and most IRC clients. * - SSL support if compiled with --enable-openssl. * - Free, licensed under LGPL license. * * Note that to use libircclient, only libircclient.h should be included into your * program. Do not include other libirc_* headers. */ #ifndef INCLUDE_LIBIRC_H #define INCLUDE_LIBIRC_H #include #if !defined (_WIN32) #include /* fd_set */ #else #include #include #if defined (ENABLE_IPV6) typedef int (WSAAPI * getaddrinfo_ptr_t) (const char *, const char* , const struct addrinfo *, struct addrinfo **); typedef void (WSAAPI * freeaddrinfo_ptr_t) (struct addrinfo*); #endif #endif #ifdef __cplusplus extern "C" { #endif /*! \brief A libircclient IRC session. * * This structure describes an IRC session. Its members are internal to * libircclient, and should not be used directly. */ typedef struct irc_session_s irc_session_t; /*! \brief A libircclient DCC session. * * This structure describes a DCC session used by libircclient. * Its members are internal to libircclient, and should not be used directly. */ typedef struct irc_dcc_session_s irc_dcc_session_t; /*! \brief A DCC session identifier. * * The irc_dcc_t type is a DCC session identifier, used to identify the * DCC sessions in callbacks and various functions. */ typedef unsigned int irc_dcc_t; /*! * \fn typedef void (*irc_dcc_callback_t) (irc_session_t * session, irc_dcc_t id, int status, void * ctx, const char * data, unsigned int length) * \brief A common DCC callback, used to inform you about the current DCC state or event. * * \param session An IRC session which generates the callback * \param id A DCC session id. * \param status An error status. 0 means no error, otherwise error code. * \param ctx A user-supplied context. * \param data Data supplied (if available) * \param length data length (if available) * * This callback is called for all DCC functions when state change occurs. * * For DCC CHAT, the callback is called in next circumstances: * - \a status is LIBIRC_ERR_CLOSED: connection is closed by remote peer. * After returning from the callback, the DCC session is automatically * destroyed. * - \a status is neither 0 nor LIBIRC_ERR_CLOSED: socket I/O error * (connect error, accept error, recv error, send error). After returning * from the callback, the DCC session is automatically destroyed. * - \a status is 0: new chat message received, \a data contains the message * (null-terminated string), \a length contains the message length. * * For DCC SEND, while file is sending, callback called in next circumstances: * - \a status is neither 0 nor LIBIRC_ERR_CLOSED: socket I/O error * (connect error, accept error, recv error, send error). After returning * from the callback, the DCC session is automatically destroyed. * - \a status is 0: new data received, \a data contains the data received, * \a length contains the amount of data received. * * For DCC RECV, while file is sending, callback called in next circumstances: * - \a status is neither 0 nor LIBIRC_ERR_CLOSED: socket I/O error * (connect error, accept error, recv error, send error). After returning * from the callback, the DCC session is automatically destroyed. * - \a status is 0, and \a data is 0: file has been received successfully. * After returning from the callback, the DCC session is automatically * destroyed. * - \a status is 0, and \a data is not 0: new data received, \a data contains * the data received, \a length contains the amount of data received. * * \ingroup dccstuff */ typedef void (*irc_dcc_callback_t) (irc_session_t * session, irc_dcc_t id, int status, void * ctx, const char * data, unsigned int length); #define IN_INCLUDE_LIBIRC_H #include "libirc_errors.h" #include "libirc_events.h" #include "libirc_options.h" #undef IN_INCLUDE_LIBIRC_H /*! * \fn irc_session_t * irc_create_session (irc_callbacks_t * callbacks) * \brief Creates and initiates a new IRC session. * * \param callbacks A structure, which defines several callbacks, which will * be called on appropriate events. Must not be NULL. * * \return An ::irc_session_t object, or 0 if creation failed. Usually, * failure is caused by out of memory error. * * Every ::irc_session_t object describes a single IRC session - a connection * to an IRC server, and possibly to some DCC clients. Almost every irc_* * function requires this object to be passed to, and therefore this function * should be called first. * * Every session created must be destroyed when it is not needed anymore * by calling irc_destroy_session(). * * The most common function sequence is: * \code * ... prepare irc_callbacks_t structure ... * irc_create_session(); * irc_connect(); * irc_run(); * irc_destroy_session(); * \endcode * * \sa irc_destroy_session * \ingroup initclose */ irc_session_t * irc_create_session (irc_callbacks_t * callbacks); /*! * \fn void irc_destroy_session (irc_session_t * session) * \brief Destroys previously created IRC session. * * \param session A session to destroy. Must not be NULL. * * This function should be used to destroy an IRC session, close the * connection to the IRC server, and free all the used resources. After * calling this function, you should not use this session object anymore. * * \ingroup initclose */ void irc_destroy_session (irc_session_t * session); /*! * \fn int irc_connect (irc_session_t * session, const char * server, unsigned short port, const char * server_password, const char * nick, const char * username, const char * realname); * \brief Initiates a connection to IRC server. * * \param session A session to initiate connections on. Must not be NULL. * \param server A domain name or an IP address of the IRC server to connect to. Cannot be NULL. * If the library is built with SSL support and the first character is hash, tries to establish the SSL connection. * For example, the connection to "irc.example.com" is assumed to be plaintext, and connection to "#irc.example.com" * is assumed to be secured by SSL. Note that SSL will only work if the library is built with the SSL support. * \param port An IRC server port, usually 6667. * \param server_password An IRC server password, if the server requires it. * May be NULL, in this case password will not be send to the * IRC server. Vast majority of IRC servers do not require passwords. * \param nick A nick, which libircclient will use to login to the IRC server. * Must not be NULL. * \param username A username of the account, which is used to connect to the * IRC server. This is for information only, will be shown in * "user properties" dialogs and returned by /whois request. * May be NULL, in this case 'nobody' will be sent as username. * \param realname A real name of the person, who connects to the IRC. Usually * people put some wide-available information here (URL, small * description or something else). This information also will * be shown in "user properties" dialogs and returned by /whois * request. May be NULL, in this case 'noname' will be sent as * username. * * \return 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 prepares and initiates a connection to the IRC server. The * connection is done asynchronously (see irc_callbacks_t::event_connect), so the success * return value means that connection was initiated (but not completed!) * successfully. * * \sa irc_run * \ingroup conndisc */ int irc_connect (irc_session_t * session, const char * server, unsigned short port, const char * server_password, const char * nick, const char * username, const char * realname); /*! * \fn int irc_connect6 (irc_session_t * session, const char * server, unsigned short port, const char * server_password, const char * nick, const char * username, const char * realname); * \brief Initiates a connection to IRC server using IPv6. * * \param session A session to initiate connections on. Must not be NULL. * \param server A domain name or an IP address of the IRC server to connect to. Cannot be NULL. * If the library is built with SSL support and the first character is hash, tries to establish the SSL connection. * For example, the connection to "irc.example.com" is assumed to be plaintext, and connection to "#irc.example.com" * is assumed to be secured by SSL. Note that SSL will only work if the library is built with the SSL support. * \param port An IRC server port, usually 6667. * \param server_password An IRC server password, if the server requires it. * May be NULL, in this case password will not be send to the * IRC server. Vast majority of IRC servers do not require passwords. * \param nick A nick, which libircclient will use to login to the IRC server. * Must not be NULL. * \param username A username of the account, which is used to connect to the * IRC server. This is for information only, will be shown in * "user properties" dialogs and returned by /whois request. * May be NULL, in this case 'nobody' will be sent as username. * \param realname A real name of the person, who connects to the IRC. Usually * people put some wide-available information here (URL, small * description or something else). This information also will * be shown in "user properties" dialogs and returned by /whois * request. May be NULL, in this case 'noname' will be sent as * username. * * \return 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 prepares and initiates a connection to the IRC server. The * connection is done asynchronously (see irc_callbacks_t::event_connect), so the success * return value means that connection was initiated (but not completed!) * successfully. * * \sa irc_run * \ingroup conndisc */ int irc_connect6 (irc_session_t * session, const char * server, unsigned short port, const char * server_password, const char * nick, const char * username, const char * realname); /*! * \fn void irc_disconnect (irc_session_t * session) * \brief Disconnects a connection to IRC server. * * \param session An IRC session. * * \return Return code 0 means success. Other value means error, the error * code may be obtained through irc_errno(). * * This function closes the IRC connection. After that connection is closed, * libircclient automatically leaves irc_run loop. * * \sa irc_connect irc_run * \ingroup conndisc */ void irc_disconnect (irc_session_t * session); /*! * \fn int irc_is_connected (irc_session_t * session) * \brief Checks whether the session is connecting/connected to the IRC server. * * \param session An initialized IRC session. * * \return Return code 1 means that session is connecting or connected to the * IRC server, zero value means that the session has been disconnected. * * \sa irc_connect irc_run * \ingroup conndisc */ int irc_is_connected (irc_session_t * session); /*! * \fn int irc_run (irc_session_t * session) * \brief Goes into forever-loop, processing IRC events and generating * callbacks. * * \param session An initiated and connected session. * * \return Return code 0 means success. Other value means error, the error * code may be obtained through irc_errno(). * * This function goes into forever loop, processing the IRC events, and * calling appropriate callbacks. This function will not return until the * server connection is terminated - either by server, or by calling * irc_cmd_quit. This function should be used, if you don't need asynchronous * request processing (i.e. your bot just reacts on the events, and doesn't * generate it asynchronously). Even in last case, you still can call irc_run, * and start the asynchronous thread in event_connect handler. See examples. * * \ingroup running */ int irc_run (irc_session_t * session); /*! * \fn int irc_add_select_descriptors (irc_session_t * session, fd_set *in_set, fd_set *out_set, int * maxfd) * \brief Adds IRC socket(s) for the descriptor set to use in select(). * * \param session An initiated and connected session. * \param in_set A FD_IN descriptor set for select() * \param out_set A FD_OUT descriptor set for select() * \param maxfd A max descriptor found. * * \return Return code 0 means success. Other value means error, the error * code may be obtained through irc_errno(). * * This function should be used when you already have a program with select() * based data processing. You prepare your descriptors, call this function * to add session's descriptor(s) into set, and then call select(). When it * returns, you should call irc_add_select_descriptors, which sends/recvs all * available data, parses received data, calls your callbacks(!), and returns. * Then you can process your sockets from set. See the example. * * \sa irc_process_select_descriptors * \ingroup running */ int irc_add_select_descriptors (irc_session_t * session, fd_set *in_set, fd_set *out_set, int * maxfd); /*! * \fn int irc_process_select_descriptors (irc_session_t * session, fd_set *in_set, fd_set *out_set) * \brief Processes the IRC socket(s), which descriptor(s) are set. * * \param session An initiated and connected session. * \param in_set A FD_IN descriptor set for select() * \param out_set A FD_OUT descriptor set for select() * * \return Return code 0 means success. Other value means error, the error * code may be obtained through irc_errno(). * * This function should be used in pair with irc_add_select_descriptors * function. See irc_add_select_descriptors description. * * \sa irc_add_select_descriptors * \ingroup running */ int irc_process_select_descriptors (irc_session_t * session, fd_set *in_set, fd_set *out_set); /*! * \fn int irc_send_raw (irc_session_t * session, const char * format, ...) * \brief Sends raw data to the IRC server. * * \param session An initiated and connected session. * \param format A printf-formatted string, followed by function args. * * \return 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. * * \ingroup ircmd_oth */ int irc_send_raw (irc_session_t * session, const char * format, ...); /*! * \fn int irc_cmd_quit (irc_session_t * session, const char * reason) * \brief Sends QUIT command to the IRC server. * * \param session An initiated and connected session. * \param reason A reason to quit. May be NULL. * * \return 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. * * \ingroup ircmd_oth */ int irc_cmd_quit (irc_session_t * session, const char * reason); /*! * \fn int irc_cmd_join (irc_session_t * session, const char * channel, const char * key) * \brief Joins the new IRC channel. * * \param session An initiated and connected session. * \param channel A channel name to join to. Must not be NULL. * \param key Channel password. May be NULL. * * \return 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 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 \a key argument. * * If join is successful, the irc_callbacks_t::event_join is called (with \a origin == * your nickname), then you are sent the channel's topic * (using ::LIBIRC_RFC_RPL_TOPIC) and the list of users who are on the * channel (using ::LIBIRC_RFC_RPL_NAMREPLY), which includes the user * joining - namely you. * * Possible error responces for this command from the RFC1459: * - ::LIBIRC_RFC_ERR_NEEDMOREPARAMS * - ::LIBIRC_RFC_ERR_BANNEDFROMCHAN * - ::LIBIRC_RFC_ERR_INVITEONLYCHAN * - ::LIBIRC_RFC_ERR_BADCHANNELKEY * - ::LIBIRC_RFC_ERR_CHANNELISFULL * - ::LIBIRC_RFC_ERR_BADCHANMASK * - ::LIBIRC_RFC_ERR_NOSUCHCHANNEL * - ::LIBIRC_RFC_ERR_TOOMANYCHANNELS * * And on success the following replies returned: * - ::LIBIRC_RFC_RPL_TOPIC * - ::LIBIRC_RFC_RPL_NAMREPLY * * \ingroup ircmd_ch */ int irc_cmd_join (irc_session_t * session, const char * channel, const char * key); /*! * \fn int irc_cmd_part (irc_session_t * session, const char * channel) * \brief Leaves the IRC channel. * * \param session An initiated and connected session. * \param channel A channel name to leave. Must not be NULL. * * \return 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 leave the IRC channel you've already joined to. * An attempt to leave the channel you aren't in results a ::LIBIRC_RFC_ERR_NOTONCHANNEL * server error. * * Possible error responces for this command from the RFC1459: * - ::LIBIRC_RFC_ERR_NEEDMOREPARAMS * - ::LIBIRC_RFC_ERR_NOSUCHCHANNEL * - ::LIBIRC_RFC_ERR_NOTONCHANNEL * * \ingroup ircmd_ch */ int irc_cmd_part (irc_session_t * session, const char * channel); /*! * \fn int irc_cmd_invite (irc_session_t * session, const char * nick, const char * channel) * \brief Invites a user to invite-only channel. * * \param session An initiated and connected session. * \param nick A nick to invite. Must not be NULL. * \param channel A channel name to invite to. Must not be NULL. * * \return 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 invite someone to invite-only channel. * "Invite-only" is a channel mode, which restricts anyone, except invided, * to join this channel. After invitation, the user could join this channel. * The user, who is invited, will receive the irc_callbacks_t::event_invite event. * Note that you must be a channel operator to INVITE the users. * * Possible error responces for this command from the RFC1459: * - ::LIBIRC_RFC_ERR_NEEDMOREPARAMS * - ::LIBIRC_RFC_ERR_NOSUCHNICK * - ::LIBIRC_RFC_ERR_NOTONCHANNEL * - ::LIBIRC_RFC_ERR_ERR_USERONCHANNEL * - ::LIBIRC_RFC_ERR_ERR_CHANOPRIVSNEEDED * * And on success one of the following replies returned: * - ::LIBIRC_RFC_RPL_INVITING * - ::LIBIRC_RFC_RPL_AWAY * * \sa irc_callbacks_t::event_invite irc_cmd_channel_mode * \ingroup ircmd_ch */ int irc_cmd_invite (irc_session_t * session, const char * nick, const char * channel); /*! * \fn int irc_cmd_names (irc_session_t * session, const char * channel) * \brief Obtains a list of users who're in channel. * * \param session An initiated and connected session. * \param channel A channel name(s) to obtain user list. Must not be NULL. * It is possible to specify more than a single channel, but * several channel names should be separated by a comma. * * \return 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 ask the IRC server for the list of the users * who're in specified channel. You can list all nicknames that are visible * to you on any channel that you can see. The list of users will be returned * using ::RPL_NAMREPLY and ::RPL_ENDOFNAMES numeric codes. * * The channel names are returned by irc_callbacks_t::event_numeric * using the following reply codes: * - ::LIBIRC_RFC_RPL_NAMREPLY * - ::LIBIRC_RFC_RPL_ENDOFNAMES * * \ingroup ircmd_ch */ int irc_cmd_names (irc_session_t * session, const char * channel); /*! * \fn int irc_cmd_list (irc_session_t * session, const char * channel) * \brief Obtains a list of active server channels with their topics. * * \param session An initiated and connected session. * \param channel A channel name(s) to list. May be NULL, in which case all the * channels will be listed. It is possible to specify more than * a single channel, but several channel names should be * separated by a comma. * * \return 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 ask the IRC server for the active (existing) * channels list. The list will be returned using ::LIBIRC_RFC_RPL_LISTSTART - * ::LIBIRC_RFC_RPL_LIST - ::LIBIRC_RFC_RPL_LISTEND sequence. * Note that "private" channels are listed (without their topics) as channel * "Prv" unless the client generating the LIST query is actually on that * channel. Likewise, secret channels are * not listed at all unless the client is a member of the channel in question. * * Possible error responces for this command from the RFC1459: * - ::LIBIRC_RFC_ERR_NOSUCHSERVER * * And the channel list is returned using the following reply codes: * - ::LIBIRC_RFC_RPL_LISTSTART * - ::LIBIRC_RFC_RPL_LISTEND * - ::LIBIRC_RFC_RPL_LIST * * \ingroup ircmd_ch */ int irc_cmd_list (irc_session_t * session, const char * channel); /*! * \fn int irc_cmd_topic (irc_session_t * session, const char * channel, const char * topic) * \brief Views or changes the channel topic. * * \param session An initiated and connected session. * \param channel A channel name to invite to. Must not be NULL. * \param topic A new topic to change. If NULL, the old topic will be * returned, and topic won't changed. * * \return 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_topic() is used to change or view the topic of a channel. * The topic for \a channel is returned if \a topic is NULL. If the \a topic * is not NULL, the topic for the \a channel will be changed. Note that, * depending on \a +t channel mode, you may be required to be a channel * operator to change the channel topic. * * If the command succeed, the IRC server will generate a ::RPL_NOTOPIC or * ::RPL_TOPIC message, containing either old or changed topic. Also the IRC * server can (but not have to) generate the non-RFC ::RPL_TOPIC_EXTRA message, * containing the nick of person, who's changed the topic, and the time of * latest topic change. * * Possible error responces for this command from the RFC1459: * - ::LIBIRC_RFC_ERR_NEEDMOREPARAMS * - ::LIBIRC_RFC_ERR_CHANOPRIVSNEEDED * - ::LIBIRC_RFC_ERR_NOTONCHANNEL * * And the topic information is returned using one of following reply codes: * - ::LIBIRC_RFC_RPL_NOTOPIC * - ::LIBIRC_RFC_RPL_TOPIC * * \sa irc_callbacks_t::event_topic irc_cmd_channel_mode * \ingroup ircmd_ch */ int irc_cmd_topic (irc_session_t * session, const char * channel, const char * topic); /*! * \fn int irc_cmd_channel_mode (irc_session_t * session, const char * channel, const char * mode) * \brief Views or changes the channel mode. * * \param session An initiated and connected session. * \param channel A channel name to invite to. Must not be NULL. * \param mode A channel mode, described below. If NULL, the channel mode is * not changed, just the old mode is returned. * * \return 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_channel_mode() is used to change or view the channel modes. * The \a channel mode is returned if the \a mode is NULL. If the \a mode * is not NULL, the mode for the \a channel will be changed. Note that, * only channel operators can change the channel modes. * * Channel mode is represended by the letters combination. Every letter has * its own meaning in channel modes. Most channel mode letters are boolean * (i.e. could only be set or reset), but a few channel mode letters accept a * parameter. All channel options 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' channel modes: * * - \a o \a nickname - gives (+o nick) or takes (-o nick) the channel * operator privileges from a \a nickname. This mode affects the * users in channel, not the channel itself. * Examples: "+o tim", "-o watson". * * - \a p - sets (+p) or resets (-p) private channel flag. * Private channels are shown in channel list as 'Prv', without the topic. * * - \a s - sets (+p) or resets (-p) secret channel flag. * Secret channels aren't shown in channel list at all. * * - \a i - sets (+i) or resets (-i) invite-only channel flag. When the flag * is set, only the people who are invited by irc_cmd_invite(), can * join this channel. * * - \a t - sets (+t) or resets (-t) topic settable by channel operator only * flag. When the flag is set, only the channel operators can change the * channel topic. * * - \a n - sets (+n) or resets (-n) the protection from the clients outside * the channel. When the \a +n mode is set, only the clients, who are in * channel, can send the messages to the channel. * * - \a m - sets (+m) or resets (-m) the moderation of the channel. When the * moderation mode is set, only channel operators and the users who have * the \a +v user mode can speak in the channel. * * - \a v \a nickname - gives (+v nick) or takes (-v nick) from user the * ability to speak on a moderated channel. * Examples: "+v tim", "-v watson". * * - \a l \a number - sets (+l 20) or removes (-l) the restriction of maximum * users in channel. When the restriction is set, and there is a number * of users in the channel, no one can join the channel anymore. * * - \a k \a key - sets (+k secret) or removes (-k) the password from the * channel. When the restriction is set, any user joining the channel * required to provide a channel key. * * - \a b \a mask - sets (+b *!*@*.mil) or removes (-b *!*@*.mil) the ban mask * on a user to keep him out of channel. Note that to remove the ban you * must specify the ban mask to remove, not just "-b". * * Note that the actual list of channel modes depends on the IRC server, and * can be bigger. If you know the popular channel 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_CHANOPRIVSNEEDED * - ::LIBIRC_RFC_ERR_NOSUCHNICK * - ::LIBIRC_RFC_ERR_NOTONCHANNEL * - ::LIBIRC_RFC_ERR_KEYSET * - ::LIBIRC_RFC_ERR_UNKNOWNMODE * - ::LIBIRC_RFC_ERR_NOSUCHCHANNEL * * And the mode information is given using following reply codes: * - ::LIBIRC_RFC_RPL_CHANNELMODEIS * - ::LIBIRC_RFC_RPL_BANLIST * - ::LIBIRC_RFC_RPL_ENDOFBANLIST * * \sa irc_cmd_topic irc_cmd_list * \ingroup ircmd_ch */ int irc_cmd_channel_mode (irc_session_t * session, const char * channel, const char * mode); /*! * \fn int irc_cmd_user_mode (irc_session_t * session, const char * mode) * \brief Views or changes your own user mode. * * \param session An initiated and connected session. * \param mode A user mode, described below. If NULL, the user mode is * not changed, just the old mode is returned. * * \return 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 \a mode is NULL. If the \a 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: * * - \a o - represents an IRC operator status. Could not be set directly (but * can be reset though), to set it use the IRC \a OPER command. * * - \a i - if set, marks a user as 'invisible' - that is, not seen by lookups * if the user is not in a channel. * * - \a w - if set, marks a user as 'receiving wallops' - special messages * generated by IRC operators using WALLOPS command. * * - \a s - if set, marks a user for receipt of server notices. * * - \a r - NON-STANDARD MODE. If set, user has been authenticated with * NICKSERV IRC service. * * - \a 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 * * \ingroup ircmd_oth */ int irc_cmd_user_mode (irc_session_t * session, const char * mode); /*! * \fn int irc_cmd_nick (irc_session_t * session, const char * newnick) * \brief Changes your nick. * * \param session An initiated and connected session. * \param newnick A new nick. Must not be NULL. * * \return 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 * * \ingroup ircmd_oth */ int irc_cmd_nick (irc_session_t * session, const char * newnick); /*! * \fn int irc_cmd_whois (irc_session_t * session, const char * nick) * \brief Queries the information about the nick. * * \param session An initiated and connected session. * \param nick A nick to query the information abour. Must not be NULL. * A comma-separated list of several nicknames may be given. * * \return 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 * * \ingroup ircmd_oth */ int irc_cmd_whois (irc_session_t * session, const char * nick); /*! * \fn irc_cmd_msg (irc_session_t * session, const char * nch, const char * text) * \brief Sends the message to the nick or to the channel. * * \param session An initiated and connected session. * \param nch A target nick or channel. Must not be NULL. * \param text Message text. Must not be NULL. * * \return 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 \a 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. * * \ingroup ircmd_msg */ int irc_cmd_msg (irc_session_t * session, const char * nch, const char * text); /*! * \fn int irc_cmd_me (irc_session_t * session, const char * nch, const char * text) * \brief Sends the /me (CTCP ACTION) message to the nick or to the channel. * * \param session An initiated and connected session. * \param nch A target nick or channel. Must not be NULL. * \param text Action message text. Must not be NULL. * * \return 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 \a 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. * * \sa irc_cmd_msg * \ingroup ircmd_msg */ int irc_cmd_me (irc_session_t * session, const char * nch, const char * text); /*! * \fn int irc_cmd_notice (irc_session_t * session, const char * nch, const char * text) * \brief Sends the notice to the nick or to the channel. * * \param session An initiated and connected session. * \param nch A target nick or channel. Must not be NULL. * \param text Notice text. Must not be NULL. * * \return 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 \a 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. * * \sa irc_cmd_msg * \ingroup ircmd_msg */ int irc_cmd_notice (irc_session_t * session, const char * nch, const char * text); /*! * \fn int irc_cmd_kick (irc_session_t * session, const char * nick, const char * channel, const char * reason) * \brief Kick some lazy ass out of channel. * * \param session An initiated and connected session. * \param nick A nick to kick. Must not be NULL. * \param channel A channel to kick this nick out of. Must not be NULL. * \param reason A reason to kick. May be NULL. * * \return 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 kick a person out of channel. Note that you must * be a channel operator to kick anyone. * * Possible error responces for this command from the RFC1459: * - ::LIBIRC_RFC_ERR_NEEDMOREPARAMS * - ::LIBIRC_RFC_ERR_BADCHANMASK * - ::LIBIRC_RFC_ERR_NOSUCHCHANNEL * - ::LIBIRC_RFC_ERR_NOTONCHANNEL * - ::LIBIRC_RFC_ERR_CHANOPRIVSNEEDED * * On success the irc_callbacks_t::event_kick event will be generated. * * \sa irc_callbacks_t::event_numeric * \ingroup ircmd_ch */ int irc_cmd_kick (irc_session_t * session, const char * nick, const char * channel, const char * reason); /*! * \fn int irc_cmd_ctcp_request (irc_session_t * session, const char * nick, const char * request) * \brief Generates a CTCP request. * * \param session An initiated and connected session. * \param nick A target nick to send request to. Must not be NULL. * \param request A request string. Must not be NULL. * * \return 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 * * \sa irc_callbacks_t::event_ctcp_rep irc_callbacks_t::event_numeric * \ingroup ctcp */ int irc_cmd_ctcp_request (irc_session_t * session, const char * nick, const char * request); /*! * \fn int irc_cmd_ctcp_reply (irc_session_t * session, const char * nick, const char * reply) * \brief Generates a reply to the CTCP request. * * \param session An initiated and connected session. * \param nick A target nick to send request to. Must not be NULL. * \param reply A reply string. Must not be NULL. * * \return 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 \c 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 * * \ingroup ctcp */ int irc_cmd_ctcp_reply (irc_session_t * session, const char * nick, const char * reply); /*! * \fn void irc_target_get_nick (const char * target, char *nick, size_t size) * \brief Gets the nick part from the target * * \param target A nick in common IRC server form like tim!root\@mycomain.com * \param nick A buffer to hold the nickname. * \param size A buffer size. If nick is longer than buffer size, it will * be truncated. * * For most events IRC server returns 'origin' (i.e. the person, who * generated this event) in i.e. "common" form, like nick!host\@domain. * However, all the irc_cmd_* functions require just a nick/ * This function parses this origin, and gets the nick, storing it into * user-provided buffer. * A buffer of size 90 should be enough for most nicks :) * * \ingroup nnparse */ void irc_target_get_nick (const char * target, char *nick, size_t size); /*! * \fn void irc_target_get_host (const char * target, char *nick, size_t size) * \brief Gets the host part from the target * * \param target A nick in common IRC server form like tim!root\@mydomain.com * \param nick A buffer to hold the nickname. * \param size A buffer size. If nick is longer than buffer size, it will * be truncated. * * For most events IRC server returns 'origin' (i.e. the person, who * generated this event) in i.e. "common" form, like nick!host\@domain. * I don't know any command, which requires host, but it may be useful :) * This function parses this origin, and gets the host, storing it into * user-provided buffer. * * \ingroup nnparse */ void irc_target_get_host (const char * target, char *nick, size_t size); /*! * \fn int irc_dcc_chat(irc_session_t * session, void * ctx, const char * nick, irc_dcc_callback_t callback, irc_dcc_t * dccid) * \brief Initiates a DCC CHAT. * * \param session An initiated and connected session. * \param ctx A user-supplied DCC session context, which will be passed to * the DCC callback function. May be NULL. * \param nick A nick to DCC CHAT with. * \param callback A DCC callback function, which will be called when * anything is said by other party. Must not be NULL. * \param dccid On success, DCC session ID will be stored in this var. * * \return 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 requests a DCC CHAT between you and other user. For * newbies, DCC chat is like private chat, but it goes directly between * two users, and bypasses IRC server. DCC CHAT request must be accepted * by other side before you can send anything. * * When the chat is accepted, terminated, or some data is received, the * callback function is called. See the details in irc_dcc_callback_t * declaration. * * 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 * * \sa irc_dcc_callback_t irc_dcc_msg * \ingroup dccstuff */ int irc_dcc_chat (irc_session_t * session, void * ctx, const char * nick, irc_dcc_callback_t callback, irc_dcc_t * dccid); /*! * \fn int irc_dcc_msg (irc_session_t * session, irc_dcc_t dccid, const char * text) * \brief Sends the message to the specific DCC CHAT * * \param session An IRC session. * \param dccid A DCC session ID, which chat request must have been accepted. * \param text Message text. Must not be NULL. * * \return Return code 0 means success. Other value means error, the error * code may be obtained through irc_errno(). * * This function is used to send the DCC CHAT messages. DCC CHAT request * must be initiated and accepted first (or just accepted, if initiated by * other side). * * \sa irc_dcc_chat * \ingroup dccstuff */ int irc_dcc_msg (irc_session_t * session, irc_dcc_t dccid, const char * text); /*! * \fn int irc_dcc_accept (irc_session_t * session, irc_dcc_t dccid, void * ctx, irc_dcc_callback_t callback) * \brief Accepts a remote DCC CHAT or DCC RECVFILE request. * * \param session An initiated and connected session. * \param dccid A DCC session ID, returned by appropriate callback. * \param ctx A user-supplied DCC session context, which will be passed * to the DCC callback function. May be NULL. * \param callback A DCC callback function, which will be called when * anything is said by other party. Must not be NULL. * * \return Return code 0 means success. Other value means error, the error * code may be obtained through irc_errno(). * * This function accepts a remote DCC request - either DCC CHAT or DCC FILE. * After the request is accepted, the supplied callback will be called, * and you can start sending messages or receiving the file. * * This function should be called only after either event_dcc_chat_req or * event_dcc_send_req events are generated, and should react to them. It is * possible not to call irc_dcc_accept or irc_dcc_decline immediately in * callback function - you may just return, and call it later. However, to * prevent memory leaks, you must call either irc_dcc_decline or * irc_dcc_accept for any incoming DCC request. * * \sa irc_dcc_decline event_dcc_chat_req event_dcc_send_req * \ingroup dccstuff */ int irc_dcc_accept (irc_session_t * session, irc_dcc_t dccid, void * ctx, irc_dcc_callback_t callback); /*! * \fn int irc_dcc_decline (irc_session_t * session, irc_dcc_t dccid) * \brief Declines a remote DCC CHAT or DCC RECVFILE request. * * \param session An initiated and connected session. * \param dccid A DCC session ID, returned by appropriate callback. * * \return Return code 0 means success. Other value means error, the error * code may be obtained through irc_errno(). * * This function declines a remote DCC request - either DCC CHAT or DCC FILE. * * This function should be called only after either event_dcc_chat_req or * event_dcc_send_req events are generated, and should react to them. It is * possible not to call irc_dcc_accept or irc_dcc_decline immediately in * callback function - you may just return, and call it later. However, to * prevent memory leaks, you must call either irc_dcc_decline or * irc_dcc_accept for any incoming DCC request. * * Do not use this function to close the accepted or initiated DCC session. * Use irc_dcc_destroy instead. * * \sa irc_dcc_accept irc_callbacks_t::event_dcc_chat_req irc_callbacks_t::event_dcc_send_req irc_dcc_destroy * \ingroup dccstuff */ int irc_dcc_decline (irc_session_t * session, irc_dcc_t dccid); /*! * \fn int irc_dcc_sendfile (irc_session_t * session, void * ctx, const char * nick, const char * filename, irc_dcc_callback_t callback, irc_dcc_t * dccid) * \brief Sends a file via DCC. * * \param session An initiated and connected session. * \param ctx A user-supplied DCC session context, which will be passed to * the DCC callback function. May be NULL. * \param nick A nick to send file via DCC to. * \param filename A file name to sent. Must be an existing file. * \param callback A DCC callback function, which will be called when * file sent operation is failed, progressed or completed. * \param dccid On success, DCC session ID will be stored in this var. * * \return 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 generates a DCC SEND request to send the file. When it is * accepted, the file is sent to the remote party, and the DCC session is * closed. The send operation progress and result can be checked in * callback. See the details in irc_dcc_callback_t declaration. * * 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 * * \sa irc_dcc_callback_t * \ingroup dccstuff */ int irc_dcc_sendfile (irc_session_t * session, void * ctx, const char * nick, const char * filename, irc_dcc_callback_t callback, irc_dcc_t * dccid); /*! * \fn int irc_dcc_destroy (irc_session_t * session, irc_dcc_t dccid) * \brief Destroys a DCC session. * * \param session An initiated and connected session. * \param dccid A DCC session ID. * * \return Return code 0 means success. Other value means error, the error * code may be obtained through irc_errno(). * * This function closes the DCC connection (if available), and destroys * the DCC session, freeing the used resources. It can be called in any * moment, even from callbacks or from different threads. * * Note that when DCC session is finished (either with success or failure), * you should not destroy it - it will be destroyed automatically. * * \ingroup dccstuff */ int irc_dcc_destroy (irc_session_t * session, irc_dcc_t dccid); /*! * \fn void irc_get_version (unsigned int * high, unsigned int * low) * \brief Obtains a libircclient version. * * \param high A pointer to receive the high version part. * \param low A pointer to receive the low version part. * * This function returns the libircclient version. You can use the version either * to check whether required options are available, or to output the version. * The preferred printf-like format string to output the version is: * * printf ("Version: %d.%02d", high, low); * * \ingroup common */ void irc_get_version (unsigned int * high, unsigned int * low); /*! * \fn void irc_set_ctx (irc_session_t * session, void * ctx) * \brief Sets the IRC session context. * * \param session An initiated session. * \param ctx A context. * * This function sets the user-defined context for this IRC session. This * context is not used by libircclient. Its purpose is to store session-specific * user data, which may be obtained later by calling irc_get_ctx(). * Note that libircclient just 'carries out' this pointer. If you allocate some * memory, and store its address in ctx (most common usage), it is your * responsibility to free it before calling irc_destroy_session(). * * \sa irc_get_ctx * \ingroup contexts */ void irc_set_ctx (irc_session_t * session, void * ctx); /*! * \fn void irc_set_ctcp_version (irc_session_t * session, const char *version) * \brief Sets the internal CTCP VERSION * * \param session an Initiated session. * \param version the version to reply * * This function sets an internal user-defined version to reply on CTCP * VERSION request. If none is given, a default one is provided. The parameter * version is copied and can be freed by the user. * * \ingroup contexts */ void irc_set_ctcp_version(irc_session_t * session, const char * version); /*! * \fn void * irc_get_ctx (irc_session_t * session) * \brief Returns the IRC session context. * * \param session An initiated session. * * This function returns the IRC session context, which was set by * irc_set_ctx(). If no context was set, this function returns NULL. * * \sa irc_set_ctx * \ingroup contexts */ void * irc_get_ctx (irc_session_t * session); /*! * \fn int irc_errno (irc_session_t * session) * \brief Returns the last error code. * * \param session An initiated session. * * This function returns the last error code associated with last operation * of this IRC session. Possible error codes are defined in libirc_errors.h * * As usual, next errno rules apply: * - irc_errno() should be called ONLY if the called function fails; * - irc_errno() doesn't return 0 if function succeed; actually, the return * value will be undefined. * - you should call irc_errno() IMMEDIATELY after function fails, before * calling any other libircclient function. * * \sa irc_strerror * \ingroup errors */ int irc_errno (irc_session_t * session); /*! * \fn const char * irc_strerror (int ircerrno) * \brief Returns the text error message associated with this error code. * * \param ircerrno A numeric error code returned by irc_errno() * * This function returns the text representation of the given error code. * * \sa irc_errno() * \ingroup errors */ const char * irc_strerror (int ircerrno); /*! * \fn void irc_option_set (irc_session_t * session, unsigned int option) * \brief Sets the libircclient option. * * \param session An initiated session. * \param option An option from libirc_options.h * * This function sets the libircclient option, changing libircclient behavior. See the * option list for the meaning for every option. * * \sa irc_option_reset * \ingroup options */ void irc_option_set (irc_session_t * session, unsigned int option); /*! * \fn void irc_option_reset (irc_session_t * session, unsigned int option) * \brief Resets the libircclient option. * * \param session An initiated session. * \param option An option from libirc_options.h * * This function removes the previously set libircclient option, changing libircclient * behavior. See the option list for the meaning for every option. * * \sa irc_option_set * \ingroup options */ void irc_option_reset (irc_session_t * session, unsigned int option); /*! * \fn char * irc_color_strip_from_mirc (const char * message) * \brief Removes all the color codes and format options. * * \param message A message from IRC * * \return Returns a new plain text message with stripped mIRC color codes. * Note that the memory for the new message is allocated using malloc(), so * you should free it using free() when it is not used anymore. If memory * allocation failed, returns 0. * * \sa irc_color_convert_from_mirc irc_color_convert_to_mirc * \ingroup colors */ char * irc_color_strip_from_mirc (const char * message); /*! * \fn char * irc_color_convert_from_mirc (const char * message) * \brief Converts all the color codes and format options to libircclient colors. * * \param message A message from IRC * * \return Returns a new message with converted mIRC color codes and format * options. See the irc_color_convert_to_mirc() help to see how the colors * are converted.\n * Note that the memory for the new message is allocated using malloc(), so * you should free it using free() when it is not used anymore. If memory * allocation failed, returns 0. * * \sa irc_color_strip_from_mirc irc_color_convert_to_mirc * \ingroup colors */ char * irc_color_convert_from_mirc (const char * message); /*! * \fn char * irc_color_convert_to_mirc (const char * message) * \brief Converts all the color codes from libircclient format to mIRC. * * \param message A message with color codes * * \return Returns a new message with converted color codes and format * options, or 0 if memory could not be allocated. Note that the memory for * the new message is allocated using malloc(), so you should free it using * free() when it is not used anymore. * * The color system of libircclient is designed to be easy to use, and * portable between different IRC clients. Every color or format option is * described using plain text commands written between square brackets. The * possible codes are: * - [B] ... [/B] - bold format mode. Everything between [B] and [/B] is written in \b bold. * - [I] ... [/I] - italic/reverse format mode. Everything between [I] and [/I] is written in \c italic, or reversed (however, because some clients are incapable of rendering italic text, most clients display this as normal text with the background and foreground colors swapped). * - [U] ... [/U] - underline format mode. Everything between [U] and [/U] is written underlined. * - [COLOR=RED] ... [/COLOR] - write the text using specified foreground color. The color is set by using the \c COLOR keyword, and equal sign followed by text color code (see below). * - [COLOR=RED/BLUE] ... [/COLOR] - write the text using specified foreground and background color. The color is set by using the \c COLOR keyword, an equal sign followed by text foreground color code, a dash and a text background color code. * * The supported text colors are: * - WHITE * - BLACK * - DARKBLUE * - DARKGREEN * - RED * - BROWN * - PURPLE * - OLIVE * - YELLOW * - GREEN * - TEAL * - CYAN * - BLUE * - MAGENTA * - DARKGRAY * - LIGHTGRAY * * Examples of color sequences: * \code * Hello, [B]Tim[/B]. * [U]Arsenal[/U] got a [COLOR=RED]red card[/COLOR] * The tree[U]s[/U] are [COLOR=GREEN/BLACK]green[/COLOR] * \endcode * * \sa irc_color_strip_from_mirc irc_color_convert_from_mirc * \ingroup colors */ char * irc_color_convert_to_mirc (const char * message); #ifdef __cplusplus } #endif #endif /* INCLUDE_LIBIRC_H */ libircclient-1.9/include/PaxHeaders.14530/libirc_events.h0000644000000000000000000000012411705455314020211 xustar0027 mtime=1326865100.635729 27 atime=1462326178.862438 30 ctime=1462326178.862438838 libircclient-1.9/include/libirc_events.h0000644000175000001440000003713311705455314020476 0ustar00timusers00000000000000/* * Copyright (C) 2004-2012 George Yunaev gyunaev@ulduzsoft.com * * This library is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at your * option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * License for more details. */ #ifndef INCLUDE_IRC_EVENTS_H #define INCLUDE_IRC_EVENTS_H #ifndef IN_INCLUDE_LIBIRC_H #error This file should not be included directly, include just libircclient.h #endif /*! * \fn typedef void (*irc_event_callback_t) (irc_session_t * session, const char * event, const char * origin, const char ** params, unsigned int count) * \brief A most common event callback * * \param session the session, which generates an event * \param event the text name of the event. Useful in case you use a single * event handler for several events simultaneously. * \param origin the originator of the event. See the note below. * \param params a list of event params. Depending on the event nature, it * could have zero or more params. The actual number of params * is specified in count. None of the params can be NULL, but * 'params' pointer itself could be NULL for some events. * \param count the total number of params supplied. * * Every event generates a callback. This callback is generated by most events. * Depending on the event nature, it can provide zero or more params. For each * event, the number of provided params is fixed, and their meaning is * described. * * Every event has origin, though the \a origin variable may be NULL, which * means that event origin is unknown. The origin usually looks like * nick!host\@ircserver, i.e. like tim!home\@irc.krasnogorsk.ru. Such origins * can not be used in IRC commands, and need to be stripped (i.e. host and * server part should be cut off) before using. This can be done either * explicitly, by calling irc_target_get_nick(), or implicitly for all the * events - by setting the #LIBIRC_OPTION_STRIPNICKS option with irc_option_set(). * * \ingroup events */ typedef void (*irc_event_callback_t) (irc_session_t * session, const char * event, const char * origin, const char ** params, unsigned int count); /*! * \fn typedef void (*irc_eventcode_callback_t) (irc_session_t * session, unsigned int event, const char * origin, const char ** params, unsigned int count) * \brief A numeric event callback * * \param session the session, which generates an event * \param event the numeric code of the event. Useful in case you use a * single event handler for several events simultaneously. * \param origin the originator of the event. See the note below. * \param params a list of event params. Depending on the event nature, it * could have zero or more params. The actual number of params * is specified in count. None of the params can be NULL, but * 'params' pointer itself could be NULL for some events. * \param count the total number of params supplied. * * Most times in reply to your actions the IRC server generates numeric * callbacks. Most of them are error codes, and some of them mark list start * and list stop markers. Every code has its own set of params; for details * you can either experiment, or read RFC 1459. * * Every event has origin, though the \a origin variable may be NULL, which * means that event origin is unknown. The origin usually looks like * nick!host\@ircserver, i.e. like tim!home\@irc.krasnogorsk.ru. Such origins * can not be used in IRC commands, and need to be stripped (i.e. host and * server part should be cut off) before using. This can be done either * explicitly, by calling irc_target_get_nick(), or implicitly for all the * events - by setting the #LIBIRC_OPTION_STRIPNICKS option with irc_option_set(). * * \ingroup events */ typedef void (*irc_eventcode_callback_t) (irc_session_t * session, unsigned int event, const char * origin, const char ** params, unsigned int count); /*! * \fn typedef void (*irc_event_dcc_chat_t) (irc_session_t * session, const char * nick, const char * addr, irc_dcc_t dccid) * \brief A remote DCC CHAT request callback * * \param session the session, which generates an event * \param nick the person who requested DCC CHAT with you. * \param addr the person's IP address in decimal-dot notation. * \param dccid an id associated with this request. Use it in calls to * irc_dcc_accept() or irc_dcc_decline(). * * This callback is called when someone requests DCC CHAT with you. In respond * you should call either irc_dcc_accept() to accept chat request, or * irc_dcc_decline() to decline chat request. * * \sa irc_dcc_accept or irc_dcc_decline * \ingroup events */ typedef void (*irc_event_dcc_chat_t) (irc_session_t * session, const char * nick, const char * addr, irc_dcc_t dccid); /*! * \fn typedef void (*irc_event_dcc_send_t) (irc_session_t * session, const char * nick, const char * addr, const char * filename, unsigned long size, irc_dcc_t dccid) * \brief A remote DCC CHAT request callback * * \param session the session, which generates an event * \param nick the person who requested DCC CHAT with you. * \param addr the person's IP address in decimal-dot notation. * \param filename the sent filename. * \param size the filename size. * \param dccid an id associated with this request. Use it in calls to * irc_dcc_accept() or irc_dcc_decline(). * * This callback is called when someone wants to send a file to you using * DCC SEND. As with chat, in respond you should call either irc_dcc_accept() * to accept this request and receive the file, or irc_dcc_decline() to * decline this request. * * \sa irc_dcc_accept or irc_dcc_decline * \ingroup events */ typedef void (*irc_event_dcc_send_t) (irc_session_t * session, const char * nick, const char * addr, const char * filename, unsigned long size, irc_dcc_t dccid); /*! \brief Event callbacks structure. * * All the communication with the IRC network is based on events. Generally * speaking, event is anything generated by someone else in the network, * or by the IRC server itself. "Someone sends you a message", "Someone * has joined the channel", "Someone has quits IRC" - all these messages * are events. * * Every event has its own event handler, which is called when the * appropriate event is received. You don't have to define all the event * handlers; define only the handlers for the events you need to intercept. * * Most event callbacks are the types of ::irc_event_callback_t. There are * also events, which generate ::irc_eventcode_callback_t, * ::irc_event_dcc_chat_t and ::irc_event_dcc_send_t callbacks. * * \ingroup events */ typedef struct { /*! * The "on_connect" event is triggered when the client successfully * connects to the server, and could send commands to the server. * No extra params supplied; \a params is 0. */ irc_event_callback_t event_connect; /*! * The "nick" event is triggered when the client receives a NICK message, * meaning that someone (including you) on a channel with the client has * changed their nickname. * * \param origin the person, who changes the nick. Note that it can be you! * \param params[0] mandatory, contains the new nick. */ irc_event_callback_t event_nick; /*! * The "quit" event is triggered upon receipt of a QUIT message, which * means that someone on a channel with the client has disconnected. * * \param origin the person, who is disconnected * \param params[0] optional, contains the reason message (user-specified). */ irc_event_callback_t event_quit; /*! * The "join" event is triggered upon receipt of a JOIN message, which * means that someone has entered a channel that the client is on. * * \param origin the person, who joins the channel. By comparing it with * your own nickname, you can check whether your JOIN * command succeed. * \param params[0] mandatory, contains the channel name. */ irc_event_callback_t event_join; /*! * The "part" event is triggered upon receipt of a PART message, which * means that someone has left a channel that the client is on. * * \param origin the person, who leaves the channel. By comparing it with * your own nickname, you can check whether your PART * command succeed. * \param params[0] mandatory, contains the channel name. * \param params[1] optional, contains the reason message (user-defined). */ irc_event_callback_t event_part; /*! * The "mode" event is triggered upon receipt of a channel MODE message, * which means that someone on a channel with the client has changed the * channel's parameters. * * \param origin the person, who changed the channel mode. * \param params[0] mandatory, contains the channel name. * \param params[1] mandatory, contains the changed channel mode, like * '+t', '-i' and so on. * \param params[2] optional, contains the mode argument (for example, a * key for +k mode, or user who got the channel operator status for * +o mode) */ irc_event_callback_t event_mode; /*! * The "umode" event is triggered upon receipt of a user MODE message, * which means that your user mode has been changed. * * \param origin the person, who changed the channel mode. * \param params[0] mandatory, contains the user changed mode, like * '+t', '-i' and so on. */ irc_event_callback_t event_umode; /*! * The "topic" event is triggered upon receipt of a TOPIC message, which * means that someone on a channel with the client has changed the * channel's topic. * * \param origin the person, who changes the channel topic. * \param params[0] mandatory, contains the channel name. * \param params[1] optional, contains the new topic. */ irc_event_callback_t event_topic; /*! * The "kick" event is triggered upon receipt of a KICK message, which * means that someone on a channel with the client (or possibly the * client itself!) has been forcibly ejected. * * \param origin the person, who kicked the poor. * \param params[0] mandatory, contains the channel name. * \param params[0] optional, contains the nick of kicked person. * \param params[1] optional, contains the kick text */ irc_event_callback_t event_kick; /*! * The "channel" event is triggered upon receipt of a PRIVMSG message * to an entire channel, which means that someone on a channel with * the client has said something aloud. Your own messages don't trigger * PRIVMSG event. * * \param origin the person, who generates the message. * \param params[0] mandatory, contains the channel name. * \param params[1] optional, contains the message text */ irc_event_callback_t event_channel; /*! * The "privmsg" event is triggered upon receipt of a PRIVMSG message * which is addressed to one or more clients, which means that someone * is sending the client a private message. * * \param origin the person, who generates the message. * \param params[0] mandatory, contains your nick. * \param params[1] optional, contains the message text */ irc_event_callback_t event_privmsg; /*! * The "notice" event is triggered upon receipt of a NOTICE message * which means that someone has sent the client a public or private * notice. According to RFC 1459, the only difference between NOTICE * and PRIVMSG is that you should NEVER automatically reply to NOTICE * messages. Unfortunately, this rule is frequently violated by IRC * servers itself - for example, NICKSERV messages require reply, and * are NOTICEs. * * \param origin the person, who generates the message. * \param params[0] mandatory, contains the target nick name. * \param params[1] optional, contains the message text */ irc_event_callback_t event_notice; /*! * The "channel_notice" event is triggered upon receipt of a NOTICE * message which means that someone has sent the client a public * notice. According to RFC 1459, the only difference between NOTICE * and PRIVMSG is that you should NEVER automatically reply to NOTICE * messages. Unfortunately, this rule is frequently violated by IRC * servers itself - for example, NICKSERV messages require reply, and * are NOTICEs. * * \param origin the person, who generates the message. * \param params[0] mandatory, contains the channel name. * \param params[1] optional, contains the message text */ irc_event_callback_t event_channel_notice; /*! * The "invite" event is triggered upon receipt of an INVITE message, * which means that someone is permitting the client's entry into a +i * channel. * * \param origin the person, who INVITEs you. * \param params[0] mandatory, contains your nick. * \param params[1] mandatory, contains the channel name you're invited into. * * \sa irc_cmd_invite irc_cmd_chanmode_invite */ irc_event_callback_t event_invite; /*! * The "ctcp" event is triggered when the client receives the CTCP * request. By default, the built-in CTCP request handler is used. The * build-in handler automatically replies on most CTCP messages, so you * will rarely need to override it. * * \param origin the person, who generates the message. * \param params[0] mandatory, the complete CTCP message, including its * arguments. * * Mirc generates PING, FINGER, VERSION, TIME and ACTION messages, * check the source code of \c libirc_event_ctcp_internal function to * see how to write your own CTCP request handler. Also you may find * useful this question in FAQ: \ref faq4 */ irc_event_callback_t event_ctcp_req; /*! * The "ctcp" event is triggered when the client receives the CTCP reply. * * \param origin the person, who generates the message. * \param params[0] mandatory, the CTCP message itself with its arguments. */ irc_event_callback_t event_ctcp_rep; /*! * The "action" event is triggered when the client receives the CTCP * ACTION message. These messages usually looks like:\n * \code * [23:32:55] * Tim gonna sleep. * \endcode * * \param origin the person, who generates the message. * \param params[0] mandatory, the ACTION message. */ irc_event_callback_t event_ctcp_action; /*! * The "unknown" event is triggered upon receipt of any number of * unclassifiable miscellaneous messages, which aren't handled by the * library. */ irc_event_callback_t event_unknown; /*! * The "numeric" event is triggered upon receipt of any numeric response * from the server. There is a lot of such responses, see the full list * here: \ref rfcnumbers. * * See the params in ::irc_eventcode_callback_t specification. */ irc_eventcode_callback_t event_numeric; /*! * The "dcc chat" event is triggered when someone requests a DCC CHAT from * you. * * See the params in ::irc_event_dcc_chat_t specification. */ irc_event_dcc_chat_t event_dcc_chat_req; /*! * The "dcc chat" event is triggered when someone wants to send a file * to you via DCC SEND request. * * See the params in ::irc_event_dcc_send_t specification. */ irc_event_dcc_send_t event_dcc_send_req; } irc_callbacks_t; #endif /* INCLUDE_IRC_EVENTS_H */ libircclient-1.9/include/PaxHeaders.14530/libirc_rfcnumeric.h0000644000000000000000000000012411707104775021046 xustar0027 mtime=1327270397.687192 27 atime=1462326178.862438 30 ctime=1462326178.862438838 libircclient-1.9/include/libirc_rfcnumeric.h0000644000175000001440000010063111707104775021325 0ustar00timusers00000000000000/* * Copyright (C) 2004-2012 George Yunaev gyunaev@ulduzsoft.com * * This library is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at your * option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * License for more details. */ /*! * \file libirc_rfcnumeric.h * \author Georgy Yunaev * \version 1.0 * \date 09.2004 * \brief This file defines RFC numeric reply codes, which should be used in * ::event_numeric callback. Every code also has a comment regarding its * arguments. */ #ifndef INCLUDE_IRC_RFCNUMERIC_H #define INCLUDE_IRC_RFCNUMERIC_H /*! \brief 001 Welcome to the Internet Relay Network \!\\@\ * * The server sends replies 001 to 004 to a user upon successful registration. * * \ingroup rfcnumbers */ #define LIBIRC_RFC_RPL_WELCOME 001 /*! \brief 002 Your host is \, running version \ * * The server sends replies 001 to 004 to a user upon successful registration. * * \ingroup rfcnumbers */ #define LIBIRC_RFC_RPL_YOURHOST 002 /*! \brief 003 This server was created \ * * The server sends replies 001 to 004 to a user upon successful registration. * * \ingroup rfcnumbers */ #define LIBIRC_RFC_RPL_CREATED 003 /*! \brief 004 \ \ \ \ * * The server sends replies 001 to 004 to a user upon successful registration. * * \ingroup rfcnumbers */ #define LIBIRC_RFC_RPL_MYINFO 004 /*! \brief 005 Try server \, port \ * * Sent by the server to a user to suggest an alternative server. This is often used when the connection is refused because the server is already full. * * \ingroup rfcnumbers */ #define LIBIRC_RFC_RPL_BOUNCE 005 /*! \brief 302 :*1\ *( * * No description available in RFC * * \ingroup rfcnumbers */ #define LIBIRC_RFC_RPL_USERHOST 302 /*! \brief 303 :*1\ *( * * No description available in RFC * * \ingroup rfcnumbers */ #define LIBIRC_RFC_RPL_ISON 303 /*! \brief 301 \ :\ * * No description available in RFC * * \ingroup rfcnumbers */ #define LIBIRC_RFC_RPL_AWAY 301 /*! \brief 305 :You are no longer marked as being away * * No description available in RFC * * \ingroup rfcnumbers */ #define LIBIRC_RFC_RPL_UNAWAY 305 /*! \brief 306 :You have been marked as being away * * These replies are used with the AWAY command (if allowed). RPL_AWAY is sent to any client sending a PRIVMSG to a client which is away. RPL_AWAY is only sent by the server to which the client is connected. Replies RPL_UNAWAY and RPL_NOWAWAY are sent when the client removes and sets an AWAY message. * * \ingroup rfcnumbers */ #define LIBIRC_RFC_RPL_NOWAWAY 306 /*! \brief 311 \ \ \ * :\ * * No description available in RFC * * \ingroup rfcnumbers */ #define LIBIRC_RFC_RPL_WHOISUSER 311 /*! \brief 312 \ \ :\ * * No description available in RFC * * \ingroup rfcnumbers */ #define LIBIRC_RFC_RPL_WHOISSERVER 312 /*! \brief 313 \ :is an IRC operator * * No description available in RFC * * \ingroup rfcnumbers */ #define LIBIRC_RFC_RPL_WHOISOPERATOR 313 /*! \brief 317 \ \ :seconds idle * * No description available in RFC * * \ingroup rfcnumbers */ #define LIBIRC_RFC_RPL_WHOISIDLE 317 /*! \brief 318 \ :End of WHOIS list * * No description available in RFC * * \ingroup rfcnumbers */ #define LIBIRC_RFC_RPL_ENDOFWHOIS 318 /*! \brief 319 " :*( ( "\@" / "+" ) \ " " )" * * No description available in RFC * * \ingroup rfcnumbers */ #define LIBIRC_RFC_RPL_WHOISCHANNELS 319 /*! \brief 314 \ \ \ * :\ * * No description available in RFC * * \ingroup rfcnumbers */ #define LIBIRC_RFC_RPL_WHOWASUSER 314 /*! \brief 369 \ :End of WHOWAS * * When replying to a WHOWAS message, a server MUST use the replies RPL_WHOWASUSER, RPL_WHOISSERVER or ERR_WASNOSUCHNICK for each nickname in the presented list. At the end of all reply batches, there MUST be RPL_ENDOFWHOWAS (even if there was only one reply and it was an error). * * \ingroup rfcnumbers */ #define LIBIRC_RFC_RPL_ENDOFWHOWAS 369 /*! \brief 322 \ \<# visible\> :\ * * No description available in RFC * * \ingroup rfcnumbers */ #define LIBIRC_RFC_RPL_LIST 322 /*! \brief 323 :End of LIST * * Replies RPL_LIST, RPL_LISTEND mark the actual replies with data and end of the server's response to a LIST command. If there are no channels available to return, only the end reply MUST be sent. * * \ingroup rfcnumbers */ #define LIBIRC_RFC_RPL_LISTEND 323 /*! \brief 325 \ \ * * No description available in RFC * * \ingroup rfcnumbers */ #define LIBIRC_RFC_RPL_UNIQOPIS 325 /*! \brief 324 \ \ \ * * No description available in RFC * * \ingroup rfcnumbers */ #define LIBIRC_RFC_RPL_CHANNELMODEIS 324 /*! \brief 331 \ :No topic is set * * No description available in RFC * * \ingroup rfcnumbers */ #define LIBIRC_RFC_RPL_NOTOPIC 331 /*! \brief 332 \ :\ * * When sending a TOPIC message to determine the channel topic, one of two replies is sent. If the topic is set, RPL_TOPIC is sent back else RPL_NOTOPIC. * * \ingroup rfcnumbers */ #define LIBIRC_RFC_RPL_TOPIC 332 /*! \brief 341 \ \ * * Returned by the server to indicate that the attempted INVITE message was successful and is being passed onto the end client. * * \ingroup rfcnumbers */ #define LIBIRC_RFC_RPL_INVITING 341 /*! \brief 342 \ :Summoning user to IRC * * Returned by a server answering a SUMMON message to indicate that it is summoning that user. * * \ingroup rfcnumbers */ #define LIBIRC_RFC_RPL_SUMMONING 342 /*! \brief 346 \ \ * * No description available in RFC * * \ingroup rfcnumbers */ #define LIBIRC_RFC_RPL_INVITELIST 346 /*! \brief 347 \ :End of channel invite list * * When listing the 'invitations masks' for a given channel, a server is required to send the list back using the RPL_INVITELIST and RPL_ENDOFINVITELIST messages. A separate RPL_INVITELIST is sent for each active mask. After the masks have been listed (or if none present) a RPL_ENDOFINVITELIST MUST be sent. * * \ingroup rfcnumbers */ #define LIBIRC_RFC_RPL_ENDOFINVITELIST 347 /*! \brief 348 \ \ * * No description available in RFC * * \ingroup rfcnumbers */ #define LIBIRC_RFC_RPL_EXCEPTLIST 348 /*! \brief 349 \ :End of channel exception list * * When listing the 'exception masks' for a given channel, a server is required to send the list back using the RPL_EXCEPTLIST and RPL_ENDOFEXCEPTLIST messages. A separate RPL_EXCEPTLIST is sent for each active mask. After the masks have been listed (or if none present) a RPL_ENDOFEXCEPTLIST MUST be sent. * * \ingroup rfcnumbers */ #define LIBIRC_RFC_RPL_ENDOFEXCEPTLIST 349 /*! \brief 351 \.\ \ :\ * * Reply by the server showing its version details. The \ is the version of the software being used (including any patchlevel revisions) and the \ is used to indicate if the server is running in "debug mode". The "comments" field may contain any comments about the version or further version details. * * \ingroup rfcnumbers */ #define LIBIRC_RFC_RPL_VERSION 351 /*! \brief 352 \ \ \ \ \ ( "H * * No description available in RFC * * \ingroup rfcnumbers */ #define LIBIRC_RFC_RPL_WHOREPLY 352 /*! \brief 315 \ :End of WHO list * * The RPL_WHOREPLY and RPL_ENDOFWHO pair are used to answer a WHO message. The RPL_WHOREPLY is only sent if there is an appropriate match to the WHO query. If there is a list of parameters supplied with a WHO message, a RPL_ENDOFWHO MUST be sent after processing each list item with \ being the item. * * \ingroup rfcnumbers */ #define LIBIRC_RFC_RPL_ENDOFWHO 315 /*! \brief 353 ( "= * * No description available in RFC * * \ingroup rfcnumbers */ #define LIBIRC_RFC_RPL_NAMREPLY 353 /*! \brief 366 \ :End of NAMES list * * To reply to a NAMES message, a reply pair consisting of RPL_NAMREPLY and RPL_ENDOFNAMES is sent by the server back to the client. If there is no channel found as in the query, then only RPL_ENDOFNAMES is returned. The exception to this is when a NAMES message is sent with no parameters and all visible channels and contents are sent back in a series of RPL_NAMEREPLY messages with a RPL_ENDOFNAMES to mark the end. * * \ingroup rfcnumbers */ #define LIBIRC_RFC_RPL_ENDOFNAMES 366 /*! \brief 364 \ \ :\ \ * * No description available in RFC * * \ingroup rfcnumbers */ #define LIBIRC_RFC_RPL_LINKS 364 /*! \brief 365 \ :End of LINKS list * * In replying to the LINKS message, a server MUST send replies back using the RPL_LINKS numeric and mark the end of the list using an RPL_ENDOFLINKS reply. * * \ingroup rfcnumbers */ #define LIBIRC_RFC_RPL_ENDOFLINKS 365 /*! \brief 367 \ \ * * No description available in RFC * * \ingroup rfcnumbers */ #define LIBIRC_RFC_RPL_BANLIST 367 /*! \brief 368 \ :End of channel ban list * * When listing the active 'bans' for a given channel, a server is required to send the list back using the RPL_BANLIST and RPL_ENDOFBANLIST messages. A separate RPL_BANLIST is sent for each active banmask. After the banmasks have been listed (or if none present) a RPL_ENDOFBANLIST MUST be sent. * * \ingroup rfcnumbers */ #define LIBIRC_RFC_RPL_ENDOFBANLIST 368 /*! \brief 371 :\ * * No description available in RFC * * \ingroup rfcnumbers */ #define LIBIRC_RFC_RPL_INFO 371 /*! \brief 374 :End of INFO list * * A server responding to an INFO message is required to send all its 'info' in a series of RPL_INFO messages with a RPL_ENDOFINFO reply to indicate the end of the replies. * * \ingroup rfcnumbers */ #define LIBIRC_RFC_RPL_ENDOFINFO 374 /*! \brief 375 :- \ Message of the day - * * No description available in RFC * * \ingroup rfcnumbers */ #define LIBIRC_RFC_RPL_MOTDSTART 375 /*! \brief 372 :- \ * * No description available in RFC * * \ingroup rfcnumbers */ #define LIBIRC_RFC_RPL_MOTD 372 /*! \brief 376 :End of MOTD command * * When responding to the MOTD message and the MOTD file is found, the file is displayed line by line, with each line no longer than 80 characters, using RPL_MOTD format replies. These MUST be surrounded by a RPL_MOTDSTART (before the RPL_MOTDs) and an RPL_ENDOFMOTD (after). * * \ingroup rfcnumbers */ #define LIBIRC_RFC_RPL_ENDOFMOTD 376 /*! \brief 381 :You are now an IRC operator * * RPL_YOUREOPER is sent back to a client which has just successfully issued an OPER message and gained operator status. * * \ingroup rfcnumbers */ #define LIBIRC_RFC_RPL_YOUREOPER 381 /*! \brief 382 \ :Rehashing * * If the REHASH option is used and an operator sends a REHASH message, an RPL_REHASHING is sent back to the operator. * * \ingroup rfcnumbers */ #define LIBIRC_RFC_RPL_REHASHING 382 /*! \brief 383 You are service \ * * Sent by the server to a service upon successful registration. * * \ingroup rfcnumbers */ #define LIBIRC_RFC_RPL_YOURESERVICE 383 /*! \brief 391 \ :\ * * When replying to the TIME message, a server MUST send the reply using the RPL_TIME format above. The string showing the time need only contain the correct day and time there. There is no further requirement for the time string. * * \ingroup rfcnumbers */ #define LIBIRC_RFC_RPL_TIME 391 /*! \brief 392 :UserID Terminal Host * * No description available in RFC * * \ingroup rfcnumbers */ #define LIBIRC_RFC_RPL_USERSSTART 392 /*! \brief 393 :\ \ \ * * No description available in RFC * * \ingroup rfcnumbers */ #define LIBIRC_RFC_RPL_USERS 393 /*! \brief 394 :End of users * * No description available in RFC * * \ingroup rfcnumbers */ #define LIBIRC_RFC_RPL_ENDOFUSERS 394 /*! \brief 395 :Nobody logged in * * If the USERS message is handled by a server, the replies RPL_USERSTART, RPL_USERS, RPL_ENDOFUSERS and RPL_NOUSERS are used. RPL_USERSSTART MUST be sent first, following by either a sequence of RPL_USERS or a single RPL_NOUSER. Following this is RPL_ENDOFUSERS. * * \ingroup rfcnumbers */ #define LIBIRC_RFC_RPL_NOUSERS 395 /*! \brief 200 Link \ \ \ V\ \ \ \ * * No description available in RFC * * \ingroup rfcnumbers */ #define LIBIRC_RFC_RPL_TRACELINK 200 /*! \brief 201 Try. \ \ * * No description available in RFC * * \ingroup rfcnumbers */ #define LIBIRC_RFC_RPL_TRACECONNECTING 201 /*! \brief 202 H.S. \ \ * * No description available in RFC * * \ingroup rfcnumbers */ #define LIBIRC_RFC_RPL_TRACEHANDSHAKE 202 /*! \brief 203 ???? \ [\] * * No description available in RFC * * \ingroup rfcnumbers */ #define LIBIRC_RFC_RPL_TRACEUNKNOWN 203 /*! \brief 204 Oper \ \ * * No description available in RFC * * \ingroup rfcnumbers */ #define LIBIRC_RFC_RPL_TRACEOPERATOR 204 /*! \brief 205 User \ \ * * No description available in RFC * * \ingroup rfcnumbers */ #define LIBIRC_RFC_RPL_TRACEUSER 205 /*! \brief 206 Serv \ \S \C \ \\@\ V\ * * No description available in RFC * * \ingroup rfcnumbers */ #define LIBIRC_RFC_RPL_TRACESERVER 206 /*! \brief 207 Service \ \ \ \ * * No description available in RFC * * \ingroup rfcnumbers */ #define LIBIRC_RFC_RPL_TRACESERVICE 207 /*! \brief 208 \ 0 \ * * No description available in RFC * * \ingroup rfcnumbers */ #define LIBIRC_RFC_RPL_TRACENEWTYPE 208 /*! \brief 209 Class \ \ * * No description available in RFC * * \ingroup rfcnumbers */ #define LIBIRC_RFC_RPL_TRACECLASS 209 /*! \brief 261 File \ \ * * No description available in RFC * * \ingroup rfcnumbers */ #define LIBIRC_RFC_RPL_TRACELOG 261 /*! \brief 262 \ \ :End of TRACE * * The RPL_TRACE* are all returned by the server in response to the TRACE message. How many are returned is dependent on the TRACE message and whether it was sent by an operator or not. There is no predefined order for which occurs first. Replies RPL_TRACEUNKNOWN, RPL_TRACECONNECTING and RPL_TRACEHANDSHAKE are all used for connections which have not been fully established and are either unknown, still attempting to connect or in the process of completing the 'server handshake'. RPL_TRACELINK is sent by any server which handles a TRACE message and has to pass it on to another server. The list of RPL_TRACELINKs sent in response to a TRACE command traversing the IRC network should reflect the actual connectivity of the servers themselves along that path. RPL_TRACENEWTYPE is to be used for any connection which does not fit in the other categories but is being displayed anyway. RPL_TRACEEND is sent to indicate the end of the list. * * \ingroup rfcnumbers */ #define LIBIRC_RFC_RPL_TRACEEND 262 /*! \brief 211 \ \ \ \ \ \ \