X-Git-Url: http://git.pk910.de/?a=blobdiff_plain;f=ircd%2Fdestruct_event.c;h=b16fd98319a5b1e33643137440cf34a055f8090e;hb=refs%2Fheads%2Fupstream-ssl;hp=a7412ff0e2e8dbeebd5341a69f91225d229b9622;hpb=b403b2b2276883d5d7820d6ac20f6aceafb8c55d;p=ircu2.10.12-pk.git diff --git a/ircd/destruct_event.c b/ircd/destruct_event.c index a7412ff..b16fd98 100644 --- a/ircd/destruct_event.c +++ b/ircd/destruct_event.c @@ -15,8 +15,10 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id$ + */ +/** @file + * @brief Implementation of timed channel destruction events. + * @version $Id$ */ #include "config.h" @@ -25,22 +27,33 @@ #include "ircd_alloc.h" #include "ircd.h" #include "ircd_events.h" +#include "ircd_log.h" +#include "send.h" +#include "msg.h" -#include +/* #include -- Now using assert in ircd_log.h */ #include +/** Structure describing a destruction event. */ struct DestructEvent { - struct DestructEvent* next_event; - struct DestructEvent* prev_event; - time_t expires; - struct Channel* chptr; + struct DestructEvent* next_event; /**< Next event in the queue. */ + struct DestructEvent* prev_event; /**< Previous event in the queue. */ + time_t expires; /**< When the destruction should happen. */ + struct Channel* chptr; /**< Channel to destroy. */ }; +/** Head of short-delay destruction events. */ static struct DestructEvent* minute_list_top; +/** Tail of short-delay destruction events. */ static struct DestructEvent* minute_list_bottom; +/** Head of long-delay destruction events. */ static struct DestructEvent* days_list_top; +/** Tail of long-delay destruction events. */ static struct DestructEvent* days_list_bottom; +/** Schedule a short-delay destruction event for \a chptr. + * @param[in] chptr Channel to destroy. + */ void schedule_destruct_event_1m(struct Channel* chptr) { struct DestructEvent* new_event; @@ -65,6 +78,9 @@ void schedule_destruct_event_1m(struct Channel* chptr) chptr->destruct_event = new_event; } +/** Schedule a long-delay destruction event for \a chptr. + * @param[in] chptr Channel to destroy. + */ void schedule_destruct_event_48h(struct Channel* chptr) { struct DestructEvent* new_event; @@ -89,6 +105,9 @@ void schedule_destruct_event_48h(struct Channel* chptr) chptr->destruct_event = new_event; } +/** Unlink a destruction event for a channel. + * @param[in] chptr Channel that is being destroyed early. + */ void remove_destruct_event(struct Channel* chptr) { struct DestructEvent* event = chptr->destruct_event; @@ -117,6 +136,9 @@ void remove_destruct_event(struct Channel* chptr) chptr->destruct_event = NULL; } +/** Execute expired channel destruction events. + * @param[in] ev Expired timer event (ignored). + */ void exec_expired_destruct_events(struct Event* ev) { int i = 0; @@ -126,6 +148,8 @@ void exec_expired_destruct_events(struct Event* ev) while (*list_bottom && TStime() >= (*list_bottom)->expires) { struct Channel* chptr = (*list_bottom)->chptr; + /* Send DESTRUCT message */ + sendcmdto_serv_butone(&me, CMD_DESTRUCT, 0, "%s %Tu", chptr->chname, chptr->creationtime); remove_destruct_event(chptr); destruct_channel(chptr); }