Typedefs | |
typedef void(* | irc_dcc_callback_t )(irc_session_t *session, irc_dcc_t id, int status, void *ctx, const char *data, unsigned int length) |
A common DCC callback, used to inform you about the current DCC state or event. | |
Functions | |
int | irc_dcc_chat (irc_session_t *session, void *ctx, const char *nick, irc_dcc_callback_t callback, irc_dcc_t *dccid) |
Initiates a DCC CHAT. | |
int | irc_dcc_msg (irc_session_t *session, irc_dcc_t dccid, const char *text) |
Sends the message to the specific DCC CHAT. | |
int | irc_dcc_accept (irc_session_t *session, irc_dcc_t dccid, void *ctx, irc_dcc_callback_t callback) |
Accepts a remote DCC CHAT or DCC RECVFILE request. | |
int | irc_dcc_decline (irc_session_t *session, irc_dcc_t dccid) |
Declines a remote DCC CHAT or DCC RECVFILE request. | |
int | irc_dcc_sendfile (irc_session_t *session, void *ctx, const char *nick, const char *filename, irc_dcc_callback_t callback, irc_dcc_t *dccid) |
Sends a file via DCC. | |
int | irc_dcc_destroy (irc_session_t *session, irc_dcc_t dccid) |
Destroys a DCC session. |
typedef void(* irc_dcc_callback_t)(irc_session_t *session, irc_dcc_t id, int status, void *ctx, const char *data, unsigned int length) |
A common DCC callback, used to inform you about the current DCC state or event.
session | An IRC session which generates the callback | |
id | A DCC session id. | |
status | An error status. 0 means no error, otherwise error code. | |
ctx | A user-supplied context. | |
data | Data supplied (if available) | |
length | data length (if available) |
For DCC CHAT, the callback is called in next circumstances:
For DCC SEND, while file is sending, callback called in next circumstances:
For DCC RECV, while file is sending, callback called in next circumstances:
int irc_dcc_accept | ( | irc_session_t * | session, | |
irc_dcc_t | dccid, | |||
void * | ctx, | |||
irc_dcc_callback_t | callback | |||
) |
Accepts a remote DCC CHAT or DCC RECVFILE request.
session | An initiated and connected session. | |
dccid | A DCC session ID, returned by appropriate callback. | |
ctx | A user-supplied DCC session context, which will be passed to the DCC callback function. May be NULL. | |
callback | A DCC callback function, which will be called when anything is said by other party. Must not be NULL. |
This function should be called only after either event_dcc_chat_req or event_dcc_send_req events are generated, and should react to them. It is possible not to call irc_dcc_accept or irc_dcc_decline immediately in callback function - you may just return, and call it later. However, to prevent memory leaks, you must call either irc_dcc_decline or irc_dcc_accept for any incoming DCC request.
int irc_dcc_chat | ( | irc_session_t * | session, | |
void * | ctx, | |||
const char * | nick, | |||
irc_dcc_callback_t | callback, | |||
irc_dcc_t * | dccid | |||
) |
Initiates a DCC CHAT.
session | An initiated and connected session. | |
ctx | A user-supplied DCC session context, which will be passed to the DCC callback function. May be NULL. | |
nick | A nick to DCC CHAT with. | |
callback | A DCC callback function, which will be called when anything is said by other party. Must not be NULL. | |
dccid | On success, DCC session ID will be stored in this var. |
When the chat is accepted, terminated, or some data is received, the callback function is called. See the details in irc_dcc_callback_t declaration.
Possible error responces for this command from the RFC1459:
int irc_dcc_decline | ( | irc_session_t * | session, | |
irc_dcc_t | dccid | |||
) |
Declines a remote DCC CHAT or DCC RECVFILE request.
session | An initiated and connected session. | |
dccid | A DCC session ID, returned by appropriate callback. |
This function should be called only after either event_dcc_chat_req or event_dcc_send_req events are generated, and should react to them. It is possible not to call irc_dcc_accept or irc_dcc_decline immediately in callback function - you may just return, and call it later. However, to prevent memory leaks, you must call either irc_dcc_decline or irc_dcc_accept for any incoming DCC request.
Do not use this function to close the accepted or initiated DCC session. Use irc_dcc_destroy instead.
int irc_dcc_destroy | ( | irc_session_t * | session, | |
irc_dcc_t | dccid | |||
) |
Destroys a DCC session.
session | An initiated and connected session. | |
dccid | A DCC session ID. |
Note that when DCC session is finished (either with success or failure), you should not destroy it - it will be destroyed automatically.
int irc_dcc_msg | ( | irc_session_t * | session, | |
irc_dcc_t | dccid, | |||
const char * | text | |||
) |
Sends the message to the specific DCC CHAT.
session | An IRC session. | |
dccid | A DCC session ID, which chat request must have been accepted. | |
text | Message text. Must not be NULL. |
int irc_dcc_sendfile | ( | irc_session_t * | session, | |
void * | ctx, | |||
const char * | nick, | |||
const char * | filename, | |||
irc_dcc_callback_t | callback, | |||
irc_dcc_t * | dccid | |||
) |
Sends a file via DCC.
session | An initiated and connected session. | |
ctx | A user-supplied DCC session context, which will be passed to the DCC callback function. May be NULL. | |
nick | A nick to send file via DCC to. | |
filename | A file name to sent. Must be an existing file. | |
callback | A DCC callback function, which will be called when file sent operation is failed, progressed or completed. | |
dccid | On success, DCC session ID will be stored in this var. |
Possible error responces for this command from the RFC1459: