libirc_doc.h   libirc_doc.h 
skipping to change at line 14 skipping to change at line 14
* This library is free software; you can redistribute it and/or modify it * 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 * under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2 of the License, or (at yo ur * the Free Software Foundation; either version 2 of the License, or (at yo ur
* option) any later version. * option) any later version.
* *
* This library is distributed in the hope that it will be useful, but WITH OUT * This library is distributed in the hope that it will be useful, but WITH OUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details. * License for more details.
* *
* $Id: libirc_doc.h,v 1.1.1.1 2004/09/08 11:49:16 gyunaev Exp $ * $Id: libirc_doc.h,v 1.3 2004/10/10 16:16:15 gyunaev Exp $
*/ */
/*! /*!
* \file libirc_doc.h * \file libirc_doc.h
* \author Georgy Yunaev * \author Georgy Yunaev
* \version 1.0 * \version 1.0
* \date 09.2004 * \date 09.2004
* \brief This file contains Doxygen modules. * \brief This file contains Doxygen modules.
*/ */
skipping to change at line 47 skipping to change at line 47
* - CTCP support with optional build-in reply code. * - CTCP support with optional build-in reply code.
* - Flexible DCC support, including both DCC chat, and DCC file transfer. * - Flexible DCC support, including both DCC chat, and DCC file transfer.
* - Can both initiate and react to initiated DCC. * - Can both initiate and react to initiated DCC.
* - Can accept or decline DCC sessions asynchronously. * - Can accept or decline DCC sessions asynchronously.
* - Plain C interface and implementation (possible to use from C++ code, * - Plain C interface and implementation (possible to use from C++ code,
* obviously) * obviously)
* - Compatible with RFC 1459 and most IRC clients. * - Compatible with RFC 1459 and most IRC clients.
* - Free, licensed under LGPL license. * - Free, licensed under LGPL license.
* - Good documentation and examples available. * - Good documentation and examples available.
* *
* \section install_sec Compilation * \section install_sec Compilation on Unix
* *
* To compile libircclient, unpack the distribution, and do the standard ma ntra: * To compile libircclient, unpack the distribution, and do the standard ma ntra:
* \code * \code
* # ./configure * # ./configure
* # make * # make
* # make install * # make install
* \endcode * \endcode
* *
* \section install_secw Compilation under MS Windows
*
* To compile libircclient under MS Windows:
* - open the src/win32/libircclient.dsw file;
* - select the appropriate library linkage (static or dynamic), and
* debug/release version;
* - do 'Make build'
*
* You can also build the example using spammer.dsp project file. Here you
* can see how to integrate libircclient into your own project.
*
* \section doc Documentation * \section doc Documentation
* *
* Documentation is not installed with \a make \a install; you should copy it * Documentation is not installed with \a make \a install; you should copy it
* somewhere by hand. * somewhere by hand.
* There is html documentation (in \a doc/html) and manual pages (\a doc/ma n). * There is html documentation (in \a doc/html) and manual pages (\a doc/ma n).
* It is also recommended to check the \a examples directory, there are a * It is also recommended to check the \a examples directory, there are a
* few examples, they'll help you. * few examples, they'll help you.
* *
* \section author Author, copyright, support. * \section author Author, copyright, support.
* *
skipping to change at line 84 skipping to change at line 95
* option) any later version. * option) any later version.
* *
* This library is distributed in the hope that it will be useful, but WITH OUT * This library is distributed in the hope that it will be useful, but WITH OUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details. * License for more details.
* *
*/ */
/*! /*!
* \defgroup initclose Initiating and destroying IRC session * \defgroup initclose Initiating and destroying IRC session.
*/ */
/*! /*!
* \defgroup conndisc Connecting, disconnecting from IRC server * \defgroup conndisc Connecting, disconnecting from IRC server.
*/ */
/*! /*!
* \defgroup running Running IRC session. * \defgroup running Running IRC session.
*/ */
/*! /*!
* \defgroup sendcmds Sending IRC commands. * \defgroup ircmd_ch IRC commands: channel management.
*/
/*!
* \defgroup ircmd_msg IRC commands: sending messages/notices.
*/
/*!
* \defgroup ircmd_oth IRC commands: other stuff.
*/ */
/*! /*!
* \defgroup ctcp CTCP requests and replies. * \defgroup ctcp CTCP requests and replies.
*/ */
/*! /*!
* \defgroup nnparse Nickname parsing. * \defgroup nnparse Nickname parsing.
*/ */
skipping to change at line 120 skipping to change at line 139
/*! /*!
* \defgroup events Handling IRC events. * \defgroup events Handling IRC events.
*/ */
/*! /*!
* \defgroup errors Obtaining error values and descriptions. * \defgroup errors Obtaining error values and descriptions.
*/ */
/*! /*!
* \defgroup errorcodes Error codes generated by libircclient.
*/
/*!
* \defgroup contexts Managing contexts. * \defgroup contexts Managing contexts.
*/ */
/*! /*!
* \defgroup common Getting libircclient version. * \defgroup common Getting libircclient version.
*/ */
/*! /*!
* \defgroup options Managing libircclient options. * \defgroup options Managing libircclient options.
*/ */
/*!
* \defgroup rfcnumbers Numeric reply codes from RFC1459
*/
/*!
* \defgroup colors Messages colors manipulation
*/
 End of changes. 8 change blocks. 
5 lines changed or deleted 28 lines changed or added


 libirc_errors.h   libirc_errors.h 
skipping to change at line 14 skipping to change at line 14
* This library is free software; you can redistribute it and/or modify it * 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 * under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2 of the License, or (at yo ur * the Free Software Foundation; either version 2 of the License, or (at yo ur
* option) any later version. * option) any later version.
* *
* This library is distributed in the hope that it will be useful, but WITH OUT * This library is distributed in the hope that it will be useful, but WITH OUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details. * License for more details.
* *
* $Id: libirc_errors.h,v 1.1.1.1 2004/09/08 11:49:17 gyunaev Exp $ * $Id: libirc_errors.h,v 1.2 2004/10/04 10:34:57 gyunaev Exp $
*/ */
/*! /*!
* \file libirc_errors.h * \file libirc_errors.h
* \author Georgy Yunaev * \author Georgy Yunaev
* \version 1.0 * \version 1.0
* \date 09.2004 * \date 09.2004
* \brief This file defines error codes generated by libircclient. * \brief This file defines error codes generated by libircclient.
*/ */
#ifndef INCLUDE_IRC_ERRORS_H #ifndef INCLUDE_IRC_ERRORS_H
#define INCLUDE_IRC_ERRORS_H #define INCLUDE_IRC_ERRORS_H
#ifndef IN_INCLUDE_LIBIRC_H #ifndef IN_INCLUDE_LIBIRC_H
#error This file should not be included directly, include just libir cclient.h #error This file should not be included directly, include just libir cclient.h
#endif #endif
/*! brief No error
* \ingroup errorcodes
*/
#define LIBIRC_ERR_OK 0 #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 #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 #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 #define LIBIRC_ERR_SOCKET 3
/*! \brief Could not connect.
*
* The socket could not connect to the IRC server, or to the destination DC
C
* 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 destinati
on
* computer, which refuses DCC transfer.
*
* \sa irc_run irc_connect
* \ingroup errorcodes
*/
#define LIBIRC_ERR_CONNECT 4 #define LIBIRC_ERR_CONNECT 4
/*! \brief Connection closed by remote peer.
*
* The IRC connection was closed by the IRC server (which could mean that a
n
* IRC operator just have banned you from the server :)), or the DCC connec
tion
* was closed by remote peer - for example, the other side just quits his m
Irc.
* Usually it is not an error.
*
* \sa irc_run irc_connect irc_dcc_callback_t
* \ingroup errorcodes
*/
#define LIBIRC_ERR_CLOSED 5 #define LIBIRC_ERR_CLOSED 5
/*! \brief Out of memory
*
* There are two possible reasons for this error. First is that memory coul
d
* 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 #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 ther
e
* is a bug in libircclient.
*
* \ingroup errorcodes
*/
#define LIBIRC_ERR_ACCEPT 7 #define LIBIRC_ERR_ACCEPT 7
#define LIBIRC_ERR_NOTFOUND 8
/*! \brief Could not send this
*
* A \a filename supplied to irc_dcc_sendfile() could not be sent. Either i
s
* is not a file (a directory or a socket, for example), or it is not reada
ble. *
*
* \sa LIBIRC_ERR_OPENFILE
* \ingroup errorcodes
*/
#define LIBIRC_ERR_NODCCSEND 9 #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 #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 sp
ace
* on disk), or a DCC socket returns a write error, which usually means tha
t
* the network connection is terminated.
*
* \ingroup errorcodes
*/
#define LIBIRC_ERR_WRITE 11 #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, a
nd
* ::event_connect is called.
*
* \ingroup errorcodes
*/
#define LIBIRC_ERR_STATE 12 #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, acceptin
g
* 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 #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 #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 #define LIBIRC_ERR_TERMINATED 15
/*! brief Internal max error value count
*/
#define LIBIRC_ERR_MAX 16 #define LIBIRC_ERR_MAX 16
#endif /* INCLUDE_IRC_ERRORS_H */ #endif /* INCLUDE_IRC_ERRORS_H */
 End of changes. 17 change blocks. 
