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:
@@ -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;
|
||||
|
||||
@@ -9,6 +9,6 @@ static inline void arcfourInit(arckey *, void *, unsigned short);
|
||||
static inline char *arcfourCrypt(arckey *, char *, int);
|
||||
static int send_dcc_encrypt (int, int, char *, int);
|
||||
static int dcc_schat_input (int, int, char *, int, int);
|
||||
static int start_dcc_crypt (int, int, unsigned long, int);
|
||||
static int end_dcc_crypt (int, unsigned long, int);
|
||||
static int start_dcc_crypt (int, int, unsigned long, unsigned short);
|
||||
static int end_dcc_crypt (int, unsigned long, unsigned short);
|
||||
void dcc_sdcc (char *, char *);
|
||||
|
||||
@@ -130,8 +130,10 @@ int new_dcc_output(int type, int s, char *buf, int len)
|
||||
|
||||
int Pkga_Init(IrcCommandDll **intp, Function_ptr *global_table)
|
||||
{
|
||||
int i;
|
||||
Server *sptr;
|
||||
static const struct dcc_ops pkga_ops = { NULL, NULL, NULL, new_dcc_output, NULL };
|
||||
int i;
|
||||
Server *sptr;
|
||||
|
||||
initialize_module("pkga");
|
||||
sptr = get_server_list();
|
||||
for (i = 0; i < server_list_size(); i++)
|
||||
@@ -144,6 +146,6 @@ Server *sptr;
|
||||
add_module_proc(HOOK_PROC, "pkga", NULL, NULL, 1, 0, Pkga_numeric, NULL);
|
||||
add_module_proc(VAR_PROC, "pkga", "new_variable", "TEST VALUE", STR_TYPE_VAR, 0, NULL, NULL);
|
||||
add_module_proc(RAW_PROC, "pkga", "PRIVMSG", NULL, 0, 0, Pkga_raw, NULL);
|
||||
add_dcc_bind("CHAT", "pkga", NULL, NULL, NULL, new_dcc_output, NULL);
|
||||
add_dcc_bind("CHAT", "pkga", &pkga_ops);
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user