/* hash.c - IRC network state database
* Copyright 2000-2004 srvx Development Team
*
- * This program is free software; you can redistribute it and/or modify
+ * This file is part of srvx.
+ *
+ * srvx is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version. Important limitations are
- * listed in the COPYING file that accompanies this software.
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program; if not, email srvx-maintainers@srvx.net.
+ * along with srvx; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
#include "conf.h"
argc++;
}
if (argc) {
- extern struct userNode *opserv;
struct mod_chanmode *change;
change = mod_chanmode_alloc(argc);
}
}
assert(argc == change->argc);
- if (change->argc > 0)
- mod_chanmode_announce(change->args[0].member->user, cNode, change);
- else
- mod_chanmode_announce(opserv, cNode, change);
+ change->args[0].member->modes &= ~MODE_CHANOP;
+ mod_chanmode_announce(change->args[0].member->user, cNode, change);
mod_chanmode_free(change);
}
}
struct modeNode* mNode;
unsigned int n;
- if (reason) {
+ if (reason)
irc_part(user, channel, reason);
- }
mNode = GetUserMode(channel, user);
/* remove modeNode from channel and user */
modeList_remove(&channel->members, mNode);
modeList_remove(&user->channels, mNode);
- free(mNode);
+ /* make callbacks */
for (n=0; n<pf_used; n++)
- pf_list[n](user, channel, reason);
+ pf_list[n](mNode, reason);
- if (!deleting && !channel->members.used && !channel->locks)
+ /* free memory */
+ free(mNode);
+
+ if (!deleting && !channel->members.used && !channel->locks && !(channel->modes & MODE_REGISTERED))
DelChannel(channel);
}
static void
hash_cleanup(void)
{
+ dict_iterator_t it, next;
+
DelServer(self, 0, NULL);
+ for (it = dict_first(channels); it; it = next) {
+ next = iter_next(it);
+ DelChannel(iter_data(it));
+ }
dict_delete(channels);
dict_delete(clients);
dict_delete(servers);