2 lines changed or deleted 149 lines changed or added


 libirc_events.h   libirc_events.h 
skipping to change at line 14 skipping to change at line 14
* This library is free software; you can redistribute it and/or modify it * 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 * under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2 of the License, or (at yo ur * the Free Software Foundation; either version 2 of the License, or (at yo ur
* option) any later version. * option) any later version.
* *
* This library is distributed in the hope that it will be useful, but WITH OUT * This library is distributed in the hope that it will be useful, but WITH OUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details. * License for more details.
* *
* $Id: libirc_events.h,v 1.1.1.1 2004/09/08 11:49:16 gyunaev Exp $ * $Id: libirc_events.h,v 1.4 2004/10/07 18:18:36 gyunaev Exp $
*/ */
/*! /*!
* \file libirc_events.h * \file libirc_events.h
* \author Georgy Yunaev * \author Georgy Yunaev
* \version 1.0 * \version 1.0
* \date 09.2004 * \date 09.2004
* \brief Describes event callbacks generated by libircclient. * \brief Describes event callbacks generated by libircclient.
* *
* This file should not be included directly. Include libircclient.h instea d. * This file should not be included directly. Include libircclient.h instea d.
skipping to change at line 207 skipping to change at line 207
* *
* \param origin the person, who leaves the channel. By comparing it with * \param origin the person, who leaves the channel. By comparing it with
* your own nickname, you can check whether your PART * your own nickname, you can check whether your PART
* command succeed. * command succeed.
* \param params[0] mandatory, contains the channel name. * \param params[0] mandatory, contains the channel name.
* \param params[1] optional, contains the reason message (user-defi ned). * \param params[1] optional, contains the reason message (user-defi ned).
*/ */
irc_event_callback_t event_part; irc_event_callback_t event_part;
/*! /*!
* The "mode" event is triggered upon receipt of a MODE message, whi * The "mode" event is triggered upon receipt of a channel MODE mess
ch age,
* means that someone on a channel with the client has changed the * which means that someone on a channel with the client has changed
the
* channel's parameters. * channel's parameters.
* *
* \param origin the person, who changed the channel mode. * \param origin the person, who changed the channel mode.
* \param params[0] mandatory, contains the channel name. * \param params[0] mandatory, contains the channel name.
* \param params[1] mandatory, contains the changed channel mode, li ke * \param params[1] mandatory, contains the changed channel mode, li ke
* '+t', '-i' and so on. * '+t', '-i' and so on.
* \param params[2] optional, contains the mode argument (for exampl e, a * \param params[2] optional, contains the mode argument (for exampl e, a
* key for +k mode) * key for +k mode, or user who got the channel operator status
for
* +o mode)
*/ */
irc_event_callback_t event_mode; irc_event_callback_t event_mode;
/*! /*!
* The "umode" event is triggered upon receipt of a user MODE messag
e,
* 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, w hich * The "topic" event is triggered upon receipt of a TOPIC message, w hich
* means that someone on a channel with the client has changed the * means that someone on a channel with the client has changed the
* channel's topic. * channel's topic.
* *
* \param origin the person, who changes the channel topic. * \param origin the person, who changes the channel topic.
* \param params[0] mandatory, contains the channel name. * \param params[0] mandatory, contains the channel name.
* \param params[1] optional, contains the new topic. * \param params[1] optional, contains the new topic.
*/ */
irc_event_callback_t event_topic; irc_event_callback_t event_topic;
skipping to change at line 289 skipping to change at line 300
irc_event_callback_t event_notice; irc_event_callback_t event_notice;
/*! /*!
* The "invite" event is triggered upon receipt of an INVITE message , * The "invite" event is triggered upon receipt of an INVITE message ,
* which means that someone is permitting the client's entry into a +i * which means that someone is permitting the client's entry into a +i
* channel. * channel.
* *
* \param origin the person, who INVITEs you. * \param origin the person, who INVITEs you.
* \param params[0] mandatory, contains your nick. * \param params[0] mandatory, contains your nick.
* \param params[1] mandatory, contains the channel name you're invi ted into. * \param params[1] mandatory, contains the channel name you're invi ted into.
*
* \sa irc_cmd_invite irc_cmd_chanmode_invite
*/ */
irc_event_callback_t event_invite; irc_event_callback_t event_invite;
/*! /*!
* The "umode" event is triggered when the client changes its person * The "ctcp" event is triggered when the client receives the CTCP
al * request. By default, the built-in CTCP request handler is used. T
* mode flags. he
*/ * build-in handler automatically replies on most CTCP messages, so
irc_event_callback_t event_umode; you
* will rarely need to override it.
/*!
* The "ctcp" event is triggered when the client receives the CTCP r
equest.
* *
* \param origin the person, who generates the message. * \param origin the person, who generates the message.
* \param params[0] mandatory, the complete CTCP message, including its * \param params[0] mandatory, the complete CTCP message, including its
* arguments. * arguments.
* *
* Mirc generates PING, FINGER, VERSION, TIME and ACTION messages, * Mirc generates PING, FINGER, VERSION, TIME and ACTION messages,
* check the example to see how to react on them. * check the source code of \c libirc_event_ctcp_internal function t
o
* 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; irc_event_callback_t event_ctcp_req;
/*! /*!
* The "ctcp" event is triggered when the client receives the CTCP r eply. * The "ctcp" event is triggered when the client receives the CTCP r eply.
* *
* \param origin the person, who generates the message. * \param origin the person, who generates the message.
* \param params[0] mandatory, the CTCP message itself with its argu ments. * \param params[0] mandatory, the CTCP message itself with its argu ments.
*/ */
irc_event_callback_t event_ctcp_rep; 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 * The "unknown" event is triggered upon receipt of any number of
* unclassifiable miscellaneous messages, which aren't handled by th e * unclassifiable miscellaneous messages, which aren't handled by th e
* library. * library.
*/ */
irc_event_callback_t event_unknown; irc_event_callback_t event_unknown;
/*! /*!
* The "numeric" event is triggered upon receipt of any numeric resp onse * The "numeric" event is triggered upon receipt of any numeric resp onse
* from the server. There is a lot of such responses, see the full l ist * from the server. There is a lot of such responses, see the full l ist
* in the RFC 1459. * here: \ref rfcnumbers.
* *
* See the params in ::irc_eventcode_callback_t specification. * See the params in ::irc_eventcode_callback_t specification.
*/ */
irc_eventcode_callback_t event_numeric; irc_eventcode_callback_t event_numeric;
/*! /*!
* The "dcc chat" event is triggered when someone requests a DCC CHA T from * The "dcc chat" event is triggered when someone requests a DCC CHA T from
* you. * you.
* *
* See the params in ::irc_event_dcc_chat_t specification. * See the params in ::irc_event_dcc_chat_t specification.
 End of changes. 9 change blocks. 
16 lines changed or deleted 44 lines changed or added


 libirc_params.h   libirc_params.h 
skipping to change at line 14 skipping to change at line 14
* This library is free software; you can redistribute it and/or modify it * 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 * under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2 of the License, or (at yo ur * the Free Software Foundation; either version 2 of the License, or (at yo ur
* option) any later version. * option) any later version.
* *
* This library is distributed in the hope that it will be useful, but WITH OUT * This library is distributed in the hope that it will be useful, but WITH OUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details. * License for more details.
* *
* $Id: libirc_params.h,v 1.4 2004/09/29 22:15:49 gyunaev Exp $ * $Id: libirc_params.h,v 1.5 2004/10/10 16:29:52 gyunaev Exp $
*/ */
#ifndef INCLUDE_IRC_PARAMS_H #ifndef INCLUDE_IRC_PARAMS_H
#define INCLUDE_IRC_PARAMS_H #define INCLUDE_IRC_PARAMS_H
#ifndef IN_INCLUDE_LIBIRC_H #ifndef IN_INCLUDE_LIBIRC_H
#error This file should not be included directly, include just libir cclient.h #error This file should not be included directly, include just libir cclient.h
#endif #endif
#define LIBIRC_VERSION_HIGH 0x0000 #define LIBIRC_VERSION_HIGH 0x0000
#define LIBIRC_VERSION_LOW 0x0004 #define LIBIRC_VERSION_LOW 0x0006
#define LIBIRC_BUFFER_SIZE 1024 #define LIBIRC_BUFFER_SIZE 1024
#define LIBIRC_DCC_BUFFER_SIZE 1024 #define LIBIRC_DCC_BUFFER_SIZE 1024
#define LIBIRC_STATE_INIT 0 #define LIBIRC_STATE_INIT 0
#define LIBIRC_STATE_LISTENING 1 #define LIBIRC_STATE_LISTENING 1
#define LIBIRC_STATE_CONNECTING 2 #define LIBIRC_STATE_CONNECTING 2
#define LIBIRC_STATE_CONNECTED 3 #define LIBIRC_STATE_CONNECTED 3
#define LIBIRC_STATE_DISCONNECTED 4 #define LIBIRC_STATE_DISCONNECTED 4
#define LIBIRC_STATE_CONFIRM_SIZE 5 // Used only by DCC send to confirm the amount of sent data #define LIBIRC_STATE_CONFIRM_SIZE 5 // Used only by DCC send to confirm the amount of sent data
 End of changes. 2 change blocks. 
