Update arcfour example module to use exported dcc_chat_socketread() callback

This allows it to actually connect OK, but it's still nonfunctional at the moment.
This commit is contained in:
Kevin Easton
2017-12-20 18:10:02 +11:00
parent d7688075b6
commit 2c94010d65
3 changed files with 10 additions and 4 deletions

View File

@@ -120,7 +120,7 @@ int Arcfour_Init(IrcCommandDll **intp, Function_ptr *global_table)
{
initialize_module("arcfour");
memset(keyboxes, 0, sizeof(keyboxes));
typenum = add_dcc_bind("SCHAT", "schat", NULL, start_dcc_crypt, get_dcc_encrypt, send_dcc_encrypt, end_dcc_crypt);
typenum = add_dcc_bind("SCHAT", "schat", NULL, start_dcc_crypt, dcc_schat_input, send_dcc_encrypt, end_dcc_crypt);
add_module_proc(DCC_PROC, "schat", "schat", "Secure DCC Chat", 0, 0, dcc_sdcc, NULL);
return 0;
}
@@ -163,7 +163,7 @@ static int send_dcc_encrypt (int type, int sock, char *buf, int len)
return -1;
}
static int get_dcc_encrypt (int type, int sock, char *buf, int parm, int len)
static int dcc_schat_input (int type, int sock, char *buf, int parm, int len)
{
if (type == DCC_CHAT) {
if ((len = dgets(buf, sock, parm, BIG_BUFFER_SIZE, NULL)) > 0) {
@@ -245,7 +245,10 @@ SocketList *sa;
new_s = accept(s, (struct sockaddr *) &remaddr, &sra);
type = flags & DCC_TYPES;
n = get_socketinfo(s);
if ((add_socketread(new_s, ntohs(remaddr.sin_port), flags, nick, get_dcc_encrypt, NULL)) < 0)
/* This uses the ordinary dcc_chat_socketread() function - it will call our
* input filter function dcc_schat_input(). */
if ((add_socketread(new_s, ntohs(remaddr.sin_port), flags, nick, dcc_chat_socketread, NULL)) < 0)
{
erase_dcc_info(s, 0, "%s", convert_output_format("$G %RDCC error: accept() failed. punt!!", NULL, NULL));
close_socketread(s);

View File

@@ -8,7 +8,7 @@ typedef struct {
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 get_dcc_encrypt (int, int, char *, int, 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);
void dcc_sdcc (char *, char *);