14805
« on: April 29, 2012, 02:44:48 am »
sick, i've separated the "protocols" from the "communication" layers.. so i can have the bot connect via:
+proto irc
+comm raw
^^ IRC protocol, raw layer, just normal send/recv's/connect etc..
or i could do this:
+proto irc
+comm ssl
now it uses ssl :F
sick..
darqbot has been transitioning from an irc bot into a full fledged "bot bot".. it's going to be able to do so much more now that i've added a bunch of function pointers in the bot_t struct.. this allows for other services to be utilized, such as http, icecast/shoutcast, file operations, etc... it's becoming versatile but damn is it growing..
i wish i had gone this route initially, it's been tough reorganizing all of this code, and i'm still not happy with it.. i doubt i'll modify it exactly how i want though, that will take a bit longer than i'm willing to accept for the time being.
/* hooks based on conf */
int (*fn_init)(struct bot *);
int (*fn_fini)(struct bot *);
void (*fn_defaults)(struct bot *);
int (*fn_connect)(struct bot *);
int (*fn_connect_init)(struct bot *);
int (*fn_disconnect)(struct bot *);
ssize_t (*fn_recv)(struct bot *);
ssize_t (*fn_recv_actual)(struct bot *, char *, int);
int (*fn_send)(struct bot *);
ssize_t (*fn_send_actual)(struct bot *, char *, int);
int (*fn_handle_text)(struct bot *);
int (*fn_listen)(struct bot *);
void (*fn_evhook)(int, short, void *);
void (*fn_evhook_accept)(int, short, void *);
void * fn_data_proto;
void * fn_data_comm;
so now with those function pointers, you can override the "default irc behavior" and completely separate it from irc..
i'm going to create an ircd.conf for it, so that i can irc directly into the bot to control it and/or watch ALL communications that it is processing, via this 'sink' thing im writing.
every send function has to support 'sinks', which allow me to tap into raw sent/recv'd data and send it wherever i want.
peace