2 lines changed or deleted 2 lines changed or added


 libircclient.h   libircclient.h 
skipping to change at line 14 skipping to change at line 14
* This library is free software; you can redistribute it and/or modify it * 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 * under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2 of the License, or (at yo ur * the Free Software Foundation; either version 2 of the License, or (at yo ur
* option) any later version. * option) any later version.
* *
* This library is distributed in the hope that it will be useful, but WITH OUT * This library is distributed in the hope that it will be useful, but WITH OUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details. * License for more details.
* *
* $Id: libircclient.h,v 1.3 2004/09/29 20:53:48 gyunaev Exp $ * $Id: libircclient.h,v 1.7 2004/10/10 16:19:04 gyunaev Exp $
*/ */
/*! /*!
* \file libircclient.h * \file libircclient.h
* \author Georgy Yunaev * \author Georgy Yunaev
* \version 1.0 * \version 1.0
* \date 09.2004 * \date 09.2004
* \brief This file defines all prototypes and functions to use libirc. * \brief This file defines all prototypes and functions to use libircclien t.
* *
* libirc is a small but powerful library, which implements client-server I RC * libircclient is a small but powerful library, which implements client-se rver IRC
* protocol. It is designed to be small, fast, portable and compatible to R FC * protocol. It is designed to be small, fast, portable and compatible to R FC
* standards, and most IRC clients. libirc features include: * standards, and most IRC clients. libircclient features include:
* - Full multi-threading support. * - Full multi-threading support.
* - Single threads handles all the IRC processing. * - Single threads handles all the IRC processing.
* - Support for single-threaded applications, and socket-based application s, * - Support for single-threaded applications, and socket-based application s,
* which use select() * which use select()
* - Synchronous and asynchronous interfaces. * - Synchronous and asynchronous interfaces.
* - CTCP support with optional build-in reply code. * - CTCP support with optional build-in reply code.
* - Flexible DCC support, including both DCC chat, and DCC file transfer. * - Flexible DCC support, including both DCC chat, and DCC file transfer.
* - Can both initiate and react to initiated DCC. * - Can both initiate and react to initiated DCC.
* - Can accept or decline DCC sessions asynchronously. * - Can accept or decline DCC sessions asynchronously.
* - Plain C interface and implementation (possible to use from C++ code, * - Plain C interface and implementation (possible to use from C++ code,
* obviously) * obviously)
* - Compatible with RFC 1459 and most IRC clients. * - Compatible with RFC 1459 and most IRC clients.
* - Free, licensed under LGPL license. * - Free, licensed under LGPL license.
* *
* Note that to use libirc, only libirc.h should be included into your * Note that to use libircclient, only libircclient.h should be included in to your
* program. Do not include other libirc_* headers. * program. Do not include other libirc_* headers.
*/ */
#ifndef INCLUDE_LIBIRC_H #ifndef INCLUDE_LIBIRC_H
#define INCLUDE_LIBIRC_H #define INCLUDE_LIBIRC_H
#if !defined (WIN32) #if !defined (WIN32)
#include <sys/select.h> /* fd_set */ #include <sys/select.h> /* fd_set */
#include <netinet/in.h> /* sockaddr_in */ #include <netinet/in.h> /* sockaddr_in */
#else #else
#include <winsock.h> #include <winsock.h>
#endif #endif
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
/*! \brief A libirc IRC session. /*! \brief A libircclient IRC session.
* *
* This structure describes an IRC session. Its members are internal to * This structure describes an IRC session. Its members are internal to
* libirc, and should not be used directly. * libircclient, and should not be used directly.
*/ */
typedef struct irc_session_s irc_session_t; typedef struct irc_session_s irc_session_t;
/*! \brief A libirc DCC session. /*! \brief A libircclient DCC session.
* *
* This structure describes a DCC session used by libirc. * This structure describes a DCC session used by libircclient.
* Its members are internal to libirc, and should not be used directly. * Its members are internal to libircclient, and should not be used directl
y.
*/ */
typedef struct irc_dcc_session_s irc_dcc_session_t; typedef struct irc_dcc_session_s irc_dcc_session_t;
/*! \brief A DCC session identifier. /*! \brief A DCC session identifier.
* *
* The irc_dcc_t type is a DCC session identifier, used to identify the * The irc_dcc_t type is a DCC session identifier, used to identify the
* DCC sessions in callbacks and various functions. * DCC sessions in callbacks and various functions.
*/ */
typedef unsigned int irc_dcc_t; typedef unsigned int irc_dcc_t;
skipping to change at line 93 skipping to change at line 93
* *
* \param session An IRC session which generates the callback * \param session An IRC session which generates the callback
* \param id A DCC session id. * \param id A DCC session id.
* \param status An error status. 0 means no error, otherwise error code. * \param status An error status. 0 means no error, otherwise error code.
* \param ctx A user-supplied context. * \param ctx A user-supplied context.
* \param data Data supplied (if available) * \param data Data supplied (if available)
* \param length data length (if available) * \param length data length (if available)
* *
* This callback is called for all DCC functions when state change occurs. * This callback is called for all DCC functions when state change occurs.
* *
* For DCC CHAT, callback called in next circumstances: * For DCC CHAT, the callback is called in next circumstances:
* - \a status is LIBIRC_ERR_CLOSED: connection is closed by remote peer. * - \a status is LIBIRC_ERR_CLOSED: connection is closed by remote peer.
* After the callback, DCC session is automatically destroyed. * After returning from the callback, the DCC session is automatically
* - \a status is not 0 and is not LIBIRC_ERR_CLOSED: connection error, * destroyed.
* accept error, recv error, send error. After the callback, DCC * - \a status is neither 0 nor LIBIRC_ERR_CLOSED: socket I/O error
* session is automatically destroyed. * (connect error, accept error, recv error, send error). After return
ing
* from the callback, the DCC session is automatically destroyed.
* - \a status is 0: new chat message received, \a data contains the messag e * - \a status is 0: new chat message received, \a data contains the messag e
* (null-terminated string), \a length contains the message length. * (null-terminated string), \a length contains the message length.
* *
* For DCC SEND, while file is sending, callback called in next circumstanc es: * For DCC SEND, while file is sending, callback called in next circumstanc es:
* - \a status is not 0 and is not LIBIRC_ERR_CLOSED: connection error, * - \a status is neither 0 nor LIBIRC_ERR_CLOSED: socket I/O error
* accept error, recv error, send error. File sent aborted. After the * (connect error, accept error, recv error, send error). After return
* callback, DCC session is automatically destroyed. ing
* from the callback, the DCC session is automatically destroyed.
* - \a status is 0: new data received, \a data contains the data received, * - \a status is 0: new data received, \a data contains the data received,
* \a length contains the amount of data received. * \a length contains the amount of data received.
* *
* For DCC RECV, while file is sending, callback called in next circumstanc es: * For DCC RECV, while file is sending, callback called in next circumstanc es:
* - \a status is not 0 and is not LIBIRC_ERR_CLOSED: connection error, * - \a status is neither 0 nor LIBIRC_ERR_CLOSED: socket I/O error
* accept error, recv error, send error. File sent aborted. After the * (connect error, accept error, recv error, send error). After return
* callback, DCC session is automatically destroyed. ing
* from the callback, the DCC session is automatically destroyed.
* - \a status is 0, and \a data is 0: file has been received successfully. * - \a status is 0, and \a data is 0: file has been received successfully.
* After the callback, DCC session is automatically destroyed. * 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 conta ins * - \a status is 0, and \a data is not 0: new data received, \a data conta ins
* the data received, \a length contains the amount of data received. * the data received, \a length contains the amount of data received.
* *
* \ingroup dccstuff * \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); 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 #define IN_INCLUDE_LIBIRC_H
#include "libirc_errors.h" #include "libirc_errors.h"
#include "libirc_events.h" #include "libirc_events.h"
skipping to change at line 189 skipping to change at line 191
* \fn int irc_connect (irc_session_t * session, const char * server, unsig ned short port, const char * server_password, const char * nick, const char * username, const char * realname); * \fn int irc_connect (irc_session_t * session, const char * server, unsig ned short port, const char * server_password, const char * nick, const char * username, const char * realname);
* \brief Initiates a connection to IRC server. * \brief Initiates a connection to IRC server.
* *
* \param session A session to initiate connections on. Must not be NULL. * \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 conne ct * \param server A domain name or an IP address of the IRC server to conne ct
* to. Must not be NULL. * to. Must not be NULL.
* \param port An IRC server port, usually 6667. * \param port An IRC server port, usually 6667.
* \param server_password An IRC server password, if the server requires i t. * \param server_password An IRC server password, if the server requires i t.
* May be NULL, in this case password will not be send to th e * May be NULL, in this case password will not be send to th e
* IRC server. * IRC server.
* \param nick A nick, which libirc will use to login to the IRC server. * \param nick A nick, which libircclient will use to login to the IRC s erver.
* Must not be NULL. * Must not be NULL.
* \param username A username of the account, which is used to connect to t he * \param username A username of the account, which is used to connect to t he
* IRC server. This is for information only, will be shown i n * IRC server. This is for information only, will be shown i n
* "user properties" dialogs and returned by /whois request. * "user properties" dialogs and returned by /whois request.
* May be NULL, in this case 'nobody' will be sent as userna me. * May be NULL, in this case 'nobody' will be sent as userna me.
* \param realname A real name of the person, who connects to the IRC. Usua lly * \param realname A real name of the person, who connects to the IRC. Usua lly
* people put some wide-available information here (URL, sma ll * people put some wide-available information here (URL, sma ll
* description or something else). This information also wil l * description or something else). This information also wil l
* be shown in "user properties" dialogs and returned by /wh ois * be shown in "user properties" dialogs and returned by /wh ois
* request. May be NULL, in this case 'noname' will be sent as * request. May be NULL, in this case 'noname' will be sent as
* username. * username.
* *
* \return Return code 0 means success. Other value means error, the error * \return Return code 0 means success. Other value means error, the error
* code may be obtained through irc_errno(). Any error, generated by the * code may be obtained through irc_errno(). Any error, generated by the
* IRC server, is available through event_numeric. * IRC server, is available through irc_callbacks_t::event_numeric.
* *
* This function prepares and initiates a connection to the IRC server. The * This function prepares and initiates a connection to the IRC server. The
* connection is done asynchronously (see ::event_connect), so the success * connection is done asynchronously (see irc_callbacks_t::event_connect), so the success
* return value means that connection was initiated (but not completed!) * return value means that connection was initiated (but not completed!)
* successfully. * successfully.
* *
* \sa irc_run * \sa irc_run
* \ingroup conndisc * \ingroup conndisc
*/ */
int irc_connect (irc_session_t * session, int irc_connect (irc_session_t * session,
const char * server, const char * server,
unsigned short port, unsigned short port,
const char * server_password, const char * server_password,
skipping to change at line 232 skipping to change at line 234
/*! /*!
* \fn void irc_disconnect (irc_session_t * session) * \fn void irc_disconnect (irc_session_t * session)
* \brief Disconnects a connection to IRC server. * \brief Disconnects a connection to IRC server.
* *
* \param session An IRC session. * \param session An IRC session.
* *
* \return Return code 0 means success. Other value means error, the error * \return Return code 0 means success. Other value means error, the error
* code may be obtained through irc_errno(). * code may be obtained through irc_errno().
* *
* This function closes the IRC connection. After that connection is closed , * This function closes the IRC connection. After that connection is closed ,
* libirc automatically leaves irc_run loop. * libircclient automatically leaves irc_run loop.
* *
* \sa irc_connect irc_run * \sa irc_connect irc_run
* \ingroup conndisc * \ingroup conndisc
*/ */
void irc_disconnect (irc_session_t * session); void irc_disconnect (irc_session_t * session);
/*! /*!
* \fn int irc_is_connected (irc_session_t * session) * \fn int irc_is_connected (irc_session_t * session)
* \brief Checks whether the session is connecting/connected to the IRC ser ver. * \brief Checks whether the session is connecting/connected to the IRC ser ver.
* *
* \param session An IRC session. * \param session An initialized IRC session.
* *
* \return Return code 1 means that session is connecting or connected to t he * \return Return code 1 means that session is connecting or connected to t he
* IRC server, zero value means that the session has been disconnected. * IRC server, zero value means that the session has been disconnected.
* *
* \sa irc_connect irc_run * \sa irc_connect irc_run
* \ingroup conndisc * \ingroup conndisc
*/ */
int irc_is_connected (irc_session_t * session); int irc_is_connected (irc_session_t * session);
/*! /*!
skipping to change at line 327 skipping to change at line 329
/*! /*!
* \fn int irc_send_raw (irc_session_t * session, const char * format, ...) * \fn int irc_send_raw (irc_session_t * session, const char * format, ...)
* \brief Sends raw data to the IRC server. * \brief Sends raw data to the IRC server.
* *
* \param session An initiated and connected session. * \param session An initiated and connected session.
* \param format A printf-formatted string, followed by function args. * \param format A printf-formatted string, followed by function args.
* *
* \return Return code 0 means success. Other value means error, the error * \return Return code 0 means success. Other value means error, the error
* code may be obtained through irc_errno(). Any error, generated by the * code may be obtained through irc_errno(). Any error, generated by the
* IRC server, is available through event_numeric. * 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 * 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 libirc * generate a server command, which is not (yet) provided by libircclient
* directly. * directly.
* *
* \ingroup sendcmds * \ingroup ircmd_oth
*/ */
int irc_send_raw (irc_session_t * session, const char * format, ...); int irc_send_raw (irc_session_t * session, const char * format, ...);
/*! /*!
* \fn int irc_cmd_quit (irc_session_t * session, const char * reason) * \fn int irc_cmd_quit (irc_session_t * session, const char * reason)
* \brief Sends QUIT command to the IRC server. * \brief Sends QUIT command to the IRC server.
* *
* \param session An initiated and connected session. * \param session An initiated and connected session.
* \param reason A reason to quit. May be NULL. * \param reason A reason to quit. May be NULL.
* *
* \return Return code 0 means success. Other value means error, the error * \return Return code 0 means success. Other value means error, the error
* code may be obtained through irc_errno(). Any error, generated by the * code may be obtained through irc_errno(). Any error, generated by the
* IRC server, is available through event_numeric. * IRC server, is available through irc_callbacks_t::event_numeric.
* *
* This function sends the QUIT command to the IRC server. This command * This function sends the QUIT command to the IRC server. This command
* forces the IRC server to close the IRC connection, and terminate the * forces the IRC server to close the IRC connection, and terminate the
* session. * session.
* *
* \ingroup sendcmds * \ingroup ircmd_oth
*/ */
int irc_cmd_quit (irc_session_t * session, const char * reason); int irc_cmd_quit (irc_session_t * session, const char * reason);
/*! /*!
* \fn int irc_cmd_join (irc_session_t * session, const char * channel, con st char * key) * \fn int irc_cmd_join (irc_session_t * session, const char * channel, con st char * key)
* \brief Joins the new IRC channel. * \brief Joins the new IRC channel.
* *
* \param session An initiated and connected session. * \param session An initiated and connected session.
* \param channel A channel name to join to. Must not be NULL. * \param channel A channel name to join to. Must not be NULL.
* \param key Channel password. May be NULL. * \param key Channel password. May be NULL.
* *
* \return Return code 0 means success. Other value means error, the error * \return Return code 0 means success. Other value means error, the error
* code may be obtained through irc_errno(). Any error, generated by the * code may be obtained through irc_errno(). Any error, generated by the
* IRC server, is available through event_numeric. * IRC server, is available through irc_callbacks_t::event_numeric.
* *
* This function is used to JOIN the IRC channel. If the channel is not exi st, * This function is used to JOIN the IRC channel. If the channel is not exi st,
* it will be automatically created by the IRC server. Note that to JOIN th e * it will be automatically created by the IRC server. Note that to JOIN th e
* password-protected channel, you must know the password, and specify it i n * password-protected channel, you must know the password, and specify it i n
* the \a key argument. * the \a key argument.
* *
* \ingroup sendcmds * 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); 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, cons
t 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 return
ed
* 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 t
han
* 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_LISTSTAR
T -
* ::LIBIRC_RFC_RPL_LIST - ::LIBIRC_RFC_RPL_LISTEND sequence.
* Note that "private" channels are listed (without their topics) as channe
l
* "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 questi
on.
*
* 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, co
nst 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 topi
c
* 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 IR
C
* server can (but not have to) generate the non-RFC ::RPL_TOPIC_EXTRA mess
age,
* 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 cha
r * topic);
/*!
* \fn int irc_cmd_channel_mode (irc_session_t * session, const char * chan
nel, 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 mod
e 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 to
pic.
*
* - \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 fla
g
* 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 onl
y
* flag. When the flag is set, only the channel operators can change t
he
* channel topic.
*
* - \a n - sets (+n) or resets (-n) the protection from the clients outsid
e
* 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 th
e
* moderation mode is set, only channel operators and the users who ha
ve
* 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 maxim
um
* users in channel. When the restriction is set, and there is a numbe
r
* 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 m
ask
* on a user to keep him out of channel. Note that to remove the ban y
ou
* must specify the ban mask to remove, not just "-b".
*
* Note that the actual list of channel modes depends on the IRC server, an
d
* 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, co
nst 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 combinat
ion.
* 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 addin
g
* 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 (b
ut
* 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 look
ups
* 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_UMOD
EIS
*
* \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 who
is
* 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) * \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. * \brief Sends the message to the nick or to the channel.
* *
* \param session An initiated and connected session. * \param session An initiated and connected session.
* \param nch A target nick or channel. Must not be NULL. * \param nch A target nick or channel. Must not be NULL.
* \param text Message text. Must not be NULL. * \param text Message text. Must not be NULL.
* *
* \return Return code 0 means success. Other value means error, the error * \return Return code 0 means success. Other value means error, the error
* code may be obtained through irc_errno(). Any error, generated by the * code may be obtained through irc_errno(). Any error, generated by the
* IRC server, is available through event_numeric. * IRC server, is available through irc_callbacks_t::event_numeric.
* *
* This function is used to send the channel or private messages. The targe t * This function is used to send the channel or private messages. The targe t
* is determined by \a nch argument: if it describes nick, this will be a * 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 * private message, if a channel name - public (channel) message. Note that
* depending on channel modes, you may be required to join the channel to * depending on channel modes, you may be required to join the channel to
* send the channel messages. * send the channel messages.
* *
* \ingroup sendcmds * 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 * t ext); int irc_cmd_msg (irc_session_t * session, const char * nch, const char * t ext);
/*! /*!
* \fn int irc_cmd_me (irc_session_t * session, const char * nch, const c har * text) * \fn int irc_cmd_me (irc_session_t * session, const char * nch, const c har * text)
* \brief Sends the /me (CTCP ACTION) message to the nick or to the channel . * \brief Sends the /me (CTCP ACTION) message to the nick or to the channel .
* *
* \param session An initiated and connected session. * \param session An initiated and connected session.
* \param nch A target nick or channel. Must not be NULL. * \param nch A target nick or channel. Must not be NULL.
* \param text Action message text. 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 * \return Return code 0 means success. Other value means error, the error
* code may be obtained through irc_errno(). Any error, generated by the * code may be obtained through irc_errno(). Any error, generated by the
* IRC server, is available through event_numeric. * IRC server, is available through irc_callbacks_t::event_numeric.
* *
* This function is used to send the /me message to channel or private. * 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. * 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 * \sa irc_cmd_msg
* \ingroup sendcmds * \ingroup ircmd_msg
*/ */
int irc_cmd_me (irc_session_t * session, const char * nch, const char * tex t); int irc_cmd_me (irc_session_t * session, const char * nch, const char * tex t);
/*! /*!
* \fn int irc_cmd_notice (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. * \brief Sends the notice to the nick or to the channel.
* *
* \param session An initiated and connected session. * \param session An initiated and connected session.
* \param nch A target nick or channel. Must not be NULL. * \param nch A target nick or channel. Must not be NULL.
* \param text Notice text. Must not be NULL. * \param text Notice text. Must not be NULL.
* *
* \return Return code 0 means success. Other value means error, the error * \return Return code 0 means success. Other value means error, the error
* code may be obtained through irc_errno(). Any error, generated by the * code may be obtained through irc_errno(). Any error, generated by the
* IRC server, is available through event_numeric. * IRC server, is available through irc_callbacks_t::event_numeric.
* *
* This function is used to send the channel or private notices. The target * 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 * 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 * private message, if a channel name - public (channel) message. Note that
* depending on channel modes, you may be required to join the channel to * depending on channel modes, you may be required to join the channel to
* send the channel notices. * send the channel notices.
* *
* The only difference between message and notice is that, according to RFC * The only difference between message and notice is that, according to RFC
* 1459, you must not automatically reply to NOTICE messages. * 1459, you must not automatically reply to NOTICE messages.
* *
* \ingroup sendcmds * 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 * \sa irc_cmd_msg
* \ingroup ircmd_msg
*/ */
int irc_cmd_notice (irc_session_t * session, const char * nch, const char * text); 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) * \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. * \brief Kick some lazy ass out of channel.
* *
* \param session An initiated and connected session. * \param session An initiated and connected session.
* \param nick A nick to kick. Must not be NULL. * \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 channel A channel to kick this nick out of. Must not be NULL.
* \param reason A reason to kick. May be NULL. * \param reason A reason to kick. May be NULL.
* *
* \return Return code 0 means success. Other value means error, the error * \return Return code 0 means success. Other value means error, the error
* code may be obtained through irc_errno(). Any error, generated by the * code may be obtained through irc_errno(). Any error, generated by the
* IRC server, is available through ::event_numeric. * IRC server, is available through irc_callbacks_t::event_numeric.
* *
* This function is used to kick a person out of channel. Note that you mus t * This function is used to kick a person out of channel. Note that you mus t
* be a channel operator to kick anyone. * be a channel operator to kick anyone.
* *
* \sa event_numeric * Possible error responces for this command from the RFC1459:
* \ingroup sendcmds * - ::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); 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) * \fn int irc_cmd_ctcp_request (irc_session_t * session, const char * nick , const char * request)
* \brief Generates a CTCP request. * \brief Generates a CTCP request.
* *
* \param session An initiated and connected session. * \param session An initiated and connected session.
* \param nick A target nick to send request to. Must not be NULL. * \param nick A target nick to send request to. Must not be NULL.
* \param request A request string. 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 * \return Return code 0 means success. Other value means error, the error
* code may be obtained through irc_errno(). Any error, generated by the * code may be obtained through irc_errno(). Any error, generated by the
* IRC server, is available through ::event_numeric. * IRC server, is available through irc_callbacks_t::event_numeric.
* *
* This function is used to send a CTCP request. There are four CTCP reques ts * This function is used to send a CTCP request. There are four CTCP reques ts
* supported by Mirc: * supported by Mirc:
* VERSION - get the client software name and version * VERSION - get the client software name and version
* FINGER - get the client username, host and real name. * FINGER - get the client username, host and real name.
* PING - get the client delay. * PING - get the client delay.
* TIME - get the client local time. * TIME - get the client local time.
* *
* A reply to the CTCP request will be sent by the ::event_ctcp_rep callbac k; * A reply to the CTCP request will be sent by the irc_callbacks_t::event_c tcp_rep callback;
* be sure to define it. * be sure to define it.
* *
* \sa event_ctcp_rep event_numeric * 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 * \ingroup ctcp
*/ */
int irc_cmd_ctcp_request (irc_session_t * session, const char * nick, const char * request); 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) * \fn int irc_cmd_ctcp_reply (irc_session_t * session, const char * nick, const char * reply)
* \brief Generates a reply to the CTCP request. * \brief Generates a reply to the CTCP request.
* *
* \param session An initiated and connected session. * \param session An initiated and connected session.
* \param nick A target nick to send request to. Must not be NULL. * \param nick A target nick to send request to. Must not be NULL.
* \param reply A reply string. 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 * \return Return code 0 means success. Other value means error, the error
* code may be obtained through irc_errno(). Any error, generated by the * code may be obtained through irc_errno(). Any error, generated by the
* IRC server, is available through event_numeric. * IRC server, is available through irc_callbacks_t::event_numeric.
*
* This function is used to send a reply to the CTCP request, if you choose
* not to use internal CTCP reply function, irc_event_ctcp_internal().
*
* \ingroup ctcp
*/
int irc_cmd_ctcp_reply (irc_session_t * session, const char * nick, const c
har * reply);
/*!
* \fn void irc_event_ctcp_internal (irc_session_t * session, const char *
event, const char * origin, const char ** params, unsigned int count)
* \brief Generates an automatic reply to the CTCP request.
* *
* \param session An initiated and connected session. * This function is used to send a reply to the CTCP request, generated by
* \param event An event name. * irc_callbacks_t::event_ctcp_req. Note that you will not receive this eve
* \param origin An event origin. nt
* \param params event params. * unless you specify your own handler as \c event_ctcp_req callback during
* \param count event params count. * the IRC session initialization.
* *
* This function generates automatic CTCP reply to remote CTCP requests. It * Possible error responces for this command from the RFC1459:
may * - ::LIBIRC_RFC_ERR_NORECIPIENT
* be either called directly from the event_ctcp_rep callback, or may be * - ::LIBIRC_RFC_ERR_NOTEXTTOSEND
* specified AS ::event_ctcp_rep callback to simplify the code when adding * - ::LIBIRC_RFC_ERR_CANNOTSENDTOCHAN
* CTCP functionality to your bot. * - ::LIBIRC_RFC_ERR_NOTONCHANNEL
* - ::LIBIRC_RFC_ERR_NOTOPLEVEL
* - ::LIBIRC_RFC_ERR_WILDTOPLEVEL
* - ::LIBIRC_RFC_ERR_TOOMANYTARGETS
* - ::LIBIRC_RFC_ERR_NOSUCHNICK
* *
* \ingroup ctcp * \ingroup ctcp
*/ */
void irc_event_ctcp_internal (irc_session_t * session, const char * event, const char * origin, const char ** params, unsigned int count); int irc_cmd_ctcp_reply (irc_session_t * session, const char * nick, const c har * reply);
/*! /*!
* \fn void irc_target_get_nick (const char * target, char *nick, size_t si ze) * \fn void irc_target_get_nick (const char * target, char *nick, size_t si ze)
* \brief Gets the nick part from the target * \brief Gets the nick part from the target
* *
* \param target A nick in common IRC server form like tim!root\@mycomain. com * \param target A nick in common IRC server form like tim!root\@mycomain. com
* \param nick A buffer to hold the nickname. * \param nick A buffer to hold the nickname.
* \param size A buffer size. If nick is longer than buffer size, it wil l * \param size A buffer size. If nick is longer than buffer size, it wil l
* be truncated. * be truncated.
* *
skipping to change at line 584 skipping to change at line 1025
* \param session An initiated and connected session. * \param session An initiated and connected session.
* \param ctx A user-supplied DCC session context, which will be passed to * \param ctx A user-supplied DCC session context, which will be passed to
* the DCC callback function. May be NULL. * the DCC callback function. May be NULL.
* \param nick A nick to DCC CHAT with. * \param nick A nick to DCC CHAT with.
* \param callback A DCC callback function, which will be called when * \param callback A DCC callback function, which will be called when
* anything is said by other party. Must not be NULL. * anything is said by other party. Must not be NULL.
* \param dccid On success, DCC session ID will be stored in this var. * \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 * \return Return code 0 means success. Other value means error, the error
* code may be obtained through irc_errno(). Any error, generated by the * code may be obtained through irc_errno(). Any error, generated by the
* IRC server, is available through event_numeric. * IRC server, is available through irc_callbacks_t::event_numeric.
* *
* This function requests a DCC CHAT between you and other user. For * This function requests a DCC CHAT between you and other user. For
* newbies, DCC chat is like private chat, but it goes directly between * newbies, DCC chat is like private chat, but it goes directly between
* two users, and bypasses IRC server. DCC CHAT request must be accepted * two users, and bypasses IRC server. DCC CHAT request must be accepted
* by other side before you can send anything. * by other side before you can send anything.
* *
* When the chat is accepted, terminated, or some data is received, the * When the chat is accepted, terminated, or some data is received, the
* callback function is called. See the details in irc_dcc_callback_t * callback function is called. See the details in irc_dcc_callback_t
* declaration. * 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 * \sa irc_dcc_callback_t irc_dcc_msg
* \ingroup dccstuff * \ingroup dccstuff
*/ */
int irc_dcc_chat (irc_session_t * session, void * ctx, const char * nick, i rc_dcc_callback_t callback, irc_dcc_t * dccid); int irc_dcc_chat (irc_session_t * session, void * ctx, const char * nick, i rc_dcc_callback_t callback, irc_dcc_t * dccid);
/*! /*!
* \fn int irc_dcc_msg (irc_session_t * session, irc_dcc_t dccid, const cha r * text) * \fn int irc_dcc_msg (irc_session_t * session, irc_dcc_t dccid, const cha r * text)
* \brief Sends the message to the specific DCC CHAT * \brief Sends the message to the specific DCC CHAT
* *
* \param session An IRC session. * \param session An IRC session.
skipping to change at line 628 skipping to change at line 1079
int irc_dcc_msg (irc_session_t * session, irc_dcc_t dccid, const cha r * text); int irc_dcc_msg (irc_session_t * session, irc_dcc_t dccid, const cha r * text);
/*! /*!
* \fn int irc_dcc_accept (irc_session_t * session, irc_dcc_t dccid, void * ctx, irc_dcc_callback_t callback) * \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. * \brief Accepts a remote DCC CHAT or DCC RECVFILE request.
* *
* \param session An initiated and connected session. * \param session An initiated and connected session.
* \param dccid A DCC session ID, returned by appropriate callback. * \param dccid A DCC session ID, returned by appropriate callback.
* \param ctx A user-supplied DCC session context, which will be passed * \param ctx A user-supplied DCC session context, which will be passed
* to the DCC callback function. May be NULL. * 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 * \param callback A DCC callback function, which will be called when
* anything is said by other party. Must not be NULL. * anything is said by other party. Must not be NULL.
* *
* \return Return code 0 means success. Other value means error, the error * \return Return code 0 means success. Other value means error, the error
* code may be obtained through irc_errno(). * code may be obtained through irc_errno().
* *
* This function accepts a remote DCC request - either DCC CHAT or DCC FILE . * This function accepts a remote DCC request - either DCC CHAT or DCC FILE .
* After the request is accepted, the supplied callback will be called, * After the request is accepted, the supplied callback will be called,
* and you can start sending messages or receiving the file. * and you can start sending messages or receiving the file.
* *
skipping to change at line 673 skipping to change at line 1123
* This function should be called only after either event_dcc_chat_req or * 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 * 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 * 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 * callback function - you may just return, and call it later. However, to
* prevent memory leaks, you must call either irc_dcc_decline or * prevent memory leaks, you must call either irc_dcc_decline or
* irc_dcc_accept for any incoming DCC request. * irc_dcc_accept for any incoming DCC request.
* *
* Do not use this function to close the accepted or initiated DCC session. * Do not use this function to close the accepted or initiated DCC session.
* Use irc_dcc_destroy instead. * Use irc_dcc_destroy instead.
* *
* \sa irc_dcc_accept event_dcc_chat_req event_dcc_send_req irc_dcc_destroy * \sa irc_dcc_accept irc_callbacks_t::event_dcc_chat_req irc_callbacks_t:: event_dcc_send_req irc_dcc_destroy
* \ingroup dccstuff * \ingroup dccstuff
*/ */
int irc_dcc_decline (irc_session_t * session, irc_dcc_t dccid); int irc_dcc_decline (irc_session_t * session, irc_dcc_t dccid);
/*! /*!
* \fn int irc_dcc_sendfile (irc_session_t * session, void * ctx, const cha r * nick, const char * filename, irc_dcc_callback_t callback, irc_dcc_t * d ccid) * \fn int irc_dcc_sendfile (irc_session_t * session, void * ctx, const cha r * nick, const char * filename, irc_dcc_callback_t callback, irc_dcc_t * d ccid)
* \brief Sends a file via DCC. * \brief Sends a file via DCC.
* *
* \param session An initiated and connected session. * \param session An initiated and connected session.
* \param ctx A user-supplied DCC session context, which will be passed to * \param ctx A user-supplied DCC session context, which will be passed to
* the DCC callback function. May be NULL. * the DCC callback function. May be NULL.
* \param nick A nick to send file via DCC to. * \param nick A nick to send file via DCC to.
* \param filename A file name to sent. Must be an existing file. * \param filename A file name to sent. Must be an existing file.
* \param callback A DCC callback function, which will be called when * \param callback A DCC callback function, which will be called when
* file sent operation is failed, progressed or completed. * file sent operation is failed, progressed or completed.
* \param dccid On success, DCC session ID will be stored in this var. * \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 * \return Return code 0 means success. Other value means error, the error
* code may be obtained through irc_errno(). Any error, generated by the * code may be obtained through irc_errno(). Any error, generated by the
* IRC server, is available through event_numeric. * IRC server, is available through irc_callbacks_t::event_numeric.
* *
* This function generates a DCC SEND request to send the file. When it is * 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 * 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 * closed. The send operation progress and result can be checked in
* callback. See the details in irc_dcc_callback_t declaration. * 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 * \sa irc_dcc_callback_t
* \ingroup dccstuff * \ingroup dccstuff
*/ */
int irc_dcc_sendfile (irc_session_t * session, void * ctx, const char * nic k, const char * filename, irc_dcc_callback_t callback, irc_dcc_t * dccid); int irc_dcc_sendfile (irc_session_t * session, void * ctx, const char * nic k, 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) * \fn int irc_dcc_destroy (irc_session_t * session, irc_dcc_t dccid)
* \brief Destroys a DCC session. * \brief Destroys a DCC session.
* *
* \param session An initiated and connected session. * \param session An initiated and connected session.
skipping to change at line 728 skipping to change at line 1188
* *
* Note that when DCC session is finished (either with success or failure), * Note that when DCC session is finished (either with success or failure),
* you should not destroy it - it will be destroyed automatically. * you should not destroy it - it will be destroyed automatically.
* *
* \ingroup dccstuff * \ingroup dccstuff
*/ */
int irc_dcc_destroy (irc_session_t * session, irc_dcc_t dccid); int irc_dcc_destroy (irc_session_t * session, irc_dcc_t dccid);
/*! /*!
* \fn void irc_get_version (unsigned int * high, unsigned int * low) * \fn void irc_get_version (unsigned int * high, unsigned int * low)
* \brief Obtains a libirc version. * \brief Obtains a libircclient version.
* *
* \param high A pointer to receive the high version part. * \param high A pointer to receive the high version part.
* \param low A pointer to receive the low version part. * \param low A pointer to receive the low version part.
* *
* This function returns the libirc version. You can use the version either * This function returns the libircclient version. You can use the version either
* to check whether required options are available, or to output the versio n. * to check whether required options are available, or to output the versio n.
* The preferred printf-like format string to output the version is: * The preferred printf-like format string to output the version is:
* *
* printf ("Version: %d.%02d", high, low); * printf ("Version: %d.%02d", high, low);
* *
* \ingroup common * \ingroup common
*/ */
void irc_get_version (unsigned int * high, unsigned int * low); void irc_get_version (unsigned int * high, unsigned int * low);
/*! /*!
* \fn void irc_set_ctx (irc_session_t * session, void * ctx) * \fn void irc_set_ctx (irc_session_t * session, void * ctx)
* \brief Sets the IRC session context. * \brief Sets the IRC session context.
* *
* \param session An initiated session. * \param session An initiated session.
* \param ctx A context. * \param ctx A context.
* *
* This function sets the user-defined context for this IRC session. This * This function sets the user-defined context for this IRC session. This
* context is not used by libirc. Its purpose is to store session-specific * context is not used by libircclient. Its purpose is to store session-spe cific
* user data, which may be obtained later by calling irc_get_ctx(). * user data, which may be obtained later by calling irc_get_ctx().
* Note that libirc just 'carries out' this pointer. If you allocate some * 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 * memory, and store its address in ctx (most common usage), it is your
* responsibility to free it before calling irc_destroy_session(). * responsibility to free it before calling irc_destroy_session().
* *
* \sa irc_get_ctx * \sa irc_get_ctx
* \ingroup contexts * \ingroup contexts
*/ */
void irc_set_ctx (irc_session_t * session, void * ctx); void irc_set_ctx (irc_session_t * session, void * ctx);
/*! /*!
* \fn void * irc_get_ctx (irc_session_t * session) * \fn void * irc_get_ctx (irc_session_t * session)
skipping to change at line 790 skipping to change at line 1250
* \param session An initiated session. * \param session An initiated session.
* *
* This function returns the last error code associated with last operation * This function returns the last error code associated with last operation
* of this IRC session. Possible error codes are defined in libirc_errors.h * of this IRC session. Possible error codes are defined in libirc_errors.h
* *
* As usual, next errno rules apply: * As usual, next errno rules apply:
* - irc_errno() should be called ONLY if the called function fails; * - irc_errno() should be called ONLY if the called function fails;
* - irc_errno() doesn't return 0 if function succeed; actually, the return * - irc_errno() doesn't return 0 if function succeed; actually, the return
* value will be undefined. * value will be undefined.
* - you should call irc_errno() IMMEDIATELY after function fails, before * - you should call irc_errno() IMMEDIATELY after function fails, before
* calling any other libirc function. * calling any other libircclient function.
* *
* \sa irc_strerror * \sa irc_strerror
* \ingroup errors * \ingroup errors
*/ */
int irc_errno (irc_session_t * session); int irc_errno (irc_session_t * session);
/*! /*!
* \fn const char * irc_strerror (int ircerrno) * \fn const char * irc_strerror (int ircerrno)
* \brief Returns the text error message associated with this error code. * \brief Returns the text error message associated with this error code.
* *
skipping to change at line 812 skipping to change at line 1272
* *
* This function returns the text representation of the given error code. * This function returns the text representation of the given error code.
* *
* \sa irc_errno() * \sa irc_errno()
* \ingroup errors * \ingroup errors
*/ */
const char * irc_strerror (int ircerrno); const char * irc_strerror (int ircerrno);
/*! /*!
* \fn void irc_option_set (irc_session_t * session, unsigned int option) * \fn void irc_option_set (irc_session_t * session, unsigned int option)
* \brief Sets the libirc option. * \brief Sets the libircclient option.
* *
* \param session An initiated session. * \param session An initiated session.
* \param option An option from libirc_options.h * \param option An option from libirc_options.h
* *
* This function sets the libirc option, changing libirc behavior. See the * This function sets the libircclient option, changing libircclient behavi or. See the
* option list for the meaning for every option. * option list for the meaning for every option.
* *
* \sa irc_option_reset * \sa irc_option_reset
* \ingroup options * \ingroup options
*/ */
void irc_option_set (irc_session_t * session, unsigned int option); void irc_option_set (irc_session_t * session, unsigned int option);
/*! /*!
* \fn void irc_option_reset (irc_session_t * session, unsigned int option) * \fn void irc_option_reset (irc_session_t * session, unsigned int option)
* \brief Resets the libirc option. * \brief Resets the libircclient option.
* *
* \param session An initiated session. * \param session An initiated session.
* \param option An option from libirc_options.h * \param option An option from libirc_options.h
* *
* This function removes the previously set libirc option, changing libirc * This function removes the previously set libircclient option, changing l ibircclient
* behavior. See the option list for the meaning for every option. * behavior. See the option list for the meaning for every option.
* *
* \sa irc_option_set * \sa irc_option_set
* \ingroup options * \ingroup options
*/ */
void irc_option_reset (irc_session_t * session, unsigned int option); 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 c
olors.
*
* \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 wr
itten 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 ar
e incapable of rendering italic text, most clients display this as normal t
ext 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 c
olor. The color is set by using the \c COLOR keyword, and equal sign follow
ed by text color code (see below).
* - [COLOR=RED/BLUE] ... [/COLOR] - write the text using specified foregro
und and background color. The color is set by using the \c COLOR keyword, a
n equal sign followed by text foreground color code, a dash and a text back
ground 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 #ifdef __cplusplus
} }
#endif #endif
#endif /* INCLUDE_LIBIRC_H */ #endif /* INCLUDE_LIBIRC_H */
 End of changes. 60 change blocks. 
84 lines changed or deleted 684 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/