Export dcc_chat_socketread() and dcc_send_socketread() callbacks to modules

The idea here is that if you have a module which implements a new DCC type that is essentially
a lightly-modified version of CHAT or SEND you can reuse these functions.
This commit is contained in:
Kevin Easton
2017-12-20 17:36:05 +11:00
parent a55feeef5f
commit d7688075b6
6 changed files with 15 additions and 7 deletions

View File

@@ -1,5 +1,8 @@
[Changes 1.2.2]
* Export dcc_chat_socketread() and dcc_send_socketread() callbacks to modules,
so that modules implementing new DCC types can use these. (caf)
* Only echo sent WALLOPS if we are _not_ +w, because otherwise the server will
echo it to us anyway. (caf)

View File

@@ -159,8 +159,10 @@ struct dcc_offer {
int BX_remove_all_dcc_binds(char *);
int BX_remove_dcc_bind(char *, int);
int BX_add_dcc_bind(char *, char *, void *, void *, void *, void *, void *);
/* add_socketread() callbacks for ordinary CHAT and SEND DCCs */
extern void BX_dcc_chat_socketread(int);
extern void BX_dcc_send_socketread(int);
SocketList *BX_find_dcc(const char *, const char *, const char *, int, int, int, int);
void BX_erase_dcc_info(int, int, char *, ...);

View File

@@ -10,7 +10,7 @@
* if we change the table below, we change this module number to the
* current date (YYYYMMDDxx where xx is a serial number).
*/
#define MODULE_VERSION 2017120602UL
#define MODULE_VERSION 2017122001UL
#include "struct.h"
@@ -585,6 +585,8 @@ enum FUNCTION_VALUE
ADD_TO_QUEUE,
DCC_FILESEND,
DCC_RESEND,
DCC_CHAT_SOCKETREAD,
DCC_SEND_SOCKETREAD,
/* who.c */
WHOBASE,

View File

@@ -612,6 +612,8 @@ extern Function_ptr *global;
#define add_to_queue (*(int (*)(char *, char *, pack *))global[ADD_TO_QUEUE])
#define dcc_filesend (*(void (*)(char *, char *))global[DCC_FILESEND])
#define dcc_resend (*(void (*)(char *, char *))global[DCC_RESEND])
#define dcc_chat_socketread (*(void (*)(int))global[DCC_CHAT_SOCKETREAD])
#define dcc_send_socketread (*(void (*)(int))global[DCC_SEND_SOCKETREAD])
/* irc.c */
#define irc_exit (*(void (*)(int, char *, char *, ...))global[IRC_EXIT_FUNC])

View File

@@ -142,8 +142,6 @@ typedef struct _DCC_List
static DCC_List *pending_dcc = NULL;
static void dcc_chat_socketread(int);
#ifndef BITCHX_LITE
static void dcc_bot_socketread(int);
#endif
@@ -767,7 +765,7 @@ void (*func)(int) = dcc_chat_socketread;
#define DCC_CTCP_MESSAGE "CTCP_MESSAGE "
#define DCC_CTCP_REPLY "CTCP_REPLY "
static void dcc_chat_socketread(int s)
void BX_dcc_chat_socketread(int s)
{
unsigned long flags;
char tmp[BIG_BUFFER_SIZE+1];
@@ -1098,7 +1096,6 @@ static const char *dcc_type_name(int type, int tdcc)
return dcc_types[type]->name;
}
void dcc_send_socketread(int s);
void start_dcc_get(int s);
/* dcc_fullname()
@@ -1796,7 +1793,7 @@ void close_dcc_file(int snum)
* following 3 functions process dcc filesends.
*/
void dcc_send_socketread(int snum)
void BX_dcc_send_socketread(int snum)
{
SocketList *s;
DCC_int *n;

View File

@@ -620,6 +620,8 @@ static int already_done = 0;
global_table[GET_ACTIVE_COUNT] = (Function_ptr) BX_get_active_count;
global_table[DCC_FILESEND] = (Function_ptr) BX_dcc_filesend;
global_table[DCC_RESEND] = (Function_ptr) BX_dcc_resend;
global_table[DCC_CHAT_SOCKETREAD] = (Function_ptr) BX_dcc_chat_socketread;
global_table[DCC_SEND_SOCKETREAD] = (Function_ptr) BX_dcc_send_socketread;
/* cdcc.c */
global_table[GET_NUM_QUEUE] = (Function_ptr) BX_get_num_queue;