Introduce a struct dcc_ops to contain all functions pointers for a custom DCC type

Modules now must pass a pointer to a struct dcc_ops when calling add_dcc_bind() instead of
a list of function pointers.
This commit is contained in:
Kevin Easton
2018-02-08 17:48:34 +11:00
parent 64ec300d5d
commit 61a926a766
9 changed files with 73 additions and 82 deletions

View File

@@ -118,9 +118,11 @@ static inline char *arcfourCrypt(arckey *arc, char *data, int len)
int Arcfour_Init(IrcCommandDll **intp, Function_ptr *global_table)
{
static const struct dcc_ops schat_ops = { NULL, start_dcc_crypt, dcc_schat_input, send_dcc_encrypt, end_dcc_crypt };
initialize_module("arcfour");
memset(keyboxes, 0, sizeof(keyboxes));
typenum = add_dcc_bind("SCHAT", "schat", NULL, start_dcc_crypt, dcc_schat_input, send_dcc_encrypt, end_dcc_crypt);
typenum = add_dcc_bind("SCHAT", "schat", &schat_ops);
add_module_proc(DCC_PROC, "schat", "schat", "Secure DCC Chat", 0, 0, dcc_sdcc, NULL);
return 0;
}
@@ -183,8 +185,7 @@ static int dcc_schat_input(int type, int sock, char *buf, int parm, int buf_size
* an encrypted connection.
*/
static int start_dcc_crypt (int s, int type, unsigned long d_addr, int d_port)
static int start_dcc_crypt (int s, int type, unsigned long d_addr, unsigned short d_port)
{
arclist *tmpbox;
put_it("start_dcc_crypt");
@@ -214,7 +215,7 @@ static int start_dcc_crypt (int s, int type, unsigned long d_addr, int d_port)
return -1;
}
static int end_dcc_crypt (int s, unsigned long d_addr, int d_port)
static int end_dcc_crypt(int s, unsigned long d_addr, unsigned short d_port)
{
int i;
for(i = 0; i < 16; i++) {
@@ -228,7 +229,6 @@ static int end_dcc_crypt (int s, unsigned long d_addr, int d_port)
return -1;
}
static void start_dcc_chat(int s)
{
struct sockaddr_in remaddr;