2000-04-26 04:03:38 -04:00
|
|
|
#ifndef __DCC_H
|
|
|
|
#define __DCC_H
|
|
|
|
|
2001-02-09 21:02:26 -05:00
|
|
|
#include "modules.h"
|
2000-04-26 04:03:38 -04:00
|
|
|
#include "network.h"
|
|
|
|
|
2001-02-09 21:02:26 -05:00
|
|
|
#define DCC(dcc) ((DCC_REC *) (dcc))
|
2000-04-26 04:03:38 -04:00
|
|
|
|
2001-02-09 21:02:26 -05:00
|
|
|
typedef struct CHAT_DCC_REC CHAT_DCC_REC;
|
2000-04-26 04:03:38 -04:00
|
|
|
|
2001-02-09 21:02:26 -05:00
|
|
|
typedef struct {
|
|
|
|
#include "dcc-rec.h"
|
|
|
|
} DCC_REC;
|
2000-04-26 04:03:38 -04:00
|
|
|
|
2001-02-09 21:02:26 -05:00
|
|
|
/* fully connected? */
|
|
|
|
#define dcc_is_connected(dcc) \
|
|
|
|
((dcc)->starttime != 0)
|
2000-04-26 04:03:38 -04:00
|
|
|
|
2001-02-09 21:02:26 -05:00
|
|
|
/* not connected, we're waiting for other side to connect */
|
|
|
|
#define dcc_is_listening(dcc) \
|
|
|
|
((dcc)->handle != NULL && (dcc)->starttime == 0)
|
2000-04-26 04:03:38 -04:00
|
|
|
|
2001-02-09 21:02:26 -05:00
|
|
|
/* not connected, waiting for user to accept it */
|
|
|
|
#define dcc_is_waiting_user(dcc) \
|
|
|
|
((dcc)->handle == NULL)
|
2000-06-03 21:36:07 -04:00
|
|
|
|
2001-02-09 21:02:26 -05:00
|
|
|
extern GSList *dcc_conns;
|
2000-06-03 21:36:07 -04:00
|
|
|
|
2001-02-09 21:02:26 -05:00
|
|
|
void dcc_register_type(const char *type);
|
|
|
|
void dcc_unregister_type(const char *type);
|
2000-04-26 04:03:38 -04:00
|
|
|
|
2001-02-09 21:02:26 -05:00
|
|
|
int dcc_str2type(const char *str);
|
|
|
|
#define dcc_type2str(type) (module_find_id_str("DCC", type))
|
2000-04-26 04:03:38 -04:00
|
|
|
|
2001-02-09 21:02:26 -05:00
|
|
|
/* Initialize DCC record */
|
|
|
|
void dcc_init_rec(DCC_REC *dcc, IRC_SERVER_REC *server, CHAT_DCC_REC *chat,
|
|
|
|
const char *nick, const char *arg);
|
|
|
|
void dcc_destroy(DCC_REC *dcc);
|
2000-04-26 04:03:38 -04:00
|
|
|
|
2001-01-17 21:30:59 -05:00
|
|
|
/* Find waiting DCC requests (non-connected) */
|
|
|
|
DCC_REC *dcc_find_request_latest(int type);
|
|
|
|
DCC_REC *dcc_find_request(int type, const char *nick, const char *arg);
|
2000-04-26 04:03:38 -04:00
|
|
|
|
2001-02-09 21:02:26 -05:00
|
|
|
/* IP <-> string for DCC CTCP messages.
|
2001-05-21 20:16:38 -04:00
|
|
|
`str' must be at least MAX_IP_LEN bytes.
|
|
|
|
If /SET dcc_own_ip is set, dcc_ip2str() always returns it. */
|
2001-02-09 21:02:26 -05:00
|
|
|
void dcc_ip2str(IPADDR *ip, char *str);
|
|
|
|
void dcc_str2ip(const char *str, IPADDR *ip);
|
2000-04-26 04:03:38 -04:00
|
|
|
|
2001-02-09 21:02:26 -05:00
|
|
|
/* Start listening for incoming connections */
|
2001-02-28 14:26:21 -05:00
|
|
|
GIOChannel *dcc_listen(GIOChannel *iface, IPADDR *ip, int *port);
|
2001-11-25 12:35:47 -05:00
|
|
|
/* Connect to specified IP address using the correct own_ip. */
|
|
|
|
GIOChannel *dcc_connect_ip(IPADDR *ip, int port);
|
2001-01-17 21:30:59 -05:00
|
|
|
|
2001-02-09 21:02:26 -05:00
|
|
|
/* Close DCC - sends "dcc closed" signal and calls dcc_destroy() */
|
|
|
|
void dcc_close(DCC_REC *dcc);
|
2001-01-17 21:30:59 -05:00
|
|
|
/* Reject a DCC request */
|
2001-01-02 11:14:19 -05:00
|
|
|
void dcc_reject(DCC_REC *dcc, IRC_SERVER_REC *server);
|
|
|
|
|
2001-02-09 21:02:26 -05:00
|
|
|
void dcc_init(void);
|
|
|
|
void dcc_deinit(void);
|
2001-01-17 21:30:59 -05:00
|
|
|
|
2000-04-26 04:03:38 -04:00
|
|
|
#endif
|