diff --git a/src/bip.c b/src/bip.c index 75984e4..2324a77 100644 --- a/src/bip.c +++ b/src/bip.c @@ -266,8 +266,21 @@ void reload_config(int i) sighup = 1; } +extern list_t *_connections; + void bad_quit(int i) { + list_iterator_t it; + for (list_it_init(_connections, &it); list_it_item(&it); + list_it_next(&it)) { + connection_t *c = list_it_item(&it); + struct link_any *la = c->user_data; + if (c->connected == CONN_OK && la && + TYPE(la) == IRC_TYPE_SERVER) { + write_line_fast(CONN(la), "QUIT :Coyote finally " + "caught me\r\n"); + } + } unlink(conf_pid_file); exit(i); } diff --git a/src/irc.c b/src/irc.c index 5e4bf34..37da913 100644 --- a/src/irc.c +++ b/src/irc.c @@ -1877,6 +1877,8 @@ void oidentd_dump(list_t *connl) } #endif +/* do not use */ +list_t *_connections = NULL; struct link_client *reloading_client; /* @@ -1900,6 +1902,8 @@ void irc_main(connection_t *inc, list_t *ll) list_init(&connecting_c, list_ptr_cmp); list_init(&connected_c, list_ptr_cmp); + _connections = &connl; + /* XXX: This one MUST be first */ list_add_first(&connl, inc); @@ -2113,6 +2117,7 @@ prot_err: ; while (list_remove_first(&reconnectl)) ; + _connections = NULL; return; }