1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-07-07 04:13:13 +02:00

- Extend HOOKTYPE_CHANNEL_DESTROY to allow cancelling the destroy event.

This commit is contained in:
William Pitcock
2013-05-20 19:37:43 +00:00
parent 06d9bd81ab
commit 01dffdfa46
+9 -3
View File
@@ -1310,14 +1310,20 @@ void sub1_from_channel(aChannel *chptr)
{
Ban *ban;
Link *lp;
bool should_destroy = true;
/* if (--chptr->users <= 0) */
if (chptr->users == 0 || --chptr->users == 0)
--chptr->users;
if (chptr->users <= 0)
{
chptr->users = 0;
/*
* Now, find all invite links from channel structure
*/
RunHook(HOOKTYPE_CHANNEL_DESTROY, chptr);
RunHook2(HOOKTYPE_CHANNEL_DESTROY, chptr, &should_destroy);
if (!should_destroy)
return;
while ((lp = chptr->invites))
del_invite(lp->value.cptr, chptr);