Fix helpserv whine when helpers leave the channel; fix ?devoiceall
[srvx.git] / src / hash.c
index edd745421fca6e7cbd9fd2bf56a074943c1d9a15..21bfa5f1bccc35c5534255f3203e50bf8a535ea8 100644 (file)
@@ -543,12 +543,15 @@ DelChannelUser(struct userNode* user, struct chanNode* channel, const char *reas
     if (!mNode)
         return;
 
-    for (n=0; n<pf_used; n++)
-       pf_list[n](mNode, reason);
-
     /* remove modeNode from channel and user */
     modeList_remove(&channel->members, mNode);
     modeList_remove(&user->channels, mNode);
+
+    /* make callbacks */
+    for (n=0; n<pf_used; n++)
+       pf_list[n](mNode, reason);
+
+    /* free memory */
     free(mNode);
 
     if (!deleting && !channel->members.used && !channel->locks && !(channel->modes & MODE_REGISTERED))