diff options
-rw-r--r-- | include/s_serv.h | 1 | ||||
-rw-r--r-- | src/ircd.c | 1 | ||||
-rw-r--r-- | src/s_serv.c | 23 |
3 files changed, 24 insertions, 1 deletions
diff --git a/include/s_serv.h b/include/s_serv.h index 1f473ab..60c6feb 100644 --- a/include/s_serv.h +++ b/include/s_serv.h @@ -90,6 +90,7 @@ extern int delete_capability(const char *); extern int unsigned find_capability(const char *); extern void send_capabilities(struct Client *, int); extern void write_links_file(void *); +extern void read_links_file(void); extern void server_estab(struct Client *); extern const char *show_capabilities(struct Client *); extern void try_connections(void *); @@ -544,6 +544,7 @@ main(int argc, char *argv[]) initialize_server_capabs(); /* Set up default_server_capabs */ initialize_global_set_options(); channel_init(); + read_links_file(); motd_init(); #ifdef HAVE_LIBGEOIP geoip_ctx = GeoIP_new(GEOIP_MEMORY_CACHE); diff --git a/src/s_serv.c b/src/s_serv.c index dc457f8..3415ad4 100644 --- a/src/s_serv.c +++ b/src/s_serv.c @@ -76,7 +76,7 @@ void write_links_file(void *notused) { FILE *file = NULL; - dlink_node *ptr = NULL, *ptr_next = NULL;; + dlink_node *ptr = NULL, *ptr_next = NULL; char buff[IRCD_BUFSIZE] = { '\0' }; if ((file = fopen(LIPATH, "w")) == NULL) @@ -121,6 +121,27 @@ write_links_file(void *notused) fclose(file); } +void +read_links_file(void) +{ + FILE *file = NULL; + char *p = NULL; + char buff[IRCD_BUFSIZE] = { '\0' }; + + if ((file = fopen(LIPATH, "r")) == NULL) + return; + + while (fgets(buff, sizeof(buff), file)) + { + if ((p = strchr(buff, '\n')) != NULL) + *p = '\0'; + + dlinkAddTail(xstrdup(buff), make_dlink_node(), &flatten_links); + } + + fclose(file); +} + /* hunt_server() * Do the basic thing in delivering the message (command) * across the relays to the specific server (server) for |